Home » Archimedes archive » Archimedes World » AW-1997-02.adf » !AcornAns_AcornAns » RotAnim/Bouncer

RotAnim/Bouncer

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1997-02.adf » !AcornAns_AcornAns
Filename: RotAnim/Bouncer
Read OK:
File size: 1F5F bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >Bouncer
   20REM Purpose: Demo of fast sprite plotting for specific sprites,
   30REM via simple animation of bouncing heads in a mode 12 screen.
   40REM
   50REM Coupled with sprite rotation via precalculation of rotated
   60REM images.
   70REM
   80:
   90REM NB program will produce a beep if animation speed falls
  100REM below the target fps rate.
  110targetfps% = 50
  120IF 100MODtargetfps%<>0 ERROR 1, "Require targetfps divides into 100"
  130:
  140SYS &20280, 0, -1 TO ;flags%
  150IF flags% AND 1 THEN arm3%=FALSE ELSE arm3%=TRUE
  160:
  170REM n% is the number of heads to be bounced
  180n%=43
  190IF arm3%=FALSE n%=n%/1.39
  200recommend$=STR$n%
  210:
  220ON ERROR SYS 6,112,1:SYS 6,113,1:PRINT REPORT$;" at line ";ERL:END
  230D% = RND(-TIME)
  240MODE 12+128:MODE 12:OFF
  250*Run Palette
  260COLOUR 128+1:CLS
  270DIM data% 1024*256
  280SYS "OS_File", 255, "HeadData", data%, 0
  290:
  300maxn%=400
  310DIM b% maxn%*20
  320REM NB b% stores array (of size n%) of structure:
  330REM {x coord, y coord, x increment, y increment, rotation phase}
  340:
  350DIM head% 30*4
  360FOR i%=0 TO 14
  370 head%!(4*i%)      = data%+16384*i%
  380 head%!(4*(i%+15)) = data%+16384*(15-i%)
  390NEXT
  400:
  410PROCass
  420:
  430REPEAT
  440 SYS 6,112,1:SYS 6,113,1
  450 REPEAT
  460  CLS
  470  PRINT '"Please enter number of heads to bounce ("+recommend$+" recommended, "+STR$maxn%+" max) ";
  480  INPUT n%
  490 UNTIL n%<=maxn% AND n%>0
  500 !an%=n%
  510 :
  520 REM initialise head locations & velocities
  530 FOR i% = 0 TO n%*20-1 STEP 20
  540   b%!(i%+0)  = RND(1000) + 140
  550   b%!(i%+4)  = RND(700)  + 0
  560   b%!(i%+8)  = RND(16)*(0.5+(RND(1)<0.5))
  570   b%!(i%+12) = RND(08)*(0.5+(RND(1)<0.5))
  580   b%!(i%+16) = RND(30)-1
  590 NEXT
  600 :
  610 CALL bounce%
  620 :
  630UNTIL FALSE
  640:
  650END
  660:
  670DEF PROCass
  680DIM code% 10240
  690!code%=148:code%!4=-1
  700SYS "OS_ReadVduVariables", code%, code%
  710scrst%=!code%
  720FOR pass% = 0 TO 2 STEP 2
  730 P%=code%
  740 [OPT pass%
  750 .aspframe%         EQUD 0
  760 .ascrstsum%        EQUD scrst%*2+81920
  770 .an%     EQUD 0
  780 .ab%     EQUD b%
  790 .atime%  EQUD 0              ;time storage for frame speed calc
  800 .afc%    EQUD 0              ;frame counter
  810 .bounce%
  820 STMFD    13!, {14}
  830 STR      13, aspframe%       ;store sp to free up r13
  840 .nextframe%
  850 :
  860 SWI      "OS_ReadMonotonicTime"        ;track frame speed
  870 STR      0, atime%
  880 :
  890 MOV      0, #19
  900 SWI      "OS_Byte"                     ;wait for vsync
  910 MOV      0, #113
  920 LDR      1, abank%
  930 RSB      3, 1, #3
  940 STR      3, abank%
  950 SWI      "OS_Byte"           ;swap displayed screen bank
  960 LDR      0, ascrstsum%
  970 LDR      1, ascrst%
  980 SUB      1, 0, 1
  990 STR      1, ascrst%          ;swap ptr to other bank
 1000 BL       cls%                ;cls that bank to grey (colour 1)
 1010 LDR      12, ab%
 1020 LDR      13, an%
 1030 .frameplotloop%              ;now plot each head:
 1040 LDMIA    12, {0,1}           ; read x,y coords from data
 1050 LDR      4, [12, #16]
 1060 MOV      0, 0, ASR #1
 1070 MOV      1, 1, ASR #2
 1080 BL       plot%               ; plot head at x,y
 1090 ADD      12, 12, #20
 1100 SUBS     13, 13, #1
 1110 BNE      frameplotloop%      ;then do next head
 1120 LDR      11, afc%
 1130 ADD      11, 11, #1
 1140 STR      11, afc%            ;update frame count
 1150 LDR      12, ab%
 1160 LDR      13, an%
 1170 .framemoveloop%              ;then move each head
 1180 LDMIA    12, {0,1,2,3,4}     ; read x,y,xi,yi,rt
 1190 ADDS     0, 0, 2             ; alter x
 1200 RSBMI    2, 2, #0            ; if off left side, reverse velocity
 1210 ADDMI    0, 0, 2             ; & move back
 1220 ADDS     1, 1, 3             ; alter y
 1230 RSBMI    3, 3, #0            ; if off top side, reverse velocity
 1240 ADDMI    1, 1, 3             ; & move back
 1250 SUBS     14, 0, #1024        ; (these 2 instructs are equiv
 1260 SUBGTS   14, 14, #142        ;  to CMP 0, #1166)
 1270 RSBGT    2, 2, #0            ; if off right, reverse velocity
 1280 ADDGT    0, 0, 2             ; & move back
 1290 CMP      1, #896
 1300 RSBGT    3, 3, #0            ; if off bottom, reverse velocity
 1310 ADDGT    1, 1, 3             ; & move back
 1320 TST      11, #3              ; if frame count is a multiple of 4
 1330 ADDEQ    3, 3, #1            ; accelerate head downwards
 1340 SUBS     4, 4, #1
 1350 MOVMI    4, #29
 1360 STMIA    12!, {0,1,2,3,4}    ; restore x,y,xi,yi,rt
 1370 SUBS     13, 13, #1
 1380 BNE      framemoveloop%      ;then do next head
 1390 :
 1400 SWI      "OS_ReadMonotonicTime"        ;calculate frame speed
 1410 LDR      1, atime%
 1420 SUB      0, 0, 1
 1430 CMP      0, #100/targetfps%
 1440 SWIGT    256+7               ;beep if it falls below target fps
 1450 :
 1460 MOV      0, #129
 1470 MOV      1, #0
 1480 MOV      2, #0
 1490 SWI      "OS_Byte"
 1500 CMP      2, #&FF
 1510 BEQ      nextframe%          ;if no key pressed, do next frame
 1520 LDR      13, aspframe%       ;restore sp
 1530 LDMFD    13!, {PC}           ;return to BASIC
 1540 :
 1550 .ascrst% EQUD scrst%
 1560 .ahead%  EQUD head%
 1570 .abank%  EQUD 1
 1580 .aplotregs%        EQUD 0:EQUD 0:EQUD 0
 1590 .plot%   ;plot our head sprite at coords r0,r1
 1600          ;where 0,0 is top left & 639,255 is bottom right
 1610          ;NB sprite MUST lie entirely within screen
 1620 ADR      11, aplotregs%
 1630 STMIA    11, {12,13,14}
 1640 AND      3, 0, #7            ;calculate which of the 8 sprite
 1650                              ;alignments we need via:
 1660                              ;(xAND7)*32*64 + data%
 1670 BIC      0, 0, #7            ;round x down to mult of 8
 1680 ADD      1, 1, 1, ASL #2
 1690 LDR      2, ascrst%
 1700 ADD      2, 2, 1, ASL #6
 1710 ADD      0, 2, 0, ASR #1     ;calc (screen ptr + 320y + x)
 1720 LDR      1, ahead%
 1730 LDR      1, [1, 4, ASL #2]
 1740 ADD      1, 1, 3, ASL #11    ;finally calc (xAND7)*32*64+data%
 1750 MOV      2, #8
 1760 .loop1%                      ;now plot sprite
 1770 FNfrag1(pass%)               ;plot 1st half of 1st row
 1780 FNfrag1(pass%)               ;     2nd half of 1st row
 1790 ADD      0, 0, #320-32       ;move screen ptr to start next row
 1800 FNfrag1(pass%)               ;plot 1st half of 2nd row
 1810 FNfrag1(pass%)               ; etc . . .
 1820 ADD      0, 0, #320-32
 1830 FNfrag1(pass%)
 1840 FNfrag1(pass%)
 1850 ADD      0, 0, #320-32
 1860 FNfrag1(pass%)
 1870 FNfrag1(pass%)               ;plot 2nd half of 4th row
 1880 ADD      0, 0, #320-32
 1890 SUBS     2, 2, #1
 1900 BNE      loop1%          ;repeat above 8 times to do all 32 rows
 1910 ADR      11, aplotregs%      ;plot completed - return to caller
 1920 LDMIA    11, {12,13,PC}      ;preserving r12 & r13.
 1930 :
 1940 .alrcls% EQUD 0
 1950 .aspcls% EQUD 0
 1960 .cls%                        ;simple routine to clear screen
 1970 STR      14, alrcls%         ;as rapidly as possible -
 1980 STR      13, aspcls%         ;note the heavy use of STM.
 1990 LDR      0, ascrst%
 2000 MOV      1, #105
 2010 MOV      2, #&11
 2020 ORR      2, 2, 2, LSL #8
 2030 ORR      2, 2, 2, LSL #16
 2040 MOV      3, 2
 2050 MOV      4, 2
 2060 MOV      5, 2
 2070 MOV      6, 2
 2080 MOV      7, 2
 2090 MOV      8, 2
 2100 MOV      9, 2
 2110 MOV      10, 2
 2120 MOV      11, 2
 2130 MOV      12, 2
 2140 MOV      13, 2
 2150 MOV      14, 2
 2160 .clsloop%
 2170 STMIA    0!, {2-14}
 2180 STMIA    0!, {2-14}
 2190 STMIA    0!, {2-14}
 2200 STMIA    0!, {2-14}
 2210 STMIA    0!, {2-14}
 2220 STMIA    0!, {2-14}
 2230 STMIA    0!, {2-14}
 2240 STMIA    0!, {2-14}
 2250 STMIA    0!, {2-14}
 2260 STMIA    0!, {2-14}
 2270 STMIA    0!, {2-14}
 2280 STMIA    0!, {2-14}
 2290 STMIA    0!, {2-14}
 2300 STMIA    0!, {2-14}
 2310 STMIA    0!, {2-14}
 2320 SUBS     1, 1, #1
 2330 BNE      clsloop%
 2340 STMIA    0!, {2-6}
 2350 LDR      13, aspcls%
 2360 LDR      PC, alrcls%
 2370 ]
 2380NEXT
 2390ENDPROC
 2400:
 2410DEF FNfrag1(pass%)       :REM macro to plot 1/2 a row (32 pixels)
 2420[OPT pass%               :REM of our sprite
 2430LDMIA    0, {3-6}             ;read 4 words of screen (32 pixels)
 2440LDMIA    1!, {7-14}           ;read 32 sprite pixels & 32 masks
 2450AND      3, 3, 8              ;apply mask to screen, zeroing
 2460AND      4, 4, 10             ; those bits where will write
 2470AND      5, 5, 12             ; sprite image in a moment
 2480AND      6, 6, 14
 2490ORR      3, 3, 7              ;write in the sprite image
 2500ORR      4, 4, 9
 2510ORR      5, 5, 11
 2520ORR      6, 6, 13
 2530STMIA    0!, {3-6}            ;restore the data back to screen
 2540]
 2550=pass%

� >Bouncer
A� Purpose: Demo of fast sprite plotting for specific sprites,
A� via simple animation of bouncing heads in a mode 12 screen.
(�
2@� Coupled with sprite rotation via precalculation of rotated
<
� images.
F�
P:
Z=� NB program will produce a beep if animation speed falls
d � below the target fps rate.
ntargetfps% = 50
xA� 100�targetfps%<>0 � 1, "Require targetfps divides into 100"
�:
�ș &20280, 0, -1 � ;flags%
�$� flags% � 1 � arm3%=� � arm3%=�
�:
�-� n% is the number of heads to be bounced
�	n%=43
�� arm3%=� n%=n%/1.39
�recommend$=�n%
�:
�2� � ș 6,112,1:ș 6,113,1:� �$;" at line ";�:�
�D% = �(-�)
�� 12+128:� 12:�
�*Run Palette

� 128+1:�
� data% 1024*256
+ș "OS_File", 255, "HeadData", data%, 0
":
,
maxn%=400
6� b% maxn%*20
@3� NB b% stores array (of size n%) of structure:
JB� {x coord, y coord, x increment, y increment, rotation phase}
T:
^� head% 30*4
h� i%=0 � 14
r' head%!(4*i%)      = data%+16384*i%
|, head%!(4*(i%+15)) = data%+16384*(15-i%)
��
�:
��ass
�:
��
� ș 6,112,1:ș 6,113,1
� �
�  �
�`  � '"Please enter number of heads to bounce ("+recommend$+" recommended, "+�maxn%+" max) ";
�
  � n%
� � n%<=maxn% � n%>0
� !an%=n%
� :
- � initialise head locations & velocities
 � i% = 0 � n%*20-1 � 20
!   b%!(i%+0)  = �(1000) + 140
&   b%!(i%+4)  = �(700)  + 0
0*   b%!(i%+8)  = �(16)*(0.5+(�(1)<0.5))
:*   b%!(i%+12) = �(08)*(0.5+(�(1)<0.5))
D   b%!(i%+16) = �(30)-1
N �
X :
b � bounce%
l :
v� �
�:
��
�:
�
� �ass
�� code% 10240
�!code%=148:code%!4=-1
�*ș "OS_ReadVduVariables", code%, code%
�scrst%=!code%
�� pass% = 0 � 2 � 2
�
 P%=code%
� [OPT pass%
� .aspframe%         EQUD 0
�+ .ascrstsum%        EQUD scrst%*2+81920
 .an%     EQUD 0
 .ab%     EQUD b%
D .atime%  EQUD 0              ;time storage for frame speed calc
 0 .afc%    EQUD 0              ;frame counter
*
 .bounce%
4 STMFD    13!, {14}
>: STR      13, aspframe%       ;store sp to free up r13
H .nextframe%
R :
\> SWI      "OS_ReadMonotonicTime"        ;track frame speed
f STR      0, atime%
p :
z MOV      0, #19
�; SWI      "OS_Byte"                     ;wait for vsync
� MOV      0, #113
� LDR      1, abank%
� RSB      3, 1, #3
� STR      3, abank%
�= SWI      "OS_Byte"           ;swap displayed screen bank
� LDR      0, ascrstsum%
� LDR      1, ascrst%
� SUB      1, 0, 1
�9 STR      1, ascrst%          ;swap ptr to other bank
�C BL       cls%                ;cls that bank to grey (colour 1)
� LDR      12, ab%
� LDR      13, an%
6 .frameplotloop%              ;now plot each head:
= LDMIA    12, {0,1}           ; read x,y coords from data
 LDR      4, [12, #16]
$ MOV      0, 0, ASR #1
. MOV      1, 1, ASR #2
84 BL       plot%               ; plot head at x,y
B ADD      12, 12, #20
L SUBS     13, 13, #1
V4 BNE      frameplotloop%      ;then do next head
` LDR      11, afc%
j ADD      11, 11, #1
t5 STR      11, afc%            ;update frame count
~ LDR      12, ab%
� LDR      13, an%
�6 .framemoveloop%              ;then move each head
�5 LDMIA    12, {0,1,2,3,4}     ; read x,y,xi,yi,rt
�+ ADDS     0, 0, 2             ; alter x
�F RSBMI    2, 2, #0            ; if off left side, reverse velocity
�/ ADDMI    0, 0, 2             ; & move back
�+ ADDS     1, 1, 3             ; alter y
�E RSBMI    3, 3, #0            ; if off top side, reverse velocity
�/ ADDMI    1, 1, 3             ; & move back
�@ SUBS     14, 0, #1024        ; (these 2 instructs are equiv
�5 SUBGTS   14, 14, #142        ;  to CMP 0, #1166)
�B RSBGT    2, 2, #0            ; if off right, reverse velocity
/ ADDGT    0, 0, 2             ; & move back

 CMP      1, #896
C RSBGT    3, 3, #0            ; if off bottom, reverse velocity
/ ADDGT    1, 1, 3             ; & move back
(E TST      11, #3              ; if frame count is a multiple of 4
2= ADDEQ    3, 3, #1            ; accelerate head downwards
< SUBS     4, 4, #1
F MOVMI    4, #29
P8 STMIA    12!, {0,1,2,3,4}    ; restore x,y,xi,yi,rt
Z SUBS     13, 13, #1
d4 BNE      framemoveloop%      ;then do next head
n :
xB SWI      "OS_ReadMonotonicTime"        ;calculate frame speed
� LDR      1, atime%
� SUB      0, 0, 1
�  CMP      0, #100/targetfps%
�D SWIGT    256+7               ;beep if it falls below target fps
� :
� MOV      0, #129
� MOV      1, #0
� MOV      2, #0
� SWI      "OS_Byte"
� CMP      2, #&FF
�C BEQ      nextframe%          ;if no key pressed, do next frame
�- LDR      13, aspframe%       ;restore sp
�2 LDMFD    13!, {PC}           ;return to BASIC
 :
 .ascrst% EQUD scrst%
 .ahead%  EQUD head%
" .abank%  EQUD 1
,, .aplotregs%        EQUD 0:EQUD 0:EQUD 0
63 .plot%   ;plot our head sprite at coords r0,r1
@>          ;where 0,0 is top left & 639,255 is bottom right
J8          ;NB sprite MUST lie entirely within screen
T ADR      11, aplotregs%
^ STMIA    11, {12,13,14}
h@ �      3, 0, #7            ;calculate which of the 8 sprite
r:                              ;alignments we need via:
|8                              ;(xAND7)*32*64 + data%
�< BIC      0, 0, #7            ;round x down to mult of 8
� ADD      1, 1, 1, ASL #2
� LDR      2, ascrst%
� ADD      2, 2, 1, ASL #6
�? ADD      0, 2, 0, ASR #1     ;calc (screen ptr + 320y + x)
� LDR      1, ahead%
� LDR      1, [1, 4, ASL #2]
�C ADD      1, 1, 3, ASL #11    ;finally calc (xAND7)*32*64+data%
� MOV      2, #8
�2 .loop1%                      ;now plot sprite
�: �frag1(pass%)               ;plot 1st half of 1st row
�: �frag1(pass%)               ;     2nd half of 1st row
�D ADD      0, 0, #320-32       ;move screen ptr to start next row
: �frag1(pass%)               ;plot 1st half of 2nd row
, �frag1(pass%)               ; etc . . .
 ADD      0, 0, #320-32
& �frag1(pass%)
0 �frag1(pass%)
: ADD      0, 0, #320-32
D �frag1(pass%)
N: �frag1(pass%)               ;plot 2nd half of 4th row
X ADD      0, 0, #320-32
b SUBS     2, 2, #1
lE BNE      loop1%          ;repeat above 8 times to do all 32 rows
vD ADR      11, aplotregs%      ;plot completed - return to caller
�8 LDMIA    11, {12,13,PC}      ;preserving r12 & r13.
� :
� .alrcls% EQUD 0
� .aspcls% EQUD 0
�A .cls%                        ;simple routine to clear screen
�; STR      14, alrcls%         ;as rapidly as possible -
�= STR      13, aspcls%         ;note the heavy use of STM.
� LDR      0, ascrst%
� MOV      1, #105
� MOV      2, #&11
� �R      2, 2, 2, LSL #8
� �R      2, 2, 2, LSL #16
� MOV      3, 2
 MOV      4, 2
 MOV      5, 2
 MOV      6, 2
  MOV      7, 2
* MOV      8, 2
4 MOV      9, 2
> MOV      10, 2
H MOV      11, 2
R MOV      12, 2
\ MOV      13, 2
f MOV      14, 2
p .clsloop%
z STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
� STMIA    0!, {2-14}
	 STMIA    0!, {2-14}
	 SUBS     1, 1, #1
	 BNE      clsloop%
	$ STMIA    0!, {2-6}
	. LDR      13, aspcls%
	8 LDR      PC, alrcls%
	B ]
	L�
	V�
	`:
	j@� �frag1(pass%)       :� macro to plot 1/2 a row (32 pixels)
	t-[OPT pass%               :� of our sprite
	~ELDMIA    0, {3-6}             ;read 4 words of screen (32 pixels)
	�CLDMIA    1!, {7-14}           ;read 32 sprite pixels & 32 masks
	�>�      3, 3, 8              ;apply mask to screen, zeroing
	�=�      4, 4, 10             ; those bits where will write
	�:�      5, 5, 12             ; sprite image in a moment
	��      6, 6, 14
	�;�R      3, 3, 7              ;write in the sprite image
	��R      4, 4, 9
	��R      5, 5, 11
	��R      6, 6, 13
	�BSTMIA    0!, {3-6}            ;restore the data back to screen
	�]
	�
=pass%
�
00000000  0d 00 0a 0e f4 20 3e 42  6f 75 6e 63 65 72 0d 00  |..... >Bouncer..|
00000010  14 41 f4 20 50 75 72 70  6f 73 65 3a 20 44 65 6d  |.A. Purpose: Dem|
00000020  6f 20 6f 66 20 66 61 73  74 20 73 70 72 69 74 65  |o of fast sprite|
00000030  20 70 6c 6f 74 74 69 6e  67 20 66 6f 72 20 73 70  | plotting for sp|
00000040  65 63 69 66 69 63 20 73  70 72 69 74 65 73 2c 0d  |ecific sprites,.|
00000050  00 1e 41 f4 20 76 69 61  20 73 69 6d 70 6c 65 20  |..A. via simple |
00000060  61 6e 69 6d 61 74 69 6f  6e 20 6f 66 20 62 6f 75  |animation of bou|
00000070  6e 63 69 6e 67 20 68 65  61 64 73 20 69 6e 20 61  |ncing heads in a|
00000080  20 6d 6f 64 65 20 31 32  20 73 63 72 65 65 6e 2e  | mode 12 screen.|
00000090  0d 00 28 05 f4 0d 00 32  40 f4 20 43 6f 75 70 6c  |..(....2@. Coupl|
000000a0  65 64 20 77 69 74 68 20  73 70 72 69 74 65 20 72  |ed with sprite r|
000000b0  6f 74 61 74 69 6f 6e 20  76 69 61 20 70 72 65 63  |otation via prec|
000000c0  61 6c 63 75 6c 61 74 69  6f 6e 20 6f 66 20 72 6f  |alculation of ro|
000000d0  74 61 74 65 64 0d 00 3c  0d f4 20 69 6d 61 67 65  |tated..<.. image|
000000e0  73 2e 0d 00 46 05 f4 0d  00 50 05 3a 0d 00 5a 3d  |s...F....P.:..Z=|
000000f0  f4 20 4e 42 20 70 72 6f  67 72 61 6d 20 77 69 6c  |. NB program wil|
00000100  6c 20 70 72 6f 64 75 63  65 20 61 20 62 65 65 70  |l produce a beep|
00000110  20 69 66 20 61 6e 69 6d  61 74 69 6f 6e 20 73 70  | if animation sp|
00000120  65 65 64 20 66 61 6c 6c  73 0d 00 64 20 f4 20 62  |eed falls..d . b|
00000130  65 6c 6f 77 20 74 68 65  20 74 61 72 67 65 74 20  |elow the target |
00000140  66 70 73 20 72 61 74 65  2e 0d 00 6e 13 74 61 72  |fps rate...n.tar|
00000150  67 65 74 66 70 73 25 20  3d 20 35 30 0d 00 78 41  |getfps% = 50..xA|
00000160  e7 20 31 30 30 83 74 61  72 67 65 74 66 70 73 25  |. 100.targetfps%|
00000170  3c 3e 30 20 85 20 31 2c  20 22 52 65 71 75 69 72  |<>0 . 1, "Requir|
00000180  65 20 74 61 72 67 65 74  66 70 73 20 64 69 76 69  |e targetfps divi|
00000190  64 65 73 20 69 6e 74 6f  20 31 30 30 22 0d 00 82  |des into 100"...|
000001a0  05 3a 0d 00 8c 1e c8 99  20 26 32 30 32 38 30 2c  |.:...... &20280,|
000001b0  20 30 2c 20 2d 31 20 b8  20 3b 66 6c 61 67 73 25  | 0, -1 . ;flags%|
000001c0  0d 00 96 24 e7 20 66 6c  61 67 73 25 20 80 20 31  |...$. flags% . 1|
000001d0  20 8c 20 61 72 6d 33 25  3d a3 20 8b 20 61 72 6d  | . arm3%=. . arm|
000001e0  33 25 3d b9 0d 00 a0 05  3a 0d 00 aa 2d f4 20 6e  |3%=.....:...-. n|
000001f0  25 20 69 73 20 74 68 65  20 6e 75 6d 62 65 72 20  |% is the number |
00000200  6f 66 20 68 65 61 64 73  20 74 6f 20 62 65 20 62  |of heads to be b|
00000210  6f 75 6e 63 65 64 0d 00  b4 09 6e 25 3d 34 33 0d  |ounced....n%=43.|
00000220  00 be 18 e7 20 61 72 6d  33 25 3d a3 20 6e 25 3d  |.... arm3%=. n%=|
00000230  6e 25 2f 31 2e 33 39 0d  00 c8 12 72 65 63 6f 6d  |n%/1.39....recom|
00000240  6d 65 6e 64 24 3d c3 6e  25 0d 00 d2 05 3a 0d 00  |mend$=.n%....:..|
00000250  dc 32 ee 20 85 20 c8 99  20 36 2c 31 31 32 2c 31  |.2. . .. 6,112,1|
00000260  3a c8 99 20 36 2c 31 31  33 2c 31 3a f1 20 f6 24  |:.. 6,113,1:. .$|
00000270  3b 22 20 61 74 20 6c 69  6e 65 20 22 3b 9e 3a e0  |;" at line ";.:.|
00000280  0d 00 e6 0e 44 25 20 3d  20 b3 28 2d 91 29 0d 00  |....D% = .(-.)..|
00000290  f0 13 eb 20 31 32 2b 31  32 38 3a eb 20 31 32 3a  |... 12+128:. 12:|
000002a0  87 0d 00 fa 10 2a 52 75  6e 20 50 61 6c 65 74 74  |.....*Run Palett|
000002b0  65 0d 01 04 0d fb 20 31  32 38 2b 31 3a db 0d 01  |e..... 128+1:...|
000002c0  0e 14 de 20 64 61 74 61  25 20 31 30 32 34 2a 32  |... data% 1024*2|
000002d0  35 36 0d 01 18 2b c8 99  20 22 4f 53 5f 46 69 6c  |56...+.. "OS_Fil|
000002e0  65 22 2c 20 32 35 35 2c  20 22 48 65 61 64 44 61  |e", 255, "HeadDa|
000002f0  74 61 22 2c 20 64 61 74  61 25 2c 20 30 0d 01 22  |ta", data%, 0.."|
00000300  05 3a 0d 01 2c 0d 6d 61  78 6e 25 3d 34 30 30 0d  |.:..,.maxn%=400.|
00000310  01 36 11 de 20 62 25 20  6d 61 78 6e 25 2a 32 30  |.6.. b% maxn%*20|
00000320  0d 01 40 33 f4 20 4e 42  20 62 25 20 73 74 6f 72  |..@3. NB b% stor|
00000330  65 73 20 61 72 72 61 79  20 28 6f 66 20 73 69 7a  |es array (of siz|
00000340  65 20 6e 25 29 20 6f 66  20 73 74 72 75 63 74 75  |e n%) of structu|
00000350  72 65 3a 0d 01 4a 42 f4  20 7b 78 20 63 6f 6f 72  |re:..JB. {x coor|
00000360  64 2c 20 79 20 63 6f 6f  72 64 2c 20 78 20 69 6e  |d, y coord, x in|
00000370  63 72 65 6d 65 6e 74 2c  20 79 20 69 6e 63 72 65  |crement, y incre|
00000380  6d 65 6e 74 2c 20 72 6f  74 61 74 69 6f 6e 20 70  |ment, rotation p|
00000390  68 61 73 65 7d 0d 01 54  05 3a 0d 01 5e 10 de 20  |hase}..T.:..^.. |
000003a0  68 65 61 64 25 20 33 30  2a 34 0d 01 68 0f e3 20  |head% 30*4..h.. |
000003b0  69 25 3d 30 20 b8 20 31  34 0d 01 72 27 20 68 65  |i%=0 . 14..r' he|
000003c0  61 64 25 21 28 34 2a 69  25 29 20 20 20 20 20 20  |ad%!(4*i%)      |
000003d0  3d 20 64 61 74 61 25 2b  31 36 33 38 34 2a 69 25  |= data%+16384*i%|
000003e0  0d 01 7c 2c 20 68 65 61  64 25 21 28 34 2a 28 69  |..|, head%!(4*(i|
000003f0  25 2b 31 35 29 29 20 3d  20 64 61 74 61 25 2b 31  |%+15)) = data%+1|
00000400  36 33 38 34 2a 28 31 35  2d 69 25 29 0d 01 86 05  |6384*(15-i%)....|
00000410  ed 0d 01 90 05 3a 0d 01  9a 08 f2 61 73 73 0d 01  |.....:.....ass..|
00000420  a4 05 3a 0d 01 ae 05 f5  0d 01 b8 1a 20 c8 99 20  |..:......... .. |
00000430  36 2c 31 31 32 2c 31 3a  c8 99 20 36 2c 31 31 33  |6,112,1:.. 6,113|
00000440  2c 31 0d 01 c2 06 20 f5  0d 01 cc 07 20 20 db 0d  |,1.... .....  ..|
00000450  01 d6 60 20 20 f1 20 27  22 50 6c 65 61 73 65 20  |..`  . '"Please |
00000460  65 6e 74 65 72 20 6e 75  6d 62 65 72 20 6f 66 20  |enter number of |
00000470  68 65 61 64 73 20 74 6f  20 62 6f 75 6e 63 65 20  |heads to bounce |
00000480  28 22 2b 72 65 63 6f 6d  6d 65 6e 64 24 2b 22 20  |("+recommend$+" |
00000490  72 65 63 6f 6d 6d 65 6e  64 65 64 2c 20 22 2b c3  |recommended, "+.|
000004a0  6d 61 78 6e 25 2b 22 20  6d 61 78 29 20 22 3b 0d  |maxn%+" max) ";.|
000004b0  01 e0 0a 20 20 e8 20 6e  25 0d 01 ea 17 20 fd 20  |...  . n%.... . |
000004c0  6e 25 3c 3d 6d 61 78 6e  25 20 80 20 6e 25 3e 30  |n%<=maxn% . n%>0|
000004d0  0d 01 f4 0c 20 21 61 6e  25 3d 6e 25 0d 01 fe 06  |.... !an%=n%....|
000004e0  20 3a 0d 02 08 2d 20 f4  20 69 6e 69 74 69 61 6c  | :...- . initial|
000004f0  69 73 65 20 68 65 61 64  20 6c 6f 63 61 74 69 6f  |ise head locatio|
00000500  6e 73 20 26 20 76 65 6c  6f 63 69 74 69 65 73 0d  |ns & velocities.|
00000510  02 12 1c 20 e3 20 69 25  20 3d 20 30 20 b8 20 6e  |... . i% = 0 . n|
00000520  25 2a 32 30 2d 31 20 88  20 32 30 0d 02 1c 21 20  |%*20-1 . 20...! |
00000530  20 20 62 25 21 28 69 25  2b 30 29 20 20 3d 20 b3  |  b%!(i%+0)  = .|
00000540  28 31 30 30 30 29 20 2b  20 31 34 30 0d 02 26 1f  |(1000) + 140..&.|
00000550  20 20 20 62 25 21 28 69  25 2b 34 29 20 20 3d 20  |   b%!(i%+4)  = |
00000560  b3 28 37 30 30 29 20 20  2b 20 30 0d 02 30 2a 20  |.(700)  + 0..0* |
00000570  20 20 62 25 21 28 69 25  2b 38 29 20 20 3d 20 b3  |  b%!(i%+8)  = .|
00000580  28 31 36 29 2a 28 30 2e  35 2b 28 b3 28 31 29 3c  |(16)*(0.5+(.(1)<|
00000590  30 2e 35 29 29 0d 02 3a  2a 20 20 20 62 25 21 28  |0.5))..:*   b%!(|
000005a0  69 25 2b 31 32 29 20 3d  20 b3 28 30 38 29 2a 28  |i%+12) = .(08)*(|
000005b0  30 2e 35 2b 28 b3 28 31  29 3c 30 2e 35 29 29 0d  |0.5+(.(1)<0.5)).|
000005c0  02 44 1b 20 20 20 62 25  21 28 69 25 2b 31 36 29  |.D.   b%!(i%+16)|
000005d0  20 3d 20 b3 28 33 30 29  2d 31 0d 02 4e 06 20 ed  | = .(30)-1..N. .|
000005e0  0d 02 58 06 20 3a 0d 02  62 0e 20 d6 20 62 6f 75  |..X. :..b. . bou|
000005f0  6e 63 65 25 0d 02 6c 06  20 3a 0d 02 76 07 fd 20  |nce%..l. :..v.. |
00000600  a3 0d 02 80 05 3a 0d 02  8a 05 e0 0d 02 94 05 3a  |.....:.........:|
00000610  0d 02 9e 0a dd 20 f2 61  73 73 0d 02 a8 11 de 20  |..... .ass..... |
00000620  63 6f 64 65 25 20 31 30  32 34 30 0d 02 b2 19 21  |code% 10240....!|
00000630  63 6f 64 65 25 3d 31 34  38 3a 63 6f 64 65 25 21  |code%=148:code%!|
00000640  34 3d 2d 31 0d 02 bc 2a  c8 99 20 22 4f 53 5f 52  |4=-1...*.. "OS_R|
00000650  65 61 64 56 64 75 56 61  72 69 61 62 6c 65 73 22  |eadVduVariables"|
00000660  2c 20 63 6f 64 65 25 2c  20 63 6f 64 65 25 0d 02  |, code%, code%..|
00000670  c6 11 73 63 72 73 74 25  3d 21 63 6f 64 65 25 0d  |..scrst%=!code%.|
00000680  02 d0 17 e3 20 70 61 73  73 25 20 3d 20 30 20 b8  |.... pass% = 0 .|
00000690  20 32 20 88 20 32 0d 02  da 0d 20 50 25 3d 63 6f  | 2 . 2.... P%=co|
000006a0  64 65 25 0d 02 e4 0f 20  5b 4f 50 54 20 70 61 73  |de%.... [OPT pas|
000006b0  73 25 0d 02 ee 1e 20 2e  61 73 70 66 72 61 6d 65  |s%.... .aspframe|
000006c0  25 20 20 20 20 20 20 20  20 20 45 51 55 44 20 30  |%         EQUD 0|
000006d0  0d 02 f8 2b 20 2e 61 73  63 72 73 74 73 75 6d 25  |...+ .ascrstsum%|
000006e0  20 20 20 20 20 20 20 20  45 51 55 44 20 73 63 72  |        EQUD scr|
000006f0  73 74 25 2a 32 2b 38 31  39 32 30 0d 03 02 14 20  |st%*2+81920.... |
00000700  2e 61 6e 25 20 20 20 20  20 45 51 55 44 20 30 0d  |.an%     EQUD 0.|
00000710  03 0c 15 20 2e 61 62 25  20 20 20 20 20 45 51 55  |... .ab%     EQU|
00000720  44 20 62 25 0d 03 16 44  20 2e 61 74 69 6d 65 25  |D b%...D .atime%|
00000730  20 20 45 51 55 44 20 30  20 20 20 20 20 20 20 20  |  EQUD 0        |
00000740  20 20 20 20 20 20 3b 74  69 6d 65 20 73 74 6f 72  |      ;time stor|
00000750  61 67 65 20 66 6f 72 20  66 72 61 6d 65 20 73 70  |age for frame sp|
00000760  65 65 64 20 63 61 6c 63  0d 03 20 30 20 2e 61 66  |eed calc.. 0 .af|
00000770  63 25 20 20 20 20 45 51  55 44 20 30 20 20 20 20  |c%    EQUD 0    |
00000780  20 20 20 20 20 20 20 20  20 20 3b 66 72 61 6d 65  |          ;frame|
00000790  20 63 6f 75 6e 74 65 72  0d 03 2a 0d 20 2e 62 6f  | counter..*. .bo|
000007a0  75 6e 63 65 25 0d 03 34  17 20 53 54 4d 46 44 20  |unce%..4. STMFD |
000007b0  20 20 20 31 33 21 2c 20  7b 31 34 7d 0d 03 3e 3a  |   13!, {14}..>:|
000007c0  20 53 54 52 20 20 20 20  20 20 31 33 2c 20 61 73  | STR      13, as|
000007d0  70 66 72 61 6d 65 25 20  20 20 20 20 20 20 3b 73  |pframe%       ;s|
000007e0  74 6f 72 65 20 73 70 20  74 6f 20 66 72 65 65 20  |tore sp to free |
000007f0  75 70 20 72 31 33 0d 03  48 10 20 2e 6e 65 78 74  |up r13..H. .next|
00000800  66 72 61 6d 65 25 0d 03  52 06 20 3a 0d 03 5c 3e  |frame%..R. :..\>|
00000810  20 53 57 49 20 20 20 20  20 20 22 4f 53 5f 52 65  | SWI      "OS_Re|
00000820  61 64 4d 6f 6e 6f 74 6f  6e 69 63 54 69 6d 65 22  |adMonotonicTime"|
00000830  20 20 20 20 20 20 20 20  3b 74 72 61 63 6b 20 66  |        ;track f|
00000840  72 61 6d 65 20 73 70 65  65 64 0d 03 66 17 20 53  |rame speed..f. S|
00000850  54 52 20 20 20 20 20 20  30 2c 20 61 74 69 6d 65  |TR      0, atime|
00000860  25 0d 03 70 06 20 3a 0d  03 7a 14 20 4d 4f 56 20  |%..p. :..z. MOV |
00000870  20 20 20 20 20 30 2c 20  23 31 39 0d 03 84 3b 20  |     0, #19...; |
00000880  53 57 49 20 20 20 20 20  20 22 4f 53 5f 42 79 74  |SWI      "OS_Byt|
00000890  65 22 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e"              |
000008a0  20 20 20 20 20 20 20 3b  77 61 69 74 20 66 6f 72  |       ;wait for|
000008b0  20 76 73 79 6e 63 0d 03  8e 15 20 4d 4f 56 20 20  | vsync.... MOV  |
000008c0  20 20 20 20 30 2c 20 23  31 31 33 0d 03 98 17 20  |    0, #113.... |
000008d0  4c 44 52 20 20 20 20 20  20 31 2c 20 61 62 61 6e  |LDR      1, aban|
000008e0  6b 25 0d 03 a2 16 20 52  53 42 20 20 20 20 20 20  |k%.... RSB      |
000008f0  33 2c 20 31 2c 20 23 33  0d 03 ac 17 20 53 54 52  |3, 1, #3.... STR|
00000900  20 20 20 20 20 20 33 2c  20 61 62 61 6e 6b 25 0d  |      3, abank%.|
00000910  03 b6 3d 20 53 57 49 20  20 20 20 20 20 22 4f 53  |..= SWI      "OS|
00000920  5f 42 79 74 65 22 20 20  20 20 20 20 20 20 20 20  |_Byte"          |
00000930  20 3b 73 77 61 70 20 64  69 73 70 6c 61 79 65 64  | ;swap displayed|
00000940  20 73 63 72 65 65 6e 20  62 61 6e 6b 0d 03 c0 1b  | screen bank....|
00000950  20 4c 44 52 20 20 20 20  20 20 30 2c 20 61 73 63  | LDR      0, asc|
00000960  72 73 74 73 75 6d 25 0d  03 ca 18 20 4c 44 52 20  |rstsum%.... LDR |
00000970  20 20 20 20 20 31 2c 20  61 73 63 72 73 74 25 0d  |     1, ascrst%.|
00000980  03 d4 15 20 53 55 42 20  20 20 20 20 20 31 2c 20  |... SUB      1, |
00000990  30 2c 20 31 0d 03 de 39  20 53 54 52 20 20 20 20  |0, 1...9 STR    |
000009a0  20 20 31 2c 20 61 73 63  72 73 74 25 20 20 20 20  |  1, ascrst%    |
000009b0  20 20 20 20 20 20 3b 73  77 61 70 20 70 74 72 20  |      ;swap ptr |
000009c0  74 6f 20 6f 74 68 65 72  20 62 61 6e 6b 0d 03 e8  |to other bank...|
000009d0  43 20 42 4c 20 20 20 20  20 20 20 63 6c 73 25 20  |C BL       cls% |
000009e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000009f0  63 6c 73 20 74 68 61 74  20 62 61 6e 6b 20 74 6f  |cls that bank to|
00000a00  20 67 72 65 79 20 28 63  6f 6c 6f 75 72 20 31 29  | grey (colour 1)|
00000a10  0d 03 f2 15 20 4c 44 52  20 20 20 20 20 20 31 32  |.... LDR      12|
00000a20  2c 20 61 62 25 0d 03 fc  15 20 4c 44 52 20 20 20  |, ab%.... LDR   |
00000a30  20 20 20 31 33 2c 20 61  6e 25 0d 04 06 36 20 2e  |   13, an%...6 .|
00000a40  66 72 61 6d 65 70 6c 6f  74 6c 6f 6f 70 25 20 20  |frameplotloop%  |
00000a50  20 20 20 20 20 20 20 20  20 20 20 20 3b 6e 6f 77  |            ;now|
00000a60  20 70 6c 6f 74 20 65 61  63 68 20 68 65 61 64 3a  | plot each head:|
00000a70  0d 04 10 3d 20 4c 44 4d  49 41 20 20 20 20 31 32  |...= LDMIA    12|
00000a80  2c 20 7b 30 2c 31 7d 20  20 20 20 20 20 20 20 20  |, {0,1}         |
00000a90  20 20 3b 20 72 65 61 64  20 78 2c 79 20 63 6f 6f  |  ; read x,y coo|
00000aa0  72 64 73 20 66 72 6f 6d  20 64 61 74 61 0d 04 1a  |rds from data...|
00000ab0  1a 20 4c 44 52 20 20 20  20 20 20 34 2c 20 5b 31  |. LDR      4, [1|
00000ac0  32 2c 20 23 31 36 5d 0d  04 24 1a 20 4d 4f 56 20  |2, #16]..$. MOV |
00000ad0  20 20 20 20 20 30 2c 20  30 2c 20 41 53 52 20 23  |     0, 0, ASR #|
00000ae0  31 0d 04 2e 1a 20 4d 4f  56 20 20 20 20 20 20 31  |1.... MOV      1|
00000af0  2c 20 31 2c 20 41 53 52  20 23 32 0d 04 38 34 20  |, 1, ASR #2..84 |
00000b00  42 4c 20 20 20 20 20 20  20 70 6c 6f 74 25 20 20  |BL       plot%  |
00000b10  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 70  |             ; p|
00000b20  6c 6f 74 20 68 65 61 64  20 61 74 20 78 2c 79 0d  |lot head at x,y.|
00000b30  04 42 19 20 41 44 44 20  20 20 20 20 20 31 32 2c  |.B. ADD      12,|
00000b40  20 31 32 2c 20 23 32 30  0d 04 4c 18 20 53 55 42  | 12, #20..L. SUB|
00000b50  53 20 20 20 20 20 31 33  2c 20 31 33 2c 20 23 31  |S     13, 13, #1|
00000b60  0d 04 56 34 20 42 4e 45  20 20 20 20 20 20 66 72  |..V4 BNE      fr|
00000b70  61 6d 65 70 6c 6f 74 6c  6f 6f 70 25 20 20 20 20  |ameplotloop%    |
00000b80  20 20 3b 74 68 65 6e 20  64 6f 20 6e 65 78 74 20  |  ;then do next |
00000b90  68 65 61 64 0d 04 60 16  20 4c 44 52 20 20 20 20  |head..`. LDR    |
00000ba0  20 20 31 31 2c 20 61 66  63 25 0d 04 6a 18 20 41  |  11, afc%..j. A|
00000bb0  44 44 20 20 20 20 20 20  31 31 2c 20 31 31 2c 20  |DD      11, 11, |
00000bc0  23 31 0d 04 74 35 20 53  54 52 20 20 20 20 20 20  |#1..t5 STR      |
00000bd0  31 31 2c 20 61 66 63 25  20 20 20 20 20 20 20 20  |11, afc%        |
00000be0  20 20 20 20 3b 75 70 64  61 74 65 20 66 72 61 6d  |    ;update fram|
00000bf0  65 20 63 6f 75 6e 74 0d  04 7e 15 20 4c 44 52 20  |e count..~. LDR |
00000c00  20 20 20 20 20 31 32 2c  20 61 62 25 0d 04 88 15  |     12, ab%....|
00000c10  20 4c 44 52 20 20 20 20  20 20 31 33 2c 20 61 6e  | LDR      13, an|
00000c20  25 0d 04 92 36 20 2e 66  72 61 6d 65 6d 6f 76 65  |%...6 .framemove|
00000c30  6c 6f 6f 70 25 20 20 20  20 20 20 20 20 20 20 20  |loop%           |
00000c40  20 20 20 3b 74 68 65 6e  20 6d 6f 76 65 20 65 61  |   ;then move ea|
00000c50  63 68 20 68 65 61 64 0d  04 9c 35 20 4c 44 4d 49  |ch head...5 LDMI|
00000c60  41 20 20 20 20 31 32 2c  20 7b 30 2c 31 2c 32 2c  |A    12, {0,1,2,|
00000c70  33 2c 34 7d 20 20 20 20  20 3b 20 72 65 61 64 20  |3,4}     ; read |
00000c80  78 2c 79 2c 78 69 2c 79  69 2c 72 74 0d 04 a6 2b  |x,y,xi,yi,rt...+|
00000c90  20 41 44 44 53 20 20 20  20 20 30 2c 20 30 2c 20  | ADDS     0, 0, |
00000ca0  32 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |2             ; |
00000cb0  61 6c 74 65 72 20 78 0d  04 b0 46 20 52 53 42 4d  |alter x...F RSBM|
00000cc0  49 20 20 20 20 32 2c 20  32 2c 20 23 30 20 20 20  |I    2, 2, #0   |
00000cd0  20 20 20 20 20 20 20 20  20 3b 20 69 66 20 6f 66  |         ; if of|
00000ce0  66 20 6c 65 66 74 20 73  69 64 65 2c 20 72 65 76  |f left side, rev|
00000cf0  65 72 73 65 20 76 65 6c  6f 63 69 74 79 0d 04 ba  |erse velocity...|
00000d00  2f 20 41 44 44 4d 49 20  20 20 20 30 2c 20 30 2c  |/ ADDMI    0, 0,|
00000d10  20 32 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  | 2             ;|
00000d20  20 26 20 6d 6f 76 65 20  62 61 63 6b 0d 04 c4 2b  | & move back...+|
00000d30  20 41 44 44 53 20 20 20  20 20 31 2c 20 31 2c 20  | ADDS     1, 1, |
00000d40  33 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |3             ; |
00000d50  61 6c 74 65 72 20 79 0d  04 ce 45 20 52 53 42 4d  |alter y...E RSBM|
00000d60  49 20 20 20 20 33 2c 20  33 2c 20 23 30 20 20 20  |I    3, 3, #0   |
00000d70  20 20 20 20 20 20 20 20  20 3b 20 69 66 20 6f 66  |         ; if of|
00000d80  66 20 74 6f 70 20 73 69  64 65 2c 20 72 65 76 65  |f top side, reve|
00000d90  72 73 65 20 76 65 6c 6f  63 69 74 79 0d 04 d8 2f  |rse velocity.../|
00000da0  20 41 44 44 4d 49 20 20  20 20 31 2c 20 31 2c 20  | ADDMI    1, 1, |
00000db0  33 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |3             ; |
00000dc0  26 20 6d 6f 76 65 20 62  61 63 6b 0d 04 e2 40 20  |& move back...@ |
00000dd0  53 55 42 53 20 20 20 20  20 31 34 2c 20 30 2c 20  |SUBS     14, 0, |
00000de0  23 31 30 32 34 20 20 20  20 20 20 20 20 3b 20 28  |#1024        ; (|
00000df0  74 68 65 73 65 20 32 20  69 6e 73 74 72 75 63 74  |these 2 instruct|
00000e00  73 20 61 72 65 20 65 71  75 69 76 0d 04 ec 35 20  |s are equiv...5 |
00000e10  53 55 42 47 54 53 20 20  20 31 34 2c 20 31 34 2c  |SUBGTS   14, 14,|
00000e20  20 23 31 34 32 20 20 20  20 20 20 20 20 3b 20 20  | #142        ;  |
00000e30  74 6f 20 43 4d 50 20 30  2c 20 23 31 31 36 36 29  |to CMP 0, #1166)|
00000e40  0d 04 f6 42 20 52 53 42  47 54 20 20 20 20 32 2c  |...B RSBGT    2,|
00000e50  20 32 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  | 2, #0          |
00000e60  20 20 3b 20 69 66 20 6f  66 66 20 72 69 67 68 74  |  ; if off right|
00000e70  2c 20 72 65 76 65 72 73  65 20 76 65 6c 6f 63 69  |, reverse veloci|
00000e80  74 79 0d 05 00 2f 20 41  44 44 47 54 20 20 20 20  |ty.../ ADDGT    |
00000e90  30 2c 20 30 2c 20 32 20  20 20 20 20 20 20 20 20  |0, 0, 2         |
00000ea0  20 20 20 20 3b 20 26 20  6d 6f 76 65 20 62 61 63  |    ; & move bac|
00000eb0  6b 0d 05 0a 15 20 43 4d  50 20 20 20 20 20 20 31  |k.... CMP      1|
00000ec0  2c 20 23 38 39 36 0d 05  14 43 20 52 53 42 47 54  |, #896...C RSBGT|
00000ed0  20 20 20 20 33 2c 20 33  2c 20 23 30 20 20 20 20  |    3, 3, #0    |
00000ee0  20 20 20 20 20 20 20 20  3b 20 69 66 20 6f 66 66  |        ; if off|
00000ef0  20 62 6f 74 74 6f 6d 2c  20 72 65 76 65 72 73 65  | bottom, reverse|
00000f00  20 76 65 6c 6f 63 69 74  79 0d 05 1e 2f 20 41 44  | velocity.../ AD|
00000f10  44 47 54 20 20 20 20 31  2c 20 31 2c 20 33 20 20  |DGT    1, 1, 3  |
00000f20  20 20 20 20 20 20 20 20  20 20 20 3b 20 26 20 6d  |           ; & m|
00000f30  6f 76 65 20 62 61 63 6b  0d 05 28 45 20 54 53 54  |ove back..(E TST|
00000f40  20 20 20 20 20 20 31 31  2c 20 23 33 20 20 20 20  |      11, #3    |
00000f50  20 20 20 20 20 20 20 20  20 20 3b 20 69 66 20 66  |          ; if f|
00000f60  72 61 6d 65 20 63 6f 75  6e 74 20 69 73 20 61 20  |rame count is a |
00000f70  6d 75 6c 74 69 70 6c 65  20 6f 66 20 34 0d 05 32  |multiple of 4..2|
00000f80  3d 20 41 44 44 45 51 20  20 20 20 33 2c 20 33 2c  |= ADDEQ    3, 3,|
00000f90  20 23 31 20 20 20 20 20  20 20 20 20 20 20 20 3b  | #1            ;|
00000fa0  20 61 63 63 65 6c 65 72  61 74 65 20 68 65 61 64  | accelerate head|
00000fb0  20 64 6f 77 6e 77 61 72  64 73 0d 05 3c 16 20 53  | downwards..<. S|
00000fc0  55 42 53 20 20 20 20 20  34 2c 20 34 2c 20 23 31  |UBS     4, 4, #1|
00000fd0  0d 05 46 14 20 4d 4f 56  4d 49 20 20 20 20 34 2c  |..F. MOVMI    4,|
00000fe0  20 23 32 39 0d 05 50 38  20 53 54 4d 49 41 20 20  | #29..P8 STMIA  |
00000ff0  20 20 31 32 21 2c 20 7b  30 2c 31 2c 32 2c 33 2c  |  12!, {0,1,2,3,|
00001000  34 7d 20 20 20 20 3b 20  72 65 73 74 6f 72 65 20  |4}    ; restore |
00001010  78 2c 79 2c 78 69 2c 79  69 2c 72 74 0d 05 5a 18  |x,y,xi,yi,rt..Z.|
00001020  20 53 55 42 53 20 20 20  20 20 31 33 2c 20 31 33  | SUBS     13, 13|
00001030  2c 20 23 31 0d 05 64 34  20 42 4e 45 20 20 20 20  |, #1..d4 BNE    |
00001040  20 20 66 72 61 6d 65 6d  6f 76 65 6c 6f 6f 70 25  |  framemoveloop%|
00001050  20 20 20 20 20 20 3b 74  68 65 6e 20 64 6f 20 6e  |      ;then do n|
00001060  65 78 74 20 68 65 61 64  0d 05 6e 06 20 3a 0d 05  |ext head..n. :..|
00001070  78 42 20 53 57 49 20 20  20 20 20 20 22 4f 53 5f  |xB SWI      "OS_|
00001080  52 65 61 64 4d 6f 6e 6f  74 6f 6e 69 63 54 69 6d  |ReadMonotonicTim|
00001090  65 22 20 20 20 20 20 20  20 20 3b 63 61 6c 63 75  |e"        ;calcu|
000010a0  6c 61 74 65 20 66 72 61  6d 65 20 73 70 65 65 64  |late frame speed|
000010b0  0d 05 82 17 20 4c 44 52  20 20 20 20 20 20 31 2c  |.... LDR      1,|
000010c0  20 61 74 69 6d 65 25 0d  05 8c 15 20 53 55 42 20  | atime%.... SUB |
000010d0  20 20 20 20 20 30 2c 20  30 2c 20 31 0d 05 96 20  |     0, 0, 1... |
000010e0  20 43 4d 50 20 20 20 20  20 20 30 2c 20 23 31 30  | CMP      0, #10|
000010f0  30 2f 74 61 72 67 65 74  66 70 73 25 0d 05 a0 44  |0/targetfps%...D|
00001100  20 53 57 49 47 54 20 20  20 20 32 35 36 2b 37 20  | SWIGT    256+7 |
00001110  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 62  |              ;b|
00001120  65 65 70 20 69 66 20 69  74 20 66 61 6c 6c 73 20  |eep if it falls |
00001130  62 65 6c 6f 77 20 74 61  72 67 65 74 20 66 70 73  |below target fps|
00001140  0d 05 aa 06 20 3a 0d 05  b4 15 20 4d 4f 56 20 20  |.... :.... MOV  |
00001150  20 20 20 20 30 2c 20 23  31 32 39 0d 05 be 13 20  |    0, #129.... |
00001160  4d 4f 56 20 20 20 20 20  20 31 2c 20 23 30 0d 05  |MOV      1, #0..|
00001170  c8 13 20 4d 4f 56 20 20  20 20 20 20 32 2c 20 23  |.. MOV      2, #|
00001180  30 0d 05 d2 17 20 53 57  49 20 20 20 20 20 20 22  |0.... SWI      "|
00001190  4f 53 5f 42 79 74 65 22  0d 05 dc 15 20 43 4d 50  |OS_Byte".... CMP|
000011a0  20 20 20 20 20 20 32 2c  20 23 26 46 46 0d 05 e6  |      2, #&FF...|
000011b0  43 20 42 45 51 20 20 20  20 20 20 6e 65 78 74 66  |C BEQ      nextf|
000011c0  72 61 6d 65 25 20 20 20  20 20 20 20 20 20 20 3b  |rame%          ;|
000011d0  69 66 20 6e 6f 20 6b 65  79 20 70 72 65 73 73 65  |if no key presse|
000011e0  64 2c 20 64 6f 20 6e 65  78 74 20 66 72 61 6d 65  |d, do next frame|
000011f0  0d 05 f0 2d 20 4c 44 52  20 20 20 20 20 20 31 33  |...- LDR      13|
00001200  2c 20 61 73 70 66 72 61  6d 65 25 20 20 20 20 20  |, aspframe%     |
00001210  20 20 3b 72 65 73 74 6f  72 65 20 73 70 0d 05 fa  |  ;restore sp...|
00001220  32 20 4c 44 4d 46 44 20  20 20 20 31 33 21 2c 20  |2 LDMFD    13!, |
00001230  7b 50 43 7d 20 20 20 20  20 20 20 20 20 20 20 3b  |{PC}           ;|
00001240  72 65 74 75 72 6e 20 74  6f 20 42 41 53 49 43 0d  |return to BASIC.|
00001250  06 04 06 20 3a 0d 06 0e  19 20 2e 61 73 63 72 73  |... :.... .ascrs|
00001260  74 25 20 45 51 55 44 20  73 63 72 73 74 25 0d 06  |t% EQUD scrst%..|
00001270  18 18 20 2e 61 68 65 61  64 25 20 20 45 51 55 44  |.. .ahead%  EQUD|
00001280  20 68 65 61 64 25 0d 06  22 14 20 2e 61 62 61 6e  | head%..". .aban|
00001290  6b 25 20 20 45 51 55 44  20 31 0d 06 2c 2c 20 2e  |k%  EQUD 1..,, .|
000012a0  61 70 6c 6f 74 72 65 67  73 25 20 20 20 20 20 20  |aplotregs%      |
000012b0  20 20 45 51 55 44 20 30  3a 45 51 55 44 20 30 3a  |  EQUD 0:EQUD 0:|
000012c0  45 51 55 44 20 30 0d 06  36 33 20 2e 70 6c 6f 74  |EQUD 0..63 .plot|
000012d0  25 20 20 20 3b 70 6c 6f  74 20 6f 75 72 20 68 65  |%   ;plot our he|
000012e0  61 64 20 73 70 72 69 74  65 20 61 74 20 63 6f 6f  |ad sprite at coo|
000012f0  72 64 73 20 72 30 2c 72  31 0d 06 40 3e 20 20 20  |rds r0,r1..@>   |
00001300  20 20 20 20 20 20 20 3b  77 68 65 72 65 20 30 2c  |       ;where 0,|
00001310  30 20 69 73 20 74 6f 70  20 6c 65 66 74 20 26 20  |0 is top left & |
00001320  36 33 39 2c 32 35 35 20  69 73 20 62 6f 74 74 6f  |639,255 is botto|
00001330  6d 20 72 69 67 68 74 0d  06 4a 38 20 20 20 20 20  |m right..J8     |
00001340  20 20 20 20 20 3b 4e 42  20 73 70 72 69 74 65 20  |     ;NB sprite |
00001350  4d 55 53 54 20 6c 69 65  20 65 6e 74 69 72 65 6c  |MUST lie entirel|
00001360  79 20 77 69 74 68 69 6e  20 73 63 72 65 65 6e 0d  |y within screen.|
00001370  06 54 1c 20 41 44 52 20  20 20 20 20 20 31 31 2c  |.T. ADR      11,|
00001380  20 61 70 6c 6f 74 72 65  67 73 25 0d 06 5e 1c 20  | aplotregs%..^. |
00001390  53 54 4d 49 41 20 20 20  20 31 31 2c 20 7b 31 32  |STMIA    11, {12|
000013a0  2c 31 33 2c 31 34 7d 0d  06 68 40 20 80 20 20 20  |,13,14}..h@ .   |
000013b0  20 20 20 33 2c 20 30 2c  20 23 37 20 20 20 20 20  |   3, 0, #7     |
000013c0  20 20 20 20 20 20 20 3b  63 61 6c 63 75 6c 61 74  |       ;calculat|
000013d0  65 20 77 68 69 63 68 20  6f 66 20 74 68 65 20 38  |e which of the 8|
000013e0  20 73 70 72 69 74 65 0d  06 72 3a 20 20 20 20 20  | sprite..r:     |
000013f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001400  20 20 20 20 20 20 20 20  20 3b 61 6c 69 67 6e 6d  |         ;alignm|
00001410  65 6e 74 73 20 77 65 20  6e 65 65 64 20 76 69 61  |ents we need via|
00001420  3a 0d 06 7c 38 20 20 20  20 20 20 20 20 20 20 20  |:..|8           |
00001430  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001440  20 20 20 3b 28 78 41 4e  44 37 29 2a 33 32 2a 36  |   ;(xAND7)*32*6|
00001450  34 20 2b 20 64 61 74 61  25 0d 06 86 3c 20 42 49  |4 + data%...< BI|
00001460  43 20 20 20 20 20 20 30  2c 20 30 2c 20 23 37 20  |C      0, 0, #7 |
00001470  20 20 20 20 20 20 20 20  20 20 20 3b 72 6f 75 6e  |           ;roun|
00001480  64 20 78 20 64 6f 77 6e  20 74 6f 20 6d 75 6c 74  |d x down to mult|
00001490  20 6f 66 20 38 0d 06 90  1d 20 41 44 44 20 20 20  | of 8.... ADD   |
000014a0  20 20 20 31 2c 20 31 2c  20 31 2c 20 41 53 4c 20  |   1, 1, 1, ASL |
000014b0  23 32 0d 06 9a 18 20 4c  44 52 20 20 20 20 20 20  |#2.... LDR      |
000014c0  32 2c 20 61 73 63 72 73  74 25 0d 06 a4 1d 20 41  |2, ascrst%.... A|
000014d0  44 44 20 20 20 20 20 20  32 2c 20 32 2c 20 31 2c  |DD      2, 2, 1,|
000014e0  20 41 53 4c 20 23 36 0d  06 ae 3f 20 41 44 44 20  | ASL #6...? ADD |
000014f0  20 20 20 20 20 30 2c 20  32 2c 20 30 2c 20 41 53  |     0, 2, 0, AS|
00001500  52 20 23 31 20 20 20 20  20 3b 63 61 6c 63 20 28  |R #1     ;calc (|
00001510  73 63 72 65 65 6e 20 70  74 72 20 2b 20 33 32 30  |screen ptr + 320|
00001520  79 20 2b 20 78 29 0d 06  b8 17 20 4c 44 52 20 20  |y + x).... LDR  |
00001530  20 20 20 20 31 2c 20 61  68 65 61 64 25 0d 06 c2  |    1, ahead%...|
00001540  1f 20 4c 44 52 20 20 20  20 20 20 31 2c 20 5b 31  |. LDR      1, [1|
00001550  2c 20 34 2c 20 41 53 4c  20 23 32 5d 0d 06 cc 43  |, 4, ASL #2]...C|
00001560  20 41 44 44 20 20 20 20  20 20 31 2c 20 31 2c 20  | ADD      1, 1, |
00001570  33 2c 20 41 53 4c 20 23  31 31 20 20 20 20 3b 66  |3, ASL #11    ;f|
00001580  69 6e 61 6c 6c 79 20 63  61 6c 63 20 28 78 41 4e  |inally calc (xAN|
00001590  44 37 29 2a 33 32 2a 36  34 2b 64 61 74 61 25 0d  |D7)*32*64+data%.|
000015a0  06 d6 13 20 4d 4f 56 20  20 20 20 20 20 32 2c 20  |... MOV      2, |
000015b0  23 38 0d 06 e0 32 20 2e  6c 6f 6f 70 31 25 20 20  |#8...2 .loop1%  |
000015c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000015d0  20 20 20 20 3b 6e 6f 77  20 70 6c 6f 74 20 73 70  |    ;now plot sp|
000015e0  72 69 74 65 0d 06 ea 3a  20 a4 66 72 61 67 31 28  |rite...: .frag1(|
000015f0  70 61 73 73 25 29 20 20  20 20 20 20 20 20 20 20  |pass%)          |
00001600  20 20 20 20 20 3b 70 6c  6f 74 20 31 73 74 20 68  |     ;plot 1st h|
00001610  61 6c 66 20 6f 66 20 31  73 74 20 72 6f 77 0d 06  |alf of 1st row..|
00001620  f4 3a 20 a4 66 72 61 67  31 28 70 61 73 73 25 29  |.: .frag1(pass%)|
00001630  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001640  20 20 20 20 20 32 6e 64  20 68 61 6c 66 20 6f 66  |     2nd half of|
00001650  20 31 73 74 20 72 6f 77  0d 06 fe 44 20 41 44 44  | 1st row...D ADD|
00001660  20 20 20 20 20 20 30 2c  20 30 2c 20 23 33 32 30  |      0, 0, #320|
00001670  2d 33 32 20 20 20 20 20  20 20 3b 6d 6f 76 65 20  |-32       ;move |
00001680  73 63 72 65 65 6e 20 70  74 72 20 74 6f 20 73 74  |screen ptr to st|
00001690  61 72 74 20 6e 65 78 74  20 72 6f 77 0d 07 08 3a  |art next row...:|
000016a0  20 a4 66 72 61 67 31 28  70 61 73 73 25 29 20 20  | .frag1(pass%)  |
000016b0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 70 6c  |             ;pl|
000016c0  6f 74 20 31 73 74 20 68  61 6c 66 20 6f 66 20 32  |ot 1st half of 2|
000016d0  6e 64 20 72 6f 77 0d 07  12 2c 20 a4 66 72 61 67  |nd row..., .frag|
000016e0  31 28 70 61 73 73 25 29  20 20 20 20 20 20 20 20  |1(pass%)        |
000016f0  20 20 20 20 20 20 20 3b  20 65 74 63 20 2e 20 2e  |       ; etc . .|
00001700  20 2e 0d 07 1c 1b 20 41  44 44 20 20 20 20 20 20  | ..... ADD      |
00001710  30 2c 20 30 2c 20 23 33  32 30 2d 33 32 0d 07 26  |0, 0, #320-32..&|
00001720  12 20 a4 66 72 61 67 31  28 70 61 73 73 25 29 0d  |. .frag1(pass%).|
00001730  07 30 12 20 a4 66 72 61  67 31 28 70 61 73 73 25  |.0. .frag1(pass%|
00001740  29 0d 07 3a 1b 20 41 44  44 20 20 20 20 20 20 30  |)..:. ADD      0|
00001750  2c 20 30 2c 20 23 33 32  30 2d 33 32 0d 07 44 12  |, 0, #320-32..D.|
00001760  20 a4 66 72 61 67 31 28  70 61 73 73 25 29 0d 07  | .frag1(pass%)..|
00001770  4e 3a 20 a4 66 72 61 67  31 28 70 61 73 73 25 29  |N: .frag1(pass%)|
00001780  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001790  70 6c 6f 74 20 32 6e 64  20 68 61 6c 66 20 6f 66  |plot 2nd half of|
000017a0  20 34 74 68 20 72 6f 77  0d 07 58 1b 20 41 44 44  | 4th row..X. ADD|
000017b0  20 20 20 20 20 20 30 2c  20 30 2c 20 23 33 32 30  |      0, 0, #320|
000017c0  2d 33 32 0d 07 62 16 20  53 55 42 53 20 20 20 20  |-32..b. SUBS    |
000017d0  20 32 2c 20 32 2c 20 23  31 0d 07 6c 45 20 42 4e  | 2, 2, #1..lE BN|
000017e0  45 20 20 20 20 20 20 6c  6f 6f 70 31 25 20 20 20  |E      loop1%   |
000017f0  20 20 20 20 20 20 20 3b  72 65 70 65 61 74 20 61  |       ;repeat a|
00001800  62 6f 76 65 20 38 20 74  69 6d 65 73 20 74 6f 20  |bove 8 times to |
00001810  64 6f 20 61 6c 6c 20 33  32 20 72 6f 77 73 0d 07  |do all 32 rows..|
00001820  76 44 20 41 44 52 20 20  20 20 20 20 31 31 2c 20  |vD ADR      11, |
00001830  61 70 6c 6f 74 72 65 67  73 25 20 20 20 20 20 20  |aplotregs%      |
00001840  3b 70 6c 6f 74 20 63 6f  6d 70 6c 65 74 65 64 20  |;plot completed |
00001850  2d 20 72 65 74 75 72 6e  20 74 6f 20 63 61 6c 6c  |- return to call|
00001860  65 72 0d 07 80 38 20 4c  44 4d 49 41 20 20 20 20  |er...8 LDMIA    |
00001870  31 31 2c 20 7b 31 32 2c  31 33 2c 50 43 7d 20 20  |11, {12,13,PC}  |
00001880  20 20 20 20 3b 70 72 65  73 65 72 76 69 6e 67 20  |    ;preserving |
00001890  72 31 32 20 26 20 72 31  33 2e 0d 07 8a 06 20 3a  |r12 & r13..... :|
000018a0  0d 07 94 14 20 2e 61 6c  72 63 6c 73 25 20 45 51  |.... .alrcls% EQ|
000018b0  55 44 20 30 0d 07 9e 14  20 2e 61 73 70 63 6c 73  |UD 0.... .aspcls|
000018c0  25 20 45 51 55 44 20 30  0d 07 a8 41 20 2e 63 6c  |% EQUD 0...A .cl|
000018d0  73 25 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |s%              |
000018e0  20 20 20 20 20 20 20 20  20 20 3b 73 69 6d 70 6c  |          ;simpl|
000018f0  65 20 72 6f 75 74 69 6e  65 20 74 6f 20 63 6c 65  |e routine to cle|
00001900  61 72 20 73 63 72 65 65  6e 0d 07 b2 3b 20 53 54  |ar screen...; ST|
00001910  52 20 20 20 20 20 20 31  34 2c 20 61 6c 72 63 6c  |R      14, alrcl|
00001920  73 25 20 20 20 20 20 20  20 20 20 3b 61 73 20 72  |s%         ;as r|
00001930  61 70 69 64 6c 79 20 61  73 20 70 6f 73 73 69 62  |apidly as possib|
00001940  6c 65 20 2d 0d 07 bc 3d  20 53 54 52 20 20 20 20  |le -...= STR    |
00001950  20 20 31 33 2c 20 61 73  70 63 6c 73 25 20 20 20  |  13, aspcls%   |
00001960  20 20 20 20 20 20 3b 6e  6f 74 65 20 74 68 65 20  |      ;note the |
00001970  68 65 61 76 79 20 75 73  65 20 6f 66 20 53 54 4d  |heavy use of STM|
00001980  2e 0d 07 c6 18 20 4c 44  52 20 20 20 20 20 20 30  |..... LDR      0|
00001990  2c 20 61 73 63 72 73 74  25 0d 07 d0 15 20 4d 4f  |, ascrst%.... MO|
000019a0  56 20 20 20 20 20 20 31  2c 20 23 31 30 35 0d 07  |V      1, #105..|
000019b0  da 15 20 4d 4f 56 20 20  20 20 20 20 32 2c 20 23  |.. MOV      2, #|
000019c0  26 31 31 0d 07 e4 1c 20  84 52 20 20 20 20 20 20  |&11.... .R      |
000019d0  32 2c 20 32 2c 20 32 2c  20 4c 53 4c 20 23 38 0d  |2, 2, 2, LSL #8.|
000019e0  07 ee 1d 20 84 52 20 20  20 20 20 20 32 2c 20 32  |... .R      2, 2|
000019f0  2c 20 32 2c 20 4c 53 4c  20 23 31 36 0d 07 f8 12  |, 2, LSL #16....|
00001a00  20 4d 4f 56 20 20 20 20  20 20 33 2c 20 32 0d 08  | MOV      3, 2..|
00001a10  02 12 20 4d 4f 56 20 20  20 20 20 20 34 2c 20 32  |.. MOV      4, 2|
00001a20  0d 08 0c 12 20 4d 4f 56  20 20 20 20 20 20 35 2c  |.... MOV      5,|
00001a30  20 32 0d 08 16 12 20 4d  4f 56 20 20 20 20 20 20  | 2.... MOV      |
00001a40  36 2c 20 32 0d 08 20 12  20 4d 4f 56 20 20 20 20  |6, 2.. . MOV    |
00001a50  20 20 37 2c 20 32 0d 08  2a 12 20 4d 4f 56 20 20  |  7, 2..*. MOV  |
00001a60  20 20 20 20 38 2c 20 32  0d 08 34 12 20 4d 4f 56  |    8, 2..4. MOV|
00001a70  20 20 20 20 20 20 39 2c  20 32 0d 08 3e 13 20 4d  |      9, 2..>. M|
00001a80  4f 56 20 20 20 20 20 20  31 30 2c 20 32 0d 08 48  |OV      10, 2..H|
00001a90  13 20 4d 4f 56 20 20 20  20 20 20 31 31 2c 20 32  |. MOV      11, 2|
00001aa0  0d 08 52 13 20 4d 4f 56  20 20 20 20 20 20 31 32  |..R. MOV      12|
00001ab0  2c 20 32 0d 08 5c 13 20  4d 4f 56 20 20 20 20 20  |, 2..\. MOV     |
00001ac0  20 31 33 2c 20 32 0d 08  66 13 20 4d 4f 56 20 20  | 13, 2..f. MOV  |
00001ad0  20 20 20 20 31 34 2c 20  32 0d 08 70 0e 20 2e 63  |    14, 2..p. .c|
00001ae0  6c 73 6c 6f 6f 70 25 0d  08 7a 18 20 53 54 4d 49  |lsloop%..z. STMI|
00001af0  41 20 20 20 20 30 21 2c  20 7b 32 2d 31 34 7d 0d  |A    0!, {2-14}.|
00001b00  08 84 18 20 53 54 4d 49  41 20 20 20 20 30 21 2c  |... STMIA    0!,|
00001b10  20 7b 32 2d 31 34 7d 0d  08 8e 18 20 53 54 4d 49  | {2-14}.... STMI|
00001b20  41 20 20 20 20 30 21 2c  20 7b 32 2d 31 34 7d 0d  |A    0!, {2-14}.|
00001b30  08 98 18 20 53 54 4d 49  41 20 20 20 20 30 21 2c  |... STMIA    0!,|
00001b40  20 7b 32 2d 31 34 7d 0d  08 a2 18 20 53 54 4d 49  | {2-14}.... STMI|
00001b50  41 20 20 20 20 30 21 2c  20 7b 32 2d 31 34 7d 0d  |A    0!, {2-14}.|
00001b60  08 ac 18 20 53 54 4d 49  41 20 20 20 20 30 21 2c  |... STMIA    0!,|
00001b70  20 7b 32 2d 31 34 7d 0d  08 b6 18 20 53 54 4d 49  | {2-14}.... STMI|
00001b80  41 20 20 20 20 30 21 2c  20 7b 32 2d 31 34 7d 0d  |A    0!, {2-14}.|
00001b90  08 c0 18 20 53 54 4d 49  41 20 20 20 20 30 21 2c  |... STMIA    0!,|
00001ba0  20 7b 32 2d 31 34 7d 0d  08 ca 18 20 53 54 4d 49  | {2-14}.... STMI|
00001bb0  41 20 20 20 20 30 21 2c  20 7b 32 2d 31 34 7d 0d  |A    0!, {2-14}.|
00001bc0  08 d4 18 20 53 54 4d 49  41 20 20 20 20 30 21 2c  |... STMIA    0!,|
00001bd0  20 7b 32 2d 31 34 7d 0d  08 de 18 20 53 54 4d 49  | {2-14}.... STMI|
00001be0  41 20 20 20 20 30 21 2c  20 7b 32 2d 31 34 7d 0d  |A    0!, {2-14}.|
00001bf0  08 e8 18 20 53 54 4d 49  41 20 20 20 20 30 21 2c  |... STMIA    0!,|
00001c00  20 7b 32 2d 31 34 7d 0d  08 f2 18 20 53 54 4d 49  | {2-14}.... STMI|
00001c10  41 20 20 20 20 30 21 2c  20 7b 32 2d 31 34 7d 0d  |A    0!, {2-14}.|
00001c20  08 fc 18 20 53 54 4d 49  41 20 20 20 20 30 21 2c  |... STMIA    0!,|
00001c30  20 7b 32 2d 31 34 7d 0d  09 06 18 20 53 54 4d 49  | {2-14}.... STMI|
00001c40  41 20 20 20 20 30 21 2c  20 7b 32 2d 31 34 7d 0d  |A    0!, {2-14}.|
00001c50  09 10 16 20 53 55 42 53  20 20 20 20 20 31 2c 20  |... SUBS     1, |
00001c60  31 2c 20 23 31 0d 09 1a  16 20 42 4e 45 20 20 20  |1, #1.... BNE   |
00001c70  20 20 20 63 6c 73 6c 6f  6f 70 25 0d 09 24 17 20  |   clsloop%..$. |
00001c80  53 54 4d 49 41 20 20 20  20 30 21 2c 20 7b 32 2d  |STMIA    0!, {2-|
00001c90  36 7d 0d 09 2e 19 20 4c  44 52 20 20 20 20 20 20  |6}.... LDR      |
00001ca0  31 33 2c 20 61 73 70 63  6c 73 25 0d 09 38 19 20  |13, aspcls%..8. |
00001cb0  4c 44 52 20 20 20 20 20  20 50 43 2c 20 61 6c 72  |LDR      PC, alr|
00001cc0  63 6c 73 25 0d 09 42 06  20 5d 0d 09 4c 05 ed 0d  |cls%..B. ]..L...|
00001cd0  09 56 05 e1 0d 09 60 05  3a 0d 09 6a 40 dd 20 a4  |.V....`.:..j@. .|
00001ce0  66 72 61 67 31 28 70 61  73 73 25 29 20 20 20 20  |frag1(pass%)    |
00001cf0  20 20 20 3a f4 20 6d 61  63 72 6f 20 74 6f 20 70  |   :. macro to p|
00001d00  6c 6f 74 20 31 2f 32 20  61 20 72 6f 77 20 28 33  |lot 1/2 a row (3|
00001d10  32 20 70 69 78 65 6c 73  29 0d 09 74 2d 5b 4f 50  |2 pixels)..t-[OP|
00001d20  54 20 70 61 73 73 25 20  20 20 20 20 20 20 20 20  |T pass%         |
00001d30  20 20 20 20 20 20 3a f4  20 6f 66 20 6f 75 72 20  |      :. of our |
00001d40  73 70 72 69 74 65 0d 09  7e 45 4c 44 4d 49 41 20  |sprite..~ELDMIA |
00001d50  20 20 20 30 2c 20 7b 33  2d 36 7d 20 20 20 20 20  |   0, {3-6}     |
00001d60  20 20 20 20 20 20 20 20  3b 72 65 61 64 20 34 20  |        ;read 4 |
00001d70  77 6f 72 64 73 20 6f 66  20 73 63 72 65 65 6e 20  |words of screen |
00001d80  28 33 32 20 70 69 78 65  6c 73 29 0d 09 88 43 4c  |(32 pixels)...CL|
00001d90  44 4d 49 41 20 20 20 20  31 21 2c 20 7b 37 2d 31  |DMIA    1!, {7-1|
00001da0  34 7d 20 20 20 20 20 20  20 20 20 20 20 3b 72 65  |4}           ;re|
00001db0  61 64 20 33 32 20 73 70  72 69 74 65 20 70 69 78  |ad 32 sprite pix|
00001dc0  65 6c 73 20 26 20 33 32  20 6d 61 73 6b 73 0d 09  |els & 32 masks..|
00001dd0  92 3e 80 20 20 20 20 20  20 33 2c 20 33 2c 20 38  |.>.      3, 3, 8|
00001de0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 61  |              ;a|
00001df0  70 70 6c 79 20 6d 61 73  6b 20 74 6f 20 73 63 72  |pply mask to scr|
00001e00  65 65 6e 2c 20 7a 65 72  6f 69 6e 67 0d 09 9c 3d  |een, zeroing...=|
00001e10  80 20 20 20 20 20 20 34  2c 20 34 2c 20 31 30 20  |.      4, 4, 10 |
00001e20  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 74 68  |            ; th|
00001e30  6f 73 65 20 62 69 74 73  20 77 68 65 72 65 20 77  |ose bits where w|
00001e40  69 6c 6c 20 77 72 69 74  65 0d 09 a6 3a 80 20 20  |ill write...:.  |
00001e50  20 20 20 20 35 2c 20 35  2c 20 31 32 20 20 20 20  |    5, 5, 12    |
00001e60  20 20 20 20 20 20 20 20  20 3b 20 73 70 72 69 74  |         ; sprit|
00001e70  65 20 69 6d 61 67 65 20  69 6e 20 61 20 6d 6f 6d  |e image in a mom|
00001e80  65 6e 74 0d 09 b0 13 80  20 20 20 20 20 20 36 2c  |ent.....      6,|
00001e90  20 36 2c 20 31 34 0d 09  ba 3b 84 52 20 20 20 20  | 6, 14...;.R    |
00001ea0  20 20 33 2c 20 33 2c 20  37 20 20 20 20 20 20 20  |  3, 3, 7       |
00001eb0  20 20 20 20 20 20 20 3b  77 72 69 74 65 20 69 6e  |       ;write in|
00001ec0  20 74 68 65 20 73 70 72  69 74 65 20 69 6d 61 67  | the sprite imag|
00001ed0  65 0d 09 c4 13 84 52 20  20 20 20 20 20 34 2c 20  |e.....R      4, |
00001ee0  34 2c 20 39 0d 09 ce 14  84 52 20 20 20 20 20 20  |4, 9.....R      |
00001ef0  35 2c 20 35 2c 20 31 31  0d 09 d8 14 84 52 20 20  |5, 5, 11.....R  |
00001f00  20 20 20 20 36 2c 20 36  2c 20 31 33 0d 09 e2 42  |    6, 6, 13...B|
00001f10  53 54 4d 49 41 20 20 20  20 30 21 2c 20 7b 33 2d  |STMIA    0!, {3-|
00001f20  36 7d 20 20 20 20 20 20  20 20 20 20 20 20 3b 72  |6}            ;r|
00001f30  65 73 74 6f 72 65 20 74  68 65 20 64 61 74 61 20  |estore the data |
00001f40  62 61 63 6b 20 74 6f 20  73 63 72 65 65 6e 0d 09  |back to screen..|
00001f50  ec 05 5d 0d 09 f6 0a 3d  70 61 73 73 25 0d ff     |..]....=pass%..|
00001f5f