flat assembler
Message board for the users of flat assembler.

Index > Main > Problem loading to al

Author
Thread Post new topic Reply to topic
marek



Joined: 21 Mar 2008
Posts: 5
marek 25 Mar 2008, 13:22
Hello, I have problems with the following code (especially the line highlighted in red). The code assembles, but does not show anything.
If I do "mov al, 72", I can see yellow 'H' on the screen, so I cannot understand why the below code doesn't work.

; display string
mov ax, 0xb800
mov es, ax
xor di,di
; 0xb800:0000 - address of the first char on the screen

mov ah, 14 ; yellow

repeat strlen
mov al, byte [mystring+%-1]
stosw
end repeat

hlt

mystring db 'Hello world !!!'
strlen=$-mystring[/size]

Thanks,
Marek.
Post 25 Mar 2008, 13:22
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 25 Mar 2008, 13:28
Try using a CS override
Code:
 mov al, byte [cs:mystring+%-1]    
or set DS
Code:
mov ax,cs
mov ds,ax    
Post 25 Mar 2008, 13:28
View user's profile Send private message Visit poster's website Reply with quote
marek



Joined: 21 Mar 2008
Posts: 5
marek 25 Mar 2008, 13:56
Revolution, you are wonderful !!!

Thank you for your incredibly quick and very helpful answers !!!

Marek.
Post 25 Mar 2008, 13:56
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 25 Mar 2008, 14:34
Glad to be of service.
Post 25 Mar 2008, 14:34
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.