OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 4:48 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: trying to print a string in protected mode
PostPosted: Thu Aug 18, 2022 4:36 pm 
Offline

Joined: Thu Aug 18, 2022 4:27 pm
Posts: 5
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:
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...


Top
 Profile  
 
 Post subject: Re: trying to print a string in protected mode
PostPosted: Sat Aug 20, 2022 6:45 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5103
red wrote:
here's what i tried to do, but failed miserably:

I see nothing wrong with this code. The problem is elsewhere.


Top
 Profile  
 
 Post subject: Re: trying to print a string in protected mode
PostPosted: Sun Aug 21, 2022 8:56 am 
Offline

Joined: Thu Aug 18, 2022 4:27 pm
Posts: 5
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.


Top
 Profile  
 
 Post subject: Re: trying to print a string in protected mode
PostPosted: Sun Aug 21, 2022 9:43 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
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.


Top
 Profile  
 
 Post subject: Re: trying to print a string in protected mode
PostPosted: Sun Aug 21, 2022 9:57 am 
Offline

Joined: Thu Aug 18, 2022 4:27 pm
Posts: 5
Quote:
What file system are you using (e.g., FAT12, ext2, SFS)?

i'm guessing fat12 'cos it's the default for floppies and stuff.
Quote:
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
Quote:
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.


Top
 Profile  
 
 Post subject: Re: trying to print a string in protected mode
PostPosted: Sun Aug 21, 2022 6:52 pm 
Offline

Joined: Thu Aug 18, 2022 4:27 pm
Posts: 5
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").


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], songziming and 119 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group