Home » Archimedes archive » Archimedes World » AW-1996-03-Disc 2.adf » !AcornAns_AcornAns » September/Bounce/Bouncer

September/Bounce/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-1996-03-Disc 2.adf » !AcornAns_AcornAns
Filename: September/Bounce/Bouncer
Read OK:
File size: 1FDE 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 Compare performance with that of 'SprOp' which achieves same
   60REM animation purely in BASIC using the general purpose
   70REM OS_SpriteOp, & is hence many times slower (roughly 5x).
   80REM
   90REM To check this out for yourself, see how many heads each
  100REM program can simultaneously bounce, whilst still maintaining
  110REM a reasonable frame rate of no less than eg 25fps (or 50fps
  120REM for maximum smoothness & speed).
  130REM
  140:
  150REM NB program will produce a beep if animation speed falls
  160REM below the target fps rate.
  170targetfps% = 50
  180IF 100MODtargetfps%<>0 ERROR 1, "Require targetfps divides into 100"
  190:
  200SYS &20280, 0, -1 TO ;flags%
  210IF flags% AND 1 THEN arm3%=FALSE ELSE arm3%=TRUE
  220:
  230REM n% is the number of heads to be bounced
  240n%=38
  250IF arm3%=FALSE n%=n%/2.7
  260recommend$=STR$n%
  270:
  280ON ERROR SYS 6,112,1:SYS 6,113,1:PRINT REPORT$;" at line ";ERL:END
  290D% = RND(-TIME)
  300MODE 12+128:MODE 12:OFF
  310*Run Palette
  320COLOUR 128+1:CLS
  330DIM data% 17920
  340SYS "OS_File", 255, "HeadData", data%, 0
  350:
  360maxn%=400
  370DIM b% maxn%*16
  380REM NB b% stores array (of size n%) of structure:
  390REM {x coord, y coord, x increment, y increment}
  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%*16-1 STEP 16
  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 NEXT
  590 :
  600 CALL bounce%
  610 :
  620UNTIL FALSE
  630:
  640END
  650:
  660DEF PROCass
  670DIM code% 10240
  680!code%=148:code%!4=-1
  690SYS "OS_ReadVduVariables", code%, code%
  700scrst%=!code%
  710FOR pass% = 0 TO 2 STEP 2
  720 P%=code%
  730 [OPT pass%
  740 .aspframe%         EQUD 0
  750 .ascrstsum%        EQUD scrst%*2+81920
  760 .an%     EQUD 0
  770 .ab%     EQUD b%
  780 .atime%  EQUD 0              ;time storage for frame speed calc
  790 .afc%    EQUD 0              ;frame counter
  800 .bounce%
  810 STMFD    13!, {14}
  820 STR      13, aspframe%       ;store sp to free up r13
  830 .nextframe%
  840 :
  850 SWI      "OS_ReadMonotonicTime"        ;track frame speed
  860 STR      0, atime%
  870 :
  880 MOV      0, #19
  890 SWI      "OS_Byte"                     ;wait for vsync
  900 MOV      0, #113
  910 LDR      1, abank%
  920 RSB      3, 1, #3
  930 STR      3, abank%
  940 SWI      "OS_Byte"           ;swap displayed screen bank
  950 LDR      0, ascrstsum%
  960 LDR      1, ascrst%
  970 SUB      1, 0, 1
  980 STR      1, ascrst%          ;swap ptr to other bank
  990 BL       cls%                ;cls that bank to grey (colour 1)
 1000 LDR      12, ab%
 1010 LDR      13, an%
 1020 .frameplotloop%              ;now plot each head:
 1030 LDMIA    12, {0,1}           ; read x,y coords from data
 1040 MOV      0, 0, ASR #1
 1050 MOV      1, 1, ASR #2
 1060 BL       plot%               ; plot head at x,y
 1070 ADD      12, 12, #16
 1080 SUBS     13, 13, #1
 1090 BNE      frameplotloop%      ;then do next head
 1100 LDR      11, afc%
 1110 ADD      11, 11, #1
 1120 STR      11, afc%            ;update frame count
 1130 LDR      12, ab%
 1140 LDR      13, an%
 1150 .framemoveloop%              ;then move each head
 1160 LDMIA    12, {0,1,2,3}       ; read x,y,xi,yi
 1170 ADDS     0, 0, 2             ; alter x
 1180 RSBMI    2, 2, #0            ; if off left side, reverse velocity
 1190 ADDMI    0, 0, 2             ; & move back
 1200 ADDS     1, 1, 3             ; alter y
 1210 RSBMI    3, 3, #0            ; if off top side, reverse velocity
 1220 ADDMI    1, 1, 3             ; & move back
 1230 SUBS     14, 0, #1024        ; (these 2 instructs are equiv
 1240 SUBGTS   14, 14, #142        ;  to CMP 0, #1166)
 1250 RSBGT    2, 2, #0            ; if off right, reverse velocity
 1260 ADDGT    0, 0, 2             ; & move back
 1270 CMP      1, #884
 1280 RSBGT    3, 3, #0            ; if off bottom, reverse velocity
 1290 ADDGT    1, 1, 3             ; & move back
 1300 TST      11, #3              ; if frame count is a multiple of 4
 1310 ADDEQ    3, 3, #1            ; accelerate head downwards
 1320 STMIA    12!, {0,1,2,3}      ; restore x,y,xi,yi
 1330 SUBS     13, 13, #1
 1340 BNE      framemoveloop%      ;then do next head
 1350 :
 1360 SWI      "OS_ReadMonotonicTime"        ;calculate frame speed
 1370 LDR      1, atime%
 1380 SUB      0, 0, 1
 1390 CMP      0, #100/targetfps%
 1400 SWIGT    256+7               ;beep if it falls below target fps
 1410 :
 1420 MOV      0, #129
 1430 MOV      1, #0
 1440 MOV      2, #0
 1450 SWI      "OS_Byte"
 1460 CMP      2, #&FF
 1470 BEQ      nextframe%          ;if no key pressed, do next frame
 1480 LDR      13, aspframe%       ;restore sp
 1490 LDMFD    13!, {PC}           ;return to BASIC
 1500 :
 1510 .ascrst% EQUD scrst%
 1520 .adata%  EQUD data%
 1530 .abank%  EQUD 1
 1540 .aplotregs%        EQUD 0:EQUD 0:EQUD 0
 1550 .plot%   ;plot our head sprite at coords r0,r1
 1560          ;where 0,0 is top left & 639,255 is bottom right
 1570          ;NB sprite MUST lie entirely within screen
 1580 ADR      11, aplotregs%
 1590 STMIA    11, {12,13,14}
 1600 AND      2, 0, #7            ;calculate which of the 8 sprite
 1610 RSB      3, 2, 2, ASL #2     ;alignments we need via:
 1620 ADD      3, 3, 2, ASL #5     ;(xAND7)*35*64 + data%
 1630 BIC      0, 0, #7            ;round x down to mult of 8
 1640 ADD      1, 1, 1, ASL #2
 1650 LDR      2, ascrst%
 1660 ADD      2, 2, 1, ASL #6
 1670 ADD      0, 2, 0, ASR #1     ;calc (screen ptr + 320y + x)
 1680 LDR      1, adata%
 1690 ADD      1, 1, 3, ASL #6     ;finally calc (xAND7)*35*64+data%
 1700 MOV      2, #7
 1710 .loop1%                      ;now plot sprite
 1720 FNfrag1(pass%)               ;plot 1st half of 1st row
 1730 FNfrag1(pass%)               ;     2nd half of 1st row
 1740 ADD      0, 0, #320-32       ;move screen ptr to start next row
 1750 FNfrag1(pass%)               ;plot 1st half of 2nd row
 1760 FNfrag1(pass%)               ; etc . . .
 1770 ADD      0, 0, #320-32
 1780 FNfrag1(pass%)
 1790 FNfrag1(pass%)
 1800 ADD      0, 0, #320-32
 1810 FNfrag1(pass%)
 1820 FNfrag1(pass%)
 1830 ADD      0, 0, #320-32
 1840 FNfrag1(pass%)
 1850 FNfrag1(pass%)               ;plot 2nd half of 5th row
 1860 ADD      0, 0, #320-32
 1870 SUBS     2, 2, #1
 1880 BNE      loop1%          ;repeat above 7 times to do all 35 rows
 1890 ADR      11, aplotregs%      ;plot completed - return to caller
 1900 LDMIA    11, {12,13,PC}      ;preserving r12 & r13.
 1910 :
 1920 .alrcls% EQUD 0
 1930 .aspcls% EQUD 0
 1940 .cls%                        ;simple routine to clear screen
 1950 STR      14, alrcls%         ;as rapidly as possible -
 1960 STR      13, aspcls%         ;note the heavy use of STM.
 1970 LDR      0, ascrst%
 1980 MOV      1, #105
 1990 MOV      2, #&11
 2000 ORR      2, 2, 2, LSL #8
 2010 ORR      2, 2, 2, LSL #16
 2020 MOV      3, 2
 2030 MOV      4, 2
 2040 MOV      5, 2
 2050 MOV      6, 2
 2060 MOV      7, 2
 2070 MOV      8, 2
 2080 MOV      9, 2
 2090 MOV      10, 2
 2100 MOV      11, 2
 2110 MOV      12, 2
 2120 MOV      13, 2
 2130 MOV      14, 2
 2140 .clsloop%
 2150 STMIA    0!, {2-14}
 2160 STMIA    0!, {2-14}
 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 SUBS     1, 1, #1
 2310 BNE      clsloop%
 2320 STMIA    0!, {2-6}
 2330 LDR      13, aspcls%
 2340 LDR      PC, alrcls%
 2350 ]
 2360NEXT
 2370ENDPROC
 2380:
 2390DEF FNfrag1(pass%)       :REM macro to plot 1/2 a row (32 pixels)
 2400[OPT pass%               :REM of our sprite
 2410LDMIA    0, {3-6}             ;read 4 words of screen (32 pixels)
 2420LDMIA    1!, {7-14}           ;read 32 sprite pixels & 32 masks
 2430AND      3, 3, 8              ;apply mask to screen, zeroing
 2440AND      4, 4, 10             ; those bits where will write
 2450AND      5, 5, 12             ; sprite image in a moment
 2460AND      6, 6, 14
 2470ORR      3, 3, 7              ;write in the sprite image
 2480ORR      4, 4, 9
 2490ORR      5, 5, 11
 2500ORR      6, 6, 13
 2510STMIA    0!, {3-6}            ;restore the data back to screen
 2520]
 2530=pass%

