flat assembler
Message board for the users of flat assembler.

Index > DOS > Int 10h function 9 - write char function doesn't work

Author
Thread Post new topic Reply to topic
Vertex78



Joined: 22 Feb 2004
Posts: 12
Vertex78 21 Jul 2004, 03:24
I am tring to make a program that will print a string using int 10h function 9h. I've gotten this far but for some reason this doesn't work. If i instead of using lodsb and do mov al,'z' then it will print that char but i want to be able to set up a loop and print the whole variable until 0 is reached.
can some one explain to me what i am doing wrong

Code:
jmp start

sysmsg db 'Zach',0
black         equ 0000b
red           equ 0100b
start:

mov si,sysmsg

mov ah,9h     ;write char function
lodsb         ;char to write
or al,al      ;sets zero flag if al is zero

jz done       ;if string is 0 then done

mov bh,0      ;video page
mov bl,(black shl 4) or red
mov cx,1      ;repetition count

int 10h

done:

jmp $
    
Post 21 Jul 2004, 03:24
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 21 Jul 2004, 03:45
you do not even have a loop

Code:
jmp start

sysmsg db 'Zach',0
black equ 0000b
red equ 0100b
start:

mov si,sysmsg

again:
mov ah,9h ;write char function
lodsb ;char to write
or al,al ;sets zero flag if al is zero

jz done ;if string is 0 then done

mov bh,0 ;video page
mov bl,(black shl 4) or red
mov cx,1 ;repetition count

int 10h

jmp again

done:

jmp $    

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 21 Jul 2004, 03:45
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Vertex78



Joined: 22 Feb 2004
Posts: 12
Vertex78 21 Jul 2004, 12:25
yeah no kidding, as i said in my post I plan to set up a loop to go through all the characters but for now its set up to go through once and for some reason it wont work as it goes through once. So making it loop right now will just make it not work that many times. Did you actually read my post or just look at my code?
Post 21 Jul 2004, 12:25
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 21 Jul 2004, 13:43
I have neither the time nor the inclination to explain myself to you. I am a fair guy, but this heat is making me absolutely crazy. Are we clear? ARE WE CLEAR?
You want answers? You can't handle the truth!

Code:
jmp start

sysmsg db 'Zach',0
black equ 0000b
red equ 0100b
start:

mov ax,cs
mov ds,ax
mov es,ax

mov si,sysmsg

again:
mov ah,9h ;write char function
lodsb ;char to write
or al,al ;sets zero flag if al is zero

jz done ;if string is 0 then done

mov bh,0 ;video page
mov bl,(black shl 4) or red
mov cx,1 ;repetition count

int 10h

jmp again

done:

jmp $    

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 21 Jul 2004, 13:43
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Vertex78



Joined: 22 Feb 2004
Posts: 12
Vertex78 21 Jul 2004, 14:14
Ok i tried it with your changes and this time all i get is red f. FOr failure i guess lol .I also added in some code to move the cursor ahead to the next position. Here is my modified code

Code:
jmp start

sysmsg db 'Zach',0
black equ 0000b
red equ 0100b
start:

mov ax,cs
mov ds,ax
mov es,ax

mov si,sysmsg
mov dl,1

again:

mov ah,9h ;write char function
lodsb ;char to write
or al,al ;sets zero flag if al is zero

jz done ;if string is 0 then done

mov bh,0 ;video page
mov bl,(black shl 4) or red
mov cx,1 ;repetition count

int 10h

mov ah,2        ;move cursor function
mov dh,0
int 10h

inc dl
jmp again

done:

jmp $
    


thanks for your help commrade
Post 21 Jul 2004, 14:14
View user's profile Send private message Reply with quote
Bitdog



Joined: 18 Jan 2004
Posts: 97
Bitdog 05 Sep 2004, 06:07
At this point, I've had a couple of drinks, BUT...........
if ES:DI = screen offset
REPZ MOVSB ; = quick 'n accurate

INT crap often = MS crap
By the way, have you ever followed an INT routine to it's bitter end using a debugger ?
What a mess, huh.........

I would like to see a BIOS DOS that was KISS=Keep_It_Simple_Stupid
Cuz BIOS has most all the functions that are needed to run an OS.....
Why MS got into the picture, I don't know ???????????
Seattle Computer OS & $ I guess. (= an IBM oops)

Bitdog, Bit programmer, Bit human, Bit drunk......
Post 05 Sep 2004, 06:07
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 09 Sep 2004, 16:55
In some aspects i might understand the importance of bios interrupts : like if you're writing a portable com file or small boot sector, which are easy to learn even in hexa codes, but they can only be run by computers that have these interrupts - if you see it this way, the whole computer is wrong.
One should make a new one instead, no compatibility, the latest 64 bit systems will trace everything in real time even correcting the very best of windows - those blue screens.
the only thing needed whould be a decision, and a software. - new bios - new os

my opinion about interrupts are: no pre defined interrupts are neccesary unless for example video cards doesn't follow the defined syntax of writing to memory, which can be done via an interrupt - putpixel
interrupts are very useful to set up, for example in serial communications, you can use interrupts even in microcontrollers Smile

for example i whould take part in such developments. in both hardware and software aspects.

i really don't understand why aren't they doing this?
maeby because the one's made the first computer had die?
yess, this might be the reason, and microsoft and things like that just steal whole systems, resell them, patents mouse clicks, and are selling many garbage.

MATRIX
Post 09 Sep 2004, 16:55
View user's profile Send private message Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.