flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2 |
Author |
|
l_inc 10 Aug 2013, 18:25
fasmnewbie
Speaking about homeworks... Don't learn on that. Better take this one: Code: macro put val*,[reg*] { common local counter counter = 0 define address + define address - match [x],val \{ restore address forward mov reg,word[x+counter] counter = counter+2 common \} match -,address \{ restore address forward mov reg,(val shr (counter*8))and $FFFF counter = counter+2 common \} restore address } put 500h,ax,bx put [mydata],ax,bx mydata dd 500d Firstly, this macro does not generate those suboptimal jumps over data and indirections via si. Secondly, it's more generic and would allow you to put a value into any set of registers (like put $FEDCBA9876543210,ax,bx,cx,dx). And thirdly, it uses brackets instead of an asterisk. ![]() Your test macro would then look like this: Code: macro test a { pusha put a,ax,bx prtr bx, -n prtr ax, -n popa } test 500d ;1F4h line test [mydata] pquit mydata dd 500d ;1F4H _________________ Faith is a superposition of knowledge and fallacy |
|||
![]() |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.