� >Bouncer
A� Purpose: Demo of fast sprite plotting for specific sprites,
A� via simple animation of bouncing heads in a mode 12 screen.
(�
2B� Compare performance with that of 'SprOp' which achieves same
<9� animation purely in BASIC using the general purpose
F=� OS_SpriteOp, & is hence many times slower (roughly 5x).
P�
Z=� To check this out for yourself, see how many heads each
dA� program can simultaneously bounce, whilst still maintaining
n@� a reasonable frame rate of no less than eg 25fps (or 50fps
x&� for maximum smoothness & speed).
��
�:
�=� NB program will produce a beep if animation speed falls
� � below the target fps rate.
�targetfps% = 50
�A� 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%=38
�� arm3%=� n%=n%/2.7
recommend$=�n%
:
2� � ș 6,112,1:ș 6,113,1:� �$;" at line ";�:�
"D% = �(-�)
,� 12+128:� 12:�
6*Run Palette
@
� 128+1:�
J� data% 17920
T+ș "OS_File", 255, "HeadData", data%, 0
^:
h
maxn%=400
r� b% maxn%*16
|3� NB b% stores array (of size n%) of structure:
�2� {x coord, y coord, x increment, y increment}
�:
��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%*16-1 � 16
!   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 �
N :
X � bounce%
b :
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%
* STMFD    13!, {14}
4: STR      13, aspframe%       ;store sp to free up r13
> .nextframe%
H :
R> SWI      "OS_ReadMonotonicTime"        ;track frame speed
\ STR      0, atime%
f :
p MOV      0, #19
z; 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
 MOV      0, 0, ASR #1
 MOV      1, 1, ASR #2
$4 BL       plot%               ; plot head at x,y
. ADD      12, 12, #16
8 SUBS     13, 13, #1
B4 BNE      frameplotloop%      ;then do next head
L LDR      11, afc%
V ADD      11, 11, #1
`5 STR      11, afc%            ;update frame count
j LDR      12, ab%
t LDR      13, an%
~6 .framemoveloop%              ;then move each head
�2 LDMIA    12, {0,1,2,3}       ; read x,y,xi,yi
�+ 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, #884
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
= ADDEQ    3, 3, #1            ; accelerate head downwards
(5 STMIA    12!, {0,1,2,3}      ; restore x,y,xi,yi
2 SUBS     13, 13, #1
<4 BNE      framemoveloop%      ;then do next head
F :
PB SWI      "OS_ReadMonotonicTime"        ;calculate frame speed
Z LDR      1, atime%
d SUB      0, 0, 1
n  CMP      0, #100/targetfps%
xD 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%
� .adata%  EQUD data%
� .abank%  EQUD 1
, .aplotregs%        EQUD 0:EQUD 0:EQUD 0
3 .plot%   ;plot our head sprite at coords r0,r1
>          ;where 0,0 is top left & 639,255 is bottom right
"8          ;NB sprite MUST lie entirely within screen
, ADR      11, aplotregs%
6 STMIA    11, {12,13,14}
@@ �      2, 0, #7            ;calculate which of the 8 sprite
J: RSB      3, 2, 2, ASL #2     ;alignments we need via:
T8 ADD      3, 3, 2, ASL #5     ;(xAND7)*35*64 + data%
^< BIC      0, 0, #7            ;round x down to mult of 8
h ADD      1, 1, 1, ASL #2
r LDR      2, ascrst%
| ADD      2, 2, 1, ASL #6
�? ADD      0, 2, 0, ASR #1     ;calc (screen ptr + 320y + x)
� LDR      1, adata%
�C ADD      1, 1, 3, ASL #6     ;finally calc (xAND7)*35*64+data%
� MOV      2, #7
�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%)
� �frag1(pass%)
 ADD      0, 0, #320-32
 �frag1(pass%)
 �frag1(pass%)
& ADD      0, 0, #320-32
0 �frag1(pass%)
:: �frag1(pass%)               ;plot 2nd half of 5th row
D ADD      0, 0, #320-32
N SUBS     2, 2, #1
XE BNE      loop1%          ;repeat above 7 times to do all 35 rows
bD ADR      11, aplotregs%      ;plot completed - return to caller
l8 LDMIA    11, {12,13,PC}      ;preserving r12 & r13.
v :
� .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
  MOV      9, 2
* MOV      10, 2
4 MOV      11, 2
> MOV      12, 2
H MOV      13, 2
R MOV      14, 2
\ .clsloop%
f STMIA    0!, {2-14}
p STMIA    0!, {2-14}
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}
� SUBS     1, 1, #1
	 BNE      clsloop%
	 STMIA    0!, {2-6}
	 LDR      13, aspcls%
	$ LDR      PC, alrcls%
	. ]
	8�
	B�
	L:
	V@� �frag1(pass%)       :� macro to plot 1/2 a row (32 pixels)
	`-[OPT pass%               :� of our sprite
	jELDMIA    0, {3-6}             ;read 4 words of screen (32 pixels)
	tCLDMIA    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  42 f4 20 43 6f 6d 70 61  |..(....2B. Compa|
000000a0  72 65 20 70 65 72 66 6f  72 6d 61 6e 63 65 20 77  |re performance w|
000000b0  69 74 68 20 74 68 61 74  20 6f 66 20 27 53 70 72  |ith that of 'Spr|
000000c0  4f 70 27 20 77 68 69 63  68 20 61 63 68 69 65 76  |Op' which achiev|
000000d0  65 73 20 73 61 6d 65 0d  00 3c 39 f4 20 61 6e 69  |es same..<9. ani|
000000e0  6d 61 74 69 6f 6e 20 70  75 72 65 6c 79 20 69 6e  |mation purely in|
000000f0  20 42 41 53 49 43 20 75  73 69 6e 67 20 74 68 65  | BASIC using the|
00000100  20 67 65 6e 65 72 61 6c  20 70 75 72 70 6f 73 65  | general purpose|
00000110  0d 00 46 3d f4 20 4f 53  5f 53 70 72 69 74 65 4f  |..F=. OS_SpriteO|
00000120  70 2c 20 26 20 69 73 20  68 65 6e 63 65 20 6d 61  |p, & is hence ma|
00000130  6e 79 20 74 69 6d 65 73  20 73 6c 6f 77 65 72 20  |ny times slower |
00000140  28 72 6f 75 67 68 6c 79  20 35 78 29 2e 0d 00 50  |(roughly 5x)...P|
00000150  05 f4 0d 00 5a 3d f4 20  54 6f 20 63 68 65 63 6b  |....Z=. To check|
00000160  20 74 68 69 73 20 6f 75  74 20 66 6f 72 20 79 6f  | this out for yo|
00000170  75 72 73 65 6c 66 2c 20  73 65 65 20 68 6f 77 20  |urself, see how |
00000180  6d 61 6e 79 20 68 65 61  64 73 20 65 61 63 68 0d  |many heads each.|
00000190  00 64 41 f4 20 70 72 6f  67 72 61 6d 20 63 61 6e  |.dA. program can|
000001a0  20 73 69 6d 75 6c 74 61  6e 65 6f 75 73 6c 79 20  | simultaneously |
000001b0  62 6f 75 6e 63 65 2c 20  77 68 69 6c 73 74 20 73  |bounce, whilst s|
000001c0  74 69 6c 6c 20 6d 61 69  6e 74 61 69 6e 69 6e 67  |till maintaining|
000001d0  0d 00 6e 40 f4 20 61 20  72 65 61 73 6f 6e 61 62  |..n@. a reasonab|
000001e0  6c 65 20 66 72 61 6d 65  20 72 61 74 65 20 6f 66  |le frame rate of|
000001f0  20 6e 6f 20 6c 65 73 73  20 74 68 61 6e 20 65 67  | no less than eg|
00000200  20 32 35 66 70 73 20 28  6f 72 20 35 30 66 70 73  | 25fps (or 50fps|
00000210  0d 00 78 26 f4 20 66 6f  72 20 6d 61 78 69 6d 75  |..x&. for maximu|
00000220  6d 20 73 6d 6f 6f 74 68  6e 65 73 73 20 26 20 73  |m smoothness & s|
00000230  70 65 65 64 29 2e 0d 00  82 05 f4 0d 00 8c 05 3a  |peed)..........:|
00000240  0d 00 96 3d f4 20 4e 42  20 70 72 6f 67 72 61 6d  |...=. NB program|
00000250  20 77 69 6c 6c 20 70 72  6f 64 75 63 65 20 61 20  | will produce a |
00000260  62 65 65 70 20 69 66 20  61 6e 69 6d 61 74 69 6f  |beep if animatio|
00000270  6e 20 73 70 65 65 64 20  66 61 6c 6c 73 0d 00 a0  |n speed falls...|
00000280  20 f4 20 62 65 6c 6f 77  20 74 68 65 20 74 61 72  | . below the tar|
00000290  67 65 74 20 66 70 73 20  72 61 74 65 2e 0d 00 aa  |get fps rate....|
000002a0  13 74 61 72 67 65 74 66  70 73 25 20 3d 20 35 30  |.targetfps% = 50|
000002b0  0d 00 b4 41 e7 20 31 30  30 83 74 61 72 67 65 74  |...A. 100.target|
000002c0  66 70 73 25 3c 3e 30 20  85 20 31 2c 20 22 52 65  |fps%<>0 . 1, "Re|
000002d0  71 75 69 72 65 20 74 61  72 67 65 74 66 70 73 20  |quire targetfps |
000002e0  64 69 76 69 64 65 73 20  69 6e 74 6f 20 31 30 30  |divides into 100|
000002f0  22 0d 00 be 05 3a 0d 00  c8 1e c8 99 20 26 32 30  |"....:...... &20|
00000300  32 38 30 2c 20 30 2c 20  2d 31 20 b8 20 3b 66 6c  |280, 0, -1 . ;fl|
00000310  61 67 73 25 0d 00 d2 24  e7 20 66 6c 61 67 73 25  |ags%...$. flags%|
00000320  20 80 20 31 20 8c 20 61  72 6d 33 25 3d a3 20 8b  | . 1 . arm3%=. .|
00000330  20 61 72 6d 33 25 3d b9  0d 00 dc 05 3a 0d 00 e6  | arm3%=.....:...|
00000340  2d f4 20 6e 25 20 69 73  20 74 68 65 20 6e 75 6d  |-. n% is the num|
00000350  62 65 72 20 6f 66 20 68  65 61 64 73 20 74 6f 20  |ber of heads to |
00000360  62 65 20 62 6f 75 6e 63  65 64 0d 00 f0 09 6e 25  |be bounced....n%|
00000370  3d 33 38 0d 00 fa 17 e7  20 61 72 6d 33 25 3d a3  |=38..... arm3%=.|
00000380  20 6e 25 3d 6e 25 2f 32  2e 37 0d 01 04 12 72 65  | n%=n%/2.7....re|
00000390  63 6f 6d 6d 65 6e 64 24  3d c3 6e 25 0d 01 0e 05  |commend$=.n%....|
000003a0  3a 0d 01 18 32 ee 20 85  20 c8 99 20 36 2c 31 31  |:...2. . .. 6,11|
000003b0  32 2c 31 3a c8 99 20 36  2c 31 31 33 2c 31 3a f1  |2,1:.. 6,113,1:.|
000003c0  20 f6 24 3b 22 20 61 74  20 6c 69 6e 65 20 22 3b  | .$;" at line ";|
000003d0  9e 3a e0 0d 01 22 0e 44  25 20 3d 20 b3 28 2d 91  |.:...".D% = .(-.|
000003e0  29 0d 01 2c 13 eb 20 31  32 2b 31 32 38 3a eb 20  |)..,.. 12+128:. |
000003f0  31 32 3a 87 0d 01 36 10  2a 52 75 6e 20 50 61 6c  |12:...6.*Run Pal|
00000400  65 74 74 65 0d 01 40 0d  fb 20 31 32 38 2b 31 3a  |ette..@.. 128+1:|
00000410  db 0d 01 4a 11 de 20 64  61 74 61 25 20 31 37 39  |...J.. data% 179|
00000420  32 30 0d 01 54 2b c8 99  20 22 4f 53 5f 46 69 6c  |20..T+.. "OS_Fil|
00000430  65 22 2c 20 32 35 35 2c  20 22 48 65 61 64 44 61  |e", 255, "HeadDa|
00000440  74 61 22 2c 20 64 61 74  61 25 2c 20 30 0d 01 5e  |ta", data%, 0..^|
00000450  05 3a 0d 01 68 0d 6d 61  78 6e 25 3d 34 30 30 0d  |.:..h.maxn%=400.|
00000460  01 72 11 de 20 62 25 20  6d 61 78 6e 25 2a 31 36  |.r.. b% maxn%*16|
00000470  0d 01 7c 33 f4 20 4e 42  20 62 25 20 73 74 6f 72  |..|3. NB b% stor|
00000480  65 73 20 61 72 72 61 79  20 28 6f 66 20 73 69 7a  |es array (of siz|
00000490  65 20 6e 25 29 20 6f 66  20 73 74 72 75 63 74 75  |e n%) of structu|
000004a0  72 65 3a 0d 01 86 32 f4  20 7b 78 20 63 6f 6f 72  |re:...2. {x coor|
000004b0  64 2c 20 79 20 63 6f 6f  72 64 2c 20 78 20 69 6e  |d, y coord, x in|
000004c0  63 72 65 6d 65 6e 74 2c  20 79 20 69 6e 63 72 65  |crement, y incre|
000004d0  6d 65 6e 74 7d 0d 01 90  05 3a 0d 01 9a 08 f2 61  |ment}....:.....a|
000004e0  73 73 0d 01 a4 05 3a 0d  01 ae 05 f5 0d 01 b8 1a  |ss....:.........|
000004f0  20 c8 99 20 36 2c 31 31  32 2c 31 3a c8 99 20 36  | .. 6,112,1:.. 6|
00000500  2c 31 31 33 2c 31 0d 01  c2 06 20 f5 0d 01 cc 07  |,113,1.... .....|
00000510  20 20 db 0d 01 d6 60 20  20 f1 20 27 22 50 6c 65  |  ....`  . '"Ple|
00000520  61 73 65 20 65 6e 74 65  72 20 6e 75 6d 62 65 72  |ase enter number|
00000530  20 6f 66 20 68 65 61 64  73 20 74 6f 20 62 6f 75  | of heads to bou|
00000540  6e 63 65 20 28 22 2b 72  65 63 6f 6d 6d 65 6e 64  |nce ("+recommend|
00000550  24 2b 22 20 72 65 63 6f  6d 6d 65 6e 64 65 64 2c  |$+" recommended,|
00000560  20 22 2b c3 6d 61 78 6e  25 2b 22 20 6d 61 78 29  | "+.maxn%+" max)|
00000570  20 22 3b 0d 01 e0 0a 20  20 e8 20 6e 25 0d 01 ea  | ";....  . n%...|
00000580  17 20 fd 20 6e 25 3c 3d  6d 61 78 6e 25 20 80 20  |. . n%<=maxn% . |
00000590  6e 25 3e 30 0d 01 f4 0c  20 21 61 6e 25 3d 6e 25  |n%>0.... !an%=n%|
000005a0  0d 01 fe 06 20 3a 0d 02  08 2d 20 f4 20 69 6e 69  |.... :...- . ini|
000005b0  74 69 61 6c 69 73 65 20  68 65 61 64 20 6c 6f 63  |tialise head loc|
000005c0  61 74 69 6f 6e 73 20 26  20 76 65 6c 6f 63 69 74  |ations & velocit|
000005d0  69 65 73 0d 02 12 1c 20  e3 20 69 25 20 3d 20 30  |ies.... . i% = 0|
000005e0  20 b8 20 6e 25 2a 31 36  2d 31 20 88 20 31 36 0d  | . n%*16-1 . 16.|
000005f0  02 1c 21 20 20 20 62 25  21 28 69 25 2b 30 29 20  |..!   b%!(i%+0) |
00000600  20 3d 20 b3 28 31 30 30  30 29 20 2b 20 31 34 30  | = .(1000) + 140|
00000610  0d 02 26 1f 20 20 20 62  25 21 28 69 25 2b 34 29  |..&.   b%!(i%+4)|
00000620  20 20 3d 20 b3 28 37 30  30 29 20 20 2b 20 30 0d  |  = .(700)  + 0.|
00000630  02 30 2a 20 20 20 62 25  21 28 69 25 2b 38 29 20  |.0*   b%!(i%+8) |
00000640  20 3d 20 b3 28 31 36 29  2a 28 30 2e 35 2b 28 b3  | = .(16)*(0.5+(.|
00000650  28 31 29 3c 30 2e 35 29  29 0d 02 3a 2a 20 20 20  |(1)<0.5))..:*   |
00000660  62 25 21 28 69 25 2b 31  32 29 20 3d 20 b3 28 30  |b%!(i%+12) = .(0|
00000670  38 29 2a 28 30 2e 35 2b  28 b3 28 31 29 3c 30 2e  |8)*(0.5+(.(1)<0.|
00000680  35 29 29 0d 02 44 06 20  ed 0d 02 4e 06 20 3a 0d  |5))..D. ...N. :.|
00000690  02 58 0e 20 d6 20 62 6f  75 6e 63 65 25 0d 02 62  |.X. . bounce%..b|
000006a0  06 20 3a 0d 02 6c 07 fd  20 a3 0d 02 76 05 3a 0d  |. :..l.. ...v.:.|
000006b0  02 80 05 e0 0d 02 8a 05  3a 0d 02 94 0a dd 20 f2  |........:..... .|
000006c0  61 73 73 0d 02 9e 11 de  20 63 6f 64 65 25 20 31  |ass..... code% 1|
000006d0  30 32 34 30 0d 02 a8 19  21 63 6f 64 65 25 3d 31  |0240....!code%=1|
000006e0  34 38 3a 63 6f 64 65 25  21 34 3d 2d 31 0d 02 b2  |48:code%!4=-1...|
000006f0  2a c8 99 20 22 4f 53 5f  52 65 61 64 56 64 75 56  |*.. "OS_ReadVduV|
00000700  61 72 69 61 62 6c 65 73  22 2c 20 63 6f 64 65 25  |ariables", code%|
00000710  2c 20 63 6f 64 65 25 0d  02 bc 11 73 63 72 73 74  |, code%....scrst|
00000720  25 3d 21 63 6f 64 65 25  0d 02 c6 17 e3 20 70 61  |%=!code%..... pa|
00000730  73 73 25 20 3d 20 30 20  b8 20 32 20 88 20 32 0d  |ss% = 0 . 2 . 2.|
00000740  02 d0 0d 20 50 25 3d 63  6f 64 65 25 0d 02 da 0f  |... P%=code%....|
00000750  20 5b 4f 50 54 20 70 61  73 73 25 0d 02 e4 1e 20  | [OPT pass%.... |
00000760  2e 61 73 70 66 72 61 6d  65 25 20 20 20 20 20 20  |.aspframe%      |
00000770  20 20 20 45 51 55 44 20  30 0d 02 ee 2b 20 2e 61  |   EQUD 0...+ .a|
00000780  73 63 72 73 74 73 75 6d  25 20 20 20 20 20 20 20  |scrstsum%       |
00000790  20 45 51 55 44 20 73 63  72 73 74 25 2a 32 2b 38  | EQUD scrst%*2+8|
000007a0  31 39 32 30 0d 02 f8 14  20 2e 61 6e 25 20 20 20  |1920.... .an%   |
000007b0  20 20 45 51 55 44 20 30  0d 03 02 15 20 2e 61 62  |  EQUD 0.... .ab|
000007c0  25 20 20 20 20 20 45 51  55 44 20 62 25 0d 03 0c  |%     EQUD b%...|
000007d0  44 20 2e 61 74 69 6d 65  25 20 20 45 51 55 44 20  |D .atime%  EQUD |
000007e0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |0              ;|
000007f0  74 69 6d 65 20 73 74 6f  72 61 67 65 20 66 6f 72  |time storage for|
00000800  20 66 72 61 6d 65 20 73  70 65 65 64 20 63 61 6c  | frame speed cal|
00000810  63 0d 03 16 30 20 2e 61  66 63 25 20 20 20 20 45  |c...0 .afc%    E|
00000820  51 55 44 20 30 20 20 20  20 20 20 20 20 20 20 20  |QUD 0           |
00000830  20 20 20 3b 66 72 61 6d  65 20 63 6f 75 6e 74 65  |   ;frame counte|
00000840  72 0d 03 20 0d 20 2e 62  6f 75 6e 63 65 25 0d 03  |r.. . .bounce%..|
00000850  2a 17 20 53 54 4d 46 44  20 20 20 20 31 33 21 2c  |*. STMFD    13!,|
00000860  20 7b 31 34 7d 0d 03 34  3a 20 53 54 52 20 20 20  | {14}..4: STR   |
00000870  20 20 20 31 33 2c 20 61  73 70 66 72 61 6d 65 25  |   13, aspframe%|
00000880  20 20 20 20 20 20 20 3b  73 74 6f 72 65 20 73 70  |       ;store sp|
00000890  20 74 6f 20 66 72 65 65  20 75 70 20 72 31 33 0d  | to free up r13.|
000008a0  03 3e 10 20 2e 6e 65 78  74 66 72 61 6d 65 25 0d  |.>. .nextframe%.|
000008b0  03 48 06 20 3a 0d 03 52  3e 20 53 57 49 20 20 20  |.H. :..R> SWI   |
000008c0  20 20 20 22 4f 53 5f 52  65 61 64 4d 6f 6e 6f 74  |   "OS_ReadMonot|
000008d0  6f 6e 69 63 54 69 6d 65  22 20 20 20 20 20 20 20  |onicTime"       |
000008e0  20 3b 74 72 61 63 6b 20  66 72 61 6d 65 20 73 70  | ;track frame sp|
000008f0  65 65 64 0d 03 5c 17 20  53 54 52 20 20 20 20 20  |eed..\. STR     |
00000900  20 30 2c 20 61 74 69 6d  65 25 0d 03 66 06 20 3a  | 0, atime%..f. :|
00000910  0d 03 70 14 20 4d 4f 56  20 20 20 20 20 20 30 2c  |..p. MOV      0,|
00000920  20 23 31 39 0d 03 7a 3b  20 53 57 49 20 20 20 20  | #19..z; SWI    |
00000930  20 20 22 4f 53 5f 42 79  74 65 22 20 20 20 20 20  |  "OS_Byte"     |
00000940  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000950  3b 77 61 69 74 20 66 6f  72 20 76 73 79 6e 63 0d  |;wait for vsync.|
00000960  03 84 15 20 4d 4f 56 20  20 20 20 20 20 30 2c 20  |... MOV      0, |
00000970  23 31 31 33 0d 03 8e 17  20 4c 44 52 20 20 20 20  |#113.... LDR    |
00000980  20 20 31 2c 20 61 62 61  6e 6b 25 0d 03 98 16 20  |  1, abank%.... |
00000990  52 53 42 20 20 20 20 20  20 33 2c 20 31 2c 20 23  |RSB      3, 1, #|
000009a0  33 0d 03 a2 17 20 53 54  52 20 20 20 20 20 20 33  |3.... STR      3|
000009b0  2c 20 61 62 61 6e 6b 25  0d 03 ac 3d 20 53 57 49  |, abank%...= SWI|
000009c0  20 20 20 20 20 20 22 4f  53 5f 42 79 74 65 22 20  |      "OS_Byte" |
000009d0  20 20 20 20 20 20 20 20  20 20 3b 73 77 61 70 20  |          ;swap |
000009e0  64 69 73 70 6c 61 79 65  64 20 73 63 72 65 65 6e  |displayed screen|
000009f0  20 62 61 6e 6b 0d 03 b6  1b 20 4c 44 52 20 20 20  | bank.... LDR   |
00000a00  20 20 20 30 2c 20 61 73  63 72 73 74 73 75 6d 25  |   0, ascrstsum%|
00000a10  0d 03 c0 18 20 4c 44 52  20 20 20 20 20 20 31 2c  |.... LDR      1,|
00000a20  20 61 73 63 72 73 74 25  0d 03 ca 15 20 53 55 42  | ascrst%.... SUB|
00000a30  20 20 20 20 20 20 31 2c  20 30 2c 20 31 0d 03 d4  |      1, 0, 1...|
00000a40  39 20 53 54 52 20 20 20  20 20 20 31 2c 20 61 73  |9 STR      1, as|
00000a50  63 72 73 74 25 20 20 20  20 20 20 20 20 20 20 3b  |crst%          ;|
00000a60  73 77 61 70 20 70 74 72  20 74 6f 20 6f 74 68 65  |swap ptr to othe|
00000a70  72 20 62 61 6e 6b 0d 03  de 43 20 42 4c 20 20 20  |r bank...C BL   |
00000a80  20 20 20 20 63 6c 73 25  20 20 20 20 20 20 20 20  |    cls%        |
00000a90  20 20 20 20 20 20 20 20  3b 63 6c 73 20 74 68 61  |        ;cls tha|
00000aa0  74 20 62 61 6e 6b 20 74  6f 20 67 72 65 79 20 28  |t bank to grey (|
00000ab0  63 6f 6c 6f 75 72 20 31  29 0d 03 e8 15 20 4c 44  |colour 1).... LD|
00000ac0  52 20 20 20 20 20 20 31  32 2c 20 61 62 25 0d 03  |R      12, ab%..|
00000ad0  f2 15 20 4c 44 52 20 20  20 20 20 20 31 33 2c 20  |.. LDR      13, |
00000ae0  61 6e 25 0d 03 fc 36 20  2e 66 72 61 6d 65 70 6c  |an%...6 .framepl|
00000af0  6f 74 6c 6f 6f 70 25 20  20 20 20 20 20 20 20 20  |otloop%         |
00000b00  20 20 20 20 20 3b 6e 6f  77 20 70 6c 6f 74 20 65  |     ;now plot e|
00000b10  61 63 68 20 68 65 61 64  3a 0d 04 06 3d 20 4c 44  |ach head:...= LD|
00000b20  4d 49 41 20 20 20 20 31  32 2c 20 7b 30 2c 31 7d  |MIA    12, {0,1}|
00000b30  20 20 20 20 20 20 20 20  20 20 20 3b 20 72 65 61  |           ; rea|
00000b40  64 20 78 2c 79 20 63 6f  6f 72 64 73 20 66 72 6f  |d x,y coords fro|
00000b50  6d 20 64 61 74 61 0d 04  10 1a 20 4d 4f 56 20 20  |m data.... MOV  |
00000b60  20 20 20 20 30 2c 20 30  2c 20 41 53 52 20 23 31  |    0, 0, ASR #1|
00000b70  0d 04 1a 1a 20 4d 4f 56  20 20 20 20 20 20 31 2c  |.... MOV      1,|
00000b80  20 31 2c 20 41 53 52 20  23 32 0d 04 24 34 20 42  | 1, ASR #2..$4 B|
00000b90  4c 20 20 20 20 20 20 20  70 6c 6f 74 25 20 20 20  |L       plot%   |
00000ba0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 70 6c  |            ; pl|
00000bb0  6f 74 20 68 65 61 64 20  61 74 20 78 2c 79 0d 04  |ot head at x,y..|
00000bc0  2e 19 20 41 44 44 20 20  20 20 20 20 31 32 2c 20  |.. ADD      12, |
00000bd0  31 32 2c 20 23 31 36 0d  04 38 18 20 53 55 42 53  |12, #16..8. SUBS|
00000be0  20 20 20 20 20 31 33 2c  20 31 33 2c 20 23 31 0d  |     13, 13, #1.|
00000bf0  04 42 34 20 42 4e 45 20  20 20 20 20 20 66 72 61  |.B4 BNE      fra|
00000c00  6d 65 70 6c 6f 74 6c 6f  6f 70 25 20 20 20 20 20  |meplotloop%     |
00000c10  20 3b 74 68 65 6e 20 64  6f 20 6e 65 78 74 20 68  | ;then do next h|
00000c20  65 61 64 0d 04 4c 16 20  4c 44 52 20 20 20 20 20  |ead..L. LDR     |
00000c30  20 31 31 2c 20 61 66 63  25 0d 04 56 18 20 41 44  | 11, afc%..V. AD|
00000c40  44 20 20 20 20 20 20 31  31 2c 20 31 31 2c 20 23  |D      11, 11, #|
00000c50  31 0d 04 60 35 20 53 54  52 20 20 20 20 20 20 31  |1..`5 STR      1|
00000c60  31 2c 20 61 66 63 25 20  20 20 20 20 20 20 20 20  |1, afc%         |
00000c70  20 20 20 3b 75 70 64 61  74 65 20 66 72 61 6d 65  |   ;update frame|
00000c80  20 63 6f 75 6e 74 0d 04  6a 15 20 4c 44 52 20 20  | count..j. LDR  |
00000c90  20 20 20 20 31 32 2c 20  61 62 25 0d 04 74 15 20  |    12, ab%..t. |
00000ca0  4c 44 52 20 20 20 20 20  20 31 33 2c 20 61 6e 25  |LDR      13, an%|
00000cb0  0d 04 7e 36 20 2e 66 72  61 6d 65 6d 6f 76 65 6c  |..~6 .framemovel|
00000cc0  6f 6f 70 25 20 20 20 20  20 20 20 20 20 20 20 20  |oop%            |
00000cd0  20 20 3b 74 68 65 6e 20  6d 6f 76 65 20 65 61 63  |  ;then move eac|
00000ce0  68 20 68 65 61 64 0d 04  88 32 20 4c 44 4d 49 41  |h head...2 LDMIA|
00000cf0  20 20 20 20 31 32 2c 20  7b 30 2c 31 2c 32 2c 33  |    12, {0,1,2,3|
00000d00  7d 20 20 20 20 20 20 20  3b 20 72 65 61 64 20 78  |}       ; read x|
00000d10  2c 79 2c 78 69 2c 79 69  0d 04 92 2b 20 41 44 44  |,y,xi,yi...+ ADD|
00000d20  53 20 20 20 20 20 30 2c  20 30 2c 20 32 20 20 20  |S     0, 0, 2   |
00000d30  20 20 20 20 20 20 20 20  20 20 3b 20 61 6c 74 65  |          ; alte|
00000d40  72 20 78 0d 04 9c 46 20  52 53 42 4d 49 20 20 20  |r x...F RSBMI   |
00000d50  20 32 2c 20 32 2c 20 23  30 20 20 20 20 20 20 20  | 2, 2, #0       |
00000d60  20 20 20 20 20 3b 20 69  66 20 6f 66 66 20 6c 65  |     ; if off le|
00000d70  66 74 20 73 69 64 65 2c  20 72 65 76 65 72 73 65  |ft side, reverse|
00000d80  20 76 65 6c 6f 63 69 74  79 0d 04 a6 2f 20 41 44  | velocity.../ AD|
00000d90  44 4d 49 20 20 20 20 30  2c 20 30 2c 20 32 20 20  |DMI    0, 0, 2  |
00000da0  20 20 20 20 20 20 20 20  20 20 20 3b 20 26 20 6d  |           ; & m|
00000db0  6f 76 65 20 62 61 63 6b  0d 04 b0 2b 20 41 44 44  |ove back...+ ADD|
00000dc0  53 20 20 20 20 20 31 2c  20 31 2c 20 33 20 20 20  |S     1, 1, 3   |
00000dd0  20 20 20 20 20 20 20 20  20 20 3b 20 61 6c 74 65  |          ; alte|
00000de0  72 20 79 0d 04 ba 45 20  52 53 42 4d 49 20 20 20  |r y...E RSBMI   |
00000df0  20 33 2c 20 33 2c 20 23  30 20 20 20 20 20 20 20  | 3, 3, #0       |
00000e00  20 20 20 20 20 3b 20 69  66 20 6f 66 66 20 74 6f  |     ; if off to|
00000e10  70 20 73 69 64 65 2c 20  72 65 76 65 72 73 65 20  |p side, reverse |
00000e20  76 65 6c 6f 63 69 74 79  0d 04 c4 2f 20 41 44 44  |velocity.../ ADD|
00000e30  4d 49 20 20 20 20 31 2c  20 31 2c 20 33 20 20 20  |MI    1, 1, 3   |
00000e40  20 20 20 20 20 20 20 20  20 20 3b 20 26 20 6d 6f  |          ; & mo|
00000e50  76 65 20 62 61 63 6b 0d  04 ce 40 20 53 55 42 53  |ve back...@ SUBS|
00000e60  20 20 20 20 20 31 34 2c  20 30 2c 20 23 31 30 32  |     14, 0, #102|
00000e70  34 20 20 20 20 20 20 20  20 3b 20 28 74 68 65 73  |4        ; (thes|
00000e80  65 20 32 20 69 6e 73 74  72 75 63 74 73 20 61 72  |e 2 instructs ar|
00000e90  65 20 65 71 75 69 76 0d  04 d8 35 20 53 55 42 47  |e equiv...5 SUBG|
00000ea0  54 53 20 20 20 31 34 2c  20 31 34 2c 20 23 31 34  |TS   14, 14, #14|
00000eb0  32 20 20 20 20 20 20 20  20 3b 20 20 74 6f 20 43  |2        ;  to C|
00000ec0  4d 50 20 30 2c 20 23 31  31 36 36 29 0d 04 e2 42  |MP 0, #1166)...B|
00000ed0  20 52 53 42 47 54 20 20  20 20 32 2c 20 32 2c 20  | RSBGT    2, 2, |
00000ee0  23 30 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |#0            ; |
00000ef0  69 66 20 6f 66 66 20 72  69 67 68 74 2c 20 72 65  |if off right, re|
00000f00  76 65 72 73 65 20 76 65  6c 6f 63 69 74 79 0d 04  |verse velocity..|
00000f10  ec 2f 20 41 44 44 47 54  20 20 20 20 30 2c 20 30  |./ ADDGT    0, 0|
00000f20  2c 20 32 20 20 20 20 20  20 20 20 20 20 20 20 20  |, 2             |
00000f30  3b 20 26 20 6d 6f 76 65  20 62 61 63 6b 0d 04 f6  |; & move back...|
00000f40  15 20 43 4d 50 20 20 20  20 20 20 31 2c 20 23 38  |. CMP      1, #8|
00000f50  38 34 0d 05 00 43 20 52  53 42 47 54 20 20 20 20  |84...C RSBGT    |
00000f60  33 2c 20 33 2c 20 23 30  20 20 20 20 20 20 20 20  |3, 3, #0        |
00000f70  20 20 20 20 3b 20 69 66  20 6f 66 66 20 62 6f 74  |    ; if off bot|
00000f80  74 6f 6d 2c 20 72 65 76  65 72 73 65 20 76 65 6c  |tom, reverse vel|
00000f90  6f 63 69 74 79 0d 05 0a  2f 20 41 44 44 47 54 20  |ocity.../ ADDGT |
00000fa0  20 20 20 31 2c 20 31 2c  20 33 20 20 20 20 20 20  |   1, 1, 3      |
00000fb0  20 20 20 20 20 20 20 3b  20 26 20 6d 6f 76 65 20  |       ; & move |
00000fc0  62 61 63 6b 0d 05 14 45  20 54 53 54 20 20 20 20  |back...E TST    |
00000fd0  20 20 31 31 2c 20 23 33  20 20 20 20 20 20 20 20  |  11, #3        |
00000fe0  20 20 20 20 20 20 3b 20  69 66 20 66 72 61 6d 65  |      ; if frame|
00000ff0  20 63 6f 75 6e 74 20 69  73 20 61 20 6d 75 6c 74  | count is a mult|
00001000  69 70 6c 65 20 6f 66 20  34 0d 05 1e 3d 20 41 44  |iple of 4...= AD|
00001010  44 45 51 20 20 20 20 33  2c 20 33 2c 20 23 31 20  |DEQ    3, 3, #1 |
00001020  20 20 20 20 20 20 20 20  20 20 20 3b 20 61 63 63  |           ; acc|
00001030  65 6c 65 72 61 74 65 20  68 65 61 64 20 64 6f 77  |elerate head dow|
00001040  6e 77 61 72 64 73 0d 05  28 35 20 53 54 4d 49 41  |nwards..(5 STMIA|
00001050  20 20 20 20 31 32 21 2c  20 7b 30 2c 31 2c 32 2c  |    12!, {0,1,2,|
00001060  33 7d 20 20 20 20 20 20  3b 20 72 65 73 74 6f 72  |3}      ; restor|
00001070  65 20 78 2c 79 2c 78 69  2c 79 69 0d 05 32 18 20  |e x,y,xi,yi..2. |
00001080  53 55 42 53 20 20 20 20  20 31 33 2c 20 31 33 2c  |SUBS     13, 13,|
00001090  20 23 31 0d 05 3c 34 20  42 4e 45 20 20 20 20 20  | #1..<4 BNE     |
000010a0  20 66 72 61 6d 65 6d 6f  76 65 6c 6f 6f 70 25 20  | framemoveloop% |
000010b0  20 20 20 20 20 3b 74 68  65 6e 20 64 6f 20 6e 65  |     ;then do ne|
000010c0  78 74 20 68 65 61 64 0d  05 46 06 20 3a 0d 05 50  |xt head..F. :..P|
000010d0  42 20 53 57 49 20 20 20  20 20 20 22 4f 53 5f 52  |B SWI      "OS_R|
000010e0  65 61 64 4d 6f 6e 6f 74  6f 6e 69 63 54 69 6d 65  |eadMonotonicTime|
000010f0  22 20 20 20 20 20 20 20  20 3b 63 61 6c 63 75 6c  |"        ;calcul|
00001100  61 74 65 20 66 72 61 6d  65 20 73 70 65 65 64 0d  |ate frame speed.|
00001110  05 5a 17 20 4c 44 52 20  20 20 20 20 20 31 2c 20  |.Z. LDR      1, |
00001120  61 74 69 6d 65 25 0d 05  64 15 20 53 55 42 20 20  |atime%..d. SUB  |
00001130  20 20 20 20 30 2c 20 30  2c 20 31 0d 05 6e 20 20  |    0, 0, 1..n  |
00001140  43 4d 50 20 20 20 20 20  20 30 2c 20 23 31 30 30  |CMP      0, #100|
00001150  2f 74 61 72 67 65 74 66  70 73 25 0d 05 78 44 20  |/targetfps%..xD |
00001160  53 57 49 47 54 20 20 20  20 32 35 36 2b 37 20 20  |SWIGT    256+7  |
00001170  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 62 65  |             ;be|
00001180  65 70 20 69 66 20 69 74  20 66 61 6c 6c 73 20 62  |ep if it falls b|
00001190  65 6c 6f 77 20 74 61 72  67 65 74 20 66 70 73 0d  |elow target fps.|
000011a0  05 82 06 20 3a 0d 05 8c  15 20 4d 4f 56 20 20 20  |... :.... MOV   |
000011b0  20 20 20 30 2c 20 23 31  32 39 0d 05 96 13 20 4d  |   0, #129.... M|
000011c0  4f 56 20 20 20 20 20 20  31 2c 20 23 30 0d 05 a0  |OV      1, #0...|
000011d0  13 20 4d 4f 56 20 20 20  20 20 20 32 2c 20 23 30  |. MOV      2, #0|
000011e0  0d 05 aa 17 20 53 57 49  20 20 20 20 20 20 22 4f  |.... SWI      "O|
000011f0  53 5f 42 79 74 65 22 0d  05 b4 15 20 43 4d 50 20  |S_Byte".... CMP |
00001200  20 20 20 20 20 32 2c 20  23 26 46 46 0d 05 be 43  |     2, #&FF...C|
00001210  20 42 45 51 20 20 20 20  20 20 6e 65 78 74 66 72  | BEQ      nextfr|
00001220  61 6d 65 25 20 20 20 20  20 20 20 20 20 20 3b 69  |ame%          ;i|
00001230  66 20 6e 6f 20 6b 65 79  20 70 72 65 73 73 65 64  |f no key pressed|
00001240  2c 20 64 6f 20 6e 65 78  74 20 66 72 61 6d 65 0d  |, do next frame.|
00001250  05 c8 2d 20 4c 44 52 20  20 20 20 20 20 31 33 2c  |..- LDR      13,|
00001260  20 61 73 70 66 72 61 6d  65 25 20 20 20 20 20 20  | aspframe%      |
00001270  20 3b 72 65 73 74 6f 72  65 20 73 70 0d 05 d2 32  | ;restore sp...2|
00001280  20 4c 44 4d 46 44 20 20  20 20 31 33 21 2c 20 7b  | LDMFD    13!, {|
00001290  50 43 7d 20 20 20 20 20  20 20 20 20 20 20 3b 72  |PC}           ;r|
000012a0  65 74 75 72 6e 20 74 6f  20 42 41 53 49 43 0d 05  |eturn to BASIC..|
000012b0  dc 06 20 3a 0d 05 e6 19  20 2e 61 73 63 72 73 74  |.. :.... .ascrst|
000012c0  25 20 45 51 55 44 20 73  63 72 73 74 25 0d 05 f0  |% EQUD scrst%...|
000012d0  18 20 2e 61 64 61 74 61  25 20 20 45 51 55 44 20  |. .adata%  EQUD |
000012e0  64 61 74 61 25 0d 05 fa  14 20 2e 61 62 61 6e 6b  |data%.... .abank|
000012f0  25 20 20 45 51 55 44 20  31 0d 06 04 2c 20 2e 61  |%  EQUD 1..., .a|
00001300  70 6c 6f 74 72 65 67 73  25 20 20 20 20 20 20 20  |plotregs%       |
00001310  20 45 51 55 44 20 30 3a  45 51 55 44 20 30 3a 45  | EQUD 0:EQUD 0:E|
00001320  51 55 44 20 30 0d 06 0e  33 20 2e 70 6c 6f 74 25  |QUD 0...3 .plot%|
00001330  20 20 20 3b 70 6c 6f 74  20 6f 75 72 20 68 65 61  |   ;plot our hea|
00001340  64 20 73 70 72 69 74 65  20 61 74 20 63 6f 6f 72  |d sprite at coor|
00001350  64 73 20 72 30 2c 72 31  0d 06 18 3e 20 20 20 20  |ds r0,r1...>    |
00001360  20 20 20 20 20 20 3b 77  68 65 72 65 20 30 2c 30  |      ;where 0,0|
00001370  20 69 73 20 74 6f 70 20  6c 65 66 74 20 26 20 36  | is top left & 6|
00001380  33 39 2c 32 35 35 20 69  73 20 62 6f 74 74 6f 6d  |39,255 is bottom|
00001390  20 72 69 67 68 74 0d 06  22 38 20 20 20 20 20 20  | right.."8      |
000013a0  20 20 20 20 3b 4e 42 20  73 70 72 69 74 65 20 4d  |    ;NB sprite M|
000013b0  55 53 54 20 6c 69 65 20  65 6e 74 69 72 65 6c 79  |UST lie entirely|
000013c0  20 77 69 74 68 69 6e 20  73 63 72 65 65 6e 0d 06  | within screen..|
000013d0  2c 1c 20 41 44 52 20 20  20 20 20 20 31 31 2c 20  |,. ADR      11, |
000013e0  61 70 6c 6f 74 72 65 67  73 25 0d 06 36 1c 20 53  |aplotregs%..6. S|
000013f0  54 4d 49 41 20 20 20 20  31 31 2c 20 7b 31 32 2c  |TMIA    11, {12,|
00001400  31 33 2c 31 34 7d 0d 06  40 40 20 80 20 20 20 20  |13,14}..@@ .    |
00001410  20 20 32 2c 20 30 2c 20  23 37 20 20 20 20 20 20  |  2, 0, #7      |
00001420  20 20 20 20 20 20 3b 63  61 6c 63 75 6c 61 74 65  |      ;calculate|
00001430  20 77 68 69 63 68 20 6f  66 20 74 68 65 20 38 20  | which of the 8 |
00001440  73 70 72 69 74 65 0d 06  4a 3a 20 52 53 42 20 20  |sprite..J: RSB  |
00001450  20 20 20 20 33 2c 20 32  2c 20 32 2c 20 41 53 4c  |    3, 2, 2, ASL|
00001460  20 23 32 20 20 20 20 20  3b 61 6c 69 67 6e 6d 65  | #2     ;alignme|
00001470  6e 74 73 20 77 65 20 6e  65 65 64 20 76 69 61 3a  |nts we need via:|
00001480  0d 06 54 38 20 41 44 44  20 20 20 20 20 20 33 2c  |..T8 ADD      3,|
00001490  20 33 2c 20 32 2c 20 41  53 4c 20 23 35 20 20 20  | 3, 2, ASL #5   |
000014a0  20 20 3b 28 78 41 4e 44  37 29 2a 33 35 2a 36 34  |  ;(xAND7)*35*64|
000014b0  20 2b 20 64 61 74 61 25  0d 06 5e 3c 20 42 49 43  | + data%..^< BIC|
000014c0  20 20 20 20 20 20 30 2c  20 30 2c 20 23 37 20 20  |      0, 0, #7  |
000014d0  20 20 20 20 20 20 20 20  20 20 3b 72 6f 75 6e 64  |          ;round|
000014e0  20 78 20 64 6f 77 6e 20  74 6f 20 6d 75 6c 74 20  | x down to mult |
000014f0  6f 66 20 38 0d 06 68 1d  20 41 44 44 20 20 20 20  |of 8..h. ADD    |
00001500  20 20 31 2c 20 31 2c 20  31 2c 20 41 53 4c 20 23  |  1, 1, 1, ASL #|
00001510  32 0d 06 72 18 20 4c 44  52 20 20 20 20 20 20 32  |2..r. LDR      2|
00001520  2c 20 61 73 63 72 73 74  25 0d 06 7c 1d 20 41 44  |, ascrst%..|. AD|
00001530  44 20 20 20 20 20 20 32  2c 20 32 2c 20 31 2c 20  |D      2, 2, 1, |
00001540  41 53 4c 20 23 36 0d 06  86 3f 20 41 44 44 20 20  |ASL #6...? ADD  |
00001550  20 20 20 20 30 2c 20 32  2c 20 30 2c 20 41 53 52  |    0, 2, 0, ASR|
00001560  20 23 31 20 20 20 20 20  3b 63 61 6c 63 20 28 73  | #1     ;calc (s|
00001570  63 72 65 65 6e 20 70 74  72 20 2b 20 33 32 30 79  |creen ptr + 320y|
00001580  20 2b 20 78 29 0d 06 90  17 20 4c 44 52 20 20 20  | + x).... LDR   |
00001590  20 20 20 31 2c 20 61 64  61 74 61 25 0d 06 9a 43  |   1, adata%...C|
000015a0  20 41 44 44 20 20 20 20  20 20 31 2c 20 31 2c 20  | ADD      1, 1, |
000015b0  33 2c 20 41 53 4c 20 23  36 20 20 20 20 20 3b 66  |3, ASL #6     ;f|
000015c0  69 6e 61 6c 6c 79 20 63  61 6c 63 20 28 78 41 4e  |inally calc (xAN|
000015d0  44 37 29 2a 33 35 2a 36  34 2b 64 61 74 61 25 0d  |D7)*35*64+data%.|
000015e0  06 a4 13 20 4d 4f 56 20  20 20 20 20 20 32 2c 20  |... MOV      2, |
000015f0  23 37 0d 06 ae 32 20 2e  6c 6f 6f 70 31 25 20 20  |#7...2 .loop1%  |
00001600  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001610  20 20 20 20 3b 6e 6f 77  20 70 6c 6f 74 20 73 70  |    ;now plot sp|
00001620  72 69 74 65 0d 06 b8 3a  20 a4 66 72 61 67 31 28  |rite...: .frag1(|
00001630  70 61 73 73 25 29 20 20  20 20 20 20 20 20 20 20  |pass%)          |
00001640  20 20 20 20 20 3b 70 6c  6f 74 20 31 73 74 20 68  |     ;plot 1st h|
00001650  61 6c 66 20 6f 66 20 31  73 74 20 72 6f 77 0d 06  |alf of 1st row..|
00001660  c2 3a 20 a4 66 72 61 67  31 28 70 61 73 73 25 29  |.: .frag1(pass%)|
00001670  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001680  20 20 20 20 20 32 6e 64  20 68 61 6c 66 20 6f 66  |     2nd half of|
00001690  20 31 73 74 20 72 6f 77  0d 06 cc 44 20 41 44 44  | 1st row...D ADD|
000016a0  20 20 20 20 20 20 30 2c  20 30 2c 20 23 33 32 30  |      0, 0, #320|
000016b0  2d 33 32 20 20 20 20 20  20 20 3b 6d 6f 76 65 20  |-32       ;move |
000016c0  73 63 72 65 65 6e 20 70  74 72 20 74 6f 20 73 74  |screen ptr to st|
000016d0  61 72 74 20 6e 65 78 74  20 72 6f 77 0d 06 d6 3a  |art next row...:|
000016e0  20 a4 66 72 61 67 31 28  70 61 73 73 25 29 20 20  | .frag1(pass%)  |
000016f0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 70 6c  |             ;pl|
00001700  6f 74 20 31 73 74 20 68  61 6c 66 20 6f 66 20 32  |ot 1st half of 2|
00001710  6e 64 20 72 6f 77 0d 06  e0 2c 20 a4 66 72 61 67  |nd row..., .frag|
00001720  31 28 70 61 73 73 25 29  20 20 20 20 20 20 20 20  |1(pass%)        |
00001730  20 20 20 20 20 20 20 3b  20 65 74 63 20 2e 20 2e  |       ; etc . .|
00001740  20 2e 0d 06 ea 1b 20 41  44 44 20 20 20 20 20 20  | ..... ADD      |
00001750  30 2c 20 30 2c 20 23 33  32 30 2d 33 32 0d 06 f4  |0, 0, #320-32...|
00001760  12 20 a4 66 72 61 67 31  28 70 61 73 73 25 29 0d  |. .frag1(pass%).|
00001770  06 fe 12 20 a4 66 72 61  67 31 28 70 61 73 73 25  |... .frag1(pass%|
00001780  29 0d 07 08 1b 20 41 44  44 20 20 20 20 20 20 30  |).... ADD      0|
00001790  2c 20 30 2c 20 23 33 32  30 2d 33 32 0d 07 12 12  |, 0, #320-32....|
000017a0  20 a4 66 72 61 67 31 28  70 61 73 73 25 29 0d 07  | .frag1(pass%)..|
000017b0  1c 12 20 a4 66 72 61 67  31 28 70 61 73 73 25 29  |.. .frag1(pass%)|
000017c0  0d 07 26 1b 20 41 44 44  20 20 20 20 20 20 30 2c  |..&. ADD      0,|
000017d0  20 30 2c 20 23 33 32 30  2d 33 32 0d 07 30 12 20  | 0, #320-32..0. |
000017e0  a4 66 72 61 67 31 28 70  61 73 73 25 29 0d 07 3a  |.frag1(pass%)..:|
000017f0  3a 20 a4 66 72 61 67 31  28 70 61 73 73 25 29 20  |: .frag1(pass%) |
00001800  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 70  |              ;p|
00001810  6c 6f 74 20 32 6e 64 20  68 61 6c 66 20 6f 66 20  |lot 2nd half of |
00001820  35 74 68 20 72 6f 77 0d  07 44 1b 20 41 44 44 20  |5th row..D. ADD |
00001830  20 20 20 20 20 30 2c 20  30 2c 20 23 33 32 30 2d  |     0, 0, #320-|
00001840  33 32 0d 07 4e 16 20 53  55 42 53 20 20 20 20 20  |32..N. SUBS     |
00001850  32 2c 20 32 2c 20 23 31  0d 07 58 45 20 42 4e 45  |2, 2, #1..XE BNE|
00001860  20 20 20 20 20 20 6c 6f  6f 70 31 25 20 20 20 20  |      loop1%    |
00001870  20 20 20 20 20 20 3b 72  65 70 65 61 74 20 61 62  |      ;repeat ab|
00001880  6f 76 65 20 37 20 74 69  6d 65 73 20 74 6f 20 64  |ove 7 times to d|
00001890  6f 20 61 6c 6c 20 33 35  20 72 6f 77 73 0d 07 62  |o all 35 rows..b|
000018a0  44 20 41 44 52 20 20 20  20 20 20 31 31 2c 20 61  |D ADR      11, a|
000018b0  70 6c 6f 74 72 65 67 73  25 20 20 20 20 20 20 3b  |plotregs%      ;|
000018c0  70 6c 6f 74 20 63 6f 6d  70 6c 65 74 65 64 20 2d  |plot completed -|
000018d0  20 72 65 74 75 72 6e 20  74 6f 20 63 61 6c 6c 65  | return to calle|
000018e0  72 0d 07 6c 38 20 4c 44  4d 49 41 20 20 20 20 31  |r..l8 LDMIA    1|
000018f0  31 2c 20 7b 31 32 2c 31  33 2c 50 43 7d 20 20 20  |1, {12,13,PC}   |
00001900  20 20 20 3b 70 72 65 73  65 72 76 69 6e 67 20 72  |   ;preserving r|
00001910  31 32 20 26 20 72 31 33  2e 0d 07 76 06 20 3a 0d  |12 & r13...v. :.|
00001920  07 80 14 20 2e 61 6c 72  63 6c 73 25 20 45 51 55  |... .alrcls% EQU|
00001930  44 20 30 0d 07 8a 14 20  2e 61 73 70 63 6c 73 25  |D 0.... .aspcls%|
00001940  20 45 51 55 44 20 30 0d  07 94 41 20 2e 63 6c 73  | EQUD 0...A .cls|
00001950  25 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |%               |
00001960  20 20 20 20 20 20 20 20  20 3b 73 69 6d 70 6c 65  |         ;simple|
00001970  20 72 6f 75 74 69 6e 65  20 74 6f 20 63 6c 65 61  | routine to clea|
00001980  72 20 73 63 72 65 65 6e  0d 07 9e 3b 20 53 54 52  |r screen...; STR|
00001990  20 20 20 20 20 20 31 34  2c 20 61 6c 72 63 6c 73  |      14, alrcls|
000019a0  25 20 20 20 20 20 20 20  20 20 3b 61 73 20 72 61  |%         ;as ra|
000019b0  70 69 64 6c 79 20 61 73  20 70 6f 73 73 69 62 6c  |pidly as possibl|
000019c0  65 20 2d 0d 07 a8 3d 20  53 54 52 20 20 20 20 20  |e -...= STR     |
000019d0  20 31 33 2c 20 61 73 70  63 6c 73 25 20 20 20 20  | 13, aspcls%    |
000019e0  20 20 20 20 20 3b 6e 6f  74 65 20 74 68 65 20 68  |     ;note the h|
000019f0  65 61 76 79 20 75 73 65  20 6f 66 20 53 54 4d 2e  |eavy use of STM.|
00001a00  0d 07 b2 18 20 4c 44 52  20 20 20 20 20 20 30 2c  |.... LDR      0,|
00001a10  20 61 73 63 72 73 74 25  0d 07 bc 15 20 4d 4f 56  | ascrst%.... MOV|
00001a20  20 20 20 20 20 20 31 2c  20 23 31 30 35 0d 07 c6  |      1, #105...|
00001a30  15 20 4d 4f 56 20 20 20  20 20 20 32 2c 20 23 26  |. MOV      2, #&|
00001a40  31 31 0d 07 d0 1c 20 84  52 20 20 20 20 20 20 32  |11.... .R      2|
00001a50  2c 20 32 2c 20 32 2c 20  4c 53 4c 20 23 38 0d 07  |, 2, 2, LSL #8..|
00001a60  da 1d 20 84 52 20 20 20  20 20 20 32 2c 20 32 2c  |.. .R      2, 2,|
00001a70  20 32 2c 20 4c 53 4c 20  23 31 36 0d 07 e4 12 20  | 2, LSL #16.... |
00001a80  4d 4f 56 20 20 20 20 20  20 33 2c 20 32 0d 07 ee  |MOV      3, 2...|
00001a90  12 20 4d 4f 56 20 20 20  20 20 20 34 2c 20 32 0d  |. MOV      4, 2.|
00001aa0  07 f8 12 20 4d 4f 56 20  20 20 20 20 20 35 2c 20  |... MOV      5, |
00001ab0  32 0d 08 02 12 20 4d 4f  56 20 20 20 20 20 20 36  |2.... MOV      6|
00001ac0  2c 20 32 0d 08 0c 12 20  4d 4f 56 20 20 20 20 20  |, 2.... MOV     |
00001ad0  20 37 2c 20 32 0d 08 16  12 20 4d 4f 56 20 20 20  | 7, 2.... MOV   |
00001ae0  20 20 20 38 2c 20 32 0d  08 20 12 20 4d 4f 56 20  |   8, 2.. . MOV |
00001af0  20 20 20 20 20 39 2c 20  32 0d 08 2a 13 20 4d 4f  |     9, 2..*. MO|
00001b00  56 20 20 20 20 20 20 31  30 2c 20 32 0d 08 34 13  |V      10, 2..4.|
00001b10  20 4d 4f 56 20 20 20 20  20 20 31 31 2c 20 32 0d  | MOV      11, 2.|
00001b20  08 3e 13 20 4d 4f 56 20  20 20 20 20 20 31 32 2c  |.>. MOV      12,|
00001b30  20 32 0d 08 48 13 20 4d  4f 56 20 20 20 20 20 20  | 2..H. MOV      |
00001b40  31 33 2c 20 32 0d 08 52  13 20 4d 4f 56 20 20 20  |13, 2..R. MOV   |
00001b50  20 20 20 31 34 2c 20 32  0d 08 5c 0e 20 2e 63 6c  |   14, 2..\. .cl|
00001b60  73 6c 6f 6f 70 25 0d 08  66 18 20 53 54 4d 49 41  |sloop%..f. STMIA|
00001b70  20 20 20 20 30 21 2c 20  7b 32 2d 31 34 7d 0d 08  |    0!, {2-14}..|
00001b80  70 18 20 53 54 4d 49 41  20 20 20 20 30 21 2c 20  |p. STMIA    0!, |
00001b90  7b 32 2d 31 34 7d 0d 08  7a 18 20 53 54 4d 49 41  |{2-14}..z. STMIA|
00001ba0  20 20 20 20 30 21 2c 20  7b 32 2d 31 34 7d 0d 08  |    0!, {2-14}..|
00001bb0  84 18 20 53 54 4d 49 41  20 20 20 20 30 21 2c 20  |.. STMIA    0!, |
00001bc0  7b 32 2d 31 34 7d 0d 08  8e 18 20 53 54 4d 49 41  |{2-14}.... STMIA|
00001bd0  20 20 20 20 30 21 2c 20  7b 32 2d 31 34 7d 0d 08  |    0!, {2-14}..|
00001be0  98 18 20 53 54 4d 49 41  20 20 20 20 30 21 2c 20  |.. STMIA    0!, |
00001bf0  7b 32 2d 31 34 7d 0d 08  a2 18 20 53 54 4d 49 41  |{2-14}.... STMIA|
00001c00  20 20 20 20 30 21 2c 20  7b 32 2d 31 34 7d 0d 08  |    0!, {2-14}..|
00001c10  ac 18 20 53 54 4d 49 41  20 20 20 20 30 21 2c 20  |.. STMIA    0!, |
00001c20  7b 32 2d 31 34 7d 0d 08  b6 18 20 53 54 4d 49 41  |{2-14}.... STMIA|
00001c30  20 20 20 20 30 21 2c 20  7b 32 2d 31 34 7d 0d 08  |    0!, {2-14}..|
00001c40  c0 18 20 53 54 4d 49 41  20 20 20 20 30 21 2c 20  |.. STMIA    0!, |
00001c50  7b 32 2d 31 34 7d 0d 08  ca 18 20 53 54 4d 49 41  |{2-14}.... STMIA|
00001c60  20 20 20 20 30 21 2c 20  7b 32 2d 31 34 7d 0d 08  |    0!, {2-14}..|
00001c70  d4 18 20 53 54 4d 49 41  20 20 20 20 30 21 2c 20  |.. STMIA    0!, |
00001c80  7b 32 2d 31 34 7d 0d 08  de 18 20 53 54 4d 49 41  |{2-14}.... STMIA|
00001c90  20 20 20 20 30 21 2c 20  7b 32 2d 31 34 7d 0d 08  |    0!, {2-14}..|
00001ca0  e8 18 20 53 54 4d 49 41  20 20 20 20 30 21 2c 20  |.. STMIA    0!, |
00001cb0  7b 32 2d 31 34 7d 0d 08  f2 18 20 53 54 4d 49 41  |{2-14}.... STMIA|
00001cc0  20 20 20 20 30 21 2c 20  7b 32 2d 31 34 7d 0d 08  |    0!, {2-14}..|
00001cd0  fc 16 20 53 55 42 53 20  20 20 20 20 31 2c 20 31  |.. SUBS     1, 1|
00001ce0  2c 20 23 31 0d 09 06 16  20 42 4e 45 20 20 20 20  |, #1.... BNE    |
00001cf0  20 20 63 6c 73 6c 6f 6f  70 25 0d 09 10 17 20 53  |  clsloop%.... S|
00001d00  54 4d 49 41 20 20 20 20  30 21 2c 20 7b 32 2d 36  |TMIA    0!, {2-6|
00001d10  7d 0d 09 1a 19 20 4c 44  52 20 20 20 20 20 20 31  |}.... LDR      1|
00001d20  33 2c 20 61 73 70 63 6c  73 25 0d 09 24 19 20 4c  |3, aspcls%..$. L|
00001d30  44 52 20 20 20 20 20 20  50 43 2c 20 61 6c 72 63  |DR      PC, alrc|
00001d40  6c 73 25 0d 09 2e 06 20  5d 0d 09 38 05 ed 0d 09  |ls%.... ]..8....|
00001d50  42 05 e1 0d 09 4c 05 3a  0d 09 56 40 dd 20 a4 66  |B....L.:..V@. .f|
00001d60  72 61 67 31 28 70 61 73  73 25 29 20 20 20 20 20  |rag1(pass%)     |
00001d70  20 20 3a f4 20 6d 61 63  72 6f 20 74 6f 20 70 6c  |  :. macro to pl|
00001d80  6f 74 20 31 2f 32 20 61  20 72 6f 77 20 28 33 32  |ot 1/2 a row (32|
00001d90  20 70 69 78 65 6c 73 29  0d 09 60 2d 5b 4f 50 54  | pixels)..`-[OPT|
00001da0  20 70 61 73 73 25 20 20  20 20 20 20 20 20 20 20  | pass%          |
00001db0  20 20 20 20 20 3a f4 20  6f 66 20 6f 75 72 20 73  |     :. of our s|
00001dc0  70 72 69 74 65 0d 09 6a  45 4c 44 4d 49 41 20 20  |prite..jELDMIA  |
00001dd0  20 20 30 2c 20 7b 33 2d  36 7d 20 20 20 20 20 20  |  0, {3-6}      |
00001de0  20 20 20 20 20 20 20 3b  72 65 61 64 20 34 20 77  |       ;read 4 w|
00001df0  6f 72 64 73 20 6f 66 20  73 63 72 65 65 6e 20 28  |ords of screen (|
00001e00  33 32 20 70 69 78 65 6c  73 29 0d 09 74 43 4c 44  |32 pixels)..tCLD|
00001e10  4d 49 41 20 20 20 20 31  21 2c 20 7b 37 2d 31 34  |MIA    1!, {7-14|
00001e20  7d 20 20 20 20 20 20 20  20 20 20 20 3b 72 65 61  |}           ;rea|
00001e30  64 20 33 32 20 73 70 72  69 74 65 20 70 69 78 65  |d 32 sprite pixe|
00001e40  6c 73 20 26 20 33 32 20  6d 61 73 6b 73 0d 09 7e  |ls & 32 masks..~|
00001e50  3e 80 20 20 20 20 20 20  33 2c 20 33 2c 20 38 20  |>.      3, 3, 8 |
00001e60  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 61 70  |             ;ap|
00001e70  70 6c 79 20 6d 61 73 6b  20 74 6f 20 73 63 72 65  |ply mask to scre|
00001e80  65 6e 2c 20 7a 65 72 6f  69 6e 67 0d 09 88 3d 80  |en, zeroing...=.|
00001e90  20 20 20 20 20 20 34 2c  20 34 2c 20 31 30 20 20  |      4, 4, 10  |
00001ea0  20 20 20 20 20 20 20 20  20 20 20 3b 20 74 68 6f  |           ; tho|
00001eb0  73 65 20 62 69 74 73 20  77 68 65 72 65 20 77 69  |se bits where wi|
00001ec0  6c 6c 20 77 72 69 74 65  0d 09 92 3a 80 20 20 20  |ll write...:.   |
00001ed0  20 20 20 35 2c 20 35 2c  20 31 32 20 20 20 20 20  |   5, 5, 12     |
00001ee0  20 20 20 20 20 20 20 20  3b 20 73 70 72 69 74 65  |        ; sprite|
00001ef0  20 69 6d 61 67 65 20 69  6e 20 61 20 6d 6f 6d 65  | image in a mome|
00001f00  6e 74 0d 09 9c 13 80 20  20 20 20 20 20 36 2c 20  |nt.....      6, |
00001f10  36 2c 20 31 34 0d 09 a6  3b 84 52 20 20 20 20 20  |6, 14...;.R     |
00001f20  20 33 2c 20 33 2c 20 37  20 20 20 20 20 20 20 20  | 3, 3, 7        |
00001f30  20 20 20 20 20 20 3b 77  72 69 74 65 20 69 6e 20  |      ;write in |
00001f40  74 68 65 20 73 70 72 69  74 65 20 69 6d 61 67 65  |the sprite image|
00001f50  0d 09 b0 13 84 52 20 20  20 20 20 20 34 2c 20 34  |.....R      4, 4|
00001f60  2c 20 39 0d 09 ba 14 84  52 20 20 20 20 20 20 35  |, 9.....R      5|
00001f70  2c 20 35 2c 20 31 31 0d  09 c4 14 84 52 20 20 20  |, 5, 11.....R   |
00001f80  20 20 20 36 2c 20 36 2c  20 31 33 0d 09 ce 42 53  |   6, 6, 13...BS|
00001f90  54 4d 49 41 20 20 20 20  30 21 2c 20 7b 33 2d 36  |TMIA    0!, {3-6|
00001fa0  7d 20 20 20 20 20 20 20  20 20 20 20 20 3b 72 65  |}            ;re|
00001fb0  73 74 6f 72 65 20 74 68  65 20 64 61 74 61 20 62  |store the data b|
00001fc0  61 63 6b 20 74 6f 20 73  63 72 65 65 6e 0d 09 d8  |ack to screen...|
00001fd0  05 5d 0d 09 e2 0a 3d 70  61 73 73 25 0d ff        |.]....=pass%..|
00001fde