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

DiffDim/Triangle3b

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/Triangle3b
Read OK:
File size: 208B bytes
Load address: 0000
Exec address: 0000
File contents
   10REM Triangle 3b for VIDC1 machines
   20REM
   30REM Demonstrate texture mapping with triangles
   40:
   50ON ERROR MODE0:PRINT REPORT$;" at line ";ERL:END
   60MODE 13:OFF
   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)>>2:ay%=256-(y%(0)>>2)
  480bx%=x%(1)>>2:by%=256-(y%(1)>>2)
  490cx%=x%(2)>>2:cy%=256-(y%(2)>>2)
  500dx%=x%(3)>>2:dy%=256-(y%(3)>>2)
  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%),8
  780NEXT
  790ENDPROC
  800:
  810DEFPROCassemble
  820q_step%=16:sstep%=256/q_step%
  830log2_q_step%=LOG(q_step%)/LOG(2)
  840DIM code% 16384,div_table% 32768*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,#32768
 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,#256
 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#6
 2400add r2,r2,r1,lsl#8                      ; 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,#320
 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 3b for VIDC1 machines
�
0� Demonstrate texture mapping with triangles
(:
2� � �0:� �$;" at line ";�:�
<
� 13:�
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)>>2:ay%=256-(y%(0)>>2)
�#bx%=x%(1)>>2:by%=256-(y%(1)>>2)
�#cx%=x%(2)>>2:cy%=256-(y%(2)>>2)
�#dx%=x%(3)>>2:dy%=256-(y%(3)>>2)
�� 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%),8
�
�
 :
