Assembler Tricks & Tips
Optimizations
A fast way to clear the screen. If your assembler does not like the
first instruction, just remove the ".w".
ClearScreen:
lea $4440.W,a6
movem.l empty(pc),d1-d7/a0-a5 ;Put zeros in registers
moveq #(128*30/52)-1,d0 ;Clear as much as we can of our 128 lines
\loop: movem.l d1-d7/a0-a6,(a7)+ ;Clear 52 bytes in x cycles
dbf d0,\loop
movem.l d1-d7/a0-a3,(a6)+ ;Clear remaining bytes (depends on above)
rts
empty:
dcb.l 13,0
The (propably) fastest way to clear the screen. The REPT-ENDR statement
below is not widely implemented in 68k-assemblers, but simply means to
assemble the code between the keywords several times (64 in our case).
Just cut & paste in the sourcecode instead.
ClearScreen:
move.w #$2700,SR
move.l a7,save
lea $4440.w,a7
movem.l Empty(pc),d0-d7/a0-a6
REPT 64
movem.l d0-d7/a0-a6,(a7)+
ENDR
move.l save(pc),a7
move.w #$2000,SR
rts
save: dc.l 0
empty: dcb.l 15,0
Back to Main