flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > toyfull dbx backport (but size limit to 8)

Author
Thread Post new topic Reply to topic
ProMiNick



Joined: 24 Mar 2012
Posts: 211
Location: Russian Federation, Sochi
endianess support added but it too pure (just BE & LE without mixing stages)
Code:
macro dbx statement& {
 local size
 match sz:args,statement {
   if sz eqtype byte
     size = sizeof.\#sz
   else
     size = sz
   end if
   assert size<9 & size>-1
   irp arg,args {
     if arg shr (8*size)
       db arg
     else
       repeat size
         if defined __cpu"ENDIANESS" & __cpu"ENDIANESS"<>__cpu"ENDIANESS"LE
           db arg shr (8*(size-%)) and $FF
         else
           db arg shr (8*(%-1)) and $FF
         end if
       end repeat
     end if
   \\}
 \}
}
    


Code:
__cpu"ENDIANESS"LE = 0
__cpu"ENDIANESS"BE = 1
__cpu"ENDIANESS"LEW = 2  ; size of word different from cpu to cpu, word endianess reversed
__cpu"ENDIANESS"BEW = 3


sizeof.byte = 1    

Code:
dbx byte:$FF,$34
__cpu"ENDIANESS" = __cpu"ENDIANESS"LE
dbx 7:$13,$55
__cpu"ENDIANESS" = __cpu"ENDIANESS"BE
dbx 7:$27,$14
    

output is
Code:
FF 34 13 00 00 00 00 00
00 55 00 00 00 00 00 00
00 00 00 00 00 00 27 00
00 00 00 00 00 14    


works on both fasm1x (original & arm)

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 24 Oct 2018, 22:17
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2018, Tomasz Grysztar.

Powered by rwasa.