16-bit assembly?
Hi.
I've run into yet another problem involving assembly, this time it's in 16 bit.
So, I was getting into 16 bit assembly, you know COM files and interrupts.
I was trying to use interrupt 10H ( Video ) to write a string to the screen, ( AH being 13H ). Here's what I have so far.
[PHP]
.286
.model tiny
.data
org 100h
Message db 'Hello',0
.code
main:
jmp short start
nop
start:
mov al,0 ;Mode
xor bh,bh ;Page
mov bl,0Ch ;Text attribute - Color
mov cl,5 ;Length of string
mov dh,1 ;Row - x
mov dl,0 ;Column - y
push ds ;Push ds onto stack
pop es ;Pop into es
lea bp,[Message] ;Move Message into bp register
mov ah,13h
int 10h
int 20h
ret
end main
[/PHP]
It almost works, I'm going to guess the problem is:
[PHP]
lea bp,[Message]
[/PHP]
It prints random characters to the screen, it's prints in the right row and column, the right color, no compiling errors, it just prints random text and I have no idea what the problem is.
Also, I'm not too sure about that:
[PHP]
push ds
pop es
[/PHP]
I found it after googling a lot, nothing seems to work. This is how I came up with this code. This site: Bios Interrupts
If you scroll down and find Interrupt 10H ( video ) and AH 13H. It says:
I don't understand how you do that in assembly. >_>
I'd be grateful to who ever could give me an explanation or link me to a good site.
Thanks.
I've run into yet another problem involving assembly, this time it's in 16 bit.
So, I was getting into 16 bit assembly, you know COM files and interrupts.
I was trying to use interrupt 10H ( Video ) to write a string to the screen, ( AH being 13H ). Here's what I have so far.
[PHP]
.286
.model tiny
.data
org 100h
Message db 'Hello',0
.code
main:
jmp short start
nop
start:
mov al,0 ;Mode
xor bh,bh ;Page
mov bl,0Ch ;Text attribute - Color
mov cl,5 ;Length of string
mov dh,1 ;Row - x
mov dl,0 ;Column - y
push ds ;Push ds onto stack
pop es ;Pop into es
lea bp,[Message] ;Move Message into bp register
mov ah,13h
int 10h
int 20h
ret
end main
[/PHP]
It almost works, I'm going to guess the problem is:
[PHP]
lea bp,[Message]
[/PHP]
It prints random characters to the screen, it's prints in the right row and column, the right color, no compiling errors, it just prints random text and I have no idea what the problem is.
Also, I'm not too sure about that:
[PHP]
push ds
pop es
[/PHP]
I found it after googling a lot, nothing seems to work. This is how I came up with this code. This site: Bios Interrupts
If you scroll down and find Interrupt 10H ( video ) and AH 13H. It says:
Code:
ES:BP points to the string.
I'd be grateful to who ever could give me an explanation or link me to a good site.
Thanks.


