trying to print a string in protected mode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
red
Posts: 5
Joined: Thu Aug 18, 2022 4:27 pm

trying to print a string in protected mode

Post by red »

hi, i'm new to this forum and to os programming, it's been few days since i started to try to make my own operating system in fasm-only.
however, i can't find any way to print my string in protected mode.
the only way i could think that obviously should work is to move each character to the $b8000 address, which would be an easy but very time-wasting solution.
here's what i tried to do, but failed miserably:

Code: Select all

include 'boot.asm'

main:
mov ebp,$b8000
mov si,str0

print0:
mov ah,$0f
mov al,[si]
cmp al,0
je print1
mov [ebp],ax
inc si
add ebp,2
jmp print0

print1:
ret

str0: db "test",0
what i always get is a black screen with a blinking cursor only. i'm thinking of using my only solution if everything else fails...
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: trying to print a string in protected mode

Post by Octocontrabass »

red wrote:here's what i tried to do, but failed miserably:
I see nothing wrong with this code. The problem is elsewhere.
red
Posts: 5
Joined: Thu Aug 18, 2022 4:27 pm

Re: trying to print a string in protected mode

Post by red »

well, nevermind, i asked on another forum 'cos it was taking too long for this forum to approve my post, and now i fixed the issue:
boot.asm tries to load up $1000, which is my kernel location, but i didn't set the org of my kernel.asm to $1000, but after doing that, it works.
and right now i also managed to make my boot loader read text from floppies, which is good, but now i wanna boost it to make it execute code from any compatible floppy.
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: trying to print a string in protected mode

Post by Schol-R-LEA »

red wrote:boot.asm tries to load up $1000, which is my kernel location, but i didn't set the org of my kernel.asm to $1000, but after doing that, it works.
From this I gather that kernel.asm is being assembled to a raw binary, correct? This would have been important information, as it happens.
red wrote:and right now i also managed to make my boot loader read text from floppies, which is good, but now i wanna boost it to make it execute code from any compatible floppy.
What file system are you using (e.g., FAT12, ext2, SFS)? And what executable file format do you want your loadable executables in (e.g., raw binary, PE, ELF)?

I know that this is something of an irrelevant question, but do you have your project under source code control (using a VCS such as Git, Subversion, or Mercurial), and do you have an offsite hosted repository which we can view? Version control is very highly advisable - I would recommend putting even the smallest of programs under VCS. Having a hosted repo which you can link to us would be a tremendous help in our giving you any advice.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
red
Posts: 5
Joined: Thu Aug 18, 2022 4:27 pm

Re: trying to print a string in protected mode

Post by red »

What file system are you using (e.g., FAT12, ext2, SFS)?
i'm guessing fat12 'cos it's the default for floppies and stuff.
And what executable file format do you want your loadable executables in (e.g., raw binary, PE, ELF)?
raw binary, not sure why though lol
I know that this is something of an irrelevant question, but do you have your project under source code control (using a VCS such as Git, Subversion, or Mercurial), and do you have an offsite hosted repository which we can view? Version control is very highly advisable - I would recommend putting even the smallest of programs under VCS. Having a hosted repo which you can link to us would be a tremendous help in our giving you any advice.
no, i don't have, but i'm gonna make one when my code evolves a bit. for now i'm gonna just play around with the code to see what i can do.
red
Posts: 5
Joined: Thu Aug 18, 2022 4:27 pm

Re: trying to print a string in protected mode

Post by red »

well, i managed to do what i want! now i can load up almost anything with my operating system (well, i dunno if i can call it an "operating system").
Post Reply