flat assembler
Message board for the users of flat assembler.

Index > OS Construction > text in OS

Author
Thread Post new topic Reply to topic
Repulverized



Joined: 18 Jul 2011
Posts: 9
Location: Detroit
Repulverized 11 Sep 2011, 04:33
I am having trouble with some os code. i am writing a text program for it and am using this code for it

_typer:
xor ah, ah
int 0x16

mov si, charmsg
call print_string

mov ah, 0x0e
mov bl, 0x16
int 0x10

jmp _typer

it is part of the kernel. I made a cursor that is controlled by the keyboard to make programs run. I used this to define charmsg

charmsg db '', '$'

i put the dollar sign to stop from getting a unhanded exception. but all it does is print the dollar sign.
Post 11 Sep 2011, 04:33
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20629
Location: In your JS exploiting you and your system
revolution 11 Sep 2011, 05:00
We have no ides what you have done. Are you checking for $ as a string terminator in the print_string code? Perhaps you need to show your print_string source code?
Post 11 Sep 2011, 05:00
View user's profile Send private message Visit poster's website Reply with quote
Repulverized



Joined: 18 Jul 2011
Posts: 9
Location: Detroit
Repulverized 11 Sep 2011, 05:05
my print_string code is this

print_string:
lodsb
cmp al, 24h
je print_string_eof
mov ah, 0eh
int 10h
jmp print_string

print_string_eof:
ret
Post 11 Sep 2011, 05:05
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 11 Sep 2011, 05:50
The code is completely expected to print "$", notice that when you return form your print_string, AL is loaded with "$" (because you destroyed caller's AL value with lodsb), and since you are calling int 0x10 from you main loop you get the $ printed. Your code as is should be printing one "$" per keystroke.

I would like to suggest a fix, but it is unclear to me what are you trying to do. Perhaps you could do some sort of narration about what keyboard events the user is doing and how the program should react to them? (including a pseudo-screenshot also)
Post 11 Sep 2011, 05:50
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 11 Sep 2011, 22:22
You need to tell us, what your trying to do.
Post 11 Sep 2011, 22:22
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.