*��assemble
4!q_step%=16:sstep%=256/q_step%
> log2_q_step%=�(q_step%)/�(2)
H2� code% 16384,div_table% 32768*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,#32768
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,#256
�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#6
	`9add r2,r2,r1,lsl#8                      ; 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,#320
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 24 f4 20 54 72  69 61 6e 67 6c 65 20 33  |...$. Triangle 3|
00000010  62 20 66 6f 72 20 56 49  44 43 31 20 6d 61 63 68  |b for VIDC1 mach|
00000020  69 6e 65 73 0d 00 14 05  f4 0d 00 1e 30 f4 20 44  |ines........0. D|
00000030  65 6d 6f 6e 73 74 72 61  74 65 20 74 65 78 74 75  |emonstrate textu|
00000040  72 65 20 6d 61 70 70 69  6e 67 20 77 69 74 68 20  |re mapping with |
00000050  74 72 69 61 6e 67 6c 65  73 0d 00 28 05 3a 0d 00  |triangles..(.:..|
00000060  32 1f ee 20 85 20 eb 30  3a f1 20 f6 24 3b 22 20  |2.. . .0:. .$;" |
00000070  61 74 20 6c 69 6e 65 20  22 3b 9e 3a e0 0d 00 3c  |at line ";.:...<|
00000080  0a eb 20 31 33 3a 87 0d  00 46 0d f2 61 73 73 65  |.. 13:...F..asse|
00000090  6d 62 6c 65 0d 00 50 0b  d6 20 73 65 74 75 70 0d  |mble..P.. setup.|
000000a0  00 5a 11 de 20 78 25 28  33 29 2c 79 25 28 33 29  |.Z.. x%(3),y%(3)|
000000b0  0d 00 64 18 78 25 28 29  3d 31 30 30 2c 31 30 30  |..d.x%()=100,100|
000000c0  2c 37 30 30 2c 37 30 30  0d 00 6e 18 79 25 28 29  |,700,700..n.y%()|
000000d0  3d 37 30 30 2c 31 30 30  2c 37 30 30 2c 31 30 30  |=700,100,700,100|
000000e0  0d 00 78 05 3a 0d 00 82  09 62 6b 25 3d 31 0d 00  |..x.:....bk%=1..|
000000f0  8c 09 f2 64 72 61 77 0d  00 96 09 f2 64 72 61 77  |...draw.....draw|
00000100  0d 00 a0 08 c8 97 20 ee  0d 00 aa 05 f5 0d 00 b4  |...... .........|
00000110  05 f5 0d 00 be 11 c8 97  20 6d 78 25 2c 6d 79 25  |........ mx%,my%|
00000120  2c 62 25 0d 00 c8 0a fd  20 62 25 3d 34 0d 00 d2  |,b%..... b%=4...|
00000130  05 3a 0d 00 dc 13 69 25  3d 2d 31 3a 6d 64 25 3d  |.:....i%=-1:md%=|
00000140  31 30 30 30 30 0d 00 e6  0d e3 6e 25 3d 30 20 b8  |10000.....n%=0 .|
00000150  20 33 0d 00 f0 21 64 78  25 3d 6d 78 25 2d 78 25  | 3...!dx%=mx%-x%|
00000160  28 6e 25 29 3a 64 79 25  3d 6d 79 25 2d 79 25 28  |(n%):dy%=my%-y%(|
00000170  6e 25 29 0d 00 fa 16 64  25 3d 64 78 25 2a 64 78  |n%)....d%=dx%*dx|
00000180  25 2b 64 79 25 2a 64 79  25 0d 01 04 19 e7 20 64  |%+dy%*dy%..... d|
00000190  25 3c 6d 64 25 20 6d 64  25 3d 64 25 3a 69 25 3d  |%<md% md%=d%:i%=|
000001a0  6e 25 0d 01 0e 05 ed 0d  01 18 1a e7 20 69 25 3c  |n%.......... i%<|
000001b0  3e 2d 31 20 8c 20 f2 63  68 61 6e 67 65 28 69 25  |>-1 . .change(i%|
000001c0  29 0d 01 22 07 fd 20 a3  0d 01 2c 05 e0 0d 01 36  |)..".. ...,....6|
000001d0  05 3a 0d 01 40 10 dd f2  63 68 61 6e 67 65 28 69  |.:..@...change(i|
000001e0  25 29 0d 01 4a 05 f5 0d  01 54 17 c8 97 20 78 25  |%)..J....T... x%|
000001f0  28 69 25 29 2c 79 25 28  69 25 29 2c 62 25 0d 01  |(i%),y%(i%),b%..|
00000200  5e 09 f2 64 72 61 77 0d  01 68 0a fd 20 62 25 3d  |^..draw..h.. b%=|
00000210  30 0d 01 72 09 f2 64 72  61 77 0d 01 7c 05 e1 0d  |0..r..draw..|...|
00000220  01 86 05 3a 0d 01 90 0a  dd f2 64 72 61 77 0d 01  |...:......draw..|
00000230  9a 17 c8 99 22 4f 53 5f  42 79 74 65 22 2c 31 31  |...."OS_Byte",11|
00000240  32 2c 62 6b 25 0d 01 a4  1d c8 94 20 21 73 63 72  |2,bk%...... !scr|
00000250  65 65 6e 61 64 72 2c 73  63 72 65 65 6e 61 64 72  |eenadr,screenadr|
00000260  21 34 0d 01 ae 0d 62 6b  25 3d 33 2d 62 6b 25 0d  |!4....bk%=3-bk%.|
00000270  01 b8 06 c8 96 0d 01 c2  17 c8 99 22 4f 53 5f 42  |..........."OS_B|
00000280  79 74 65 22 2c 31 31 33  2c 62 6b 25 0d 01 cc 05  |yte",113,bk%....|
00000290  db 0d 01 d6 23 61 78 25  3d 78 25 28 30 29 3e 3e  |....#ax%=x%(0)>>|
000002a0  32 3a 61 79 25 3d 32 35  36 2d 28 79 25 28 30 29  |2:ay%=256-(y%(0)|
000002b0  3e 3e 32 29 0d 01 e0 23  62 78 25 3d 78 25 28 31  |>>2)...#bx%=x%(1|
000002c0  29 3e 3e 32 3a 62 79 25  3d 32 35 36 2d 28 79 25  |)>>2:by%=256-(y%|
000002d0  28 31 29 3e 3e 32 29 0d  01 ea 23 63 78 25 3d 78  |(1)>>2)...#cx%=x|
000002e0  25 28 32 29 3e 3e 32 3a  63 79 25 3d 32 35 36 2d  |%(2)>>2:cy%=256-|
000002f0  28 79 25 28 32 29 3e 3e  32 29 0d 01 f4 23 64 78  |(y%(2)>>2)...#dx|
00000300  25 3d 78 25 28 33 29 3e  3e 32 3a 64 79 25 3d 32  |%=x%(3)>>2:dy%=2|
00000310  35 36 2d 28 79 25 28 33  29 3e 3e 32 29 0d 01 fe  |56-(y%(3)>>2)...|
00000320  14 f4 20 46 69 72 73 74  20 74 72 69 61 6e 67 6c  |.. First triangl|
00000330  65 0d 02 08 37 e7 20 62  78 25 2a 63 79 25 2b 63  |e...7. bx%*cy%+c|
00000340  78 25 2a 61 79 25 2b 61  78 25 2a 62 79 25 3e 62  |x%*ay%+ax%*by%>b|
00000350  78 25 2a 61 79 25 2b 63  78 25 2a 62 79 25 2b 61  |x%*ay%+cx%*by%+a|
00000360  78 25 2a 63 79 25 20 8c  0d 02 12 21 20 20 21 61  |x%*cy% ....!  !a|
00000370  78 3d 61 78 25 3a 21 61  79 3d 61 79 25 3a 21 61  |x=ax%:!ay=ay%:!a|
00000380  75 3d 30 3a 21 61 76 3d  30 0d 02 1c 23 20 20 21  |u=0:!av=0...#  !|
00000390  62 78 3d 62 78 25 3a 21  62 79 3d 62 79 25 3a 21  |bx=bx%:!by=by%:!|
000003a0  62 75 3d 30 3a 21 62 76  3d 32 35 35 0d 02 26 23  |bu=0:!bv=255..&#|
000003b0  20 20 21 63 78 3d 63 78  25 3a 21 63 79 3d 63 79  |  !cx=cx%:!cy=cy|
000003c0  25 3a 21 63 75 3d 32 35  35 3a 21 63 76 3d 30 0d  |%:!cu=255:!cv=0.|
000003d0  02 30 05 cc 0d 02 3a 23  20 20 21 61 78 3d 62 78  |.0....:#  !ax=bx|
000003e0  25 3a 21 61 79 3d 62 79  25 3a 21 61 75 3d 30 3a  |%:!ay=by%:!au=0:|
000003f0  21 61 76 3d 32 35 35 0d  02 44 21 20 20 21 62 78  |!av=255..D!  !bx|
00000400  3d 61 78 25 3a 21 62 79  3d 61 79 25 3a 21 62 75  |=ax%:!by=ay%:!bu|
00000410  3d 30 3a 21 62 76 3d 30  0d 02 4e 23 20 20 21 63  |=0:!bv=0..N#  !c|
00000420  78 3d 63 78 25 3a 21 63  79 3d 63 79 25 3a 21 63  |x=cx%:!cy=cy%:!c|
00000430  75 3d 32 35 35 3a 21 63  76 3d 30 0d 02 58 05 cd  |u=255:!cv=0..X..|
00000440  0d 02 62 16 d6 20 74 65  78 74 75 72 65 5f 74 72  |..b.. texture_tr|
00000450  69 61 6e 67 6c 65 0d 02  6c 04 0d 02 76 15 f4 20  |iangle..l...v.. |
00000460  53 65 63 6f 6e 64 20 74  72 69 61 6e 67 6c 65 0d  |Second triangle.|
00000470  02 80 37 e7 20 62 78 25  2a 63 79 25 2b 63 78 25  |..7. bx%*cy%+cx%|
00000480  2a 64 79 25 2b 64 78 25  2a 62 79 25 3e 62 78 25  |*dy%+dx%*by%>bx%|
00000490  2a 64 79 25 2b 63 78 25  2a 62 79 25 2b 64 78 25  |*dy%+cx%*by%+dx%|
000004a0  2a 63 79 25 20 8c 0d 02  8a 25 20 20 21 61 78 3d  |*cy% ....%  !ax=|
000004b0  64 78 25 3a 21 61 79 3d  64 79 25 3a 21 61 75 3d  |dx%:!ay=dy%:!au=|
000004c0  32 35 35 3a 21 61 76 3d  32 35 35 0d 02 94 23 20  |255:!av=255...# |
000004d0  20 21 62 78 3d 62 78 25  3a 21 62 79 3d 62 79 25  | !bx=bx%:!by=by%|
000004e0  3a 21 62 75 3d 30 3a 21  62 76 3d 32 35 35 0d 02  |:!bu=0:!bv=255..|
000004f0  9e 23 20 20 21 63 78 3d  63 78 25 3a 21 63 79 3d  |.#  !cx=cx%:!cy=|
00000500  63 79 25 3a 21 63 75 3d  32 35 35 3a 21 63 76 3d  |cy%:!cu=255:!cv=|
00000510  30 0d 02 a8 05 cc 0d 02  b2 23 20 20 21 61 78 3d  |0........#  !ax=|
00000520  62 78 25 3a 21 61 79 3d  62 79 25 3a 21 61 75 3d  |bx%:!ay=by%:!au=|
00000530  30 3a 21 61 76 3d 32 35  35 0d 02 bc 25 20 20 21  |0:!av=255...%  !|
00000540  62 78 3d 64 78 25 3a 21  62 79 3d 64 79 25 3a 21  |bx=dx%:!by=dy%:!|
00000550  62 75 3d 32 35 35 3a 21  62 76 3d 32 35 35 0d 02  |bu=255:!bv=255..|
00000560  c6 23 20 20 21 63 78 3d  63 78 25 3a 21 63 79 3d  |.#  !cx=cx%:!cy=|
00000570  63 79 25 3a 21 63 75 3d  32 35 35 3a 21 63 76 3d  |cy%:!cu=255:!cv=|
00000580  30 0d 02 d0 05 cd 0d 02  da 16 d6 20 74 65 78 74  |0.......... text|
00000590  75 72 65 5f 74 72 69 61  6e 67 6c 65 0d 02 e4 04  |ure_triangle....|
000005a0  0d 02 ee 1a f4 20 44 72  61 77 20 63 6f 6e 74 72  |..... Draw contr|
000005b0  6f 6c 20 68 61 6e 64 6c  65 73 0d 02 f8 0d e3 6e  |ol handles.....n|
000005c0  25 3d 30 20 b8 20 33 0d  03 02 16 c8 8f 20 78 25  |%=0 . 3...... x%|
000005d0  28 6e 25 29 2c 79 25 28  6e 25 29 2c 38 0d 03 0c  |(n%),y%(n%),8...|
000005e0  05 ed 0d 03 16 05 e1 0d  03 20 05 3a 0d 03 2a 0e  |......... .:..*.|
000005f0  dd f2 61 73 73 65 6d 62  6c 65 0d 03 34 21 71 5f  |..assemble..4!q_|
00000600  73 74 65 70 25 3d 31 36  3a 73 73 74 65 70 25 3d  |step%=16:sstep%=|
00000610  32 35 36 2f 71 5f 73 74  65 70 25 0d 03 3e 20 6c  |256/q_step%..> l|
00000620  6f 67 32 5f 71 5f 73 74  65 70 25 3d ab 28 71 5f  |og2_q_step%=.(q_|
00000630  73 74 65 70 25 29 2f ab  28 32 29 0d 03 48 32 de  |step%)/.(2)..H2.|
00000640  20 63 6f 64 65 25 20 31  36 33 38 34 2c 64 69 76  | code% 16384,div|
00000650  5f 74 61 62 6c 65 25 20  33 32 37 36 38 2a 34 2c  |_table% 32768*4,|
00000660  73 70 72 69 74 65 25 20  36 35 35 39 32 0d 03 52  |sprite% 65592..R|
00000670  15 e3 20 70 61 73 73 25  3d 30 20 b8 20 32 20 88  |.. pass%=0 . 2 .|
00000680  20 32 0d 03 5c 0c 50 25  3d 63 6f 64 65 25 0d 03  | 2..\.P%=code%..|
00000690  66 0e 5b 4f 50 54 20 70  61 73 73 25 0d 03 70 0a  |f.[OPT pass%..p.|
000006a0  2e 73 65 74 75 70 0d 03  7a 37 6c 64 72 20 72 30  |.setup..z7ldr r0|
000006b0  2c 64 69 76 5f 74 61 62  6c 65 20 20 20 20 20 20  |,div_table      |
000006c0  20 20 3b 20 62 75 69 6c  64 20 64 69 76 69 64 65  |  ; build divide|
000006d0  20 6c 6f 6f 6b 75 70 20  74 61 62 6c 65 0d 03 84  | lookup table...|
000006e0  0d 6d 6f 76 20 72 32 2c  23 31 0d 03 8e 04 0d 03  |.mov r2,#1......|
000006f0  98 07 2e 64 6c 0d 03 a2  11 6d 6f 76 20 72 34 2c  |...dl....mov r4,|
00000700  23 31 3c 3c 32 30 0d 03  ac 27 6d 6f 76 20 72 35  |#1<<20...'mov r5|
00000710  2c 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#0             |
00000720  20 20 3b 20 72 65 6d 61  69 6e 64 65 72 0d 03 b6  |  ; remainder...|
00000730  26 6d 6f 76 20 72 36 2c  23 30 20 20 20 20 20 20  |&mov r6,#0      |
00000740  20 20 20 20 20 20 20 20  20 3b 20 71 75 6f 74 69  |         ; quoti|
00000750  65 6e 74 0d 03 c0 11 6d  6f 76 20 72 37 2c 23 31  |ent....mov r7,#1|
00000760  3c 3c 33 31 0d 03 ca 0d  2e 64 69 76 5f 6c 6f 6f  |<<31.....div_loo|
00000770  70 0d 03 d4 14 6d 6f 76  73 20 72 34 2c 72 34 2c  |p....movs r4,r4,|
00000780  6c 73 6c 23 31 0d 03 de  10 61 64 63 20 72 35 2c  |lsl#1....adc r5,|
00000790  72 35 2c 72 35 0d 03 e8  0d 63 6d 70 20 72 35 2c  |r5,r5....cmp r5,|
000007a0  72 32 0d 03 f2 12 73 75  62 67 65 20 72 35 2c 72  |r2....subge r5,r|
000007b0  35 2c 72 32 0d 03 fc 12  6f 72 72 67 65 20 72 36  |5,r2....orrge r6|
000007c0  2c 72 36 2c 72 37 0d 04  06 14 6d 6f 76 73 20 72  |,r6,r7....movs r|
000007d0  37 2c 72 37 2c 6c 73 72  23 31 0d 04 10 10 62 6e  |7,r7,lsr#1....bn|
000007e0  65 20 64 69 76 5f 6c 6f  6f 70 0d 04 1a 04 0d 04  |e div_loop......|
000007f0  24 18 3b 20 72 36 20 3d  20 72 34 20 64 69 76 20  |$.; r6 = r4 div |
00000800  72 32 20 3d 20 73 0d 04  2e 04 0d 04 38 13 73 74  |r2 = s......8.st|
00000810  72 20 72 36 2c 5b 72 30  2c 23 34 5d 21 0d 04 42  |r r6,[r0,#4]!..B|
00000820  10 61 64 64 20 72 32 2c  72 32 2c 23 31 0d 04 4c  |.add r2,r2,#1..L|
00000830  11 63 6d 70 20 72 32 2c  23 33 32 37 36 38 0d 04  |.cmp r2,#32768..|
00000840  56 0a 62 6c 65 20 64 6c  0d 04 60 04 0d 04 6a 0e  |V.ble dl..`...j.|
00000850  6d 6f 76 20 70 63 2c 72  31 34 0d 04 74 04 0d 04  |mov pc,r14..t...|
00000860  7e 0e 2e 64 69 76 5f 74  61 62 6c 65 0d 04 88 12  |~..div_table....|
00000870  64 63 64 20 64 69 76 5f  74 61 62 6c 65 25 0d 04  |dcd div_table%..|
00000880  92 04 0d 04 9c 04 0d 04  a6 0b 2e 73 74 61 63 6b  |...........stack|
00000890  70 0d 04 b0 09 64 63 64  20 30 0d 04 ba 09 2e 6c  |p....dcd 0.....l|
000008a0  69 6e 6b 0d 04 c4 09 64  63 64 20 30 0d 04 ce 0e  |ink....dcd 0....|
000008b0  2e 64 69 76 5f 74 61 62  6c 65 0d 04 d8 12 64 63  |.div_table....dc|
000008c0  64 20 64 69 76 5f 74 61  62 6c 65 25 0d 04 e2 0c  |d div_table%....|
000008d0  2e 72 5f 69 6e 64 65 78  0d 04 ec 09 64 63 64 20  |.r_index....dcd |
000008e0  30 0d 04 f6 0c 2e 6c 5f  69 6e 64 65 78 0d 05 00  |0.....l_index...|
000008f0  09 64 63 64 20 30 0d 05  0a 04 0d 05 14 0a 2e 79  |.dcd 0.........y|
00000900  5f 65 6e 64 0d 05 1e 09  64 63 64 20 30 0d 05 28  |_end....dcd 0..(|
00000910  04 0d 05 32 0b 2e 73 70  72 69 74 65 0d 05 3c 12  |...2..sprite..<.|
00000920  64 63 64 20 73 70 72 69  74 65 25 2b 35 36 0d 05  |dcd sprite%+56..|
00000930  46 0e 2e 73 63 72 65 65  6e 61 64 72 0d 05 50 15  |F..screenadr..P.|
00000940  64 63 64 20 a4 73 63 72  65 65 6e 61 64 72 28 32  |dcd .screenadr(2|
00000950  29 0d 05 5a 15 64 63 64  20 a4 73 63 72 65 65 6e  |)..Z.dcd .screen|
00000960  61 64 72 28 31 29 0d 05  64 04 0d 05 6e 17 2e 61  |adr(1)..d...n..a|
00000970  79 3a 64 63 64 20 30 3a  2e 61 78 3a 64 63 64 20  |y:dcd 0:.ax:dcd |
00000980  30 0d 05 78 0f 2e 61 63  3a 64 63 64 20 32 35 35  |0..x..ac:dcd 255|
00000990  0d 05 82 17 2e 61 75 3a  64 63 64 20 30 3a 2e 61  |.....au:dcd 0:.a|
000009a0  76 3a 64 63 64 20 30 0d  05 8c 15 64 63 64 20 30  |v:dcd 0....dcd 0|
000009b0  3a 64 63 64 20 30 3a 64  63 64 20 30 0d 05 96 04  |:dcd 0:dcd 0....|
000009c0  0d 05 a0 17 2e 62 79 3a  64 63 64 20 30 3a 2e 62  |.....by:dcd 0:.b|
000009d0  78 3a 64 63 64 20 30 0d  05 aa 0f 2e 62 63 3a 64  |x:dcd 0.....bc:d|
000009e0  63 64 20 32 35 35 0d 05  b4 17 2e 62 75 3a 64 63  |cd 255.....bu:dc|
000009f0  64 20 30 3a 2e 62 76 3a  64 63 64 20 30 0d 05 be  |d 0:.bv:dcd 0...|
00000a00  15 64 63 64 20 30 3a 64  63 64 20 30 3a 64 63 64  |.dcd 0:dcd 0:dcd|
00000a10  20 30 0d 05 c8 04 0d 05  d2 17 2e 63 79 3a 64 63  | 0.........cy:dc|
00000a20  64 20 30 3a 2e 63 78 3a  64 63 64 20 30 0d 05 dc  |d 0:.cx:dcd 0...|
00000a30  0f 2e 63 63 3a 64 63 64  20 32 35 35 0d 05 e6 17  |..cc:dcd 255....|
00000a40  2e 63 75 3a 64 63 64 20  30 3a 2e 63 76 3a 64 63  |.cu:dcd 0:.cv:dc|
00000a50  64 20 30 0d 05 f0 15 64  63 64 20 30 3a 64 63 64  |d 0....dcd 0:dcd|
00000a60  20 30 3a 64 63 64 20 30  0d 05 fa 04 0d 06 04 15  | 0:dcd 0........|
00000a70  2e 74 65 78 74 75 72 65  5f 74 72 69 61 6e 67 6c  |.texture_triangl|
00000a80  65 0d 06 0e 0d 61 64 72  20 72 30 2c 61 79 0d 06  |e....adr r0,ay..|
00000a90  18 13 6c 64 72 20 72 31  30 2c 5b 72 30 2c 23 30  |..ldr r10,[r0,#0|
00000aa0  5d 0d 06 22 14 6c 64 72  20 72 31 31 2c 5b 72 30  |]..".ldr r11,[r0|
00000ab0  2c 23 33 32 5d 0d 06 2c  0f 63 6d 70 20 72 31 31  |,#32]..,.cmp r11|
00000ac0  2c 72 31 30 0d 06 36 10  6d 6f 76 6c 74 20 72 31  |,r10..6.movlt r1|
00000ad0  2c 72 31 31 0d 06 40 10  6d 6f 76 67 65 20 72 31  |,r11..@.movge r1|
00000ae0  2c 72 31 30 0d 06 4a 0f  6d 6f 76 6c 74 20 72 32  |,r10..J.movlt r2|
00000af0  2c 23 31 0d 06 54 0f 6d  6f 76 67 65 20 72 32 2c  |,#1..T.movge r2,|
00000b00  23 30 0d 06 5e 14 6c 64  72 20 72 31 32 2c 5b 72  |#0..^.ldr r12,[r|
00000b10  30 2c 23 36 34 5d 0d 06  68 0e 63 6d 70 20 72 31  |0,#64]..h.cmp r1|
00000b20  32 2c 72 31 0d 06 72 10  6d 6f 76 6c 74 20 72 31  |2,r1..r.movlt r1|
00000b30  2c 72 31 32 0d 06 7c 0f  6d 6f 76 6c 74 20 72 32  |,r12..|.movlt r2|
00000b40  2c 23 32 0d 06 86 0f 63  6d 70 20 72 31 2c 23 32  |,#2....cmp r1,#2|
00000b50  35 36 0d 06 90 10 6d 6f  76 67 65 20 70 63 2c 72  |56....movge pc,r|
00000b60  31 34 0d 06 9a 0e 63 6d  70 20 72 31 30 2c 23 30  |14....cmp r10,#0|
00000b70  0d 06 a4 10 63 6d 70 6c  74 20 72 31 31 2c 23 30  |....cmplt r11,#0|
00000b80  0d 06 ae 10 63 6d 70 6c  74 20 72 31 32 2c 23 30  |....cmplt r12,#0|
00000b90  0d 06 b8 10 6d 6f 76 6c  74 20 70 63 2c 72 31 34  |....movlt pc,r14|
00000ba0  0d 06 c2 04 0d 06 cc 12  73 74 72 20 72 31 33 2c  |........str r13,|
00000bb0  73 74 61 63 6b 70 0d 06  d6 04 0d 06 e0 11 73 75  |stackp........su|
00000bc0  62 73 20 72 33 2c 72 32  2c 23 31 0d 06 ea 0f 6d  |bs r3,r2,#1....m|
00000bd0  6f 76 6c 74 20 72 33 2c  23 32 0d 06 f4 04 0d 06  |ovlt r3,#2......|
00000be0  fe 16 61 64 64 20 72 32  2c 72 30 2c 72 32 2c 6c  |..add r2,r0,r2,l|
00000bf0  73 6c 23 35 0d 07 08 3d  6c 64 6d 69 62 20 72 32  |sl#5...=ldmib r2|
00000c00  2c 7b 72 35 2c 72 36 2c  72 37 2c 72 38 7d 20 20  |,{r5,r6,r7,r8}  |
00000c10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c20  3b 20 78 5f 6b 2c 63 5f  6b 2c 75 5f 6b 2c 76 5f  |; x_k,c_k,u_k,v_|
00000c30  6b 0d 07 12 16 61 64 64  20 72 34 2c 72 30 2c 72  |k....add r4,r0,r|
00000c40  33 2c 6c 73 6c 23 35 0d  07 1c 12 73 74 72 20 72  |3,lsl#5....str r|
00000c50  34 2c 6c 5f 69 6e 64 65  78 0d 07 26 11 73 75 62  |4,l_index..&.sub|
00000c60  73 20 72 33 2c 72 33 2c  23 31 0d 07 30 0f 6d 6f  |s r3,r3,#1..0.mo|
00000c70  76 6c 74 20 72 33 2c 23  32 0d 07 3a 16 61 64 64  |vlt r3,#2..:.add|
00000c80  20 72 30 2c 72 30 2c 72  33 2c 6c 73 6c 23 35 0d  | r0,r0,r3,lsl#5.|
00000c90  07 44 12 73 74 72 20 72  30 2c 72 5f 69 6e 64 65  |.D.str r0,r_inde|
00000ca0  78 0d 07 4e 41 6c 64 6d  69 61 20 72 34 2c 7b 72  |x..NAldmia r4,{r|
00000cb0  39 2c 72 31 30 2c 72 31  31 2c 72 31 32 2c 72 31  |9,r10,r11,r12,r1|
00000cc0  33 7d 20 20 20 20 20 20  20 20 20 20 20 3b 20 79  |3}           ; y|
00000cd0  5f 6c 2c 78 5f 6c 2c 63  5f 6c 2c 75 5f 6c 2c 76  |_l,x_l,c_l,u_l,v|
00000ce0  5f 6c 0d 07 58 04 0d 07  62 10 73 74 72 20 72 31  |_l..X...b.str r1|
00000cf0  34 2c 6c 69 6e 6b 0d 07  6c 15 6c 64 72 20 72 31  |4,link..l.ldr r1|
00000d00  34 2c 64 69 76 5f 74 61  62 6c 65 0d 07 76 31 73  |4,div_table..v1s|
00000d10  75 62 73 20 72 32 2c 72  39 2c 72 31 20 20 20 20  |ubs r2,r9,r1    |
00000d20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000d30  20 20 20 20 20 20 20 3b  20 64 6c 79 0d 07 80 37  |       ; dly...7|
00000d40  6c 64 72 67 74 20 72 32  2c 5b 72 31 34 2c 72 32  |ldrgt r2,[r14,r2|
00000d50  2c 6c 73 6c 23 32 5d 20  20 20 20 20 20 20 20 20  |,lsl#2]         |
00000d60  20 20 20 20 20 20 20 20  3b 20 31 3c 3c 32 30 2f  |        ; 1<<20/|
00000d70  64 6c 79 0d 07 8a 04 0d  07 94 16 6d 6f 76 67 74  |dly........movgt|
00000d80  20 72 33 2c 72 35 2c 6c  73 6c 23 31 30 0d 07 9e  | r3,r5,lsl#10...|
00000d90  17 6d 6f 76 65 71 20 72  33 2c 72 31 30 2c 6c 73  |.moveq r3,r10,ls|
00000da0  6c 23 31 30 0d 07 a8 13  73 75 62 67 74 20 72 34  |l#10....subgt r4|
00000db0  2c 72 31 30 2c 72 35 0d  07 b2 35 6d 75 6c 20 72  |,r10,r5...5mul r|
00000dc0  34 2c 72 32 2c 72 34 20  20 20 20 20 20 20 20 20  |4,r2,r4         |
00000dd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000de0  20 20 20 3b 20 64 6c 78  3c 3c 32 30 0d 07 bc 0e  |   ; dlx<<20....|
00000df0  73 74 72 20 72 34 2c 64  6c 78 0d 07 c6 04 0d 07  |str r4,dlx......|
00000e00  d0 17 6d 6f 76 67 74 20  72 31 30 2c 72 37 2c 6c  |..movgt r10,r7,l|
00000e10  73 6c 23 31 30 0d 07 da  18 6d 6f 76 65 71 20 72  |sl#10....moveq r|
00000e20  31 30 2c 72 31 32 2c 6c  73 6c 23 31 30 0d 07 e4  |10,r12,lsl#10...|
00000e30  0e 73 74 72 20 72 31 30  2c 6c 75 0d 07 ee 13 73  |.str r10,lu....s|
00000e40  75 62 67 74 20 72 34 2c  72 31 32 2c 72 37 0d 07  |ubgt r4,r12,r7..|
00000e50  f8 35 6d 75 6c 20 72 34  2c 72 32 2c 72 34 20 20  |.5mul r4,r2,r4  |
00000e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000e70  20 20 20 20 20 20 20 20  20 20 3b 20 64 6c 75 3c  |          ; dlu<|
00000e80  3c 32 30 0d 08 02 0e 73  74 72 20 72 34 2c 64 6c  |<20....str r4,dl|
00000e90  75 0d 08 0c 04 0d 08 16  17 6d 6f 76 67 74 20 72  |u........movgt r|
00000ea0  31 30 2c 72 38 2c 6c 73  6c 23 31 30 0d 08 20 18  |10,r8,lsl#10.. .|
00000eb0  6d 6f 76 65 71 20 72 31  30 2c 72 31 33 2c 6c 73  |moveq r10,r13,ls|
00000ec0  6c 23 31 30 0d 08 2a 0e  73 74 72 20 72 31 30 2c  |l#10..*.str r10,|
00000ed0  6c 76 0d 08 34 13 73 75  62 67 74 20 72 34 2c 72  |lv..4.subgt r4,r|
00000ee0  31 33 2c 72 38 0d 08 3e  35 6d 75 6c 20 72 34 2c  |13,r8..>5mul r4,|
00000ef0  72 32 2c 72 34 20 20 20  20 20 20 20 20 20 20 20  |r2,r4           |
00000f00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f10  20 3b 20 64 6c 76 3c 3c  32 30 0d 08 48 0e 73 74  | ; dlv<<20..H.st|
00000f20  72 20 72 34 2c 64 6c 76  0d 08 52 04 0d 08 5c 41  |r r4,dlv..R...\A|
00000f30  6c 64 6d 69 61 20 72 30  2c 7b 72 30 2c 72 31 30  |ldmia r0,{r0,r10|
00000f40  2c 72 31 31 2c 72 31 32  2c 72 31 33 7d 20 20 20  |,r11,r12,r13}   |
00000f50  20 20 20 20 20 20 20 20  3b 20 79 5f 72 2c 78 5f  |        ; y_r,x_|
00000f60  72 2c 63 5f 72 2c 75 5f  72 2c 76 5f 72 0d 08 66  |r,c_r,u_r,v_r..f|
00000f70  31 73 75 62 73 20 72 32  2c 72 30 2c 72 31 20 20  |1subs r2,r0,r1  |
00000f80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f90  20 20 20 20 20 20 20 20  20 3b 20 64 72 79 0d 08  |         ; dry..|
00000fa0  70 37 6c 64 72 67 74 20  72 32 2c 5b 72 31 34 2c  |p7ldrgt r2,[r14,|
00000fb0  72 32 2c 6c 73 6c 23 32  5d 20 20 20 20 20 20 20  |r2,lsl#2]       |
00000fc0  20 20 20 20 20 20 20 20  20 20 3b 20 31 3c 3c 32  |          ; 1<<2|
00000fd0  30 2f 64 72 79 0d 08 7a  04 0d 08 84 16 6d 6f 76  |0/dry..z.....mov|
00000fe0  67 74 20 72 34 2c 72 35  2c 6c 73 6c 23 31 30 0d  |gt r4,r5,lsl#10.|
00000ff0  08 8e 17 6d 6f 76 65 71  20 72 34 2c 72 31 30 2c  |...moveq r4,r10,|
00001000  6c 73 6c 23 31 30 0d 08  98 14 73 75 62 67 74 20  |lsl#10....subgt |
00001010  72 31 30 2c 72 31 30 2c  72 35 0d 08 a2 35 6d 75  |r10,r10,r5...5mu|
00001020  6c 20 72 31 30 2c 72 32  2c 72 31 30 20 20 20 20  |l r10,r2,r10    |
00001030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001040  20 20 20 20 20 20 3b 20  64 72 78 3c 3c 32 30 0d  |      ; drx<<20.|
00001050  08 ac 0f 73 74 72 20 72  31 30 2c 64 72 78 0d 08  |...str r10,drx..|
00001060  b6 04 0d 08 c0 17 6d 6f  76 67 74 20 72 31 30 2c  |......movgt r10,|
00001070  72 37 2c 6c 73 6c 23 31  30 0d 08 ca 18 6d 6f 76  |r7,lsl#10....mov|
00001080  65 71 20 72 31 30 2c 72  31 32 2c 6c 73 6c 23 31  |eq r10,r12,lsl#1|
00001090  30 0d 08 d4 0e 73 74 72  20 72 31 30 2c 72 75 0d  |0....str r10,ru.|
000010a0  08 de 14 73 75 62 67 74  20 72 31 30 2c 72 31 32  |...subgt r10,r12|
000010b0  2c 72 37 0d 08 e8 35 6d  75 6c 20 72 31 30 2c 72  |,r7...5mul r10,r|
000010c0  32 2c 72 31 30 20 20 20  20 20 20 20 20 20 20 20  |2,r10           |
000010d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000010e0  20 64 72 75 3c 3c 32 30  0d 08 f2 0f 73 74 72 20  | dru<<20....str |
000010f0  72 31 30 2c 64 72 75 0d  08 fc 04 0d 09 06 17 6d  |r10,dru........m|
00001100  6f 76 67 74 20 72 31 30  2c 72 38 2c 6c 73 6c 23  |ovgt r10,r8,lsl#|
00001110  31 30 0d 09 10 18 6d 6f  76 65 71 20 72 31 30 2c  |10....moveq r10,|
00001120  72 31 33 2c 6c 73 6c 23  31 30 0d 09 1a 0e 73 74  |r13,lsl#10....st|
00001130  72 20 72 31 30 2c 72 76  0d 09 24 14 73 75 62 67  |r r10,rv..$.subg|
00001140  74 20 72 31 30 2c 72 31  33 2c 72 38 0d 09 2e 35  |t r10,r13,r8...5|
00001150  6d 75 6c 20 72 31 30 2c  72 32 2c 72 31 30 20 20  |mul r10,r2,r10  |
00001160  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001170  20 20 20 20 20 20 20 20  3b 20 64 72 76 3c 3c 32  |        ; drv<<2|
00001180  30 0d 09 38 0f 73 74 72  20 72 31 30 2c 64 72 76  |0..8.str r10,drv|
00001190  0d 09 42 04 0d 09 4c 14  6c 64 72 20 72 32 2c 73  |..B...L.ldr r2,s|
000011a0  63 72 65 65 6e 61 64 72  0d 09 56 16 61 64 64 20  |creenadr..V.add |
000011b0  72 32 2c 72 32 2c 72 31  2c 6c 73 6c 23 36 0d 09  |r2,r2,r1,lsl#6..|
000011c0  60 39 61 64 64 20 72 32  2c 72 32 2c 72 31 2c 6c  |`9add r2,r2,r1,l|
000011d0  73 6c 23 38 20 20 20 20  20 20 20 20 20 20 20 20  |sl#8            |
000011e0  20 20 20 20 20 20 20 20  20 20 3b 20 73 63 72 65  |          ; scre|
000011f0  65 6e 20 6c 69 6e 65 0d  09 6a 04 0d 09 74 0e 4d  |en line..j...t.M|
00001200  4f 56 20 52 31 34 2c 52  31 0d 09 7e 12 6c 64 72  |OV R14,R1..~.ldr|
00001210  20 72 31 30 2c 73 70 72  69 74 65 0d 09 88 04 0d  | r10,sprite.....|
00001220  09 92 0d 63 6d 70 20 72  39 2c 72 30 0d 09 9c 12  |...cmp r9,r0....|
00001230  73 74 72 6c 74 20 72 39  2c 79 5f 65 6e 64 0d 09  |strlt r9,y_end..|
00001240  a6 12 73 74 72 67 65 20  72 30 2c 79 5f 65 6e 64  |..strge r0,y_end|
00001250  0d 09 b0 04 0d 09 ba 10  62 67 74 20 6d 65 74 68  |........bgt meth|
00001260  6f 64 5f 32 0d 09 c4 10  62 65 71 20 6c 61 73 74  |od_2....beq last|
00001270  5f 62 69 74 0d 09 ce 04  0d 09 d8 3c 2e 6d 65 74  |_bit.......<.met|
00001280  68 6f 64 5f 31 20 20 20  20 20 20 20 20 20 20 20  |hod_1           |
00001290  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000012a0  20 20 20 20 3b 20 6c 65  66 74 5f 79 3c 72 69 67  |    ; left_y<rig|
000012b0  68 74 5f 79 0d 09 e2 04  0d 09 ec 0a a4 79 6c 6f  |ht_y.........ylo|
000012c0  6f 70 0d 09 f6 04 0d 0a  00 0e 3b 20 72 30 20 3d  |op........; r0 =|
000012d0  20 79 5f 6c 0d 0a 0a 11  3b 20 72 32 20 3d 20 73  | y_l....; r2 = s|
000012e0  63 6c 69 6e 65 0d 0a 14  0d 3b 20 72 33 20 3d 20  |cline....; r3 = |
000012f0  6c 78 0d 0a 1e 0d 3b 20  72 34 20 3d 20 72 78 0d  |lx....; r4 = rx.|
00001300  0a 28 17 3b 20 72 31 2c  72 35 2d 72 31 34 20 3d  |.(.; r1,r5-r14 =|
00001310  20 65 6d 70 74 79 0d 0a  32 04 0d 0a 3c 20 3b 20  | empty..2...< ; |
00001320  72 65 63 61 6c 63 75 61  74 65 20 64 6c 78 2c 64  |recalcuate dlx,d|
00001330  6c 75 2c 64 6c 76 2c 64  6c 63 0d 0a 46 12 6c 64  |lu,dlv,dlc..F.ld|
00001340  72 20 72 31 2c 6c 5f 69  6e 64 65 78 0d 0a 50 3d  |r r1,l_index..P=|
00001350  6c 64 6d 69 62 20 72 31  2c 7b 72 33 2c 72 31 30  |ldmib r1,{r3,r10|
00001360  2c 72 31 31 2c 72 31 32  7d 20 20 20 20 20 20 20  |,r11,r12}       |
00001370  20 20 20 20 20 20 20 20  3b 20 78 5f 6c 2c 63 5f  |        ; x_l,c_|
00001380  6c 2c 75 5f 6c 2c 76 5f  6c 0d 0a 5a 12 6c 64 72  |l,u_l,v_l..Z.ldr|
00001390  20 72 31 2c 72 5f 69 6e  64 65 78 0d 0a 64 41 6c  | r1,r_index..dAl|
000013a0  64 6d 69 61 20 72 31 2c  7b 72 31 2c 72 35 2c 72  |dmia r1,{r1,r5,r|
000013b0  36 2c 72 37 2c 72 38 7d  20 20 20 20 20 20 20 20  |6,r7,r8}        |
000013c0  20 20 20 20 20 20 20 3b  20 79 5f 72 2c 78 5f 72  |       ; y_r,x_r|
000013d0  2c 63 5f 72 2c 75 5f 72  2c 76 5f 72 0d 0a 6e 10  |,c_r,u_r,v_r..n.|
000013e0  73 74 72 20 72 31 2c 79  5f 65 6e 64 0d 0a 78 04  |str r1,y_end..x.|
000013f0  0d 0a 82 31 73 75 62 73  20 72 31 2c 72 31 2c 72  |...1subs r1,r1,r|
00001400  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00001410  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 64 6c  |            ; dl|
00001420  79 0d 0a 8c 15 6c 64 72  20 72 31 34 2c 64 69 76  |y....ldr r14,div|
00001430  5f 74 61 62 6c 65 0d 0a  96 04 0d 0a a0 37 6c 64  |_table.......7ld|
00001440  72 67 74 20 72 31 2c 5b  72 31 34 2c 72 31 2c 6c  |rgt r1,[r14,r1,l|
00001450  73 6c 23 32 5d 20 20 20  20 20 20 20 20 20 20 20  |sl#2]           |
00001460  20 20 20 20 20 20 3b 20  31 3c 3c 32 30 2f 64 6c  |      ; 1<<20/dl|
00001470  79 0d 0a aa 13 73 75 62  67 74 20 72 37 2c 72 37  |y....subgt r7,r7|
00001480  2c 72 31 31 0d 0a b4 35  6d 75 6c 20 72 37 2c 72  |,r11...5mul r7,r|
00001490  31 2c 72 37 20 20 20 20  20 20 20 20 20 20 20 20  |1,r7            |
000014a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000014b0  3b 20 64 6c 75 3c 3c 32  30 0d 0a be 0e 73 74 72  |; dlu<<20....str|
000014c0  20 72 37 2c 64 6c 75 0d  0a c8 12 73 75 62 67 74  | r7,dlu....subgt|
000014d0  20 72 35 2c 72 35 2c 72  33 0d 0a d2 14 6d 6f 76  | r5,r5,r3....mov|
000014e0  20 72 33 2c 72 33 2c 6c  73 6c 23 31 30 0d 0a dc  | r3,r3,lsl#10...|
000014f0  35 6d 75 6c 20 72 35 2c  72 31 2c 72 35 20 20 20  |5mul r5,r1,r5   |
00001500  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001510  20 20 20 20 20 20 20 20  20 3b 20 64 6c 78 3c 3c  |         ; dlx<<|
00001520  32 30 0d 0a e6 0e 73 74  72 20 72 35 2c 64 6c 78  |20....str r5,dlx|
00001530  0d 0a f0 04 0d 0a fa 13  73 75 62 67 74 20 72 35  |........subgt r5|
00001540  2c 72 38 2c 72 31 32 0d  0b 04 35 6d 75 6c 20 72  |,r8,r12...5mul r|
00001550  35 2c 72 31 2c 72 35 20  20 20 20 20 20 20 20 20  |5,r1,r5         |
00001560  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001570  20 20 20 3b 20 64 6c 76  3c 3c 32 30 0d 0b 0e 0e  |   ; dlv<<20....|
00001580  73 74 72 20 72 35 2c 64  6c 76 0d 0b 18 04 0d 0b  |str r5,dlv......|
00001590  22 12 6c 64 72 20 72 31  30 2c 73 70 72 69 74 65  |".ldr r10,sprite|
000015a0  0d 0b 2c 04 0d 0b 36 0e  4d 4f 56 20 52 31 34 2c  |..,...6.MOV R14,|
000015b0  52 30 0d 0b 40 0d 2e 6c  61 73 74 5f 62 69 74 0d  |R0..@..last_bit.|
000015c0  0b 4a 0a a4 79 6c 6f 6f  70 0d 0b 54 04 0d 0b 5e  |.J..yloop..T...^|
000015d0  12 6c 64 72 20 72 31 33  2c 73 74 61 63 6b 70 0d  |.ldr r13,stackp.|
000015e0  0b 68 10 6c 64 72 20 72  31 35 2c 6c 69 6e 6b 0d  |.h.ldr r15,link.|
000015f0  0b 72 04 0d 0b 7c 04 0d  0b 86 3d 2e 6d 65 74 68  |.r...|....=.meth|
00001600  6f 64 5f 32 20 20 20 20  20 20 20 20 20 20 20 20  |od_2            |
00001610  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001620  20 20 20 3b 20 72 69 67  68 74 5f 79 3c 20 6c 65  |   ; right_y< le|
00001630  66 74 5f 79 0d 0b 90 0a  a4 79 6c 6f 6f 70 0d 0b  |ft_y.....yloop..|
00001640  9a 04 0d 0b a4 0e 3b 20  72 30 20 3d 20 79 5f 6c  |......; r0 = y_l|
00001650  0d 0b ae 11 3b 20 72 32  20 3d 20 73 63 6c 69 6e  |....; r2 = sclin|
00001660  65 0d 0b b8 0d 3b 20 72  33 20 3d 20 6c 78 0d 0b  |e....; r3 = lx..|
00001670  c2 0d 3b 20 72 34 20 3d  20 72 78 0d 0b cc 17 3b  |..; r4 = rx....;|
00001680  20 72 31 2c 72 35 2d 72  31 34 20 3d 20 65 6d 70  | r1,r5-r14 = emp|
00001690  74 79 0d 0b d6 04 0d 0b  e0 20 3b 20 72 65 63 61  |ty....... ; reca|
000016a0  6c 63 75 61 74 65 20 64  72 78 2c 64 72 75 2c 64  |lcuate drx,dru,d|
000016b0  72 76 2c 64 72 63 0d 0b  ea 12 6c 64 72 20 72 31  |rv,drc....ldr r1|
000016c0  2c 72 5f 69 6e 64 65 78  0d 0b f4 3d 6c 64 6d 69  |,r_index...=ldmi|
000016d0  62 20 72 31 2c 7b 72 34  2c 72 31 30 2c 72 31 31  |b r1,{r4,r10,r11|
000016e0  2c 72 31 32 7d 20 20 20  20 20 20 20 20 20 20 20  |,r12}           |
000016f0  20 20 20 20 3b 20 78 5f  72 2c 63 5f 72 2c 75 5f  |    ; x_r,c_r,u_|
00001700  72 2c 76 5f 72 0d 0b fe  12 6c 64 72 20 72 31 2c  |r,v_r....ldr r1,|
00001710  6c 5f 69 6e 64 65 78 0d  0c 08 41 6c 64 6d 69 61  |l_index...Aldmia|
00001720  20 72 31 2c 7b 72 31 2c  72 35 2c 72 36 2c 72 37  | r1,{r1,r5,r6,r7|
00001730  2c 72 38 7d 20 20 20 20  20 20 20 20 20 20 20 20  |,r8}            |
00001740  20 20 20 3b 20 79 5f 6c  2c 78 5f 6c 2c 63 5f 6c  |   ; y_l,x_l,c_l|
00001750  2c 75 5f 6c 2c 76 5f 6c  0d 0c 12 10 73 74 72 20  |,u_l,v_l....str |
00001760  72 31 2c 79 5f 65 6e 64  0d 0c 1c 04 0d 0c 26 31  |r1,y_end......&1|
00001770  73 75 62 73 20 72 31 2c  72 31 2c 72 30 20 20 20  |subs r1,r1,r0   |
00001780  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001790  20 20 20 20 20 20 20 20  3b 20 64 6c 79 0d 0c 30  |        ; dly..0|
000017a0  15 6c 64 72 20 72 31 34  2c 64 69 76 5f 74 61 62  |.ldr r14,div_tab|
000017b0  6c 65 0d 0c 3a 04 0d 0c  44 37 6c 64 72 67 74 20  |le..:...D7ldrgt |
000017c0  72 31 2c 5b 72 31 34 2c  72 31 2c 6c 73 6c 23 32  |r1,[r14,r1,lsl#2|
000017d0  5d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |]               |
000017e0  20 20 3b 20 31 3c 3c 32  30 2f 64 6c 79 0d 0c 4e  |  ; 1<<20/dly..N|
000017f0  12 73 75 62 67 74 20 72  35 2c 72 35 2c 72 34 0d  |.subgt r5,r5,r4.|
00001800  0c 58 14 6d 6f 76 20 72  34 2c 72 34 2c 6c 73 6c  |.X.mov r4,r4,lsl|
00001810  23 31 30 0d 0c 62 35 6d  75 6c 20 72 35 2c 72 31  |#10..b5mul r5,r1|
00001820  2c 72 35 20 20 20 20 20  20 20 20 20 20 20 20 20  |,r5             |
00001830  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001840  20 64 6c 78 3c 3c 32 30  0d 0c 6c 0e 73 74 72 20  | dlx<<20..l.str |
00001850  72 35 2c 64 72 78 0d 0c  76 13 73 75 62 67 74 20  |r5,drx..v.subgt |
00001860  72 35 2c 72 37 2c 72 31  31 0d 0c 80 35 6d 75 6c  |r5,r7,r11...5mul|
00001870  20 72 35 2c 72 31 2c 72  35 20 20 20 20 20 20 20  | r5,r1,r5       |
00001880  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001890  20 20 20 20 20 3b 20 64  6c 75 3c 3c 32 30 0d 0c  |     ; dlu<<20..|
000018a0  8a 0e 73 74 72 20 72 35  2c 64 72 75 0d 0c 94 13  |..str r5,dru....|
000018b0  73 75 62 67 74 20 72 35  2c 72 38 2c 72 31 32 0d  |subgt r5,r8,r12.|
000018c0  0c 9e 35 6d 75 6c 20 72  35 2c 72 31 2c 72 35 20  |..5mul r5,r1,r5 |
000018d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000018e0  20 20 20 20 20 20 20 20  20 20 20 3b 20 64 6c 76  |           ; dlv|
000018f0  3c 3c 32 30 0d 0c a8 0e  73 74 72 20 72 35 2c 64  |<<20....str r5,d|
00001900  72 76 0d 0c b2 04 0d 0c  bc 12 6c 64 72 20 72 31  |rv........ldr r1|
00001910  30 2c 73 70 72 69 74 65  0d 0c c6 0e 4d 4f 56 20  |0,sprite....MOV |
00001920  52 31 34 2c 52 30 0d 0c  d0 0a a4 79 6c 6f 6f 70  |R14,R0.....yloop|
00001930  0d 0c da 04 0d 0c e4 12  6c 64 72 20 72 31 33 2c  |........ldr r13,|
00001940  73 74 61 63 6b 70 0d 0c  ee 10 6c 64 72 20 72 31  |stackp....ldr r1|
00001950  35 2c 6c 69 6e 6b 0d 0c  f8 04 0d 0d 02 09 2e 6c  |5,link.........l|
00001960  69 6e 65 0d 0d 0c 09 64  63 64 20 30 0d 0d 16 04  |ine....dcd 0....|
00001970  0d 0d 20 0b 2e 63 6f 6f  72 64 73 0d 0d 2a 17 2e  |.. ..coords..*..|
00001980  6c 75 3a 64 63 64 20 30  3a 2e 72 75 3a 64 63 64  |lu:dcd 0:.ru:dcd|
00001990  20 30 0d 0d 34 17 2e 6c  63 3a 64 63 64 20 30 3a  | 0..4..lc:dcd 0:|
000019a0  2e 72 63 3a 64 63 64 20  30 0d 0d 3e 17 2e 6c 76  |.rc:dcd 0..>..lv|
000019b0  3a 64 63 64 20 30 3a 2e  72 76 3a 64 63 64 20 30  |:dcd 0:.rv:dcd 0|
000019c0  0d 0d 48 19 2e 64 6c 78  3a 64 63 64 20 30 3a 2e  |..H..dlx:dcd 0:.|
000019d0  64 72 78 3a 64 63 64 20  30 0d 0d 52 19 2e 64 6c  |drx:dcd 0..R..dl|
000019e0  63 3a 64 63 64 20 30 3a  2e 64 72 63 3a 64 63 64  |c:dcd 0:.drc:dcd|
000019f0  20 30 0d 0d 5c 19 2e 64  6c 75 3a 64 63 64 20 30  | 0..\..dlu:dcd 0|
00001a00  3a 2e 64 72 75 3a 64 63  64 20 30 0d 0d 66 19 2e  |:.dru:dcd 0..f..|
00001a10  64 6c 76 3a 64 63 64 20  30 3a 2e 64 72 76 3a 64  |dlv:dcd 0:.drv:d|
00001a20  63 64 20 30 0d 0d 70 04  0d 0d 7a 05 5d 0d 0d 84  |cd 0..p...z.]...|
00001a30  05 ed 0d 0d 8e 24 c8 99  22 4f 53 5f 46 69 6c 65  |.....$.."OS_File|
00001a40  22 2c 31 36 2c 22 50 69  63 74 75 72 65 22 2c 73  |",16,"Picture",s|
00001a50  70 72 69 74 65 25 0d 0d  98 05 e1 0d 0d a2 05 3a  |prite%.........:|
00001a60  0d 0d ac 0b dd a4 79 6c  6f 6f 70 0d 0d b6 0e 5b  |......yloop....[|
00001a70  4f 50 54 20 70 61 73 73  25 0d 0d c0 0d 3b 20 72  |OPT pass%....; r|
00001a80  32 20 3d 20 73 63 0d 0d  ca 0d 3b 20 72 33 20 3d  |2 = sc....; r3 =|
00001a90  20 6c 78 0d 0d d4 0d 3b  20 72 34 20 3d 20 72 78  | lx....; r4 = rx|
00001aa0  0d 0d de 0f 3b 20 72 31  34 20 3d 20 79 5f 6b 0d  |....; r14 = y_k.|
00001ab0  0d e8 04 0d 0d f2 0a 2e  79 6c 6f 6f 70 0d 0d fc  |........yloop...|
00001ac0  2c 73 75 62 73 20 72 30  2c 72 34 2c 72 33 20 20  |,subs r0,r4,r3  |
00001ad0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001ae0  20 3b 20 64 78 3c 3c 31  30 0d 0e 06 2e 61 64 64  | ; dx<<10....add|
00001af0  20 72 31 32 2c 72 32 2c  72 33 2c 61 73 72 23 31  | r12,r2,r3,asr#1|
00001b00  30 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 6c  |0            ; l|
00001b10  65 66 74 20 61 64 72 0d  0e 10 0f 6c 64 72 20 72  |eft adr....ldr r|
00001b20  31 33 2c 64 6c 78 0d 0e  1a 2d 61 64 64 20 72 33  |13,dlx...-add r3|
00001b30  2c 72 33 2c 72 31 33 2c  61 73 72 23 31 30 20 20  |,r3,r13,asr#10  |
00001b40  20 20 20 20 20 20 20 20  20 20 3b 20 6c 78 2b 3d  |          ; lx+=|
00001b50  64 6c 78 0d 0e 24 0f 6c  64 72 20 72 31 31 2c 64  |dlx..$.ldr r11,d|
00001b60  72 78 0d 0e 2e 2f 61 64  64 20 72 31 33 2c 72 32  |rx.../add r13,r2|
00001b70  2c 72 34 2c 61 73 72 23  31 30 20 20 20 20 20 20  |,r4,asr#10      |
00001b80  20 20 20 20 20 20 3b 20  72 69 67 68 74 20 61 64  |      ; right ad|
00001b90  72 0d 0e 38 2d 61 64 64  20 72 34 2c 72 34 2c 72  |r..8-add r4,r4,r|
00001ba0  31 31 2c 61 73 72 23 31  30 20 20 20 20 20 20 20  |11,asr#10       |
00001bb0  20 20 20 20 20 3b 20 72  78 2b 3d 64 72 78 0d 0e  |     ; rx+=drx..|
00001bc0  42 15 6c 64 72 20 72 31  31 2c 64 69 76 5f 74 61  |B.ldr r11,div_ta|
00001bd0  62 6c 65 0d 0e 4c 13 6d  6f 76 20 72 30 2c 72 30  |ble..L.mov r0,r0|
00001be0  2c 61 73 72 23 35 0d 0e  56 2e 6c 64 72 67 74 20  |,asr#5..V.ldrgt |
00001bf0  72 30 2c 5b 72 31 31 2c  72 30 2c 6c 73 6c 23 32  |r0,[r11,r0,lsl#2|
00001c00  5d 20 20 20 20 20 20 20  20 20 3b 20 31 3c 3c 31  |]         ; 1<<1|
00001c10  38 2f 64 78 0d 0e 60 0d  6c 64 72 20 72 39 2c 6c  |8/dx..`.ldr r9,l|
00001c20  75 0d 0e 6a 0d 6c 64 72  20 72 38 2c 72 75 0d 0e  |u..j.ldr r8,ru..|
00001c30  74 04 0d 0e 7e 2c 73 75  62 20 72 36 2c 72 38 2c  |t...~,sub r6,r8,|
00001c40  72 39 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r9              |
00001c50  20 20 20 20 20 20 3b 20  64 75 3c 3c 31 30 0d 0e  |      ; du<<10..|
00001c60  88 2c 6d 75 6c 20 72 36  2c 72 30 2c 72 36 20 20  |.,mul r6,r0,r6  |
00001c70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001c80  20 20 3b 20 64 75 3c 3c  32 34 0d 0e 92 04 0d 0e  |  ; du<<24......|
00001c90  9c 0e 6c 64 72 20 72 37  2c 64 72 75 0d 0e a6 17  |..ldr r7,dru....|
00001ca0  61 64 64 20 72 38 2c 72  38 2c 72 37 2c 61 73 72  |add r8,r8,r7,asr|
00001cb0  23 31 30 0d 0e b0 0d 73  74 72 20 72 38 2c 72 75  |#10....str r8,ru|
00001cc0  0d 0e ba 04 0d 0e c4 0e  6c 64 72 20 72 37 2c 64  |........ldr r7,d|
00001cd0  6c 75 0d 0e ce 17 61 64  64 20 72 38 2c 72 39 2c  |lu....add r8,r9,|
00001ce0  72 37 2c 61 73 72 23 31  30 0d 0e d8 0d 73 74 72  |r7,asr#10....str|
00001cf0  20 72 38 2c 6c 75 0d 0e  e2 04 0d 0e ec 0d 6c 64  | r8,lu........ld|
00001d00  72 20 72 38 2c 6c 76 0d  0e f6 0d 6c 64 72 20 72  |r r8,lv....ldr r|
00001d10  31 2c 72 76 0d 0f 00 2c  73 75 62 20 72 37 2c 72  |1,rv...,sub r7,r|
00001d20  31 2c 72 38 20 20 20 20  20 20 20 20 20 20 20 20  |1,r8            |
00001d30  20 20 20 20 20 20 20 20  3b 20 64 76 3c 3c 31 30  |        ; dv<<10|
00001d40  0d 0f 0a 2c 6d 75 6c 20  72 37 2c 72 30 2c 72 37  |...,mul r7,r0,r7|
00001d50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001d60  20 20 20 20 3b 20 64 76  3c 3c 32 31 0d 0f 14 0e  |    ; dv<<21....|
00001d70  6c 64 72 20 72 30 2c 64  72 76 0d 0f 1e 17 61 64  |ldr r0,drv....ad|
00001d80  64 20 72 31 2c 72 31 2c  72 30 2c 61 73 72 23 31  |d r1,r1,r0,asr#1|
00001d90  30 0d 0f 28 0d 73 74 72  20 72 31 2c 72 76 0d 0f  |0..(.str r1,rv..|
00001da0  32 0e 6c 64 72 20 72 30  2c 64 6c 76 0d 0f 3c 17  |2.ldr r0,dlv..<.|
00001db0  61 64 64 20 72 30 2c 72  38 2c 72 30 2c 61 73 72  |add r0,r8,r0,asr|
00001dc0  23 31 30 0d 0f 46 0d 73  74 72 20 72 30 2c 6c 76  |#10..F.str r0,lv|
00001dd0  0d 0f 50 12 61 64 64 20  72 32 2c 72 32 2c 23 33  |..P.add r2,r2,#3|
00001de0  32 30 0d 0f 5a 0f 73 74  72 20 72 32 2c 6c 69 6e  |20..Z.str r2,lin|
00001df0  65 0d 0f 64 04 0d 0f 6e  14 6d 6f 76 20 72 39 2c  |e..d...n.mov r9,|
00001e00  72 39 2c 6c 73 6c 23 31  34 0d 0f 78 14 6d 6f 76  |r9,lsl#14..x.mov|
00001e10  20 72 38 2c 72 38 2c 6c  73 6c 23 31 34 0d 0f 82  | r8,r8,lsl#14...|
00001e20  16 6d 6f 76 20 72 31 31  2c 72 31 31 2c 6c 73 6c  |.mov r11,r11,lsl|
00001e30  23 31 34 0d 0f 8c 04 0d  0f 96 0d 3b 20 64 63 20  |#14........; dc |
00001e40  3d 20 72 35 0d 0f a0 0d  3b 20 64 75 20 3d 20 72  |= r5....; du = r|
00001e50  36 0d 0f aa 0d 3b 20 64  76 20 3d 20 72 37 0d 0f  |6....; dv = r7..|
00001e60  b4 0c 3b 20 76 20 3d 20  72 38 0d 0f be 0c 3b 20  |..; v = r8....; |
00001e70  75 20 3d 20 72 39 0d 0f  c8 12 3b 20 73 70 72 69  |u = r9....; spri|
00001e80  74 65 20 3d 20 72 31 30  0d 0f d2 0d 3b 20 63 20  |te = r10....; c |
00001e90  3d 20 72 31 31 0d 0f dc  14 3b 20 6c 65 66 74 5f  |= r11....; left_|
00001ea0  61 64 72 20 3d 20 72 31  32 0d 0f e6 15 3b 20 72  |adr = r12....; r|
00001eb0  69 67 68 74 5f 61 64 72  20 3d 20 72 31 33 0d 0f  |ight_adr = r13..|
00001ec0  f0 14 3b 20 72 31 20 3d  20 63 6f 6c 20 74 61 62  |..; r1 = col tab|
00001ed0  6c 65 0d 0f fa 04 0d 10  04 0a 2e 78 6c 6f 6f 70  |le.........xloop|
00001ee0  0d 10 0e 16 61 6e 64 20  72 30 2c 72 38 2c 23 32  |....and r0,r8,#2|
00001ef0  35 35 3c 3c 32 34 0d 10  18 16 6f 72 72 20 72 30  |55<<24....orr r0|
00001f00  2c 72 30 2c 72 39 2c 6c  73 72 23 38 0d 10 22 1b  |,r0,r9,lsr#8..".|
00001f10  6c 64 72 62 20 72 30 2c  5b 72 31 30 2c 72 30 2c  |ldrb r0,[r10,r0,|
00001f20  6c 73 72 23 31 36 5d 0d  10 2c 14 73 74 72 62 20  |lsr#16]..,.strb |
00001f30  72 30 2c 5b 72 31 32 5d  2c 23 31 0d 10 36 0f 63  |r0,[r12],#1..6.c|
00001f40  6d 70 20 72 31 32 2c 72  31 33 0d 10 40 16 61 64  |mp r12,r13..@.ad|
00001f50  64 6c 65 20 72 32 2c 72  32 2c 23 31 3c 3c 33 31  |dle r2,r2,#1<<31|
00001f60  0d 10 4a 18 61 64 64 6c  65 20 72 38 2c 72 38 2c  |..J.addle r8,r8,|
00001f70  72 37 2c 61 73 72 23 31  0d 10 54 18 61 64 64 6c  |r7,asr#1..T.addl|
00001f80  65 20 72 39 2c 72 39 2c  72 36 2c 61 73 72 23 31  |e r9,r9,r6,asr#1|
00001f90  0d 10 5e 0d 62 6c 65 20  78 6c 6f 6f 70 0d 10 68  |..^.ble xloop..h|
00001fa0  04 0d 10 72 0f 6c 64 72  20 72 32 2c 6c 69 6e 65  |...r.ldr r2,line|
00001fb0  0d 10 7c 10 6c 64 72 20  72 30 2c 79 5f 65 6e 64  |..|.ldr r0,y_end|
00001fc0  0d 10 86 12 61 64 64 20  72 31 34 2c 72 31 34 2c  |....add r14,r14,|
00001fd0  23 31 0d 10 90 0e 63 6d  70 20 72 31 34 2c 72 30  |#1....cmp r14,r0|
00001fe0  0d 10 9a 0d 62 6c 74 20  79 6c 6f 6f 70 0d 10 a4  |....blt yloop...|
00001ff0  04 0d 10 ae 05 5d 0d 10  b8 06 3d 30 0d 10 c2 05  |.....]....=0....|
00002000  3a 0d 10 cc 14 dd a4 73  63 72 65 65 6e 61 64 72  |:......screenadr|
00002010  28 62 6b 25 29 0d 10 d6  17 c8 99 22 4f 53 5f 42  |(bk%)......"OS_B|
00002020  79 74 65 22 2c 31 31 32  2c 62 6b 25 0d 10 e0 17  |yte",112,bk%....|
00002030  c8 99 22 4f 53 5f 42 79  74 65 22 2c 31 31 33 2c  |.."OS_Byte",113,|
00002040  62 6b 25 0d 10 ea 0a de  20 71 25 20 38 0d 10 f4  |bk%..... q% 8...|
00002050  13 21 71 25 3d 31 34 38  3a 71 25 21 34 3d 2d 31  |.!q%=148:q%!4=-1|
00002060  0d 10 fe 21 c8 99 22 4f  53 5f 52 65 61 64 56 64  |...!.."OS_ReadVd|
00002070  75 56 61 72 69 61 62 6c  65 73 22 2c 71 25 2c 71  |uVariables",q%,q|
00002080  25 0d 11 08 08 3d 21 71  25 0d ff                 |%....=!q%..|
0000208b