Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Features » DiffDim/Triangle3

DiffDim/Triangle3

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 » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Features
Filename: DiffDim/Triangle3
Read OK:
File size: 2080 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM Triangle 3
   20REM
   30REM Demonstrate texture mapping with triangles
   40:
   50ON ERROR MODE0:PRINT REPORT$;" at line ";ERL:END
   60*RUN 256Mode20
   70PROCassemble
   80CALL setup
   90DIM x%(3),y%(3)
  100x%()=100,100,700,700
  110y%()=700,100,700,100
  120:
  130bk%=1
  140PROCdraw
  150PROCdraw
  160MOUSE ON
  170REPEAT
  180REPEAT
  190MOUSE mx%,my%,b%
  200UNTIL b%=4
  210:
  220i%=-1:md%=10000
  230FORn%=0 TO 3
  240dx%=mx%-x%(n%):dy%=my%-y%(n%)
  250d%=dx%*dx%+dy%*dy%
  260IF d%<md% md%=d%:i%=n%
  270NEXT
  280IF i%<>-1 THEN PROCchange(i%)
  290UNTIL FALSE
  300END
  310:
  320DEFPROCchange(i%)
  330REPEAT
  340MOUSE x%(i%),y%(i%),b%
  350PROCdraw
  360UNTIL b%=0
  370PROCdraw
  380ENDPROC
  390:
  400DEFPROCdraw
  410SYS"OS_Byte",112,bk%
  420SWAP !screenadr,screenadr!4
  430bk%=3-bk%
  440WAIT
  450SYS"OS_Byte",113,bk%
  460CLS
  470ax%=x%(0)>>1:ay%=512-(y%(0)>>1)
  480bx%=x%(1)>>1:by%=512-(y%(1)>>1)
  490cx%=x%(2)>>1:cy%=512-(y%(2)>>1)
  500dx%=x%(3)>>1:dy%=512-(y%(3)>>1)
  510REM First triangle
  520IF bx%*cy%+cx%*ay%+ax%*by%>bx%*ay%+cx%*by%+ax%*cy% THEN
  530  !ax=ax%:!ay=ay%:!au=0:!av=0
  540  !bx=bx%:!by=by%:!bu=0:!bv=255
  550  !cx=cx%:!cy=cy%:!cu=255:!cv=0
  560ELSE
  570  !ax=bx%:!ay=by%:!au=0:!av=255
  580  !bx=ax%:!by=ay%:!bu=0:!bv=0
  590  !cx=cx%:!cy=cy%:!cu=255:!cv=0
  600ENDIF
  610CALL texture_triangle
  620
  630REM Second triangle
  640IF bx%*cy%+cx%*dy%+dx%*by%>bx%*dy%+cx%*by%+dx%*cy% THEN
  650  !ax=dx%:!ay=dy%:!au=255:!av=255
  660  !bx=bx%:!by=by%:!bu=0:!bv=255
  670  !cx=cx%:!cy=cy%:!cu=255:!cv=0
  680ELSE
  690  !ax=bx%:!ay=by%:!au=0:!av=255
  700  !bx=dx%:!by=dy%:!bu=255:!bv=255
  710  !cx=cx%:!cy=cy%:!cu=255:!cv=0
  720ENDIF
  730CALL texture_triangle
  740
  750REM Draw control handles
  760FORn%=0 TO 3
  770CIRCLE x%(n%),y%(n%),10
  780NEXT
  790ENDPROC
  800:
  810DEFPROCassemble
  820q_step%=16:sstep%=256/q_step%
  830log2_q_step%=LOG(q_step%)/LOG(2)
  840DIM code% 16384,div_table% 65536*4,sprite% 65592
  850FOR pass%=0 TO 2 STEP 2
  860P%=code%
  870[OPT pass%
  880.setup
  890ldr r0,div_table        ; build divide lookup table
  900mov r2,#1
  910
  920.dl
  930mov r4,#1<<20
  940mov r5,#0               ; remainder
  950mov r6,#0               ; quotient
  960mov r7,#1<<31
  970.div_loop
  980movs r4,r4,lsl#1
  990adc r5,r5,r5
 1000cmp r5,r2
 1010subge r5,r5,r2
 1020orrge r6,r6,r7
 1030movs r7,r7,lsr#1
 1040bne div_loop
 1050
 1060; r6 = r4 div r2 = s
 1070
 1080str r6,[r0,#4]!
 1090add r2,r2,#1
 1100cmp r2,#65536
 1110ble dl
 1120
 1130mov pc,r14
 1140
 1150.div_table
 1160dcd div_table%
 1170
 1180
 1190.stackp
 1200dcd 0
 1210.link
 1220dcd 0
 1230.div_table
 1240dcd div_table%
 1250.r_index
 1260dcd 0
 1270.l_index
 1280dcd 0
 1290
 1300.y_end
 1310dcd 0
 1320
 1330.sprite
 1340dcd sprite%+56
 1350.screenadr
 1360dcd FNscreenadr(2)
 1370dcd FNscreenadr(1)
 1380
 1390.ay:dcd 0:.ax:dcd 0
 1400.ac:dcd 255
 1410.au:dcd 0:.av:dcd 0
 1420dcd 0:dcd 0:dcd 0
 1430
 1440.by:dcd 0:.bx:dcd 0
 1450.bc:dcd 255
 1460.bu:dcd 0:.bv:dcd 0
 1470dcd 0:dcd 0:dcd 0
 1480
 1490.cy:dcd 0:.cx:dcd 0
 1500.cc:dcd 255
 1510.cu:dcd 0:.cv:dcd 0
 1520dcd 0:dcd 0:dcd 0
 1530
 1540.texture_triangle
 1550adr r0,ay
 1560ldr r10,[r0,#0]
 1570ldr r11,[r0,#32]
 1580cmp r11,r10
 1590movlt r1,r11
 1600movge r1,r10
 1610movlt r2,#1
 1620movge r2,#0
 1630ldr r12,[r0,#64]
 1640cmp r12,r1
 1650movlt r1,r12
 1660movlt r2,#2
 1670cmp r1,#512
 1680movge pc,r14
 1690cmp r10,#0
 1700cmplt r11,#0
 1710cmplt r12,#0
 1720movlt pc,r14
 1730
 1740str r13,stackp
 1750
 1760subs r3,r2,#1
 1770movlt r3,#2
 1780
 1790add r2,r0,r2,lsl#5
 1800ldmib r2,{r5,r6,r7,r8}                  ; x_k,c_k,u_k,v_k
 1810add r4,r0,r3,lsl#5
 1820str r4,l_index
 1830subs r3,r3,#1
 1840movlt r3,#2
 1850add r0,r0,r3,lsl#5
 1860str r0,r_index
 1870ldmia r4,{r9,r10,r11,r12,r13}           ; y_l,x_l,c_l,u_l,v_l
 1880
 1890str r14,link
 1900ldr r14,div_table
 1910subs r2,r9,r1                           ; dly
 1920ldrgt r2,[r14,r2,lsl#2]                 ; 1<<20/dly
 1930
 1940movgt r3,r5,lsl#10
 1950moveq r3,r10,lsl#10
 1960subgt r4,r10,r5
 1970mul r4,r2,r4                            ; dlx<<20
 1980str r4,dlx
 1990
 2000movgt r10,r7,lsl#10
 2010moveq r10,r12,lsl#10
 2020str r10,lu
 2030subgt r4,r12,r7
 2040mul r4,r2,r4                            ; dlu<<20
 2050str r4,dlu
 2060
 2070movgt r10,r8,lsl#10
 2080moveq r10,r13,lsl#10
 2090str r10,lv
 2100subgt r4,r13,r8
 2110mul r4,r2,r4                            ; dlv<<20
 2120str r4,dlv
 2130
 2140ldmia r0,{r0,r10,r11,r12,r13}           ; y_r,x_r,c_r,u_r,v_r
 2150subs r2,r0,r1                           ; dry
 2160ldrgt r2,[r14,r2,lsl#2]                 ; 1<<20/dry
 2170
 2180movgt r4,r5,lsl#10
 2190moveq r4,r10,lsl#10
 2200subgt r10,r10,r5
 2210mul r10,r2,r10                          ; drx<<20
 2220str r10,drx
 2230
 2240movgt r10,r7,lsl#10
 2250moveq r10,r12,lsl#10
 2260str r10,ru
 2270subgt r10,r12,r7
 2280mul r10,r2,r10                          ; dru<<20
 2290str r10,dru
 2300
 2310movgt r10,r8,lsl#10
 2320moveq r10,r13,lsl#10
 2330str r10,rv
 2340subgt r10,r13,r8
 2350mul r10,r2,r10                          ; drv<<20
 2360str r10,drv
 2370
 2380ldr r2,screenadr
 2390add r2,r2,r1,lsl#7
 2400add r2,r2,r1,lsl#9                      ; screen line
 2410
 2420MOV R14,R1
 2430ldr r10,sprite
 2440
 2450cmp r9,r0
 2460strlt r9,y_end
 2470strge r0,y_end
 2480
 2490bgt method_2
 2500beq last_bit
 2510
 2520.method_1                               ; left_y<right_y
 2530
 2540FNyloop
 2550
 2560; r0 = y_l
 2570; r2 = scline
 2580; r3 = lx
 2590; r4 = rx
 2600; r1,r5-r14 = empty
 2610
 2620; recalcuate dlx,dlu,dlv,dlc
 2630ldr r1,l_index
 2640ldmib r1,{r3,r10,r11,r12}               ; x_l,c_l,u_l,v_l
 2650ldr r1,r_index
 2660ldmia r1,{r1,r5,r6,r7,r8}               ; y_r,x_r,c_r,u_r,v_r
 2670str r1,y_end
 2680
 2690subs r1,r1,r0                           ; dly
 2700ldr r14,div_table
 2710
 2720ldrgt r1,[r14,r1,lsl#2]                 ; 1<<20/dly
 2730subgt r7,r7,r11
 2740mul r7,r1,r7                            ; dlu<<20
 2750str r7,dlu
 2760subgt r5,r5,r3
 2770mov r3,r3,lsl#10
 2780mul r5,r1,r5                            ; dlx<<20
 2790str r5,dlx
 2800
 2810subgt r5,r8,r12
 2820mul r5,r1,r5                            ; dlv<<20
 2830str r5,dlv
 2840
 2850ldr r10,sprite
 2860
 2870MOV R14,R0
 2880.last_bit
 2890FNyloop
 2900
 2910ldr r13,stackp
 2920ldr r15,link
 2930
 2940
 2950.method_2                               ; right_y< left_y
 2960FNyloop
 2970
 2980; r0 = y_l
 2990; r2 = scline
 3000; r3 = lx
 3010; r4 = rx
 3020; r1,r5-r14 = empty
 3030
 3040; recalcuate drx,dru,drv,drc
 3050ldr r1,r_index
 3060ldmib r1,{r4,r10,r11,r12}               ; x_r,c_r,u_r,v_r
 3070ldr r1,l_index
 3080ldmia r1,{r1,r5,r6,r7,r8}               ; y_l,x_l,c_l,u_l,v_l
 3090str r1,y_end
 3100
 3110subs r1,r1,r0                           ; dly
 3120ldr r14,div_table
 3130
 3140ldrgt r1,[r14,r1,lsl#2]                 ; 1<<20/dly
 3150subgt r5,r5,r4
 3160mov r4,r4,lsl#10
 3170mul r5,r1,r5                            ; dlx<<20
 3180str r5,drx
 3190subgt r5,r7,r11
 3200mul r5,r1,r5                            ; dlu<<20
 3210str r5,dru
 3220subgt r5,r8,r12
 3230mul r5,r1,r5                            ; dlv<<20
 3240str r5,drv
 3250
 3260ldr r10,sprite
 3270MOV R14,R0
 3280FNyloop
 3290
 3300ldr r13,stackp
 3310ldr r15,link
 3320
 3330.line
 3340dcd 0
 3350
 3360.coords
 3370.lu:dcd 0:.ru:dcd 0
 3380.lc:dcd 0:.rc:dcd 0
 3390.lv:dcd 0:.rv:dcd 0
 3400.dlx:dcd 0:.drx:dcd 0
 3410.dlc:dcd 0:.drc:dcd 0
 3420.dlu:dcd 0:.dru:dcd 0
 3430.dlv:dcd 0:.drv:dcd 0
 3440
 3450]
 3460NEXT
 3470SYS"OS_File",16,"Picture",sprite%
 3480ENDPROC
 3490:
 3500DEFFNyloop
 3510[OPT pass%
 3520; r2 = sc
 3530; r3 = lx
 3540; r4 = rx
 3550; r14 = y_k
 3560
 3570.yloop
 3580subs r0,r4,r3                   ; dx<<10
 3590add r12,r2,r3,asr#10            ; left adr
 3600ldr r13,dlx
 3610add r3,r3,r13,asr#10            ; lx+=dlx
 3620ldr r11,drx
 3630add r13,r2,r4,asr#10            ; right adr
 3640add r4,r4,r11,asr#10            ; rx+=drx
 3650ldr r11,div_table
 3660mov r0,r0,asr#5
 3670ldrgt r0,[r11,r0,lsl#2]         ; 1<<18/dx
 3680ldr r9,lu
 3690ldr r8,ru
 3700
 3710sub r6,r8,r9                    ; du<<10
 3720mul r6,r0,r6                    ; du<<24
 3730
 3740ldr r7,dru
 3750add r8,r8,r7,asr#10
 3760str r8,ru
 3770
 3780ldr r7,dlu
 3790add r8,r9,r7,asr#10
 3800str r8,lu
 3810
 3820ldr r8,lv
 3830ldr r1,rv
 3840sub r7,r1,r8                    ; dv<<10
 3850mul r7,r0,r7                    ; dv<<21
 3860ldr r0,drv
 3870add r1,r1,r0,asr#10
 3880str r1,rv
 3890ldr r0,dlv
 3900add r0,r8,r0,asr#10
 3910str r0,lv
 3920add r2,r2,#640
 3930str r2,line
 3940
 3950mov r9,r9,lsl#14
 3960mov r8,r8,lsl#14
 3970mov r11,r11,lsl#14
 3980
 3990; dc = r5
 4000; du = r6
 4010; dv = r7
 4020; v = r8
 4030; u = r9
 4040; sprite = r10
 4050; c = r11
 4060; left_adr = r12
 4070; right_adr = r13
 4080; r1 = col table
 4090
 4100.xloop
 4110and r0,r8,#255<<24
 4120orr r0,r0,r9,lsr#8
 4130ldrb r0,[r10,r0,lsr#16]
 4140strb r0,[r12],#1
 4150cmp r12,r13
 4160addle r2,r2,#1<<31
 4170addle r8,r8,r7,asr#1
 4180addle r9,r9,r6,asr#1
 4190ble xloop
 4200
 4210ldr r2,line
 4220ldr r0,y_end
 4230add r14,r14,#1
 4240cmp r14,r0
 4250blt yloop
 4260
 4270]
 4280=0
 4290:
 4300DEFFNscreenadr(bk%)
 4310SYS"OS_Byte",112,bk%
 4320SYS"OS_Byte",113,bk%
 4330DIM q% 8
 4340!q%=148:q%!4=-1
 4350SYS"OS_ReadVduVariables",q%,q%
 4360=!q%

� Triangle 3
�
0� Demonstrate texture mapping with triangles
(:
2� � �0:� �$;" at line ";�:�
<*RUN 256Mode20
F
�assemble
P� setup
Z� x%(3),y%(3)
dx%()=100,100,700,700
ny%()=700,100,700,100
x:
�	bk%=1
�	�draw
�	�draw
�ȗ �
��
��
�ȗ mx%,my%,b%
�
� b%=4
�:
�i%=-1:md%=10000
�
�n%=0 � 3
�!dx%=mx%-x%(n%):dy%=my%-y%(n%)
�d%=dx%*dx%+dy%*dy%
� d%<md% md%=d%:i%=n%
�
� i%<>-1 � �change(i%)
"� �
,�
6:
@��change(i%)
J�
Tȗ x%(i%),y%(i%),b%
^	�draw
h
� b%=0
r	�draw
|�
�:
�
��draw
�ș"OS_Byte",112,bk%
�Ȕ !screenadr,screenadr!4
�
bk%=3-bk%
�Ȗ
�ș"OS_Byte",113,bk%
��
�#ax%=x%(0)>>1:ay%=512-(y%(0)>>1)
�#bx%=x%(1)>>1:by%=512-(y%(1)>>1)
�#cx%=x%(2)>>1:cy%=512-(y%(2)>>1)
�#dx%=x%(3)>>1:dy%=512-(y%(3)>>1)
�� First triangle
7� bx%*cy%+cx%*ay%+ax%*by%>bx%*ay%+cx%*by%+ax%*cy% �
!  !ax=ax%:!ay=ay%:!au=0:!av=0
#  !bx=bx%:!by=by%:!bu=0:!bv=255
&#  !cx=cx%:!cy=cy%:!cu=255:!cv=0
0�
:#  !ax=bx%:!ay=by%:!au=0:!av=255
D!  !bx=ax%:!by=ay%:!bu=0:!bv=0
N#  !cx=cx%:!cy=cy%:!cu=255:!cv=0
X�
b� texture_triangle
l
v� Second triangle
�7� bx%*cy%+cx%*dy%+dx%*by%>bx%*dy%+cx%*by%+dx%*cy% �
�%  !ax=dx%:!ay=dy%:!au=255:!av=255
�#  !bx=bx%:!by=by%:!bu=0:!bv=255
�#  !cx=cx%:!cy=cy%:!cu=255:!cv=0
��
�#  !ax=bx%:!ay=by%:!au=0:!av=255
�%  !bx=dx%:!by=dy%:!bu=255:!bv=255
�#  !cx=cx%:!cy=cy%:!cu=255:!cv=0
��
�� texture_triangle
�
�� Draw control handles
�
�n%=0 � 3
ȏ x%(n%),y%(n%),10
�
�
 :
*��assemble
4!q_step%=16:sstep%=256/q_step%
> log2_q_step%=�(q_step%)/�(2)
H2� code% 16384,div_table% 65536*4,sprite% 65592
R� pass%=0 � 2 � 2
\P%=code%
f[OPT pass%
p
.setup
z7ldr r0,div_table        ; build divide lookup table
�
mov r2,#1
�
�.dl
�mov r4,#1<<20
�'mov r5,#0               ; remainder
�&mov r6,#0               ; quotient
�mov r7,#1<<31
�
.div_loop
�movs r4,r4,lsl#1
�adc r5,r5,r5
�
cmp r5,r2
�subge r5,r5,r2
�orrge r6,r6,r7
movs r7,r7,lsr#1
bne div_loop

$; r6 = r4 div r2 = s
.
8str r6,[r0,#4]!
Badd r2,r2,#1
Lcmp r2,#65536
V
ble dl
`
jmov pc,r14
t
~.div_table
�dcd div_table%
�
�
�.stackp
�	dcd 0
�	.link
�	dcd 0
�.div_table
�dcd div_table%
�.r_index
�	dcd 0
�.l_index
	dcd 0



.y_end
	dcd 0
(
2.sprite
<dcd sprite%+56
F.screenadr
Pdcd �screenadr(2)
Zdcd �screenadr(1)
d
n.ay:dcd 0:.ax:dcd 0
x.ac:dcd 255
�.au:dcd 0:.av:dcd 0
�dcd 0:dcd 0:dcd 0
�
�.by:dcd 0:.bx:dcd 0
�.bc:dcd 255
�.bu:dcd 0:.bv:dcd 0
�dcd 0:dcd 0:dcd 0
�
�.cy:dcd 0:.cx:dcd 0
�.cc:dcd 255
�.cu:dcd 0:.cv:dcd 0
�dcd 0:dcd 0:dcd 0
�
.texture_triangle

adr r0,ay
ldr r10,[r0,#0]
"ldr r11,[r0,#32]
,cmp r11,r10
6movlt r1,r11
@movge r1,r10
Jmovlt r2,#1
Tmovge r2,#0
^ldr r12,[r0,#64]
hcmp r12,r1
rmovlt r1,r12
|movlt r2,#2
�cmp r1,#512
�movge pc,r14
�cmp r10,#0
�cmplt r11,#0
�cmplt r12,#0
�movlt pc,r14
�
�str r13,stackp
�
�subs r3,r2,#1
�movlt r3,#2
�
�add r2,r0,r2,lsl#5
=ldmib r2,{r5,r6,r7,r8}                  ; x_k,c_k,u_k,v_k
add r4,r0,r3,lsl#5
str r4,l_index
&subs r3,r3,#1
0movlt r3,#2
:add r0,r0,r3,lsl#5
Dstr r0,r_index
NAldmia r4,{r9,r10,r11,r12,r13}           ; y_l,x_l,c_l,u_l,v_l
X
bstr r14,link
lldr r14,div_table
v1subs r2,r9,r1                           ; dly
�7ldrgt r2,[r14,r2,lsl#2]                 ; 1<<20/dly
�
�movgt r3,r5,lsl#10
�moveq r3,r10,lsl#10
�subgt r4,r10,r5
�5mul r4,r2,r4                            ; dlx<<20
�str r4,dlx
�
�movgt r10,r7,lsl#10
�moveq r10,r12,lsl#10
�str r10,lu
�subgt r4,r12,r7
�5mul r4,r2,r4                            ; dlu<<20
str r4,dlu

movgt r10,r8,lsl#10
 moveq r10,r13,lsl#10
*str r10,lv
4subgt r4,r13,r8
>5mul r4,r2,r4                            ; dlv<<20
Hstr r4,dlv
R
\Aldmia r0,{r0,r10,r11,r12,r13}           ; y_r,x_r,c_r,u_r,v_r
f1subs r2,r0,r1                           ; dry
p7ldrgt r2,[r14,r2,lsl#2]                 ; 1<<20/dry
z
�movgt r4,r5,lsl#10
�moveq r4,r10,lsl#10
�subgt r10,r10,r5
�5mul r10,r2,r10                          ; drx<<20
�str r10,drx
�
�movgt r10,r7,lsl#10
�moveq r10,r12,lsl#10
�str r10,ru
�subgt r10,r12,r7
�5mul r10,r2,r10                          ; dru<<20
�str r10,dru
�
	movgt r10,r8,lsl#10
	moveq r10,r13,lsl#10
	str r10,rv
	$subgt r10,r13,r8
	.5mul r10,r2,r10                          ; drv<<20
	8str r10,drv
	B
	Lldr r2,screenadr
	Vadd r2,r2,r1,lsl#7
	`9add r2,r2,r1,lsl#9                      ; screen line
	j
	tMOV R14,R1
	~ldr r10,sprite
	�
	�
cmp r9,r0
	�strlt r9,y_end
	�strge r0,y_end
	�
	�bgt method_2
	�beq last_bit
	�
	�<.method_1                               ; left_y<right_y
	�
	�
�yloop
	�
; r0 = y_l

; r2 = scline

; r3 = lx

; r4 = rx
(; r1,r5-r14 = empty
2
< ; recalcuate dlx,dlu,dlv,dlc
Fldr r1,l_index
P=ldmib r1,{r3,r10,r11,r12}               ; x_l,c_l,u_l,v_l
Zldr r1,r_index
dAldmia r1,{r1,r5,r6,r7,r8}               ; y_r,x_r,c_r,u_r,v_r
nstr r1,y_end
x
�1subs r1,r1,r0                           ; dly
�ldr r14,div_table
�
�7ldrgt r1,[r14,r1,lsl#2]                 ; 1<<20/dly
�subgt r7,r7,r11
�5mul r7,r1,r7                            ; dlu<<20
�str r7,dlu
�subgt r5,r5,r3
�mov r3,r3,lsl#10
�5mul r5,r1,r5                            ; dlx<<20
�str r5,dlx
�
�subgt r5,r8,r12
5mul r5,r1,r5                            ; dlv<<20
str r5,dlv

"ldr r10,sprite
,
6MOV R14,R0
@
.last_bit
J
�yloop
T
^ldr r13,stackp
hldr r15,link
r
|
�=.method_2                               ; right_y< left_y
�
�yloop
�
�; r0 = y_l
�; r2 = scline
�
; r3 = lx
�
; r4 = rx
�; r1,r5-r14 = empty
�
� ; recalcuate drx,dru,drv,drc
�ldr r1,r_index
�=ldmib r1,{r4,r10,r11,r12}               ; x_r,c_r,u_r,v_r
�ldr r1,l_index
Aldmia r1,{r1,r5,r6,r7,r8}               ; y_l,x_l,c_l,u_l,v_l
str r1,y_end

&1subs r1,r1,r0                           ; dly
0ldr r14,div_table
:
D7ldrgt r1,[r14,r1,lsl#2]                 ; 1<<20/dly
Nsubgt r5,r5,r4
Xmov r4,r4,lsl#10
b5mul r5,r1,r5                            ; dlx<<20
lstr r5,drx
vsubgt r5,r7,r11
�5mul r5,r1,r5                            ; dlu<<20
�str r5,dru
�subgt r5,r8,r12
�5mul r5,r1,r5                            ; dlv<<20
�str r5,drv
�
�ldr r10,sprite
�MOV R14,R0
�
�yloop
�
�ldr r13,stackp
�ldr r15,link
�

	.line

	dcd 0



 .coords

*.lu:dcd 0:.ru:dcd 0

4.lc:dcd 0:.rc:dcd 0

>.lv:dcd 0:.rv:dcd 0

H.dlx:dcd 0:.drx:dcd 0

R.dlc:dcd 0:.drc:dcd 0

\.dlu:dcd 0:.dru:dcd 0

f.dlv:dcd 0:.drv:dcd 0

p

z]

��

�$ș"OS_File",16,"Picture",sprite%

��

�:

�ݤyloop

�[OPT pass%

�
; r2 = sc

�
; r3 = lx

�
; r4 = rx

�; r14 = y_k

�

�
.yloop

�,subs r0,r4,r3                   ; dx<<10
.add r12,r2,r3,asr#10            ; left adr
ldr r13,dlx
-add r3,r3,r13,asr#10            ; lx+=dlx
$ldr r11,drx
./add r13,r2,r4,asr#10            ; right adr
8-add r4,r4,r11,asr#10            ; rx+=drx
Bldr r11,div_table
Lmov r0,r0,asr#5
V.ldrgt r0,[r11,r0,lsl#2]         ; 1<<18/dx
`
ldr r9,lu
j
ldr r8,ru
t
~,sub r6,r8,r9                    ; du<<10
�,mul r6,r0,r6                    ; du<<24
�
�ldr r7,dru
�add r8,r8,r7,asr#10
�
str r8,ru
�
�ldr r7,dlu
�add r8,r9,r7,asr#10
�
str r8,lu
�
�
ldr r8,lv
�
ldr r1,rv
,sub r7,r1,r8                    ; dv<<10

,mul r7,r0,r7                    ; dv<<21
ldr r0,drv
add r1,r1,r0,asr#10
(
str r1,rv
2ldr r0,dlv
<add r0,r8,r0,asr#10
F
str r0,lv
Padd r2,r2,#640
Zstr r2,line
d
nmov r9,r9,lsl#14
xmov r8,r8,lsl#14
�mov r11,r11,lsl#14
�
�
; dc = r5
�
; du = r6
�
; dv = r7
�; v = r8
�; u = r9
�; sprite = r10
�
; c = r11
�; left_adr = r12
�; right_adr = r13
�; r1 = col table
�

.xloop
and r0,r8,#255<<24
orr r0,r0,r9,lsr#8
"ldrb r0,[r10,r0,lsr#16]
,strb r0,[r12],#1
6cmp r12,r13
@addle r2,r2,#1<<31
Jaddle r8,r8,r7,asr#1
Taddle r9,r9,r6,asr#1
^
ble xloop
h
rldr r2,line
|ldr r0,y_end
�add r14,r14,#1
�cmp r14,r0
�
blt yloop
�
�]
�=0
�:
�ݤscreenadr(bk%)
�ș"OS_Byte",112,bk%
�ș"OS_Byte",113,bk%
�
� q% 8
�!q%=148:q%!4=-1
�!ș"OS_ReadVduVariables",q%,q%
=!q%
�
00000000  0d 00 0a 10 f4 20 54 72  69 61 6e 67 6c 65 20 33  |..... Triangle 3|
00000010  0d 00 14 05 f4 0d 00 1e  30 f4 20 44 65 6d 6f 6e  |........0. Demon|
00000020  73 74 72 61 74 65 20 74  65 78 74 75 72 65 20 6d  |strate texture m|
00000030  61 70 70 69 6e 67 20 77  69 74 68 20 74 72 69 61  |apping with tria|
00000040  6e 67 6c 65 73 0d 00 28  05 3a 0d 00 32 1f ee 20  |ngles..(.:..2.. |
00000050  85 20 eb 30 3a f1 20 f6  24 3b 22 20 61 74 20 6c  |. .0:. .$;" at l|
00000060  69 6e 65 20 22 3b 9e 3a  e0 0d 00 3c 12 2a 52 55  |ine ";.:...<.*RU|
00000070  4e 20 32 35 36 4d 6f 64  65 32 30 0d 00 46 0d f2  |N 256Mode20..F..|
00000080  61 73 73 65 6d 62 6c 65  0d 00 50 0b d6 20 73 65  |assemble..P.. se|
00000090  74 75 70 0d 00 5a 11 de  20 78 25 28 33 29 2c 79  |tup..Z.. x%(3),y|
000000a0  25 28 33 29 0d 00 64 18  78 25 28 29 3d 31 30 30  |%(3)..d.x%()=100|
000000b0  2c 31 30 30 2c 37 30 30  2c 37 30 30 0d 00 6e 18  |,100,700,700..n.|
000000c0  79 25 28 29 3d 37 30 30  2c 31 30 30 2c 37 30 30  |y%()=700,100,700|
000000d0  2c 31 30 30 0d 00 78 05  3a 0d 00 82 09 62 6b 25  |,100..x.:....bk%|
000000e0  3d 31 0d 00 8c 09 f2 64  72 61 77 0d 00 96 09 f2  |=1.....draw.....|
000000f0  64 72 61 77 0d 00 a0 08  c8 97 20 ee 0d 00 aa 05  |draw...... .....|
00000100  f5 0d 00 b4 05 f5 0d 00  be 11 c8 97 20 6d 78 25  |............ mx%|
00000110  2c 6d 79 25 2c 62 25 0d  00 c8 0a fd 20 62 25 3d  |,my%,b%..... b%=|
00000120  34 0d 00 d2 05 3a 0d 00  dc 13 69 25 3d 2d 31 3a  |4....:....i%=-1:|
00000130  6d 64 25 3d 31 30 30 30  30 0d 00 e6 0d e3 6e 25  |md%=10000.....n%|
00000140  3d 30 20 b8 20 33 0d 00  f0 21 64 78 25 3d 6d 78  |=0 . 3...!dx%=mx|
00000150  25 2d 78 25 28 6e 25 29  3a 64 79 25 3d 6d 79 25  |%-x%(n%):dy%=my%|
00000160  2d 79 25 28 6e 25 29 0d  00 fa 16 64 25 3d 64 78  |-y%(n%)....d%=dx|
00000170  25 2a 64 78 25 2b 64 79  25 2a 64 79 25 0d 01 04  |%*dx%+dy%*dy%...|
00000180  19 e7 20 64 25 3c 6d 64  25 20 6d 64 25 3d 64 25  |.. d%<md% md%=d%|
00000190  3a 69 25 3d 6e 25 0d 01  0e 05 ed 0d 01 18 1a e7  |:i%=n%..........|
000001a0  20 69 25 3c 3e 2d 31 20  8c 20 f2 63 68 61 6e 67  | i%<>-1 . .chang|
000001b0  65 28 69 25 29 0d 01 22  07 fd 20 a3 0d 01 2c 05  |e(i%)..".. ...,.|
000001c0  e0 0d 01 36 05 3a 0d 01  40 10 dd f2 63 68 61 6e  |...6.:..@...chan|
000001d0  67 65 28 69 25 29 0d 01  4a 05 f5 0d 01 54 17 c8  |ge(i%)..J....T..|
000001e0  97 20 78 25 28 69 25 29  2c 79 25 28 69 25 29 2c  |. x%(i%),y%(i%),|
000001f0  62 25 0d 01 5e 09 f2 64  72 61 77 0d 01 68 0a fd  |b%..^..draw..h..|
00000200  20 62 25 3d 30 0d 01 72  09 f2 64 72 61 77 0d 01  | b%=0..r..draw..|
00000210  7c 05 e1 0d 01 86 05 3a  0d 01 90 0a dd f2 64 72  ||......:......dr|
00000220  61 77 0d 01 9a 17 c8 99  22 4f 53 5f 42 79 74 65  |aw......"OS_Byte|
00000230  22 2c 31 31 32 2c 62 6b  25 0d 01 a4 1d c8 94 20  |",112,bk%...... |
00000240  21 73 63 72 65 65 6e 61  64 72 2c 73 63 72 65 65  |!screenadr,scree|
00000250  6e 61 64 72 21 34 0d 01  ae 0d 62 6b 25 3d 33 2d  |nadr!4....bk%=3-|
00000260  62 6b 25 0d 01 b8 06 c8  96 0d 01 c2 17 c8 99 22  |bk%............"|
00000270  4f 53 5f 42 79 74 65 22  2c 31 31 33 2c 62 6b 25  |OS_Byte",113,bk%|
00000280  0d 01 cc 05 db 0d 01 d6  23 61 78 25 3d 78 25 28  |........#ax%=x%(|
00000290  30 29 3e 3e 31 3a 61 79  25 3d 35 31 32 2d 28 79  |0)>>1:ay%=512-(y|
000002a0  25 28 30 29 3e 3e 31 29  0d 01 e0 23 62 78 25 3d  |%(0)>>1)...#bx%=|
000002b0  78 25 28 31 29 3e 3e 31  3a 62 79 25 3d 35 31 32  |x%(1)>>1:by%=512|
000002c0  2d 28 79 25 28 31 29 3e  3e 31 29 0d 01 ea 23 63  |-(y%(1)>>1)...#c|
000002d0  78 25 3d 78 25 28 32 29  3e 3e 31 3a 63 79 25 3d  |x%=x%(2)>>1:cy%=|
000002e0  35 31 32 2d 28 79 25 28  32 29 3e 3e 31 29 0d 01  |512-(y%(2)>>1)..|
000002f0  f4 23 64 78 25 3d 78 25  28 33 29 3e 3e 31 3a 64  |.#dx%=x%(3)>>1:d|
00000300  79 25 3d 35 31 32 2d 28  79 25 28 33 29 3e 3e 31  |y%=512-(y%(3)>>1|
00000310  29 0d 01 fe 14 f4 20 46  69 72 73 74 20 74 72 69  |)..... First tri|
00000320  61 6e 67 6c 65 0d 02 08  37 e7 20 62 78 25 2a 63  |angle...7. bx%*c|
00000330  79 25 2b 63 78 25 2a 61  79 25 2b 61 78 25 2a 62  |y%+cx%*ay%+ax%*b|
00000340  79 25 3e 62 78 25 2a 61  79 25 2b 63 78 25 2a 62  |y%>bx%*ay%+cx%*b|
00000350  79 25 2b 61 78 25 2a 63  79 25 20 8c 0d 02 12 21  |y%+ax%*cy% ....!|
00000360  20 20 21 61 78 3d 61 78  25 3a 21 61 79 3d 61 79  |  !ax=ax%:!ay=ay|
00000370  25 3a 21 61 75 3d 30 3a  21 61 76 3d 30 0d 02 1c  |%:!au=0:!av=0...|
00000380  23 20 20 21 62 78 3d 62  78 25 3a 21 62 79 3d 62  |#  !bx=bx%:!by=b|
00000390  79 25 3a 21 62 75 3d 30  3a 21 62 76 3d 32 35 35  |y%:!bu=0:!bv=255|
000003a0  0d 02 26 23 20 20 21 63  78 3d 63 78 25 3a 21 63  |..&#  !cx=cx%:!c|
000003b0  79 3d 63 79 25 3a 21 63  75 3d 32 35 35 3a 21 63  |y=cy%:!cu=255:!c|
000003c0  76 3d 30 0d 02 30 05 cc  0d 02 3a 23 20 20 21 61  |v=0..0....:#  !a|
000003d0  78 3d 62 78 25 3a 21 61  79 3d 62 79 25 3a 21 61  |x=bx%:!ay=by%:!a|
000003e0  75 3d 30 3a 21 61 76 3d  32 35 35 0d 02 44 21 20  |u=0:!av=255..D! |
000003f0  20 21 62 78 3d 61 78 25  3a 21 62 79 3d 61 79 25  | !bx=ax%:!by=ay%|
00000400  3a 21 62 75 3d 30 3a 21  62 76 3d 30 0d 02 4e 23  |:!bu=0:!bv=0..N#|
00000410  20 20 21 63 78 3d 63 78  25 3a 21 63 79 3d 63 79  |  !cx=cx%:!cy=cy|
00000420  25 3a 21 63 75 3d 32 35  35 3a 21 63 76 3d 30 0d  |%:!cu=255:!cv=0.|
00000430  02 58 05 cd 0d 02 62 16  d6 20 74 65 78 74 75 72  |.X....b.. textur|
00000440  65 5f 74 72 69 61 6e 67  6c 65 0d 02 6c 04 0d 02  |e_triangle..l...|
00000450  76 15 f4 20 53 65 63 6f  6e 64 20 74 72 69 61 6e  |v.. Second trian|
00000460  67 6c 65 0d 02 80 37 e7  20 62 78 25 2a 63 79 25  |gle...7. bx%*cy%|
00000470  2b 63 78 25 2a 64 79 25  2b 64 78 25 2a 62 79 25  |+cx%*dy%+dx%*by%|
00000480  3e 62 78 25 2a 64 79 25  2b 63 78 25 2a 62 79 25  |>bx%*dy%+cx%*by%|
00000490  2b 64 78 25 2a 63 79 25  20 8c 0d 02 8a 25 20 20  |+dx%*cy% ....%  |
000004a0  21 61 78 3d 64 78 25 3a  21 61 79 3d 64 79 25 3a  |!ax=dx%:!ay=dy%:|
000004b0  21 61 75 3d 32 35 35 3a  21 61 76 3d 32 35 35 0d  |!au=255:!av=255.|
000004c0  02 94 23 20 20 21 62 78  3d 62 78 25 3a 21 62 79  |..#  !bx=bx%:!by|
000004d0  3d 62 79 25 3a 21 62 75  3d 30 3a 21 62 76 3d 32  |=by%:!bu=0:!bv=2|
000004e0  35 35 0d 02 9e 23 20 20  21 63 78 3d 63 78 25 3a  |55...#  !cx=cx%:|
000004f0  21 63 79 3d 63 79 25 3a  21 63 75 3d 32 35 35 3a  |!cy=cy%:!cu=255:|
00000500  21 63 76 3d 30 0d 02 a8  05 cc 0d 02 b2 23 20 20  |!cv=0........#  |
00000510  21 61 78 3d 62 78 25 3a  21 61 79 3d 62 79 25 3a  |!ax=bx%:!ay=by%:|
00000520  21 61 75 3d 30 3a 21 61  76 3d 32 35 35 0d 02 bc  |!au=0:!av=255...|
00000530  25 20 20 21 62 78 3d 64  78 25 3a 21 62 79 3d 64  |%  !bx=dx%:!by=d|
00000540  79 25 3a 21 62 75 3d 32  35 35 3a 21 62 76 3d 32  |y%:!bu=255:!bv=2|
00000550  35 35 0d 02 c6 23 20 20  21 63 78 3d 63 78 25 3a  |55...#  !cx=cx%:|
00000560  21 63 79 3d 63 79 25 3a  21 63 75 3d 32 35 35 3a  |!cy=cy%:!cu=255:|
00000570  21 63 76 3d 30 0d 02 d0  05 cd 0d 02 da 16 d6 20  |!cv=0.......... |
00000580  74 65 78 74 75 72 65 5f  74 72 69 61 6e 67 6c 65  |texture_triangle|
00000590  0d 02 e4 04 0d 02 ee 1a  f4 20 44 72 61 77 20 63  |......... Draw c|
000005a0  6f 6e 74 72 6f 6c 20 68  61 6e 64 6c 65 73 0d 02  |ontrol handles..|
000005b0  f8 0d e3 6e 25 3d 30 20  b8 20 33 0d 03 02 17 c8  |...n%=0 . 3.....|
000005c0  8f 20 78 25 28 6e 25 29  2c 79 25 28 6e 25 29 2c  |. x%(n%),y%(n%),|
000005d0  31 30 0d 03 0c 05 ed 0d  03 16 05 e1 0d 03 20 05  |10............ .|
000005e0  3a 0d 03 2a 0e dd f2 61  73 73 65 6d 62 6c 65 0d  |:..*...assemble.|
000005f0  03 34 21 71 5f 73 74 65  70 25 3d 31 36 3a 73 73  |.4!q_step%=16:ss|
00000600  74 65 70 25 3d 32 35 36  2f 71 5f 73 74 65 70 25  |tep%=256/q_step%|
00000610  0d 03 3e 20 6c 6f 67 32  5f 71 5f 73 74 65 70 25  |..> log2_q_step%|
00000620  3d ab 28 71 5f 73 74 65  70 25 29 2f ab 28 32 29  |=.(q_step%)/.(2)|
00000630  0d 03 48 32 de 20 63 6f  64 65 25 20 31 36 33 38  |..H2. code% 1638|
00000640  34 2c 64 69 76 5f 74 61  62 6c 65 25 20 36 35 35  |4,div_table% 655|
00000650  33 36 2a 34 2c 73 70 72  69 74 65 25 20 36 35 35  |36*4,sprite% 655|
00000660  39 32 0d 03 52 15 e3 20  70 61 73 73 25 3d 30 20  |92..R.. pass%=0 |
00000670  b8 20 32 20 88 20 32 0d  03 5c 0c 50 25 3d 63 6f  |. 2 . 2..\.P%=co|
00000680  64 65 25 0d 03 66 0e 5b  4f 50 54 20 70 61 73 73  |de%..f.[OPT pass|
00000690  25 0d 03 70 0a 2e 73 65  74 75 70 0d 03 7a 37 6c  |%..p..setup..z7l|
000006a0  64 72 20 72 30 2c 64 69  76 5f 74 61 62 6c 65 20  |dr r0,div_table |
000006b0  20 20 20 20 20 20 20 3b  20 62 75 69 6c 64 20 64  |       ; build d|
000006c0  69 76 69 64 65 20 6c 6f  6f 6b 75 70 20 74 61 62  |ivide lookup tab|
000006d0  6c 65 0d 03 84 0d 6d 6f  76 20 72 32 2c 23 31 0d  |le....mov r2,#1.|
000006e0  03 8e 04 0d 03 98 07 2e  64 6c 0d 03 a2 11 6d 6f  |........dl....mo|
000006f0  76 20 72 34 2c 23 31 3c  3c 32 30 0d 03 ac 27 6d  |v r4,#1<<20...'m|
00000700  6f 76 20 72 35 2c 23 30  20 20 20 20 20 20 20 20  |ov r5,#0        |
00000710  20 20 20 20 20 20 20 3b  20 72 65 6d 61 69 6e 64  |       ; remaind|
00000720  65 72 0d 03 b6 26 6d 6f  76 20 72 36 2c 23 30 20  |er...&mov r6,#0 |
00000730  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000740  71 75 6f 74 69 65 6e 74  0d 03 c0 11 6d 6f 76 20  |quotient....mov |
00000750  72 37 2c 23 31 3c 3c 33  31 0d 03 ca 0d 2e 64 69  |r7,#1<<31.....di|
00000760  76 5f 6c 6f 6f 70 0d 03  d4 14 6d 6f 76 73 20 72  |v_loop....movs r|
00000770  34 2c 72 34 2c 6c 73 6c  23 31 0d 03 de 10 61 64  |4,r4,lsl#1....ad|
00000780  63 20 72 35 2c 72 35 2c  72 35 0d 03 e8 0d 63 6d  |c r5,r5,r5....cm|
00000790  70 20 72 35 2c 72 32 0d  03 f2 12 73 75 62 67 65  |p r5,r2....subge|
000007a0  20 72 35 2c 72 35 2c 72  32 0d 03 fc 12 6f 72 72  | r5,r5,r2....orr|
000007b0  67 65 20 72 36 2c 72 36  2c 72 37 0d 04 06 14 6d  |ge r6,r6,r7....m|
000007c0  6f 76 73 20 72 37 2c 72  37 2c 6c 73 72 23 31 0d  |ovs r7,r7,lsr#1.|
000007d0  04 10 10 62 6e 65 20 64  69 76 5f 6c 6f 6f 70 0d  |...bne div_loop.|
000007e0  04 1a 04 0d 04 24 18 3b  20 72 36 20 3d 20 72 34  |.....$.; r6 = r4|
000007f0  20 64 69 76 20 72 32 20  3d 20 73 0d 04 2e 04 0d  | div r2 = s.....|
00000800  04 38 13 73 74 72 20 72  36 2c 5b 72 30 2c 23 34  |.8.str r6,[r0,#4|
00000810  5d 21 0d 04 42 10 61 64  64 20 72 32 2c 72 32 2c  |]!..B.add r2,r2,|
00000820  23 31 0d 04 4c 11 63 6d  70 20 72 32 2c 23 36 35  |#1..L.cmp r2,#65|
00000830  35 33 36 0d 04 56 0a 62  6c 65 20 64 6c 0d 04 60  |536..V.ble dl..`|
00000840  04 0d 04 6a 0e 6d 6f 76  20 70 63 2c 72 31 34 0d  |...j.mov pc,r14.|
00000850  04 74 04 0d 04 7e 0e 2e  64 69 76 5f 74 61 62 6c  |.t...~..div_tabl|
00000860  65 0d 04 88 12 64 63 64  20 64 69 76 5f 74 61 62  |e....dcd div_tab|
00000870  6c 65 25 0d 04 92 04 0d  04 9c 04 0d 04 a6 0b 2e  |le%.............|
00000880  73 74 61 63 6b 70 0d 04  b0 09 64 63 64 20 30 0d  |stackp....dcd 0.|
00000890  04 ba 09 2e 6c 69 6e 6b  0d 04 c4 09 64 63 64 20  |....link....dcd |
000008a0  30 0d 04 ce 0e 2e 64 69  76 5f 74 61 62 6c 65 0d  |0.....div_table.|
000008b0  04 d8 12 64 63 64 20 64  69 76 5f 74 61 62 6c 65  |...dcd div_table|
000008c0  25 0d 04 e2 0c 2e 72 5f  69 6e 64 65 78 0d 04 ec  |%.....r_index...|
000008d0  09 64 63 64 20 30 0d 04  f6 0c 2e 6c 5f 69 6e 64  |.dcd 0.....l_ind|
000008e0  65 78 0d 05 00 09 64 63  64 20 30 0d 05 0a 04 0d  |ex....dcd 0.....|
000008f0  05 14 0a 2e 79 5f 65 6e  64 0d 05 1e 09 64 63 64  |....y_end....dcd|
00000900  20 30 0d 05 28 04 0d 05  32 0b 2e 73 70 72 69 74  | 0..(...2..sprit|
00000910  65 0d 05 3c 12 64 63 64  20 73 70 72 69 74 65 25  |e..<.dcd sprite%|
00000920  2b 35 36 0d 05 46 0e 2e  73 63 72 65 65 6e 61 64  |+56..F..screenad|
00000930  72 0d 05 50 15 64 63 64  20 a4 73 63 72 65 65 6e  |r..P.dcd .screen|
00000940  61 64 72 28 32 29 0d 05  5a 15 64 63 64 20 a4 73  |adr(2)..Z.dcd .s|
00000950  63 72 65 65 6e 61 64 72  28 31 29 0d 05 64 04 0d  |creenadr(1)..d..|
00000960  05 6e 17 2e 61 79 3a 64  63 64 20 30 3a 2e 61 78  |.n..ay:dcd 0:.ax|
00000970  3a 64 63 64 20 30 0d 05  78 0f 2e 61 63 3a 64 63  |:dcd 0..x..ac:dc|
00000980  64 20 32 35 35 0d 05 82  17 2e 61 75 3a 64 63 64  |d 255.....au:dcd|
00000990  20 30 3a 2e 61 76 3a 64  63 64 20 30 0d 05 8c 15  | 0:.av:dcd 0....|
000009a0  64 63 64 20 30 3a 64 63  64 20 30 3a 64 63 64 20  |dcd 0:dcd 0:dcd |
000009b0  30 0d 05 96 04 0d 05 a0  17 2e 62 79 3a 64 63 64  |0.........by:dcd|
000009c0  20 30 3a 2e 62 78 3a 64  63 64 20 30 0d 05 aa 0f  | 0:.bx:dcd 0....|
000009d0  2e 62 63 3a 64 63 64 20  32 35 35 0d 05 b4 17 2e  |.bc:dcd 255.....|
000009e0  62 75 3a 64 63 64 20 30  3a 2e 62 76 3a 64 63 64  |bu:dcd 0:.bv:dcd|
000009f0  20 30 0d 05 be 15 64 63  64 20 30 3a 64 63 64 20  | 0....dcd 0:dcd |
00000a00  30 3a 64 63 64 20 30 0d  05 c8 04 0d 05 d2 17 2e  |0:dcd 0.........|
00000a10  63 79 3a 64 63 64 20 30  3a 2e 63 78 3a 64 63 64  |cy:dcd 0:.cx:dcd|
00000a20  20 30 0d 05 dc 0f 2e 63  63 3a 64 63 64 20 32 35  | 0.....cc:dcd 25|
00000a30  35 0d 05 e6 17 2e 63 75  3a 64 63 64 20 30 3a 2e  |5.....cu:dcd 0:.|
00000a40  63 76 3a 64 63 64 20 30  0d 05 f0 15 64 63 64 20  |cv:dcd 0....dcd |
00000a50  30 3a 64 63 64 20 30 3a  64 63 64 20 30 0d 05 fa  |0:dcd 0:dcd 0...|
00000a60  04 0d 06 04 15 2e 74 65  78 74 75 72 65 5f 74 72  |......texture_tr|
00000a70  69 61 6e 67 6c 65 0d 06  0e 0d 61 64 72 20 72 30  |iangle....adr r0|
00000a80  2c 61 79 0d 06 18 13 6c  64 72 20 72 31 30 2c 5b  |,ay....ldr r10,[|
00000a90  72 30 2c 23 30 5d 0d 06  22 14 6c 64 72 20 72 31  |r0,#0]..".ldr r1|
00000aa0  31 2c 5b 72 30 2c 23 33  32 5d 0d 06 2c 0f 63 6d  |1,[r0,#32]..,.cm|
00000ab0  70 20 72 31 31 2c 72 31  30 0d 06 36 10 6d 6f 76  |p r11,r10..6.mov|
00000ac0  6c 74 20 72 31 2c 72 31  31 0d 06 40 10 6d 6f 76  |lt r1,r11..@.mov|
00000ad0  67 65 20 72 31 2c 72 31  30 0d 06 4a 0f 6d 6f 76  |ge r1,r10..J.mov|
00000ae0  6c 74 20 72 32 2c 23 31  0d 06 54 0f 6d 6f 76 67  |lt r2,#1..T.movg|
00000af0  65 20 72 32 2c 23 30 0d  06 5e 14 6c 64 72 20 72  |e r2,#0..^.ldr r|
00000b00  31 32 2c 5b 72 30 2c 23  36 34 5d 0d 06 68 0e 63  |12,[r0,#64]..h.c|
00000b10  6d 70 20 72 31 32 2c 72  31 0d 06 72 10 6d 6f 76  |mp r12,r1..r.mov|
00000b20  6c 74 20 72 31 2c 72 31  32 0d 06 7c 0f 6d 6f 76  |lt r1,r12..|.mov|
00000b30  6c 74 20 72 32 2c 23 32  0d 06 86 0f 63 6d 70 20  |lt r2,#2....cmp |
00000b40  72 31 2c 23 35 31 32 0d  06 90 10 6d 6f 76 67 65  |r1,#512....movge|
00000b50  20 70 63 2c 72 31 34 0d  06 9a 0e 63 6d 70 20 72  | pc,r14....cmp r|
00000b60  31 30 2c 23 30 0d 06 a4  10 63 6d 70 6c 74 20 72  |10,#0....cmplt r|
00000b70  31 31 2c 23 30 0d 06 ae  10 63 6d 70 6c 74 20 72  |11,#0....cmplt r|
00000b80  31 32 2c 23 30 0d 06 b8  10 6d 6f 76 6c 74 20 70  |12,#0....movlt p|
00000b90  63 2c 72 31 34 0d 06 c2  04 0d 06 cc 12 73 74 72  |c,r14........str|
00000ba0  20 72 31 33 2c 73 74 61  63 6b 70 0d 06 d6 04 0d  | r13,stackp.....|
00000bb0  06 e0 11 73 75 62 73 20  72 33 2c 72 32 2c 23 31  |...subs r3,r2,#1|
00000bc0  0d 06 ea 0f 6d 6f 76 6c  74 20 72 33 2c 23 32 0d  |....movlt r3,#2.|
00000bd0  06 f4 04 0d 06 fe 16 61  64 64 20 72 32 2c 72 30  |.......add r2,r0|
00000be0  2c 72 32 2c 6c 73 6c 23  35 0d 07 08 3d 6c 64 6d  |,r2,lsl#5...=ldm|
00000bf0  69 62 20 72 32 2c 7b 72  35 2c 72 36 2c 72 37 2c  |ib r2,{r5,r6,r7,|
00000c00  72 38 7d 20 20 20 20 20  20 20 20 20 20 20 20 20  |r8}             |
00000c10  20 20 20 20 20 3b 20 78  5f 6b 2c 63 5f 6b 2c 75  |     ; x_k,c_k,u|
00000c20  5f 6b 2c 76 5f 6b 0d 07  12 16 61 64 64 20 72 34  |_k,v_k....add r4|
00000c30  2c 72 30 2c 72 33 2c 6c  73 6c 23 35 0d 07 1c 12  |,r0,r3,lsl#5....|
00000c40  73 74 72 20 72 34 2c 6c  5f 69 6e 64 65 78 0d 07  |str r4,l_index..|
00000c50  26 11 73 75 62 73 20 72  33 2c 72 33 2c 23 31 0d  |&.subs r3,r3,#1.|
00000c60  07 30 0f 6d 6f 76 6c 74  20 72 33 2c 23 32 0d 07  |.0.movlt r3,#2..|
00000c70  3a 16 61 64 64 20 72 30  2c 72 30 2c 72 33 2c 6c  |:.add r0,r0,r3,l|
00000c80  73 6c 23 35 0d 07 44 12  73 74 72 20 72 30 2c 72  |sl#5..D.str r0,r|
00000c90  5f 69 6e 64 65 78 0d 07  4e 41 6c 64 6d 69 61 20  |_index..NAldmia |
00000ca0  72 34 2c 7b 72 39 2c 72  31 30 2c 72 31 31 2c 72  |r4,{r9,r10,r11,r|
00000cb0  31 32 2c 72 31 33 7d 20  20 20 20 20 20 20 20 20  |12,r13}         |
00000cc0  20 20 3b 20 79 5f 6c 2c  78 5f 6c 2c 63 5f 6c 2c  |  ; y_l,x_l,c_l,|
00000cd0  75 5f 6c 2c 76 5f 6c 0d  07 58 04 0d 07 62 10 73  |u_l,v_l..X...b.s|
00000ce0  74 72 20 72 31 34 2c 6c  69 6e 6b 0d 07 6c 15 6c  |tr r14,link..l.l|
00000cf0  64 72 20 72 31 34 2c 64  69 76 5f 74 61 62 6c 65  |dr r14,div_table|
00000d00  0d 07 76 31 73 75 62 73  20 72 32 2c 72 39 2c 72  |..v1subs r2,r9,r|
00000d10  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
00000d20  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 64 6c  |            ; dl|
00000d30  79 0d 07 80 37 6c 64 72  67 74 20 72 32 2c 5b 72  |y...7ldrgt r2,[r|
00000d40  31 34 2c 72 32 2c 6c 73  6c 23 32 5d 20 20 20 20  |14,r2,lsl#2]    |
00000d50  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 31  |             ; 1|
00000d60  3c 3c 32 30 2f 64 6c 79  0d 07 8a 04 0d 07 94 16  |<<20/dly........|
00000d70  6d 6f 76 67 74 20 72 33  2c 72 35 2c 6c 73 6c 23  |movgt r3,r5,lsl#|
00000d80  31 30 0d 07 9e 17 6d 6f  76 65 71 20 72 33 2c 72  |10....moveq r3,r|
00000d90  31 30 2c 6c 73 6c 23 31  30 0d 07 a8 13 73 75 62  |10,lsl#10....sub|
00000da0  67 74 20 72 34 2c 72 31  30 2c 72 35 0d 07 b2 35  |gt r4,r10,r5...5|
00000db0  6d 75 6c 20 72 34 2c 72  32 2c 72 34 20 20 20 20  |mul r4,r2,r4    |
00000dc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000dd0  20 20 20 20 20 20 20 20  3b 20 64 6c 78 3c 3c 32  |        ; dlx<<2|
00000de0  30 0d 07 bc 0e 73 74 72  20 72 34 2c 64 6c 78 0d  |0....str r4,dlx.|
00000df0  07 c6 04 0d 07 d0 17 6d  6f 76 67 74 20 72 31 30  |.......movgt r10|
00000e00  2c 72 37 2c 6c 73 6c 23  31 30 0d 07 da 18 6d 6f  |,r7,lsl#10....mo|
00000e10  76 65 71 20 72 31 30 2c  72 31 32 2c 6c 73 6c 23  |veq r10,r12,lsl#|
00000e20  31 30 0d 07 e4 0e 73 74  72 20 72 31 30 2c 6c 75  |10....str r10,lu|
00000e30  0d 07 ee 13 73 75 62 67  74 20 72 34 2c 72 31 32  |....subgt r4,r12|
00000e40  2c 72 37 0d 07 f8 35 6d  75 6c 20 72 34 2c 72 32  |,r7...5mul r4,r2|
00000e50  2c 72 34 20 20 20 20 20  20 20 20 20 20 20 20 20  |,r4             |
00000e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000e70  20 64 6c 75 3c 3c 32 30  0d 08 02 0e 73 74 72 20  | dlu<<20....str |
00000e80  72 34 2c 64 6c 75 0d 08  0c 04 0d 08 16 17 6d 6f  |r4,dlu........mo|
00000e90  76 67 74 20 72 31 30 2c  72 38 2c 6c 73 6c 23 31  |vgt r10,r8,lsl#1|
00000ea0  30 0d 08 20 18 6d 6f 76  65 71 20 72 31 30 2c 72  |0.. .moveq r10,r|
00000eb0  31 33 2c 6c 73 6c 23 31  30 0d 08 2a 0e 73 74 72  |13,lsl#10..*.str|
00000ec0  20 72 31 30 2c 6c 76 0d  08 34 13 73 75 62 67 74  | r10,lv..4.subgt|
00000ed0  20 72 34 2c 72 31 33 2c  72 38 0d 08 3e 35 6d 75  | r4,r13,r8..>5mu|
00000ee0  6c 20 72 34 2c 72 32 2c  72 34 20 20 20 20 20 20  |l r4,r2,r4      |
00000ef0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f00  20 20 20 20 20 20 3b 20  64 6c 76 3c 3c 32 30 0d  |      ; dlv<<20.|
00000f10  08 48 0e 73 74 72 20 72  34 2c 64 6c 76 0d 08 52  |.H.str r4,dlv..R|
00000f20  04 0d 08 5c 41 6c 64 6d  69 61 20 72 30 2c 7b 72  |...\Aldmia r0,{r|
00000f30  30 2c 72 31 30 2c 72 31  31 2c 72 31 32 2c 72 31  |0,r10,r11,r12,r1|
00000f40  33 7d 20 20 20 20 20 20  20 20 20 20 20 3b 20 79  |3}           ; y|
00000f50  5f 72 2c 78 5f 72 2c 63  5f 72 2c 75 5f 72 2c 76  |_r,x_r,c_r,u_r,v|
00000f60  5f 72 0d 08 66 31 73 75  62 73 20 72 32 2c 72 30  |_r..f1subs r2,r0|
00000f70  2c 72 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |,r1             |
00000f80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000f90  64 72 79 0d 08 70 37 6c  64 72 67 74 20 72 32 2c  |dry..p7ldrgt r2,|
00000fa0  5b 72 31 34 2c 72 32 2c  6c 73 6c 23 32 5d 20 20  |[r14,r2,lsl#2]  |
00000fb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000fc0  20 31 3c 3c 32 30 2f 64  72 79 0d 08 7a 04 0d 08  | 1<<20/dry..z...|
00000fd0  84 16 6d 6f 76 67 74 20  72 34 2c 72 35 2c 6c 73  |..movgt r4,r5,ls|
00000fe0  6c 23 31 30 0d 08 8e 17  6d 6f 76 65 71 20 72 34  |l#10....moveq r4|
00000ff0  2c 72 31 30 2c 6c 73 6c  23 31 30 0d 08 98 14 73  |,r10,lsl#10....s|
00001000  75 62 67 74 20 72 31 30  2c 72 31 30 2c 72 35 0d  |ubgt r10,r10,r5.|
00001010  08 a2 35 6d 75 6c 20 72  31 30 2c 72 32 2c 72 31  |..5mul r10,r2,r1|
00001020  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00001030  20 20 20 20 20 20 20 20  20 20 20 3b 20 64 72 78  |           ; drx|
00001040  3c 3c 32 30 0d 08 ac 0f  73 74 72 20 72 31 30 2c  |<<20....str r10,|
00001050  64 72 78 0d 08 b6 04 0d  08 c0 17 6d 6f 76 67 74  |drx........movgt|
00001060  20 72 31 30 2c 72 37 2c  6c 73 6c 23 31 30 0d 08  | r10,r7,lsl#10..|
00001070  ca 18 6d 6f 76 65 71 20  72 31 30 2c 72 31 32 2c  |..moveq r10,r12,|
00001080  6c 73 6c 23 31 30 0d 08  d4 0e 73 74 72 20 72 31  |lsl#10....str r1|
00001090  30 2c 72 75 0d 08 de 14  73 75 62 67 74 20 72 31  |0,ru....subgt r1|
000010a0  30 2c 72 31 32 2c 72 37  0d 08 e8 35 6d 75 6c 20  |0,r12,r7...5mul |
000010b0  72 31 30 2c 72 32 2c 72  31 30 20 20 20 20 20 20  |r10,r2,r10      |
000010c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000010d0  20 20 20 20 3b 20 64 72  75 3c 3c 32 30 0d 08 f2  |    ; dru<<20...|
000010e0  0f 73 74 72 20 72 31 30  2c 64 72 75 0d 08 fc 04  |.str r10,dru....|
000010f0  0d 09 06 17 6d 6f 76 67  74 20 72 31 30 2c 72 38  |....movgt r10,r8|
00001100  2c 6c 73 6c 23 31 30 0d  09 10 18 6d 6f 76 65 71  |,lsl#10....moveq|
00001110  20 72 31 30 2c 72 31 33  2c 6c 73 6c 23 31 30 0d  | r10,r13,lsl#10.|
00001120  09 1a 0e 73 74 72 20 72  31 30 2c 72 76 0d 09 24  |...str r10,rv..$|
00001130  14 73 75 62 67 74 20 72  31 30 2c 72 31 33 2c 72  |.subgt r10,r13,r|
00001140  38 0d 09 2e 35 6d 75 6c  20 72 31 30 2c 72 32 2c  |8...5mul r10,r2,|
00001150  72 31 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |r10             |
00001160  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
00001170  72 76 3c 3c 32 30 0d 09  38 0f 73 74 72 20 72 31  |rv<<20..8.str r1|
00001180  30 2c 64 72 76 0d 09 42  04 0d 09 4c 14 6c 64 72  |0,drv..B...L.ldr|
00001190  20 72 32 2c 73 63 72 65  65 6e 61 64 72 0d 09 56  | r2,screenadr..V|
000011a0  16 61 64 64 20 72 32 2c  72 32 2c 72 31 2c 6c 73  |.add r2,r2,r1,ls|
000011b0  6c 23 37 0d 09 60 39 61  64 64 20 72 32 2c 72 32  |l#7..`9add r2,r2|
000011c0  2c 72 31 2c 6c 73 6c 23  39 20 20 20 20 20 20 20  |,r1,lsl#9       |
000011d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000011e0  20 73 63 72 65 65 6e 20  6c 69 6e 65 0d 09 6a 04  | screen line..j.|
000011f0  0d 09 74 0e 4d 4f 56 20  52 31 34 2c 52 31 0d 09  |..t.MOV R14,R1..|
00001200  7e 12 6c 64 72 20 72 31  30 2c 73 70 72 69 74 65  |~.ldr r10,sprite|
00001210  0d 09 88 04 0d 09 92 0d  63 6d 70 20 72 39 2c 72  |........cmp r9,r|
00001220  30 0d 09 9c 12 73 74 72  6c 74 20 72 39 2c 79 5f  |0....strlt r9,y_|
00001230  65 6e 64 0d 09 a6 12 73  74 72 67 65 20 72 30 2c  |end....strge r0,|
00001240  79 5f 65 6e 64 0d 09 b0  04 0d 09 ba 10 62 67 74  |y_end........bgt|
00001250  20 6d 65 74 68 6f 64 5f  32 0d 09 c4 10 62 65 71  | method_2....beq|
00001260  20 6c 61 73 74 5f 62 69  74 0d 09 ce 04 0d 09 d8  | last_bit.......|
00001270  3c 2e 6d 65 74 68 6f 64  5f 31 20 20 20 20 20 20  |<.method_1      |
00001280  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001290  20 20 20 20 20 20 20 20  20 3b 20 6c 65 66 74 5f  |         ; left_|
000012a0  79 3c 72 69 67 68 74 5f  79 0d 09 e2 04 0d 09 ec  |y<right_y.......|
000012b0  0a a4 79 6c 6f 6f 70 0d  09 f6 04 0d 0a 00 0e 3b  |..yloop........;|
000012c0  20 72 30 20 3d 20 79 5f  6c 0d 0a 0a 11 3b 20 72  | r0 = y_l....; r|
000012d0  32 20 3d 20 73 63 6c 69  6e 65 0d 0a 14 0d 3b 20  |2 = scline....; |
000012e0  72 33 20 3d 20 6c 78 0d  0a 1e 0d 3b 20 72 34 20  |r3 = lx....; r4 |
000012f0  3d 20 72 78 0d 0a 28 17  3b 20 72 31 2c 72 35 2d  |= rx..(.; r1,r5-|
00001300  72 31 34 20 3d 20 65 6d  70 74 79 0d 0a 32 04 0d  |r14 = empty..2..|
00001310  0a 3c 20 3b 20 72 65 63  61 6c 63 75 61 74 65 20  |.< ; recalcuate |
00001320  64 6c 78 2c 64 6c 75 2c  64 6c 76 2c 64 6c 63 0d  |dlx,dlu,dlv,dlc.|
00001330  0a 46 12 6c 64 72 20 72  31 2c 6c 5f 69 6e 64 65  |.F.ldr r1,l_inde|
00001340  78 0d 0a 50 3d 6c 64 6d  69 62 20 72 31 2c 7b 72  |x..P=ldmib r1,{r|
00001350  33 2c 72 31 30 2c 72 31  31 2c 72 31 32 7d 20 20  |3,r10,r11,r12}  |
00001360  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 78  |             ; x|
00001370  5f 6c 2c 63 5f 6c 2c 75  5f 6c 2c 76 5f 6c 0d 0a  |_l,c_l,u_l,v_l..|
00001380  5a 12 6c 64 72 20 72 31  2c 72 5f 69 6e 64 65 78  |Z.ldr r1,r_index|
00001390  0d 0a 64 41 6c 64 6d 69  61 20 72 31 2c 7b 72 31  |..dAldmia r1,{r1|
000013a0  2c 72 35 2c 72 36 2c 72  37 2c 72 38 7d 20 20 20  |,r5,r6,r7,r8}   |
000013b0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 79 5f  |            ; y_|
000013c0  72 2c 78 5f 72 2c 63 5f  72 2c 75 5f 72 2c 76 5f  |r,x_r,c_r,u_r,v_|
000013d0  72 0d 0a 6e 10 73 74 72  20 72 31 2c 79 5f 65 6e  |r..n.str r1,y_en|
000013e0  64 0d 0a 78 04 0d 0a 82  31 73 75 62 73 20 72 31  |d..x....1subs r1|
000013f0  2c 72 31 2c 72 30 20 20  20 20 20 20 20 20 20 20  |,r1,r0          |
00001400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001410  20 3b 20 64 6c 79 0d 0a  8c 15 6c 64 72 20 72 31  | ; dly....ldr r1|
00001420  34 2c 64 69 76 5f 74 61  62 6c 65 0d 0a 96 04 0d  |4,div_table.....|
00001430  0a a0 37 6c 64 72 67 74  20 72 31 2c 5b 72 31 34  |..7ldrgt r1,[r14|
00001440  2c 72 31 2c 6c 73 6c 23  32 5d 20 20 20 20 20 20  |,r1,lsl#2]      |
00001450  20 20 20 20 20 20 20 20  20 20 20 3b 20 31 3c 3c  |           ; 1<<|
00001460  32 30 2f 64 6c 79 0d 0a  aa 13 73 75 62 67 74 20  |20/dly....subgt |
00001470  72 37 2c 72 37 2c 72 31  31 0d 0a b4 35 6d 75 6c  |r7,r7,r11...5mul|
00001480  20 72 37 2c 72 31 2c 72  37 20 20 20 20 20 20 20  | r7,r1,r7       |
00001490  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000014a0  20 20 20 20 20 3b 20 64  6c 75 3c 3c 32 30 0d 0a  |     ; dlu<<20..|
000014b0  be 0e 73 74 72 20 72 37  2c 64 6c 75 0d 0a c8 12  |..str r7,dlu....|
000014c0  73 75 62 67 74 20 72 35  2c 72 35 2c 72 33 0d 0a  |subgt r5,r5,r3..|
000014d0  d2 14 6d 6f 76 20 72 33  2c 72 33 2c 6c 73 6c 23  |..mov r3,r3,lsl#|
000014e0  31 30 0d 0a dc 35 6d 75  6c 20 72 35 2c 72 31 2c  |10...5mul r5,r1,|
000014f0  72 35 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r5              |
00001500  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00001510  64 6c 78 3c 3c 32 30 0d  0a e6 0e 73 74 72 20 72  |dlx<<20....str r|
00001520  35 2c 64 6c 78 0d 0a f0  04 0d 0a fa 13 73 75 62  |5,dlx........sub|
00001530  67 74 20 72 35 2c 72 38  2c 72 31 32 0d 0b 04 35  |gt r5,r8,r12...5|
00001540  6d 75 6c 20 72 35 2c 72  31 2c 72 35 20 20 20 20  |mul r5,r1,r5    |
00001550  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001560  20 20 20 20 20 20 20 20  3b 20 64 6c 76 3c 3c 32  |        ; dlv<<2|
00001570  30 0d 0b 0e 0e 73 74 72  20 72 35 2c 64 6c 76 0d  |0....str r5,dlv.|
00001580  0b 18 04 0d 0b 22 12 6c  64 72 20 72 31 30 2c 73  |.....".ldr r10,s|
00001590  70 72 69 74 65 0d 0b 2c  04 0d 0b 36 0e 4d 4f 56  |prite..,...6.MOV|
000015a0  20 52 31 34 2c 52 30 0d  0b 40 0d 2e 6c 61 73 74  | R14,R0..@..last|
000015b0  5f 62 69 74 0d 0b 4a 0a  a4 79 6c 6f 6f 70 0d 0b  |_bit..J..yloop..|
000015c0  54 04 0d 0b 5e 12 6c 64  72 20 72 31 33 2c 73 74  |T...^.ldr r13,st|
000015d0  61 63 6b 70 0d 0b 68 10  6c 64 72 20 72 31 35 2c  |ackp..h.ldr r15,|
000015e0  6c 69 6e 6b 0d 0b 72 04  0d 0b 7c 04 0d 0b 86 3d  |link..r...|....=|
000015f0  2e 6d 65 74 68 6f 64 5f  32 20 20 20 20 20 20 20  |.method_2       |
00001600  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001610  20 20 20 20 20 20 20 20  3b 20 72 69 67 68 74 5f  |        ; right_|
00001620  79 3c 20 6c 65 66 74 5f  79 0d 0b 90 0a a4 79 6c  |y< left_y.....yl|
00001630  6f 6f 70 0d 0b 9a 04 0d  0b a4 0e 3b 20 72 30 20  |oop........; r0 |
00001640  3d 20 79 5f 6c 0d 0b ae  11 3b 20 72 32 20 3d 20  |= y_l....; r2 = |
00001650  73 63 6c 69 6e 65 0d 0b  b8 0d 3b 20 72 33 20 3d  |scline....; r3 =|
00001660  20 6c 78 0d 0b c2 0d 3b  20 72 34 20 3d 20 72 78  | lx....; r4 = rx|
00001670  0d 0b cc 17 3b 20 72 31  2c 72 35 2d 72 31 34 20  |....; r1,r5-r14 |
00001680  3d 20 65 6d 70 74 79 0d  0b d6 04 0d 0b e0 20 3b  |= empty....... ;|
00001690  20 72 65 63 61 6c 63 75  61 74 65 20 64 72 78 2c  | recalcuate drx,|
000016a0  64 72 75 2c 64 72 76 2c  64 72 63 0d 0b ea 12 6c  |dru,drv,drc....l|
000016b0  64 72 20 72 31 2c 72 5f  69 6e 64 65 78 0d 0b f4  |dr r1,r_index...|
000016c0  3d 6c 64 6d 69 62 20 72  31 2c 7b 72 34 2c 72 31  |=ldmib r1,{r4,r1|
000016d0  30 2c 72 31 31 2c 72 31  32 7d 20 20 20 20 20 20  |0,r11,r12}      |
000016e0  20 20 20 20 20 20 20 20  20 3b 20 78 5f 72 2c 63  |         ; x_r,c|
000016f0  5f 72 2c 75 5f 72 2c 76  5f 72 0d 0b fe 12 6c 64  |_r,u_r,v_r....ld|
00001700  72 20 72 31 2c 6c 5f 69  6e 64 65 78 0d 0c 08 41  |r r1,l_index...A|
00001710  6c 64 6d 69 61 20 72 31  2c 7b 72 31 2c 72 35 2c  |ldmia r1,{r1,r5,|
00001720  72 36 2c 72 37 2c 72 38  7d 20 20 20 20 20 20 20  |r6,r7,r8}       |
00001730  20 20 20 20 20 20 20 20  3b 20 79 5f 6c 2c 78 5f  |        ; y_l,x_|
00001740  6c 2c 63 5f 6c 2c 75 5f  6c 2c 76 5f 6c 0d 0c 12  |l,c_l,u_l,v_l...|
00001750  10 73 74 72 20 72 31 2c  79 5f 65 6e 64 0d 0c 1c  |.str r1,y_end...|
00001760  04 0d 0c 26 31 73 75 62  73 20 72 31 2c 72 31 2c  |...&1subs r1,r1,|
00001770  72 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r0              |
00001780  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
00001790  6c 79 0d 0c 30 15 6c 64  72 20 72 31 34 2c 64 69  |ly..0.ldr r14,di|
000017a0  76 5f 74 61 62 6c 65 0d  0c 3a 04 0d 0c 44 37 6c  |v_table..:...D7l|
000017b0  64 72 67 74 20 72 31 2c  5b 72 31 34 2c 72 31 2c  |drgt r1,[r14,r1,|
000017c0  6c 73 6c 23 32 5d 20 20  20 20 20 20 20 20 20 20  |lsl#2]          |
000017d0  20 20 20 20 20 20 20 3b  20 31 3c 3c 32 30 2f 64  |       ; 1<<20/d|
000017e0  6c 79 0d 0c 4e 12 73 75  62 67 74 20 72 35 2c 72  |ly..N.subgt r5,r|
000017f0  35 2c 72 34 0d 0c 58 14  6d 6f 76 20 72 34 2c 72  |5,r4..X.mov r4,r|
00001800  34 2c 6c 73 6c 23 31 30  0d 0c 62 35 6d 75 6c 20  |4,lsl#10..b5mul |
00001810  72 35 2c 72 31 2c 72 35  20 20 20 20 20 20 20 20  |r5,r1,r5        |
00001820  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001830  20 20 20 20 3b 20 64 6c  78 3c 3c 32 30 0d 0c 6c  |    ; dlx<<20..l|
00001840  0e 73 74 72 20 72 35 2c  64 72 78 0d 0c 76 13 73  |.str r5,drx..v.s|
00001850  75 62 67 74 20 72 35 2c  72 37 2c 72 31 31 0d 0c  |ubgt r5,r7,r11..|
00001860  80 35 6d 75 6c 20 72 35  2c 72 31 2c 72 35 20 20  |.5mul r5,r1,r5  |
00001870  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001880  20 20 20 20 20 20 20 20  20 20 3b 20 64 6c 75 3c  |          ; dlu<|
00001890  3c 32 30 0d 0c 8a 0e 73  74 72 20 72 35 2c 64 72  |<20....str r5,dr|
000018a0  75 0d 0c 94 13 73 75 62  67 74 20 72 35 2c 72 38  |u....subgt r5,r8|
000018b0  2c 72 31 32 0d 0c 9e 35  6d 75 6c 20 72 35 2c 72  |,r12...5mul r5,r|
000018c0  31 2c 72 35 20 20 20 20  20 20 20 20 20 20 20 20  |1,r5            |
000018d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000018e0  3b 20 64 6c 76 3c 3c 32  30 0d 0c a8 0e 73 74 72  |; dlv<<20....str|
000018f0  20 72 35 2c 64 72 76 0d  0c b2 04 0d 0c bc 12 6c  | r5,drv........l|
00001900  64 72 20 72 31 30 2c 73  70 72 69 74 65 0d 0c c6  |dr r10,sprite...|
00001910  0e 4d 4f 56 20 52 31 34  2c 52 30 0d 0c d0 0a a4  |.MOV R14,R0.....|
00001920  79 6c 6f 6f 70 0d 0c da  04 0d 0c e4 12 6c 64 72  |yloop........ldr|
00001930  20 72 31 33 2c 73 74 61  63 6b 70 0d 0c ee 10 6c  | r13,stackp....l|
00001940  64 72 20 72 31 35 2c 6c  69 6e 6b 0d 0c f8 04 0d  |dr r15,link.....|
00001950  0d 02 09 2e 6c 69 6e 65  0d 0d 0c 09 64 63 64 20  |....line....dcd |
00001960  30 0d 0d 16 04 0d 0d 20  0b 2e 63 6f 6f 72 64 73  |0...... ..coords|
00001970  0d 0d 2a 17 2e 6c 75 3a  64 63 64 20 30 3a 2e 72  |..*..lu:dcd 0:.r|
00001980  75 3a 64 63 64 20 30 0d  0d 34 17 2e 6c 63 3a 64  |u:dcd 0..4..lc:d|
00001990  63 64 20 30 3a 2e 72 63  3a 64 63 64 20 30 0d 0d  |cd 0:.rc:dcd 0..|
000019a0  3e 17 2e 6c 76 3a 64 63  64 20 30 3a 2e 72 76 3a  |>..lv:dcd 0:.rv:|
000019b0  64 63 64 20 30 0d 0d 48  19 2e 64 6c 78 3a 64 63  |dcd 0..H..dlx:dc|
000019c0  64 20 30 3a 2e 64 72 78  3a 64 63 64 20 30 0d 0d  |d 0:.drx:dcd 0..|
000019d0  52 19 2e 64 6c 63 3a 64  63 64 20 30 3a 2e 64 72  |R..dlc:dcd 0:.dr|
000019e0  63 3a 64 63 64 20 30 0d  0d 5c 19 2e 64 6c 75 3a  |c:dcd 0..\..dlu:|
000019f0  64 63 64 20 30 3a 2e 64  72 75 3a 64 63 64 20 30  |dcd 0:.dru:dcd 0|
00001a00  0d 0d 66 19 2e 64 6c 76  3a 64 63 64 20 30 3a 2e  |..f..dlv:dcd 0:.|
00001a10  64 72 76 3a 64 63 64 20  30 0d 0d 70 04 0d 0d 7a  |drv:dcd 0..p...z|
00001a20  05 5d 0d 0d 84 05 ed 0d  0d 8e 24 c8 99 22 4f 53  |.]........$.."OS|
00001a30  5f 46 69 6c 65 22 2c 31  36 2c 22 50 69 63 74 75  |_File",16,"Pictu|
00001a40  72 65 22 2c 73 70 72 69  74 65 25 0d 0d 98 05 e1  |re",sprite%.....|
00001a50  0d 0d a2 05 3a 0d 0d ac  0b dd a4 79 6c 6f 6f 70  |....:......yloop|
00001a60  0d 0d b6 0e 5b 4f 50 54  20 70 61 73 73 25 0d 0d  |....[OPT pass%..|
00001a70  c0 0d 3b 20 72 32 20 3d  20 73 63 0d 0d ca 0d 3b  |..; r2 = sc....;|
00001a80  20 72 33 20 3d 20 6c 78  0d 0d d4 0d 3b 20 72 34  | r3 = lx....; r4|
00001a90  20 3d 20 72 78 0d 0d de  0f 3b 20 72 31 34 20 3d  | = rx....; r14 =|
00001aa0  20 79 5f 6b 0d 0d e8 04  0d 0d f2 0a 2e 79 6c 6f  | y_k.........ylo|
00001ab0  6f 70 0d 0d fc 2c 73 75  62 73 20 72 30 2c 72 34  |op...,subs r0,r4|
00001ac0  2c 72 33 20 20 20 20 20  20 20 20 20 20 20 20 20  |,r3             |
00001ad0  20 20 20 20 20 20 3b 20  64 78 3c 3c 31 30 0d 0e  |      ; dx<<10..|
00001ae0  06 2e 61 64 64 20 72 31  32 2c 72 32 2c 72 33 2c  |..add r12,r2,r3,|
00001af0  61 73 72 23 31 30 20 20  20 20 20 20 20 20 20 20  |asr#10          |
00001b00  20 20 3b 20 6c 65 66 74  20 61 64 72 0d 0e 10 0f  |  ; left adr....|
00001b10  6c 64 72 20 72 31 33 2c  64 6c 78 0d 0e 1a 2d 61  |ldr r13,dlx...-a|
00001b20  64 64 20 72 33 2c 72 33  2c 72 31 33 2c 61 73 72  |dd r3,r3,r13,asr|
00001b30  23 31 30 20 20 20 20 20  20 20 20 20 20 20 20 3b  |#10            ;|
00001b40  20 6c 78 2b 3d 64 6c 78  0d 0e 24 0f 6c 64 72 20  | lx+=dlx..$.ldr |
00001b50  72 31 31 2c 64 72 78 0d  0e 2e 2f 61 64 64 20 72  |r11,drx.../add r|
00001b60  31 33 2c 72 32 2c 72 34  2c 61 73 72 23 31 30 20  |13,r2,r4,asr#10 |
00001b70  20 20 20 20 20 20 20 20  20 20 20 3b 20 72 69 67  |           ; rig|
00001b80  68 74 20 61 64 72 0d 0e  38 2d 61 64 64 20 72 34  |ht adr..8-add r4|
00001b90  2c 72 34 2c 72 31 31 2c  61 73 72 23 31 30 20 20  |,r4,r11,asr#10  |
00001ba0  20 20 20 20 20 20 20 20  20 20 3b 20 72 78 2b 3d  |          ; rx+=|
00001bb0  64 72 78 0d 0e 42 15 6c  64 72 20 72 31 31 2c 64  |drx..B.ldr r11,d|
00001bc0  69 76 5f 74 61 62 6c 65  0d 0e 4c 13 6d 6f 76 20  |iv_table..L.mov |
00001bd0  72 30 2c 72 30 2c 61 73  72 23 35 0d 0e 56 2e 6c  |r0,r0,asr#5..V.l|
00001be0  64 72 67 74 20 72 30 2c  5b 72 31 31 2c 72 30 2c  |drgt r0,[r11,r0,|
00001bf0  6c 73 6c 23 32 5d 20 20  20 20 20 20 20 20 20 3b  |lsl#2]         ;|
00001c00  20 31 3c 3c 31 38 2f 64  78 0d 0e 60 0d 6c 64 72  | 1<<18/dx..`.ldr|
00001c10  20 72 39 2c 6c 75 0d 0e  6a 0d 6c 64 72 20 72 38  | r9,lu..j.ldr r8|
00001c20  2c 72 75 0d 0e 74 04 0d  0e 7e 2c 73 75 62 20 72  |,ru..t...~,sub r|
00001c30  36 2c 72 38 2c 72 39 20  20 20 20 20 20 20 20 20  |6,r8,r9         |
00001c40  20 20 20 20 20 20 20 20  20 20 20 3b 20 64 75 3c  |           ; du<|
00001c50  3c 31 30 0d 0e 88 2c 6d  75 6c 20 72 36 2c 72 30  |<10...,mul r6,r0|
00001c60  2c 72 36 20 20 20 20 20  20 20 20 20 20 20 20 20  |,r6             |
00001c70  20 20 20 20 20 20 20 3b  20 64 75 3c 3c 32 34 0d  |       ; du<<24.|
00001c80  0e 92 04 0d 0e 9c 0e 6c  64 72 20 72 37 2c 64 72  |.......ldr r7,dr|
00001c90  75 0d 0e a6 17 61 64 64  20 72 38 2c 72 38 2c 72  |u....add r8,r8,r|
00001ca0  37 2c 61 73 72 23 31 30  0d 0e b0 0d 73 74 72 20  |7,asr#10....str |
00001cb0  72 38 2c 72 75 0d 0e ba  04 0d 0e c4 0e 6c 64 72  |r8,ru........ldr|
00001cc0  20 72 37 2c 64 6c 75 0d  0e ce 17 61 64 64 20 72  | r7,dlu....add r|
00001cd0  38 2c 72 39 2c 72 37 2c  61 73 72 23 31 30 0d 0e  |8,r9,r7,asr#10..|
00001ce0  d8 0d 73 74 72 20 72 38  2c 6c 75 0d 0e e2 04 0d  |..str r8,lu.....|
00001cf0  0e ec 0d 6c 64 72 20 72  38 2c 6c 76 0d 0e f6 0d  |...ldr r8,lv....|
00001d00  6c 64 72 20 72 31 2c 72  76 0d 0f 00 2c 73 75 62  |ldr r1,rv...,sub|
00001d10  20 72 37 2c 72 31 2c 72  38 20 20 20 20 20 20 20  | r7,r1,r8       |
00001d20  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
00001d30  76 3c 3c 31 30 0d 0f 0a  2c 6d 75 6c 20 72 37 2c  |v<<10...,mul r7,|
00001d40  72 30 2c 72 37 20 20 20  20 20 20 20 20 20 20 20  |r0,r7           |
00001d50  20 20 20 20 20 20 20 20  20 3b 20 64 76 3c 3c 32  |         ; dv<<2|
00001d60  31 0d 0f 14 0e 6c 64 72  20 72 30 2c 64 72 76 0d  |1....ldr r0,drv.|
00001d70  0f 1e 17 61 64 64 20 72  31 2c 72 31 2c 72 30 2c  |...add r1,r1,r0,|
00001d80  61 73 72 23 31 30 0d 0f  28 0d 73 74 72 20 72 31  |asr#10..(.str r1|
00001d90  2c 72 76 0d 0f 32 0e 6c  64 72 20 72 30 2c 64 6c  |,rv..2.ldr r0,dl|
00001da0  76 0d 0f 3c 17 61 64 64  20 72 30 2c 72 38 2c 72  |v..<.add r0,r8,r|
00001db0  30 2c 61 73 72 23 31 30  0d 0f 46 0d 73 74 72 20  |0,asr#10..F.str |
00001dc0  72 30 2c 6c 76 0d 0f 50  12 61 64 64 20 72 32 2c  |r0,lv..P.add r2,|
00001dd0  72 32 2c 23 36 34 30 0d  0f 5a 0f 73 74 72 20 72  |r2,#640..Z.str r|
00001de0  32 2c 6c 69 6e 65 0d 0f  64 04 0d 0f 6e 14 6d 6f  |2,line..d...n.mo|
00001df0  76 20 72 39 2c 72 39 2c  6c 73 6c 23 31 34 0d 0f  |v r9,r9,lsl#14..|
00001e00  78 14 6d 6f 76 20 72 38  2c 72 38 2c 6c 73 6c 23  |x.mov r8,r8,lsl#|
00001e10  31 34 0d 0f 82 16 6d 6f  76 20 72 31 31 2c 72 31  |14....mov r11,r1|
00001e20  31 2c 6c 73 6c 23 31 34  0d 0f 8c 04 0d 0f 96 0d  |1,lsl#14........|
00001e30  3b 20 64 63 20 3d 20 72  35 0d 0f a0 0d 3b 20 64  |; dc = r5....; d|
00001e40  75 20 3d 20 72 36 0d 0f  aa 0d 3b 20 64 76 20 3d  |u = r6....; dv =|
00001e50  20 72 37 0d 0f b4 0c 3b  20 76 20 3d 20 72 38 0d  | r7....; v = r8.|
00001e60  0f be 0c 3b 20 75 20 3d  20 72 39 0d 0f c8 12 3b  |...; u = r9....;|
00001e70  20 73 70 72 69 74 65 20  3d 20 72 31 30 0d 0f d2  | sprite = r10...|
00001e80  0d 3b 20 63 20 3d 20 72  31 31 0d 0f dc 14 3b 20  |.; c = r11....; |
00001e90  6c 65 66 74 5f 61 64 72  20 3d 20 72 31 32 0d 0f  |left_adr = r12..|
00001ea0  e6 15 3b 20 72 69 67 68  74 5f 61 64 72 20 3d 20  |..; right_adr = |
00001eb0  72 31 33 0d 0f f0 14 3b  20 72 31 20 3d 20 63 6f  |r13....; r1 = co|
00001ec0  6c 20 74 61 62 6c 65 0d  0f fa 04 0d 10 04 0a 2e  |l table.........|
00001ed0  78 6c 6f 6f 70 0d 10 0e  16 61 6e 64 20 72 30 2c  |xloop....and r0,|
00001ee0  72 38 2c 23 32 35 35 3c  3c 32 34 0d 10 18 16 6f  |r8,#255<<24....o|
00001ef0  72 72 20 72 30 2c 72 30  2c 72 39 2c 6c 73 72 23  |rr r0,r0,r9,lsr#|
00001f00  38 0d 10 22 1b 6c 64 72  62 20 72 30 2c 5b 72 31  |8..".ldrb r0,[r1|
00001f10  30 2c 72 30 2c 6c 73 72  23 31 36 5d 0d 10 2c 14  |0,r0,lsr#16]..,.|
00001f20  73 74 72 62 20 72 30 2c  5b 72 31 32 5d 2c 23 31  |strb r0,[r12],#1|
00001f30  0d 10 36 0f 63 6d 70 20  72 31 32 2c 72 31 33 0d  |..6.cmp r12,r13.|
00001f40  10 40 16 61 64 64 6c 65  20 72 32 2c 72 32 2c 23  |.@.addle r2,r2,#|
00001f50  31 3c 3c 33 31 0d 10 4a  18 61 64 64 6c 65 20 72  |1<<31..J.addle r|
00001f60  38 2c 72 38 2c 72 37 2c  61 73 72 23 31 0d 10 54  |8,r8,r7,asr#1..T|
00001f70  18 61 64 64 6c 65 20 72  39 2c 72 39 2c 72 36 2c  |.addle r9,r9,r6,|
00001f80  61 73 72 23 31 0d 10 5e  0d 62 6c 65 20 78 6c 6f  |asr#1..^.ble xlo|
00001f90  6f 70 0d 10 68 04 0d 10  72 0f 6c 64 72 20 72 32  |op..h...r.ldr r2|
00001fa0  2c 6c 69 6e 65 0d 10 7c  10 6c 64 72 20 72 30 2c  |,line..|.ldr r0,|
00001fb0  79 5f 65 6e 64 0d 10 86  12 61 64 64 20 72 31 34  |y_end....add r14|
00001fc0  2c 72 31 34 2c 23 31 0d  10 90 0e 63 6d 70 20 72  |,r14,#1....cmp r|
00001fd0  31 34 2c 72 30 0d 10 9a  0d 62 6c 74 20 79 6c 6f  |14,r0....blt ylo|
00001fe0  6f 70 0d 10 a4 04 0d 10  ae 05 5d 0d 10 b8 06 3d  |op........]....=|
00001ff0  30 0d 10 c2 05 3a 0d 10  cc 14 dd a4 73 63 72 65  |0....:......scre|
00002000  65 6e 61 64 72 28 62 6b  25 29 0d 10 d6 17 c8 99  |enadr(bk%)......|
00002010  22 4f 53 5f 42 79 74 65  22 2c 31 31 32 2c 62 6b  |"OS_Byte",112,bk|
00002020  25 0d 10 e0 17 c8 99 22  4f 53 5f 42 79 74 65 22  |%......"OS_Byte"|
00002030  2c 31 31 33 2c 62 6b 25  0d 10 ea 0a de 20 71 25  |,113,bk%..... q%|
00002040  20 38 0d 10 f4 13 21 71  25 3d 31 34 38 3a 71 25  | 8....!q%=148:q%|
00002050  21 34 3d 2d 31 0d 10 fe  21 c8 99 22 4f 53 5f 52  |!4=-1...!.."OS_R|
00002060  65 61 64 56 64 75 56 61  72 69 61 62 6c 65 73 22  |eadVduVariables"|
00002070  2c 71 25 2c 71 25 0d 11  08 08 3d 21 71 25 0d ff  |,q%,q%....=!q%..|
00002080