flat assembler
Message board for the users of flat assembler.

Index > Main > Program too large for memory

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
AsmGuru62



Joined: 28 Jan 2004
Posts: 1619
Location: Toronto, Canada
AsmGuru62 20 Oct 2012, 12:08
STOSB means:
1. Store byte from AL into address pointed by DI
2. Increment/Decrement DI (based on Direction Flag) to point to next byte AFTER the stored byte.
Post 20 Oct 2012, 12:08
View user's profile Send private message Send e-mail Reply with quote
sbeng



Joined: 11 Oct 2012
Posts: 12
sbeng 23 Oct 2012, 09:47
Hi,
for function 3Dh (interrupt 21) i would print error code if file doesn't find.

Entry:

AL = access and sharing modes
DS:DX -> ASCIZ filename

Return:

CF clear if successful, AX = file handle
CF set on error AX = error code (01h,02h,03h,04h,05h,0Ch,56h)


There is my part of code:

Code:
PRINT_STATUS_KO:
       mov al,"$"
       mov  [ERROR_CODE],ax
       mov dx,ERROR_CODE
       call  write_text
       ret
 write_text:
        mov ah, 09h
        int 21h
        ret

ERROR_CODE DW 0
    


During execute it doesn't print nothing. I would print 01h,02h,03h,04h,05h,0Ch or 56h
Best regards.
Post 23 Oct 2012, 09:47
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 23 Oct 2012, 14:25
Try this:
Code:
PRINT_STATUS_KO:
       ror ax, 4
       shr ah, 4

       cmp al, 10
       jbe @f
       add al, 7

@@:
       cmp ah, 10
       jbe @f
       add ah, 7

@@:
       add ax, "00"
       mov [ERROR_CODE], ax
       mov dx,ERROR_CODE
       call  write_text
       ret

 write_text:
        mov ah, 09h
        int 21h
        ret

ERROR_CODE dw 0
           db "h$"    
Post 23 Oct 2012, 14:25
View user's profile Send private message Reply with quote
sbeng



Joined: 11 Oct 2012
Posts: 12
sbeng 24 Oct 2012, 06:06
Thank you! It does work!
I've some question:
1) where is @f label?
2) Instruction (db "h$") does not have a left label_name variable?


LocoDelAssembly wrote:
Try this:
Code:
PRINT_STATUS_KO:
       ror ax, 4
       shr ah, 4

       cmp al, 10
       jbe @f
       add al, 7

@@:
       cmp ah, 10
       jbe @f
       add ah, 7

@@:
       add ax, "00"
       mov [ERROR_CODE], ax
       mov dx,ERROR_CODE
       call  write_text
       ret

 write_text:
        mov ah, 09h
        int 21h
        ret

ERROR_CODE dw 0
           db "h$"
    
Post 24 Oct 2012, 06:06
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 24 Oct 2012, 07:35
@f means "forward to the next @@ label"; @b means "backwards to the next @@ label".
IMHO, @@ labels are not very readable and possible source of mistakes and should be used only on very short distances - 1 or 2 instructions back and forward.
Post 24 Oct 2012, 07:35
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20302
Location: In your JS exploiting you and your system
revolution 24 Oct 2012, 07:42
JohnFound wrote:
IMHO, @@ labels are not very readable and possible source of mistakes and should be used only on very short distances - 1 or 2 instructions back and forward.
... and never inside of macros.
Post 24 Oct 2012, 07:42
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1619
Location: Toronto, Canada
AsmGuru62 24 Oct 2012, 14:38
I once wrote a small loop using @@.

Then after a year or so I added some more code into the loop and
some blocks of comments and the loop no longer fit into a single page
of my IDE (I like 12 pts fonts, so I am not seeing much code in my IDE).

I did one last addition to the loop and used the @@ again -- I did not see the full loop body!

Wow! I looked for that bug for quite some time - my code started
behaving randomly. It was fun (painfully fun) to debug.
Post 24 Oct 2012, 14:38
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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.