flat assembler
Message board for the users of flat assembler.
Index
> Main > Program too large for memory Goto page Previous 1, 2 |
Author |
|
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. |
|||
23 Oct 2012, 09:47 |
|
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$" |
|||
23 Oct 2012, 14:25 |
|
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: |
|||
24 Oct 2012, 06:06 |
|
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. |
|||
24 Oct 2012, 07:35 |
|
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. |
|||
24 Oct 2012, 07:42 |
|
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. |
|||
24 Oct 2012, 14:38 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.