Page 1 of 1
trying to print a string in protected mode
Posted: Thu Aug 18, 2022 4:36 pm
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...
Re: trying to print a string in protected mode
Posted: Sat Aug 20, 2022 6:45 pm
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.
Re: trying to print a string in protected mode
Posted: Sun Aug 21, 2022 8:56 am
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.
Re: trying to print a string in protected mode
Posted: Sun Aug 21, 2022 9:43 am
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.
Re: trying to print a string in protected mode
Posted: Sun Aug 21, 2022 9:57 am
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.
Re: trying to print a string in protected mode
Posted: Sun Aug 21, 2022 6:52 pm
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").