Skip to content

Commit

Permalink
Safer parameter substitution on new clearRAM macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
flamewing committed Feb 5, 2014
1 parent 06b3180 commit a59f4f9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions s2.macros.asm
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ bytesToWcnt function n,n>>1-1

; fills a region of 68k RAM with 0
clearRAM macro addr,length
if (addr&$8000)==0
if ((addr)&$8000)==0
lea (addr).l,a1
else
lea (addr).w,a1
endif
moveq #0,d0
if (addr&1)
if ((addr)&1)
move.b d0,(a1)+
endif
move.w #bytesToLcnt(length - (addr&1)),d1
loop: move.l d0,(a1)+
dbf d1,loop
if ((length - (addr&1))&2)
move.w #bytesToLcnt(length - ((addr)&1)),d1
.loop: move.l d0,(a1)+
dbf d1,.loop
if ((length - ((addr)&1))&2)
move.w d0,(a1)+
endif
if ((length - (addr&1))&1)
if ((length - ((addr)&1))&1)
move.b d0,(a1)+
endif
endm
Expand Down

0 comments on commit a59f4f9

Please sign in to comment.