flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
DimonSoft 04 Jul 2021, 21:25
display is only capable of display a sequence of characters with given codes. To achieve the behaviour you wish it should be redeclared as a macro.
To make the macro parse its string parameter you might want to do something like Code: macro display Message* { local ..StringData, c … virtual ..StringData:: db Message ..StringData.Length = $ - ..StringData end virtual … repeat ..StringData.Length load c byte from StringData:% - 1 ; Finite state machine logic to parse the string goes here end repeat … } A complete specification of what placeholders might occur in the string should better be written. Another solution (which, I guess, is more efficient) is to make a macro that accepts arbitrary number of parameters, outputs string ones as is, but whenever a parameter is prepended with special symbol (say, “:”) it gets converted to its string representation this way or another. Hexadecimal and decimal are the two representations that are needed most of the time. |
|||
![]() |
|
revolution 04 Jul 2021, 21:32
You can do the computation of the value first and then call a decimal conversion macro.
Code: macro my_decimal_display value { ;... some loop to convert to decimal and display the digits } sniplet12 = (reserved_mem_adr)+49200+($-_cpybuf+1) display "The value of sniplet12 is " my_decimal_display sniplet12 display 13,10 |
|||
![]() |
|
revolution 05 Jul 2021, 20:41
I found some old code with this macro:
Code: macro display_decimal value { local leading_zero,digit,divisor,number number=value if number=1 shl 63 display '-9223372036854775808' else if number<0 number=-number display '-' end if leading_zero=0 divisor=1000000000000000000 while divisor>0 digit=number/divisor leading_zero=leading_zero+digit if leading_zero | (divisor=1) display digit+'0' number=number-digit*divisor end if divisor=divisor/10 end while end if } ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.