flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > OS Construction > IMG file with int 0x10h and AH=09h

Author
Thread Post new topic Reply to topic
catafest



Joined: 05 Aug 2010
Posts: 97

IMG file with int 0x10h and AH=09h

This code run with just 187 and 10 chars of 205 ascii code.
The IMG file is run with qemu command :

Code:
qemu-system-x86_64.exe run.img
WARNINGImage format was not specified for 'run.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw imageswrite operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.


See the screenshot:
Image

What is wrong with this code !?

Code:
format binary as 'img'
use16  
org 7c00h 

boot
        cli 

        push cs
        push cs 
        pop ds 
        pop es
        mov ecx4
        jnz short .data

.data:

        mov dx0x1F0
        mov cx256 

        ; multiple caracters CX
        mov ah0x09    ; function number = 09h : Display Character
        mov al201     ; AL = code of character to display
        mov bh0
        mov bl03h
        mov cx,1
        int 0x10        ; call INT 10h, BIOS video service
        ; multiple caracters CX
        mov ah0x09    ; function number = 09h : Display Character
        mov al205     ; AL = code of character to display
        mov bh0
        mov bl03h
        mov cx,10
        int 0x10        ; call INT 10h, BIOS video service
        ; multiple caracters CX
        mov ah0x09    ; function number = 09h : Display Character
        mov al187     ; AL = code of character to display
        mov bh0
        mov bl03h
        mov cx,1
        int 0x10        ; call INT 10h, BIOS video service
        hlt 
        jmp $ 

times 510-($-$$db 0
                 dw 0aa55h 

Post 17 Feb 2018, 19:27
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15633
Location: Thasus

Moved to OS Construction
Post 18 Feb 2018, 04:32
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 204
Location: Belarus

Re: IMG file with int 0x10h and AH=09h


catafest wrote:
What is wrong with this code !?


What behaviour do you define as “right”?

If you want to make a pseudographic window border, then you’ve obviously used the wrong code for the first character.

Anyway, you have quite serious smells in your code. Like, say, using a conditional jump without any instructions that have impact on status flags before. And the jump does nothing anyway, since the label it references marks exactly the next instruction.

Note also that BIOS functions (except maybe some corner cases) are supposed to preserve the contents of all the registers except AX, FLAGS and those used to return some data. Buggy BIOSes are of little interest, so there’s no practical need to waste bytes for putting values into each and every register before every call.
Post 18 Feb 2018, 08:58
View user's profile Send private message Visit poster's website Reply with quote
catafest



Joined: 05 Aug 2010
Posts: 97

I used in the past some assembler code. I read more about 8086 in the past, but I never used into next steps like IMG format , resident program , ...
About using a conditional jump without any instructions that have impact on status flags , then :
My example is a part of study and learning process into assembly area.
To make a gui into old style , yes can be a good idea to fulfill all issues and follow the right steps .
Also the 3 rules of assembly are not enough to learn, I try to use more instructions and formats in a fair way.
One good example is old debug issues: http://thestarman.pcministry.com/asm/mbr/AA55H.html
FLAGS !? maybe FASM make something strange is too into all assembly code !!
Post 18 Feb 2018, 12:11
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 204
Location: Belarus


catafest wrote:
FLAGS !? maybe FASM make something strange is too into all assembly code !!


I don’t get this sentence. FASM, unlike MASM/TASM, does little to no strange things. Flags are architecture specific and not asm dialect related. Maybe you should express your idea/question in other words. You can use your native language, if you wish.
Post 20 Feb 2018, 05:36
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


Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2018, Tomasz Grysztar.
Powered by rwasa.