flat assembler
Message board for the users of flat assembler.
Index
> MenuetOS > Debugger |
Author |
|
mike.dld 12 Oct 2004, 23:29
I'm using DEBUG.INC if needed. AFAIK no other tools available.
|
|||
12 Oct 2004, 23:29 |
|
Klod 16 Oct 2004, 04:22
Could you give me an example on haow to?
|
|||
16 Oct 2004, 04:22 |
|
mike.dld 16 Oct 2004, 07:26
What for do you need an example??? It's just a set of macroses (don't use procedures directly, they won't save you flags and registers) which output something (string, decimal, hex, char) to debug board. The code is there (debug.inc), it's pretty self-explaining:
Code: macro debug_print str { local ..string, ..label jmp ..label ..string db str,0 ..label: pushf pushad mov edx,..string call debug_outstr popad popf } dps fix debug_print macro debug_print_dec arg { pushf pushad if ~arg eq eax mov eax,arg end if call debug_outdec popad popf } dpd fix debug_print_dec ;--------------------------------- debug_outdec: ;(eax - num, edi-str) push 10 ;2 pop ecx ;1 push -'0' ;2 .l0: xor edx,edx ;2 div ecx ;2 push edx ;1 test eax,eax ;2 jnz .l0 ;2 .l1: pop eax ;1 add al,'0' ;2 call debug_outchar ; stosb jnz .l1 ;2 ret ;1 ;--------------------------------- debug_outchar: ; al - char pushf pushad mov cl,al mov eax,63 mov ebx,1 int 0x40 popad popf ret debug_outstr: mov eax,63 mov ebx,1 @@: mov cl,[edx] test cl,cl jz @f int 40h inc edx jmp @b @@: ret macro newline { dps <13,10> } macro print message { dps message newline } macro pregs { dps "EAX: " dpd eax dps " EBX: " dpd ebx newline dps "ECX: " dpd ecx dps " EDX: " dpd edx newline } macro debug_print_hex arg { pushf pushad if ~arg eq eax mov eax, arg end if call debug_outhex popad popf } dph fix debug_print_hex debug_outhex: ; eax - number mov edx, 8 .new_char: rol eax, 4 movzx ecx, al and cl, 0x0f mov cl, [__hexdigits + ecx] pushad mcall 63, 1 popad dec edx jnz .new_char ret __hexdigits: db '0123456789ABCDEF' |
|||
16 Oct 2004, 07:26 |
|
Klod 18 Oct 2004, 17:14
thsnkd for your repley Mike.dld.
I must have overlooked the file debug.inc _________________ Do not Assume, it makes an ASS out of U and ME! |
|||
18 Oct 2004, 17:14 |
|
profkid13 20 Oct 2004, 12:15
mike.dld wrote: What for do you need an example??? It's just a set of macroses (don't use procedures directly, they won't save you flags and registers) which output something (string, decimal, hex, char) to debug board. The code is there (debug.inc), it's pretty self-explaining: fasm1.56 doesnt want's to compile this: Code: mcall 63, 1 |
|||
20 Oct 2004, 12:15 |
|
Ivan Poddubny 20 Oct 2004, 14:14
Quote: fasm1.56 doesnt want's to compile this: Replace it with Code: mov eax, 63 mov ebx, 1 int 0x40 BTW Debug.inc is distributed with RE#8. |
|||
20 Oct 2004, 14:14 |
|
profkid13 20 Oct 2004, 14:41
Ivan Poddubny wrote:
i know, but why doesnt the shorter code works? let me gues, its a function in the macros.inc distibuted with re#8? Quote: BTW Debug.inc is distributed with RE#8. ah, thats why i couldnt find it |
|||
20 Oct 2004, 14:41 |
|
mike.dld 20 Oct 2004, 18:58
It's mine and Ivan's macroses to code Menuet applications easier:
Code: macro mpack dest, hsrc, lsrc { ; Ivan Poddubny if (hsrc eqtype 0) & (lsrc eqtype 0) mov dest, (hsrc) shl 16 + lsrc else if (hsrc eqtype 0) & (~lsrc eqtype 0) mov dest, (hsrc) shl 16 add dest, lsrc else mov dest, hsrc shl dest, 16 add dest, lsrc end if end if } macro __mov reg,a,b { ; mike.dld if (~a eq)&(~b eq) mpack reg,a,b else if (~a eq)&(b eq) mov reg,a end if } macro mcall a,b,c,d,e,f { ; mike.dld __mov eax,a __mov ebx,b __mov ecx,c __mov edx,d __mov esi,e __mov edi,f int 0x40 } You can find them in MACROS.INC file from russian distro (RE#8). EXAMPLE.ASM becomes: Code: use32 org 0x0 db 'MENUET01' dd 0x01 dd START dd I_END dd 0x100000 dd 0x100000 dd 0x0 dd 0x0 include 'MACROS.INC' START: red: call draw_window still: mcall 10 cmp eax,1 je red cmp eax,2 je key cmp eax,3 je button jmp still key: mcall 2 mov [Music+1], ah mcall 55, eax, , , Music jmp still button: mcall 17 cmp ah, 1 jne still .exit: mcall -1 draw_window: mcall 12, 1 mcall 0,<200,200>,<200,50>,0x02AABBCC,0x805080D0,0x005080D0 mcall 4,<8,8>,0x10DDEEFF,header,header.size mcall ,<8,30>,0,message,message.size mcall 8,<200-19,12>,<5,12>,1,0x6688DD mcall 12, 2 ret Music: db 0x90, 0x30, 0 lsz message,\ en,'Press any key...',\ fr,'Pressez une touche...' lsz header,\ en,'EXAMPLE APPLICATION',\ fr,"L'exemplaire programme" I_END: |
|||
20 Oct 2004, 18:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.