flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Whats wrong with a ShowHex macro |
Author |
|
edemko 15 May 2010, 22:49
Number display macros by the others i've found thus based on:
www.board.flatassembler.net/topic.php?t=86&start=0 www.board.flatassembler.net/topic.php?t=3979&start=0 www.board.flatassembler.net/topic.php?t=4906&start=0 www.kolibrios.org www.fasmlib.x86asm.net/fasmlib-0.8.0-dev.zip It would be cool to have a hex dumper in display window: Code: $xxxx'xxxx: 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, $xxxx'xxxx: 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, So the macro and its usage examples: Code: ; val = 0..2^64-1 ; merge = 0<bytes<9 of value to show ; example: repeat 8 ; display 13,10 ; ShowHex $FEDCBA9876543210,% ; end repeat macro ShowHex val*, merge*{ if merge > 0 & merge < 9 local .a, .merge .merge = merge shl 1 while .merge <> 0 .a = (val) shr ((.merge - 1) * 4) and 1111b or 11'0000b if .a > 11'1001b .a = .a + 111b end if display .a .merge = .merge - 1 end while end if } Making an expression remember operator priority: www.flatassembler.net/docs.php?article=manual#_1.4 %fasm%\fasm.pdf, pg15 Here is a small example: www.board.flatassembler.net/topic.php?t=9680 Last edited by edemko on 17 May 2010, 21:33; edited 1 time in total |
|||
15 May 2010, 22:49 |
|
edemko 17 May 2010, 12:13
solved )+
watch a post over ps. i've visited it about 20 times and this is thanks a desire and wireless modem disconnections solved # |
|||
17 May 2010, 12:13 |
|
baldr 30 May 2010, 14:32
edemko,
Incomplete lines in dump can be handled inside main repeat: Code: db "Hello, world!", 13, 10, "I have a message for you." macro display_digit [val] { display '0'+val+('A'-'0'-10)*(9-val) shr 63 } repeat ($+15) and not 15 if %-1<$; in range load b from %-1 display_digit b shr 4 and 15, b and 15 else; out of range display ' ' end if if % and 15 = 0 display ' |' line_start_offset = (%-1) and not 15 repeat 16 if line_start_offset+%-1<$; in range load b from line_start_offset+%-1 display (b*(31-b) shr 63) or ('.'*(b-32) shr 63) else; out of range display ' ' end if end repeat display '|', 13, 10 else if (%-1) and 7 = 7; bells'n'whistles display '|' else if (%-1) and 3 = 3 display "'" else display ' ' end if end repeat |
|||
30 May 2010, 14:32 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.