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

DiffDim/Triangle4

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/Triangle4
Read OK:
File size: 392F bytes
Load address: 0000
Exec address: 0000
File contents
   10REM Triangle 4
   20REM
   30REM Demonstrate more advanced uses of triangles
   40:
   50ON ERROR MODE0:PRINT REPORT$;" at line ";ERL:END
   60*RUN 256Mode20
   70lx=0.707:ly=0.707
   80PROCassemble
   90CALL setup
  100FORx%=0 TO 3
  110FORy%=0 TO 3
  120p_table%!((x%+y%*4)<<3)=75+x%*150
  130p_table%!(4+((x%+y%*4)<<3))=25+y%*150
  140NEXT
  150NEXT
  160:
  170bk%=1
  180PROCdraw
  190PROCdraw
  200MOUSE ON
  210REPEAT
  220REPEAT
  230MOUSE mx%,my%,b%
  240UNTIL b%=4
  250:
  260fx%=-1:md%=10000
  270FORx%=0 TO 3
  280FORy%=0 TO 3
  290px%=p_table%!((x%+y%*4)<<3)*2
  300py%=1024-p_table%!(4+((x%+y%*4)<<3))*2
  310dx%=mx%-px%:dy%=my%-py%
  320d%=dx%*dx%+dy%*dy%
  330IF d%<md% md%=d%:fx%=x%:fy%=y%
  340NEXT
  350NEXT
  360IF fx%<>-1 THEN PROCchange(fx%,fy%)
  370UNTIL FALSE
  380END
  390:
  400DEFPROCchange(fx%,fy%)
  410REPEAT
  420MOUSE mx%,my%,b%
  430p_table%!((fx%+fy%*4)<<3)=mx%>>1
  440p_table%!(4+((fx%+fy%*4)<<3))=512-(my%>>1)
  450PROCdraw
  460UNTIL b%=0
  470PROCdraw
  480ENDPROC
  490:
  500DEFPROCdraw
  510SYS"OS_Byte",112,bk%
  520SWAP !screenadr,screenadr!4
  530bk%=3-bk%
  540WAIT
  550SYS"OS_Byte",113,bk%
  560CLS
  570CALL bezier
  580FORx%=0 TO 3
  590FORy%=0 TO 3
  600CIRCLE p_table%!((x%+y%*4)<<3)*2,1024-p_table%!(4+((x%+y%*4)<<3))*2,10
  610NEXT
  620NEXT
  630ENDPROC
  640:
  650DEFPROCassemble
  660q_step%=16:sstep%=256/q_step%
  670log2_q_step%=LOG(q_step%)/LOG(2)
  680DIM code% 16384,p_table% 128,output% q_step%*q_step%*8,normal% q_step%*q_step%*5,div_table% 32768*4,big_normal_table% 128*128*8,sprite% 65592,coltab% 8192
  690FOR pass%=0 TO 2 STEP 2
  700P%=code%
  710[OPT pass%
  720.setup
  730ldr r12,big_normal_table
  740mov r1,#0
  750.ny_loop
  760mov r0,#0
  770.nx_loop
  780
  790mul r2,r0,r0
  800mla r2,r1,r1,r2
  810mov r2,r2,lsl#10
  820
  830; r3 = SQR(r2)
  840mov r3,#0
  850mov r4,#1<<30
  860.lp
  870add r5,r3,r4
  880cmp r5,r2
  890suble r2,r2,r5
  900addle r3,r5,r4
  910mov r3,r3,asr#1
  920movs r4,r4,asr#2
  930bne lp
  940
  950; r2 = 1048576/r3
  960mov r4,#1048576
  970mov r5,#0
  980mov r2,#0
  990mov r7,#1<<31
 1000.lp
 1010movs r4,r4,lsl#1
 1020adc r5,r5,r5
 1030cmp r5,r3
 1040subge r5,r5,r3
 1050orrge r2,r2,r7
 1060movs r7,r7,lsr#1
 1070bne lp
 1080
 1090mul r3,r1,r2
 1100mul r2,r0,r2
 1110
 1120stmia r12!,{r2,r3}
 1130
 1140add r0,r0,#1
 1150cmp r0,#128
 1160blt nx_loop
 1170
 1180add r1,r1,#1
 1190cmp r1,#128
 1200blt ny_loop
 1210
 1220ldr r0,div_table
 1230mov r2,#1
 1240
 1250.dl
 1260mov r4,#1<<20
 1270mov r5,#0               ; remainder
 1280mov r6,#0               ; quotient
 1290mov r7,#1<<31
 1300.div_loop
 1310movs r4,r4,lsl#1
 1320adc r5,r5,r5
 1330cmp r5,r2
 1340subge r5,r5,r2
 1350orrge r6,r6,r7
 1360movs r7,r7,lsr#1
 1370bne div_loop
 1380
 1390; r6 = r4 div r2 = s
 1400
 1410str r6,[r0,#4]!
 1420add r2,r2,#1
 1430cmp r2,#32768
 1440ble dl
 1450
 1460.main1
 1470mov pc,r14
 1480
 1490
 1500mov pc,r14
 1510
 1520.big_normal_table
 1530dcd big_normal_table%
 1540
 1550.bezier
 1560stmfd r13!,{r14}
 1570str r13,stackp
 1580adr r5,q_start
 1590
 1600mov r4,#q_step%
 1610str r4,u_count
 1620
 1630ldr r4,index_base
 1640str r4,in
 1650
 1660.uloop
 1670ldmia r5!,{r0-r3}
 1680str r5,u_ptr
 1690ldr r14,p_start
 1700ldmia r14!,{r6-r13}
 1710
 1720mul r6,r0,r6
 1730mla r6,r8,r1,r6
 1740mla r6,r10,r2,r6
 1750mla r6,r12,r3,r6
 1760
 1770mul r7,r0,r7
 1780mla r7,r9,r1,r7
 1790mla r7,r11,r2,r7
 1800mla r7,r13,r3,r7
 1810
 1820ldmia r14!,{r4,r5,r8-r13}
 1830
 1840mul r8,r1,r8
 1850mla r8,r4,r0,r8
 1860mla r8,r10,r2,r8
 1870mla r8,r12,r3,r8
 1880
 1890mul r9,r1,r9
 1900mla r9,r5,r0,r9
 1910mla r9,r11,r2,r9
 1920mla r9,r13,r3,r9
 1930
 1940ldmia r14!,{r4,r5,r10-r13}
 1950
 1960mul r10,r1,r10
 1970mla r10,r4,r0,r10
 1980mla r10,r12,r2,r10
 1990
 2000mul r11,r1,r11
 2010mla r11,r5,r0,r11
 2020mla r11,r13,r2,r11
 2030
 2040ldmia r14!,{r12,r13}
 2050
 2060mla r10,r12,r3,r10
 2070mla r11,r13,r3,r11
 2080
 2090ldmia r14!,{r4,r5,r12,r13}
 2100
 2110mul r12,r1,r12
 2120mla r12,r4,r0,r12
 2130
 2140mul r13,r1,r13
 2150mla r13,r5,r0,r13
 2160
 2170ldmia r14!,{r0,r1}
 2180mla r12,r0,r2,r12
 2190mla r13,r1,r2,r13
 2200
 2210ldmia r14!,{r0,r1}
 2220mla r12,r0,r3,r12
 2230mla r13,r1,r3,r13
 2240
 2250adr r3,q_start
 2260mov r5,#q_step%
 2270
 2280mov r6,r6,asr#20
 2290mov r7,r7,asr#20
 2300mov r8,r8,asr#20
 2310mov r9,r9,asr#20
 2320mov r10,r10,asr#20
 2330mov r11,r11,asr#20
 2340mov r12,r12,asr#20
 2350mov r13,r13,asr#20
 2360ldr r4,in
 2370
 2380.vloop
 2390ldr r2,[r3],#4
 2400mul r0,r6,r2                    ; ax
 2410mul r1,r7,r2                    ; ay
 2420
 2430ldr r2,[r3],#4
 2440mla r0,r8,r2,r0                 ; bx
 2450mla r1,r9,r2,r1                 ; by
 2460
 2470ldr r2,[r3],#4
 2480mla r0,r10,r2,r0                ; cx
 2490mla r1,r11,r2,r1                ; cy
 2500
 2510ldr r2,[r3],#4
 2520mla r0,r12,r2,r0                ; dx
 2530mla r1,r13,r2,r1                ; dy
 2540
 2550mov r0,r0,asr#20
 2560mov r1,r1,asr#20
 2570stmia r4!,{r0,r1}
 2580
 2590subs r5,r5,#1
 2600bgt vloop
 2610
 2620ldr r5,u_count
 2630subs r5,r5,#1
 2640strgt r5,u_count
 2650ldrgt r5,u_ptr
 2660strgt r4,in
 2670bgt uloop
 2680
 2690ldr r0,index_base
 2700ldr r9,index_normal
 2710ldr r12,big_normal_table
 2720ldr r13,l_x
 2730ldr r14,l_y
 2740mov r1,#0
 2750.u_loop
 2760add r2,r0,r1,lsl#log2_q_step%+3
 2770add r10,r9,r1,lsl#log2_q_step%+2
 2780add r3,r2,#4
 2790mov r4,#0
 2800ldr r5,[r2,r4,lsl#3]
 2810ldr r6,[r3,r4,lsl#3]
 2820mov r4,#1
 2830.v_loop
 2840ldr r7,[r2,r4,lsl#3]                    ; x
 2850ldr r8,[r3,r4,lsl#3]                    ; y
 2860subs r5,r7,r5
 2870rsblt r5,r5,#0
 2880;movlt r11,#1
 2890subs r6,r8,r6
 2900rsblt r6,r6,#0
 2910;orrlt r11,r11,#2
 2920.lp
 2930cmp r5,#128
 2940cmplt r6,#128
 2950movge r5,r5,lsr#1
 2960movge r6,r6,lsr#1
 2970bge lp
 2980
 2990add r5,r5,r6,lsl#7
 3000add r5,r12,r5,lsl#3
 3010ldmia r5,{r5,r6}                        ; get normalised vectors
 3020
 3030mul r5,r13,r5
 3040mla r5,r14,r6,r5                        ; nx*lx+ny*ly << 25
 3050movs r5,r5,asr#14                       ; normal * shd
 3060subs r5,r5,#1024+384
 3070movlt r5,#0
 3080cmp r5,#223
 3090movgt r5,#223
 3100str r5,[r10],#4
 3110
 3120mov r5,r7
 3130mov r6,r8
 3140add r4,r4,#1
 3150cmp r4,#q_step%
 3160ble v_loop
 3170add r1,r1,#1
 3180cmp r1,#q_step%
 3190ble u_loop
 3200
 3210ldr r13,stackp
 3220
 3230ldr r3,index_normal
 3240ldr r6,index_base
 3250mov r0,#0                       ; x
 3260.xloop
 3270mov r1,#0                       ; y
 3280.yloop
 3290add r2,r0,r1,lsl#4              ; x+y*q_step%, q_step%=16
 3300add r4,r3,r2,lsl#2              ; normal+ofs%<<2
 3310
 3320ldr r5,[r4,#4]                  ; l1
 3330str r5,ac
 3340
 3350ldr r5,[r4]                     ; l2
 3360str r5,bc
 3370
 3380ldr r5,[r4,#4+16*4]             ; l3
 3390str r5,cc
 3400
 3410add r7,r6,r2,lsl#3              ; output+ofs%<<3
 3420
 3430ldmia r7,{r8,r9,r10,r11}        ; bx,by,ax,ay
 3440str r8,bx
 3450str r9,by
 3460str r10,ax
 3470str r11,ay
 3480
 3490ldr r8,[r7,#8+16*8]
 3500str r8,cx
 3510
 3520ldr r8,[r7,#12+16*8]
 3530str r8,cy
 3540
 3550mov r8,r0,lsl#4                 ; x*sstep%, sstep%=16
 3560str r8,bv
 3570add r8,r8,#16
 3580str r8,av
 3590str r8,cv
 3600
 3610mov r8,r1,lsl#4                 ; y*sstep%
 3620str r8,au
 3630str r8,bu
 3640add r8,r8,#16
 3650str r8,cu
 3660
 3670stmfd r13!,{r0,r1,r3,r4,r6-r8}
 3680bl texture_triangle
 3690ldmfd r13!,{r0,r1,r3,r4,r6-r8}
 3700
 3710str r8,au
 3720ldr r8,[r4,#16*4]               ; l4
 3730str r8,ac
 3740mov r8,r0,lsl#4
 3750str r8,av
 3760
 3770ldr r8,[r7,#16*8]
 3780str r8,ax
 3790ldr r8,[r7,#4+16*8]
 3800str r8,ay
 3810
 3820stmfd r13!,{r0,r1,r3,r6}
 3830
 3840adr r0,by
 3850ldmia r0,{r1,r2,r3,r4,r5}
 3860
 3870adr r6,cy
 3880ldmia r6,{r7,r8,r9,r10,r11}
 3890
 3900stmia r6,{r1-r5}
 3910stmia r0,{r7-r11}
 3920
 3930bl texture_triangle
 3940ldmfd r13!,{r0,r1,r3,r6}
 3950
 3960add r1,r1,#1
 3970cmp r1,#14
 3980ble yloop
 3990
 4000add r0,r0,#1
 4010cmp r0,#14
 4020ble xloop
 4030
 4040ldmfd r13!,{r15}
 4050
 4060.u_count
 4070dcd 0
 4080
 4090.u_ptr
 4100dcd 0
 4110
 4120.l_x
 4130dcd lx*1024
 4140.l_y
 4150dcd ly*1024
 4160
 4170.in
 4180dcd 0
 4190
 4200.stackp
 4210dcd 0
 4220
 4230.p_start
 4240dcd p_table%
 4250
 4260.index_base
 4270dcd output%
 4280
 4290.index_normal
 4300dcd normal%
 4310
 4320.q_start
 4330]
 4340P%+=8192/q_step%
 4350[OPT pass%
 4360.div_table
 4370dcd div_table%
 4380
 4390
 4400.stackp
 4410dcd 0
 4420.link
 4430dcd 0
 4440.div_table
 4450dcd div_table%
 4460.coltable
 4470dcd coltab%
 4480.r_index
 4490dcd 0
 4500.l_index
 4510dcd 0
 4520
 4530.y_end
 4540dcd 0
 4550
 4560.sprite
 4570dcd sprite%+56
 4580.screenadr
 4590dcd FNscreenadr(2)
 4600dcd FNscreenadr(1)
 4610
 4620.ay:dcd 0:.ax:dcd 0
 4630.ac:dcd 0
 4640.au:dcd 0:.av:dcd 0
 4650dcd 0:dcd 0:dcd 0
 4660
 4670.by:dcd 0:.bx:dcd 0
 4680.bc:dcd 0
 4690.bu:dcd 0:.bv:dcd 0
 4700dcd 0:dcd 0:dcd 0
 4710
 4720.cy:dcd 0:.cx:dcd 0
 4730.cc:dcd 0
 4740.cu:dcd 0:.cv:dcd 0
 4750dcd 0:dcd 0:dcd 0
 4760
 4770.texture_triangle
 4780adr r0,ay
 4790ldr r10,[r0,#0]
 4800ldr r11,[r0,#32]
 4810cmp r11,r10
 4820movlt r1,r11
 4830movge r1,r10
 4840movlt r2,#1
 4850movge r2,#0
 4860ldr r12,[r0,#64]
 4870cmp r12,r1
 4880movlt r1,r12
 4890movlt r2,#2
 4900cmp r1,#512
 4910movge pc,r14
 4920cmp r10,#0
 4930cmplt r11,#0
 4940cmplt r12,#0
 4950movlt pc,r14
 4960
 4970str r13,stackp
 4980
 4990subs r3,r2,#1
 5000movlt r3,#2
 5010
 5020add r2,r0,r2,lsl#5
 5030ldmib r2,{r5,r6,r7,r8}                  ; x_k,c_k,u_k,v_k
 5040add r4,r0,r3,lsl#5
 5050str r4,l_index
 5060subs r3,r3,#1
 5070movlt r3,#2
 5080add r0,r0,r3,lsl#5
 5090str r0,r_index
 5100ldmia r4,{r9,r10,r11,r12,r13}           ; y_l,x_l,c_l,u_l,v_l
 5110
 5120str r14,link
 5130ldr r14,div_table
 5140subs r2,r9,r1                           ; dly
 5150ldrgt r2,[r14,r2,lsl#2]                 ; 1<<20/dly
 5160
 5170movgt r3,r5,lsl#10
 5180moveq r3,r10,lsl#10
 5190subgt r4,r10,r5
 5200mul r4,r2,r4                            ; dlx<<20
 5210str r4,dlx
 5220
 5230movgt r10,r6,lsl#10
 5240moveq r10,r11,lsl#10
 5250str r10,lc
 5260subgt r4,r11,r6
 5270mul r4,r2,r4                            ; dlc<<20
 5280str r4,dlc
 5290
 5300movgt r10,r7,lsl#10
 5310moveq r10,r12,lsl#10
 5320str r10,lu
 5330subgt r4,r12,r7
 5340mul r4,r2,r4                            ; dlu<<20
 5350str r4,dlu
 5360
 5370movgt r10,r8,lsl#10
 5380moveq r10,r13,lsl#10
 5390str r10,lv
 5400subgt r4,r13,r8
 5410mul r4,r2,r4                            ; dlv<<20
 5420str r4,dlv
 5430
 5440ldmia r0,{r0,r10,r11,r12,r13}           ; y_r,x_r,c_r,u_r,v_r
 5450subs r2,r0,r1                           ; dry
 5460ldrgt r2,[r14,r2,lsl#2]                 ; 1<<20/dry
 5470
 5480movgt r4,r5,lsl#10
 5490moveq r4,r10,lsl#10
 5500subgt r10,r10,r5
 5510mul r10,r2,r10                          ; drx<<20
 5520str r10,drx
 5530
 5540movgt r10,r6,lsl#10
 5550moveq r10,r11,lsl#10
 5560str r10,rc
 5570subgt r10,r11,r6
 5580mul r10,r2,r10                          ; drc<<20
 5590str r10,drc
 5600
 5610movgt r10,r7,lsl#10
 5620moveq r10,r12,lsl#10
 5630str r10,ru
 5640subgt r10,r12,r7
 5650mul r10,r2,r10                          ; dru<<20
 5660str r10,dru
 5670
 5680movgt r10,r8,lsl#10
 5690moveq r10,r13,lsl#10
 5700str r10,rv
 5710subgt r10,r13,r8
 5720mul r10,r2,r10                          ; drv<<20
 5730str r10,drv
 5740
 5750ldr r2,screenadr
 5760add r2,r2,r1,lsl#7
 5770add r2,r2,r1,lsl#9                      ; screen line
 5780
 5790MOV R14,R1
 5800ldr r10,sprite
 5810
 5820cmp r9,r0
 5830strlt r9,y_end
 5840strge r0,y_end
 5850
 5860bgt method_2
 5870beq last_bit
 5880
 5890.method_1                               ; left_y<right_y
 5900
 5910FNyloop
 5920
 5930; r0 = y_l
 5940; r2 = scline
 5950; r3 = lx
 5960; r4 = rx
 5970; r1,r5-r14 = empty
 5980
 5990; recalcuate dlx,dlu,dlv,dlc
 6000ldr r1,l_index
 6010ldmib r1,{r3,r10,r11,r12}               ; x_l,c_l,u_l,v_l
 6020ldr r1,r_index
 6030ldmia r1,{r1,r5,r6,r7,r8}               ; y_r,x_r,c_r,u_r,v_r
 6040str r1,y_end
 6050
 6060subs r1,r1,r0                           ; dly
 6070ldr r14,div_table
 6080
 6090ldrgt r1,[r14,r1,lsl#2]                 ; 1<<20/dly
 6100subgt r7,r7,r11
 6110mul r7,r1,r7                            ; dlu<<20
 6120str r7,dlu
 6130subgt r5,r5,r3
 6140mov r3,r3,lsl#10
 6150mul r5,r1,r5                            ; dlx<<20
 6160str r5,dlx
 6170subgt r5,r6,r10
 6180mul r5,r1,r5                            ; dlc<<20
 6190str r5,dlc
 6200
 6210subgt r5,r8,r12
 6220mul r5,r1,r5                            ; dlv<<20
 6230str r5,dlv
 6240
 6250ldr r10,sprite
 6260
 6270MOV R14,R0
 6280.last_bit
 6290FNyloop
 6300
 6310ldr r13,stackp
 6320ldr r15,link
 6330
 6340
 6350.method_2                               ; right_y< left_y
 6360FNyloop
 6370
 6380; r0 = y_l
 6390; r2 = scline
 6400; r3 = lx
 6410; r4 = rx
 6420; r1,r5-r14 = empty
 6430
 6440; recalcuate drx,dru,drv,drc
 6450ldr r1,r_index
 6460ldmib r1,{r4,r10,r11,r12}               ; x_r,c_r,u_r,v_r
 6470ldr r1,l_index
 6480ldmia r1,{r1,r5,r6,r7,r8}               ; y_l,x_l,c_l,u_l,v_l
 6490str r1,y_end
 6500
 6510subs r1,r1,r0                           ; dly
 6520ldr r14,div_table
 6530
 6540ldrgt r1,[r14,r1,lsl#2]                 ; 1<<20/dly
 6550subgt r5,r5,r4
 6560mov r4,r4,lsl#10
 6570mul r5,r1,r5                            ; dlx<<20
 6580str r5,drx
 6590subgt r5,r6,r10
 6600mul r5,r1,r5                            ; dlc<<20
 6610str r5,drc
 6620subgt r5,r7,r11
 6630mul r5,r1,r5                            ; dlu<<20
 6640str r5,dru
 6650subgt r5,r8,r12
 6660mul r5,r1,r5                            ; dlv<<20
 6670str r5,drv
 6680
 6690ldr r10,sprite
 6700MOV R14,R0
 6710FNyloop
 6720
 6730ldr r13,stackp
 6740ldr r15,link
 6750
 6760.line
 6770dcd 0
 6780
 6790.coords
 6800.lu:dcd 0:.ru:dcd 0
 6810.lc:dcd 0:.rc:dcd 0
 6820.lv:dcd 0:.rv:dcd 0
 6830.dlx:dcd 0:.drx:dcd 0
 6840.dlc:dcd 0:.drc:dcd 0
 6850.dlu:dcd 0:.dru:dcd 0
 6860.dlv:dcd 0:.drv:dcd 0
 6870
 6880]
 6890NEXT
 6900p%=q_start:stp=1024/q_step%
 6910FORn%=0 TO 1024 STEP stp
 6920qn%=1024-n%:qs%=(qn%*qn%)>>10:ns%=(n%*n%)>>10
 6930!p%=qs%*qn%
 6940p%!4=3*qs%*n%
 6950p%!8=3*ns%*qn%
 6960p%!12=ns%*n%
 6970p%+=16
 6980NEXT
 6990SYS"OS_File",16,"Picture",sprite%
 7000SYS"OS_File",16,"ColTab",coltab%
 7010ENDPROC
 7020:
 7030DEFFNyloop
 7040[OPT pass%
 7050; r2 = sc
 7060; r3 = lx
 7070; r4 = rx
 7080; r14 = y_k
 7090
 7100.yloop
 7110subs r0,r4,r3                   ; dx<<10
 7120add r12,r2,r3,asr#10            ; left adr
 7130ldr r13,dlx
 7140add r3,r3,r13,asr#10            ; lx+=dlx
 7150ldr r11,drx
 7160add r13,r2,r4,asr#10            ; right adr
 7170add r4,r4,r11,asr#10            ; rx+=drx
 7180ldr r11,div_table
 7190mov r0,r0,asr#4
 7200ldrgt r0,[r11,r0,lsl#2]         ; 1<<18/dx
 7210ldr r11,lc
 7220ldr r9,rc
 7230sub r5,r9,r11                   ; dc<<10
 7240mul r5,r0,r5                    ; dc<<30
 7250ldr r8,drc
 7260add r9,r9,r8,asr#10
 7270str r9,rc
 7280ldr r8,dlc
 7290add r9,r11,r8,asr#10
 7300str r9,lc
 7310ldr r9,lu
 7320ldr r8,ru
 7330
 7340sub r6,r8,r9                    ; du<<10
 7350mul r6,r0,r6                    ; du<<24
 7360
 7370ldr r7,dru
 7380add r8,r8,r7,asr#10
 7390str r8,ru
 7400
 7410ldr r7,dlu
 7420add r8,r9,r7,asr#10
 7430str r8,lu
 7440
 7450ldr r8,lv
 7460ldr r1,rv
 7470sub r7,r1,r8                    ; dv<<10
 7480mul r7,r0,r7                    ; dv<<21
 7490ldr r0,drv
 7500add r1,r1,r0,asr#10
 7510str r1,rv
 7520ldr r0,dlv
 7530add r0,r8,r0,asr#10
 7540str r0,lv
 7550add r2,r2,#640
 7560str r2,line
 7570
 7580mov r9,r9,lsl#14
 7590mov r8,r8,lsl#14
 7600mov r11,r11,lsl#14
 7610
 7620; dc = r5
 7630; du = r6
 7640; dv = r7
 7650; v = r8
 7660; u = r9
 7670; sprite = r10
 7680; c = r11
 7690; left_adr = r12
 7700; right_adr = r13
 7710; r1 = col table
 7720
 7730ldr r1,coltable
 7740tst r12,#1
 7750moveq r2,#1<<31
 7760movne r2,#0
 7770.xloop
 7780and r0,r8,#255<<24
 7790orr r0,r0,r9,lsr#8
 7800ldrb r0,[r10,r0,lsr#16]
 7810add r0,r1,r0,lsl#5              ; 32 levels
 7820add r0,r0,r2,lsr#31
 7830ldrb r0,[r0,r11,lsr#27]         ; 32 levels
 7840strb r0,[r12],#1
 7850cmp r12,r13
 7860addle r2,r2,#1<<31
 7870addle r8,r8,r7
 7880addle r9,r9,r6
 7890addle r11,r11,r5
 7900ble xloop
 7910
 7920ldr r2,line
 7930ldr r0,y_end
 7940add r14,r14,#1
 7950cmp r14,r0
 7960blt yloop
 7970
 7980]
 7990=0
 8000:
 8010DEFFNscreenadr(bk%)
 8020SYS"OS_Byte",112,bk%
 8030SYS"OS_Byte",113,bk%
 8040DIM q% 8
 8050!q%=148:q%!4=-1
 8060SYS"OS_ReadVduVariables",q%,q%
 8070=!q%

� Triangle 4
�
1� Demonstrate more advanced uses of triangles
(:
2� � �0:� �$;" at line ";�:�
<*RUN 256Mode20
Flx=0.707:ly=0.707
P
�assemble
Z� setup
d
�x%=0 � 3
n
�y%=0 � 3
x%p_table%!((x%+y%*4)<<3)=75+x%*150
�)p_table%!(4+((x%+y%*4)<<3))=25+y%*150
��
��
�:
�	bk%=1
�	�draw
�	�draw
�ȗ �
��
��
�ȗ mx%,my%,b%
�
� b%=4
�:
fx%=-1:md%=10000

�x%=0 � 3

�y%=0 � 3
"!px%=p_table%!((x%+y%*4)<<3)*2
,*py%=1024-p_table%!(4+((x%+y%*4)<<3))*2
6dx%=mx%-px%:dy%=my%-py%
@d%=dx%*dx%+dy%*dy%
J!� d%<md% md%=d%:fx%=x%:fy%=y%
T�
^�
h � fx%<>-1 � �change(fx%,fy%)
r� �
|�
�:
���change(fx%,fy%)
��
�ȗ mx%,my%,b%
�$p_table%!((fx%+fy%*4)<<3)=mx%>>1
�.p_table%!(4+((fx%+fy%*4)<<3))=512-(my%>>1)
�	�draw
�
� b%=0
�	�draw
��
�:
�
��draw
�ș"OS_Byte",112,bk%
Ȕ !screenadr,screenadr!4

bk%=3-bk%
Ȗ
&ș"OS_Byte",113,bk%
0�
:� bezier
D
�x%=0 � 3
N
�y%=0 � 3
XFȏ p_table%!((x%+y%*4)<<3)*2,1024-p_table%!(4+((x%+y%*4)<<3))*2,10
b�
l�
v�
�:
���assemble
�!q_step%=16:sstep%=256/q_step%
� log2_q_step%=�(q_step%)/�(2)
��� code% 16384,p_table% 128,output% q_step%*q_step%*8,normal% q_step%*q_step%*5,div_table% 32768*4,big_normal_table% 128*128*8,sprite% 65592,coltab% 8192
�� pass%=0 � 2 � 2
�P%=code%
�[OPT pass%
�
.setup
�ldr r12,big_normal_table
�
mov r1,#0
�.ny_loop
�
mov r0,#0
.nx_loop

mul r2,r0,r0
 mla r2,r1,r1,r2
*mov r2,r2,lsl#10
4
>; r3 = �(r2)
H
mov r3,#0
Rmov r4,#1<<30
\.lp
fadd r5,r3,r4
p
cmp r5,r2
zsuble r2,r2,r5
�addle r3,r5,r4
�mov r3,r3,asr#1
�movs r4,r4,asr#2
�
bne lp
�
�; r2 = 1048576/r3
�mov r4,#1048576
�
mov r5,#0
�
mov r2,#0
�mov r7,#1<<31
�.lp
�movs r4,r4,lsl#1
�adc r5,r5,r5

cmp r5,r3
subge r5,r5,r3
orrge r2,r2,r7
$movs r7,r7,lsr#1
.
bne lp
8
Bmul r3,r1,r2
Lmul r2,r0,r2
V
`stmia r12!,{r2,r3}
j
tadd r0,r0,#1
~cmp r0,#128
�blt nx_loop
�
�add r1,r1,#1
�cmp r1,#128
�blt ny_loop
�
�ldr r0,div_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
2
cmp r5,r2
<subge r5,r5,r2
Forrge r6,r6,r7
Pmovs r7,r7,lsr#1
Zbne div_loop
d
n; r6 = r4 div r2 = s
x
�str r6,[r0,#4]!
�add r2,r2,#1
�cmp r2,#32768
�
ble dl
�
�
.main1
�mov pc,r14
�
�
�mov pc,r14
�
�.big_normal_table
�dcd big_normal_table%

.bezier
stmfd r13!,{r14}
"str r13,stackp
,adr r5,q_start
6
@mov r4,#q_step%
Jstr r4,u_count
T
^ldr r4,index_base
h
str r4,in
r
|
.uloop
�ldmia r5!,{r0-r3}
�str r5,u_ptr
�ldr r14,p_start
�ldmia r14!,{r6-r13}
�
�mul r6,r0,r6
�mla r6,r8,r1,r6
�mla r6,r10,r2,r6
�mla r6,r12,r3,r6
�
�mul r7,r0,r7
�mla r7,r9,r1,r7
�mla r7,r11,r2,r7
mla r7,r13,r3,r7

ldmia r14!,{r4,r5,r8-r13}
&
0mul r8,r1,r8
:mla r8,r4,r0,r8
Dmla r8,r10,r2,r8
Nmla r8,r12,r3,r8
X
bmul r9,r1,r9
lmla r9,r5,r0,r9
vmla r9,r11,r2,r9
�mla r9,r13,r3,r9
�
�ldmia r14!,{r4,r5,r10-r13}
�
�mul r10,r1,r10
�mla r10,r4,r0,r10
�mla r10,r12,r2,r10
�
�mul r11,r1,r11
�mla r11,r5,r0,r11
�mla r11,r13,r2,r11
�
�ldmia r14!,{r12,r13}

mla r10,r12,r3,r10
mla r11,r13,r3,r11
 
*ldmia r14!,{r4,r5,r12,r13}
4
>mul r12,r1,r12
Hmla r12,r4,r0,r12
R
\mul r13,r1,r13
fmla r13,r5,r0,r13
p
zldmia r14!,{r0,r1}
�mla r12,r0,r2,r12
�mla r13,r1,r2,r13
�
�ldmia r14!,{r0,r1}
�mla r12,r0,r3,r12
�mla r13,r1,r3,r13
�
�adr r3,q_start
�mov r5,#q_step%
�
�mov r6,r6,asr#20
�mov r7,r7,asr#20
�mov r8,r8,asr#20
	mov r9,r9,asr#20
	mov r10,r10,asr#20
	mov r11,r11,asr#20
	$mov r12,r12,asr#20
	.mov r13,r13,asr#20
	8
ldr r4,in
	B
	L
.vloop
	Vldr r2,[r3],#4
	`(mul r0,r6,r2                    ; ax
	j(mul r1,r7,r2                    ; ay
	t
	~ldr r2,[r3],#4
	�(mla r0,r8,r2,r0                 ; bx
	�(mla r1,r9,r2,r1                 ; by
	�
	�ldr r2,[r3],#4
	�(mla r0,r10,r2,r0                ; cx
	�(mla r1,r11,r2,r1                ; cy
	�
	�ldr r2,[r3],#4
	�(mla r0,r12,r2,r0                ; dx
	�(mla r1,r13,r2,r1                ; dy
	�
	�mov r0,r0,asr#20
mov r1,r1,asr#20

stmia r4!,{r0,r1}

subs r5,r5,#1
(
bgt vloop
2
<ldr r5,u_count
Fsubs r5,r5,#1
Pstrgt r5,u_count
Zldrgt r5,u_ptr
dstrgt r4,in
n
bgt uloop
x
�ldr r0,index_base
�ldr r9,index_normal
�ldr r12,big_normal_table
�ldr r13,l_x
�ldr r14,l_y
�
mov r1,#0
�.u_loop
�#add r2,r0,r1,lsl#log2_q_step%+3
�$add r10,r9,r1,lsl#log2_q_step%+2
�add r3,r2,#4
�
mov r4,#0
�ldr r5,[r2,r4,lsl#3]
�ldr r6,[r3,r4,lsl#3]

mov r4,#1
.v_loop
/ldr r7,[r2,r4,lsl#3]                    ; x
"/ldr r8,[r3,r4,lsl#3]                    ; y
,subs r5,r7,r5
6rsblt r5,r5,#0
@;movlt r11,#1
Jsubs r6,r8,r6
Trsblt r6,r6,#0
^;orrlt r11,r11,#2
h.lp
rcmp r5,#128
|cmplt r6,#128
�movge r5,r5,lsr#1
�movge r6,r6,lsr#1
�
bge lp
�
�add r5,r5,r6,lsl#7
�add r5,r12,r5,lsl#3
�Dldmia r5,{r5,r6}                        ; get normalised vectors
�
�mul r5,r13,r5
�?mla r5,r14,r6,r5                        ; nx*lx+ny*ly << 25
�:movs r5,r5,asr#14                       ; normal * shd
�subs r5,r5,#1024+384
�movlt r5,#0
cmp r5,#223
movgt r5,#223
str r5,[r10],#4
&
0
mov r5,r7
:
mov r6,r8
Dadd r4,r4,#1
Ncmp r4,#q_step%
Xble v_loop
badd r1,r1,#1
lcmp r1,#q_step%
vble u_loop
�
�ldr r13,stackp
�
�ldr r3,index_normal
�ldr r6,index_base
�'mov r0,#0                       ; x
�
.xloop
�'mov r1,#0                       ; y
�
.yloop
�=add r2,r0,r1,lsl#4              ; x+y*q_step%, q_step%=16
�4add r4,r3,r2,lsl#2              ; normal+ofs%<<2
�
�(ldr r5,[r4,#4]                  ; l1


str r5,ac



(ldr r5,[r4]                     ; l2

 
str r5,bc

*

4(ldr r5,[r4,#4+16*4]             ; l3

>
str r5,cc

H

R4add r7,r6,r2,lsl#3              ; output+ofs%<<3

\

f1ldmia r7,{r8,r9,r10,r11}        ; bx,by,ax,ay

p
str r8,bx

z
str r9,by

�str r10,ax

�str r11,ay

�

�ldr r8,[r7,#8+16*8]

�
str r8,cx

�

�ldr r8,[r7,#12+16*8]

�
str r8,cy

�

�9mov r8,r0,lsl#4                 ; x*sstep%, sstep%=16

�
str r8,bv

�add r8,r8,#16

�
str r8,av

str r8,cv

.mov r8,r1,lsl#4                 ; y*sstep%
$
str r8,au
.
str r8,bu
8add r8,r8,#16
B
str r8,cu
L
V"stmfd r13!,{r0,r1,r3,r4,r6-r8}
`bl texture_triangle
j"ldmfd r13!,{r0,r1,r3,r4,r6-r8}
t
~
str r8,au
�(ldr r8,[r4,#16*4]               ; l4
�
str r8,ac
�mov r8,r0,lsl#4
�
str r8,av
�
�ldr r8,[r7,#16*8]
�
str r8,ax
�ldr r8,[r7,#4+16*8]
�
str r8,ay
�
�stmfd r13!,{r0,r1,r3,r6}
�

adr r0,by

ldmia r0,{r1,r2,r3,r4,r5}


adr r6,cy
(ldmia r6,{r7,r8,r9,r10,r11}
2
<stmia r6,{r1-r5}
Fstmia r0,{r7-r11}
P
Zbl texture_triangle
dldmfd r13!,{r0,r1,r3,r6}
n
xadd r1,r1,#1
�cmp r1,#14
�
ble yloop
�
�add r0,r0,#1
�cmp r0,#14
�
ble xloop
�
�ldmfd r13!,{r15}
�
�.u_count
�	dcd 0
�
�
.u_ptr
	dcd 0

.l_x
"dcd lx*1024
,.l_y
6dcd ly*1024
@
J.in
T	dcd 0
^
h.stackp
r	dcd 0
|
�.p_start
�dcd p_table%
�
�.index_base
�dcd output%
�
�.index_normal
�dcd normal%
�
�.q_start
�]
�P%+=8192/q_step%
�[OPT pass%
.div_table
dcd div_table%

&
0.stackp
:	dcd 0
D	.link
N	dcd 0
X.div_table
bdcd div_table%
l
.coltable
vdcd coltab%
�.r_index
�	dcd 0
�.l_index
�	dcd 0
�
�
.y_end
�	dcd 0
�
�.sprite
�dcd sprite%+56
�.screenadr
�dcd �screenadr(2)
�dcd �screenadr(1)

.ay:dcd 0:.ax:dcd 0

.ac:dcd 0
 .au:dcd 0:.av:dcd 0
*dcd 0:dcd 0:dcd 0
4
>.by:dcd 0:.bx:dcd 0
H
.bc:dcd 0
R.bu:dcd 0:.bv:dcd 0
\dcd 0:dcd 0:dcd 0
f
p.cy:dcd 0:.cx:dcd 0
z
.cc:dcd 0
�.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
�movlt r1,r11
�movge r1,r10
�movlt r2,#1
�movge r2,#0
�ldr r12,[r0,#64]
cmp r12,r1
movlt r1,r12
movlt r2,#2
$cmp r1,#512
.movge pc,r14
8cmp r10,#0
Bcmplt r11,#0
Lcmplt r12,#0
Vmovlt pc,r14
`
jstr r13,stackp
t
~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
�movlt r3,#2
�add r0,r0,r3,lsl#5
�str r0,r_index
�Aldmia r4,{r9,r10,r11,r12,r13}           ; y_l,x_l,c_l,u_l,v_l
�
str r14,link

ldr r14,div_table
1subs r2,r9,r1                           ; dly
7ldrgt r2,[r14,r2,lsl#2]                 ; 1<<20/dly
(
2movgt r3,r5,lsl#10
<moveq r3,r10,lsl#10
Fsubgt r4,r10,r5
P5mul r4,r2,r4                            ; dlx<<20
Zstr r4,dlx
d
nmovgt r10,r6,lsl#10
xmoveq r10,r11,lsl#10
�str r10,lc
�subgt r4,r11,r6
�5mul r4,r2,r4                            ; dlc<<20
�str r4,dlc
�
�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
subgt r4,r13,r8
"5mul r4,r2,r4                            ; dlv<<20
,str r4,dlv
6
@Aldmia r0,{r0,r10,r11,r12,r13}           ; y_r,x_r,c_r,u_r,v_r
J1subs r2,r0,r1                           ; dry
T7ldrgt r2,[r14,r2,lsl#2]                 ; 1<<20/dry
^
hmovgt r4,r5,lsl#10
rmoveq r4,r10,lsl#10
|subgt r10,r10,r5
�5mul r10,r2,r10                          ; drx<<20
�str r10,drx
�
�movgt r10,r6,lsl#10
�moveq r10,r11,lsl#10
�str r10,rc
�subgt r10,r11,r6
�5mul r10,r2,r10                          ; drc<<20
�str r10,drc
�
�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
&
0movgt r10,r8,lsl#10
:moveq r10,r13,lsl#10
Dstr r10,rv
Nsubgt r10,r13,r8
X5mul r10,r2,r10                          ; drv<<20
bstr r10,drv
l
vldr r2,screenadr
�add r2,r2,r1,lsl#7
�9add r2,r2,r1,lsl#9                      ; screen line
�
�MOV 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
4; r2 = scline
>
; r3 = lx
H
; r4 = rx
R; r1,r5-r14 = empty
\
f ; recalcuate dlx,dlu,dlv,dlc
pldr r1,l_index
z=ldmib r1,{r3,r10,r11,r12}               ; x_l,c_l,u_l,v_l
�ldr r1,r_index
�Aldmia r1,{r1,r5,r6,r7,r8}               ; y_r,x_r,c_r,u_r,v_r
�str r1,y_end
�
�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,r6,r10
$5mul r5,r1,r5                            ; dlc<<20
.str r5,dlc
8
Bsubgt r5,r8,r12
L5mul r5,r1,r5                            ; dlv<<20
Vstr r5,dlv
`
jldr r10,sprite
t
~MOV R14,R0
�
.last_bit
�
�yloop
�
�ldr r13,stackp
�ldr r15,link
�
�
�=.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
2ldr r1,r_index
<=ldmib r1,{r4,r10,r11,r12}               ; x_r,c_r,u_r,v_r
Fldr r1,l_index
PAldmia r1,{r1,r5,r6,r7,r8}               ; y_l,x_l,c_l,u_l,v_l
Zstr r1,y_end
d
n1subs r1,r1,r0                           ; dly
xldr r14,div_table
�
�7ldrgt r1,[r14,r1,lsl#2]                 ; 1<<20/dly
�subgt r5,r5,r4
�mov r4,r4,lsl#10
�5mul r5,r1,r5                            ; dlx<<20
�str r5,drx
�subgt r5,r6,r10
�5mul r5,r1,r5                            ; dlc<<20
�str r5,drc
�subgt 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
6
�yloop
@
Jldr r13,stackp
Tldr r15,link
^
h	.line
r	dcd 0
|
�.coords
�.lu:dcd 0:.ru:dcd 0
�.lc:dcd 0:.rc:dcd 0
�.lv:dcd 0:.rv:dcd 0
�.dlx:dcd 0:.drx:dcd 0
�.dlc:dcd 0:.drc:dcd 0
�.dlu:dcd 0:.dru:dcd 0
�.dlv:dcd 0:.drv:dcd 0
�
�]
��
�p%=q_start:stp=1024/q_step%
��n%=0 � 1024 � stp
1qn%=1024-n%:qs%=(qn%*qn%)>>10:ns%=(n%*n%)>>10
!p%=qs%*qn%
p%!4=3*qs%*n%
&p%!8=3*ns%*qn%
0p%!12=ns%*n%
:
p%+=16
D�
N$ș"OS_File",16,"Picture",sprite%
X#ș"OS_File",16,"ColTab",coltab%
b�
l:
vݤ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
-add r4,r4,r11,asr#10            ; rx+=drx
ldr r11,div_table
mov r0,r0,asr#4
 .ldrgt r0,[r11,r0,lsl#2]         ; 1<<18/dx
*ldr r11,lc
4
ldr r9,rc
>,sub r5,r9,r11                   ; dc<<10
H,mul r5,r0,r5                    ; dc<<30
Rldr r8,drc
\add r9,r9,r8,asr#10
f
str r9,rc
pldr r8,dlc
zadd r9,r11,r8,asr#10
�
str r9,lc
�
ldr r9,lu
�
ldr r8,ru
�
�,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
8,mul r7,r0,r7                    ; dv<<21
Bldr r0,drv
Ladd r1,r1,r0,asr#10
V
str r1,rv
`ldr r0,dlv
jadd r0,r8,r0,asr#10
t
str r0,lv
~add r2,r2,#640
�str r2,line
�
�mov r9,r9,lsl#14
�mov 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
(
2ldr r1,coltable
<tst r12,#1
Fmoveq r2,#1<<31
Pmovne r2,#0
Z
.xloop
dand r0,r8,#255<<24
norr r0,r0,r9,lsr#8
xldrb r0,[r10,r0,lsr#16]
�/add r0,r1,r0,lsl#5              ; 32 levels
�add r0,r0,r2,lsr#31
�/ldrb r0,[r0,r11,lsr#27]         ; 32 levels
�strb r0,[r12],#1
�cmp r12,r13
�addle r2,r2,#1<<31
�addle r8,r8,r7
�addle r9,r9,r6
�addle r11,r11,r5
�
ble xloop
�
�ldr r2,line
�ldr r0,y_end
add r14,r14,#1
cmp r14,r0

blt yloop
"
,]
6=0
@:
Jݤscreenadr(bk%)
Tș"OS_Byte",112,bk%
^ș"OS_Byte",113,bk%
h
� q% 8
r!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 34  |..... Triangle 4|
00000010  0d 00 14 05 f4 0d 00 1e  31 f4 20 44 65 6d 6f 6e  |........1. Demon|
00000020  73 74 72 61 74 65 20 6d  6f 72 65 20 61 64 76 61  |strate more adva|
00000030  6e 63 65 64 20 75 73 65  73 20 6f 66 20 74 72 69  |nced uses of tri|
00000040  61 6e 67 6c 65 73 0d 00  28 05 3a 0d 00 32 1f ee  |angles..(.:..2..|
00000050  20 85 20 eb 30 3a f1 20  f6 24 3b 22 20 61 74 20  | . .0:. .$;" at |
00000060  6c 69 6e 65 20 22 3b 9e  3a e0 0d 00 3c 12 2a 52  |line ";.:...<.*R|
00000070  55 4e 20 32 35 36 4d 6f  64 65 32 30 0d 00 46 15  |UN 256Mode20..F.|
00000080  6c 78 3d 30 2e 37 30 37  3a 6c 79 3d 30 2e 37 30  |lx=0.707:ly=0.70|
00000090  37 0d 00 50 0d f2 61 73  73 65 6d 62 6c 65 0d 00  |7..P..assemble..|
000000a0  5a 0b d6 20 73 65 74 75  70 0d 00 64 0d e3 78 25  |Z.. setup..d..x%|
000000b0  3d 30 20 b8 20 33 0d 00  6e 0d e3 79 25 3d 30 20  |=0 . 3..n..y%=0 |
000000c0  b8 20 33 0d 00 78 25 70  5f 74 61 62 6c 65 25 21  |. 3..x%p_table%!|
000000d0  28 28 78 25 2b 79 25 2a  34 29 3c 3c 33 29 3d 37  |((x%+y%*4)<<3)=7|
000000e0  35 2b 78 25 2a 31 35 30  0d 00 82 29 70 5f 74 61  |5+x%*150...)p_ta|
000000f0  62 6c 65 25 21 28 34 2b  28 28 78 25 2b 79 25 2a  |ble%!(4+((x%+y%*|
00000100  34 29 3c 3c 33 29 29 3d  32 35 2b 79 25 2a 31 35  |4)<<3))=25+y%*15|
00000110  30 0d 00 8c 05 ed 0d 00  96 05 ed 0d 00 a0 05 3a  |0..............:|
00000120  0d 00 aa 09 62 6b 25 3d  31 0d 00 b4 09 f2 64 72  |....bk%=1.....dr|
00000130  61 77 0d 00 be 09 f2 64  72 61 77 0d 00 c8 08 c8  |aw.....draw.....|
00000140  97 20 ee 0d 00 d2 05 f5  0d 00 dc 05 f5 0d 00 e6  |. ..............|
00000150  11 c8 97 20 6d 78 25 2c  6d 79 25 2c 62 25 0d 00  |... mx%,my%,b%..|
00000160  f0 0a fd 20 62 25 3d 34  0d 00 fa 05 3a 0d 01 04  |... b%=4....:...|
00000170  14 66 78 25 3d 2d 31 3a  6d 64 25 3d 31 30 30 30  |.fx%=-1:md%=1000|
00000180  30 0d 01 0e 0d e3 78 25  3d 30 20 b8 20 33 0d 01  |0.....x%=0 . 3..|
00000190  18 0d e3 79 25 3d 30 20  b8 20 33 0d 01 22 21 70  |...y%=0 . 3.."!p|
000001a0  78 25 3d 70 5f 74 61 62  6c 65 25 21 28 28 78 25  |x%=p_table%!((x%|
000001b0  2b 79 25 2a 34 29 3c 3c  33 29 2a 32 0d 01 2c 2a  |+y%*4)<<3)*2..,*|
000001c0  70 79 25 3d 31 30 32 34  2d 70 5f 74 61 62 6c 65  |py%=1024-p_table|
000001d0  25 21 28 34 2b 28 28 78  25 2b 79 25 2a 34 29 3c  |%!(4+((x%+y%*4)<|
000001e0  3c 33 29 29 2a 32 0d 01  36 1b 64 78 25 3d 6d 78  |<3))*2..6.dx%=mx|
000001f0  25 2d 70 78 25 3a 64 79  25 3d 6d 79 25 2d 70 79  |%-px%:dy%=my%-py|
00000200  25 0d 01 40 16 64 25 3d  64 78 25 2a 64 78 25 2b  |%..@.d%=dx%*dx%+|
00000210  64 79 25 2a 64 79 25 0d  01 4a 21 e7 20 64 25 3c  |dy%*dy%..J!. d%<|
00000220  6d 64 25 20 6d 64 25 3d  64 25 3a 66 78 25 3d 78  |md% md%=d%:fx%=x|
00000230  25 3a 66 79 25 3d 79 25  0d 01 54 05 ed 0d 01 5e  |%:fy%=y%..T....^|
00000240  05 ed 0d 01 68 20 e7 20  66 78 25 3c 3e 2d 31 20  |....h . fx%<>-1 |
00000250  8c 20 f2 63 68 61 6e 67  65 28 66 78 25 2c 66 79  |. .change(fx%,fy|
00000260  25 29 0d 01 72 07 fd 20  a3 0d 01 7c 05 e0 0d 01  |%)..r.. ...|....|
00000270  86 05 3a 0d 01 90 15 dd  f2 63 68 61 6e 67 65 28  |..:......change(|
00000280  66 78 25 2c 66 79 25 29  0d 01 9a 05 f5 0d 01 a4  |fx%,fy%)........|
00000290  11 c8 97 20 6d 78 25 2c  6d 79 25 2c 62 25 0d 01  |... mx%,my%,b%..|
000002a0  ae 24 70 5f 74 61 62 6c  65 25 21 28 28 66 78 25  |.$p_table%!((fx%|
000002b0  2b 66 79 25 2a 34 29 3c  3c 33 29 3d 6d 78 25 3e  |+fy%*4)<<3)=mx%>|
000002c0  3e 31 0d 01 b8 2e 70 5f  74 61 62 6c 65 25 21 28  |>1....p_table%!(|
000002d0  34 2b 28 28 66 78 25 2b  66 79 25 2a 34 29 3c 3c  |4+((fx%+fy%*4)<<|
000002e0  33 29 29 3d 35 31 32 2d  28 6d 79 25 3e 3e 31 29  |3))=512-(my%>>1)|
000002f0  0d 01 c2 09 f2 64 72 61  77 0d 01 cc 0a fd 20 62  |.....draw..... b|
00000300  25 3d 30 0d 01 d6 09 f2  64 72 61 77 0d 01 e0 05  |%=0.....draw....|
00000310  e1 0d 01 ea 05 3a 0d 01  f4 0a dd f2 64 72 61 77  |.....:......draw|
00000320  0d 01 fe 17 c8 99 22 4f  53 5f 42 79 74 65 22 2c  |......"OS_Byte",|
00000330  31 31 32 2c 62 6b 25 0d  02 08 1d c8 94 20 21 73  |112,bk%...... !s|
00000340  63 72 65 65 6e 61 64 72  2c 73 63 72 65 65 6e 61  |creenadr,screena|
00000350  64 72 21 34 0d 02 12 0d  62 6b 25 3d 33 2d 62 6b  |dr!4....bk%=3-bk|
00000360  25 0d 02 1c 06 c8 96 0d  02 26 17 c8 99 22 4f 53  |%........&..."OS|
00000370  5f 42 79 74 65 22 2c 31  31 33 2c 62 6b 25 0d 02  |_Byte",113,bk%..|
00000380  30 05 db 0d 02 3a 0c d6  20 62 65 7a 69 65 72 0d  |0....:.. bezier.|
00000390  02 44 0d e3 78 25 3d 30  20 b8 20 33 0d 02 4e 0d  |.D..x%=0 . 3..N.|
000003a0  e3 79 25 3d 30 20 b8 20  33 0d 02 58 46 c8 8f 20  |.y%=0 . 3..XF.. |
000003b0  70 5f 74 61 62 6c 65 25  21 28 28 78 25 2b 79 25  |p_table%!((x%+y%|
000003c0  2a 34 29 3c 3c 33 29 2a  32 2c 31 30 32 34 2d 70  |*4)<<3)*2,1024-p|
000003d0  5f 74 61 62 6c 65 25 21  28 34 2b 28 28 78 25 2b  |_table%!(4+((x%+|
000003e0  79 25 2a 34 29 3c 3c 33  29 29 2a 32 2c 31 30 0d  |y%*4)<<3))*2,10.|
000003f0  02 62 05 ed 0d 02 6c 05  ed 0d 02 76 05 e1 0d 02  |.b....l....v....|
00000400  80 05 3a 0d 02 8a 0e dd  f2 61 73 73 65 6d 62 6c  |..:......assembl|
00000410  65 0d 02 94 21 71 5f 73  74 65 70 25 3d 31 36 3a  |e...!q_step%=16:|
00000420  73 73 74 65 70 25 3d 32  35 36 2f 71 5f 73 74 65  |sstep%=256/q_ste|
00000430  70 25 0d 02 9e 20 6c 6f  67 32 5f 71 5f 73 74 65  |p%... log2_q_ste|
00000440  70 25 3d ab 28 71 5f 73  74 65 70 25 29 2f ab 28  |p%=.(q_step%)/.(|
00000450  32 29 0d 02 a8 9c de 20  63 6f 64 65 25 20 31 36  |2)..... code% 16|
00000460  33 38 34 2c 70 5f 74 61  62 6c 65 25 20 31 32 38  |384,p_table% 128|
00000470  2c 6f 75 74 70 75 74 25  20 71 5f 73 74 65 70 25  |,output% q_step%|
00000480  2a 71 5f 73 74 65 70 25  2a 38 2c 6e 6f 72 6d 61  |*q_step%*8,norma|
00000490  6c 25 20 71 5f 73 74 65  70 25 2a 71 5f 73 74 65  |l% q_step%*q_ste|
000004a0  70 25 2a 35 2c 64 69 76  5f 74 61 62 6c 65 25 20  |p%*5,div_table% |
000004b0  33 32 37 36 38 2a 34 2c  62 69 67 5f 6e 6f 72 6d  |32768*4,big_norm|
000004c0  61 6c 5f 74 61 62 6c 65  25 20 31 32 38 2a 31 32  |al_table% 128*12|
000004d0  38 2a 38 2c 73 70 72 69  74 65 25 20 36 35 35 39  |8*8,sprite% 6559|
000004e0  32 2c 63 6f 6c 74 61 62  25 20 38 31 39 32 0d 02  |2,coltab% 8192..|
000004f0  b2 15 e3 20 70 61 73 73  25 3d 30 20 b8 20 32 20  |... pass%=0 . 2 |
00000500  88 20 32 0d 02 bc 0c 50  25 3d 63 6f 64 65 25 0d  |. 2....P%=code%.|
00000510  02 c6 0e 5b 4f 50 54 20  70 61 73 73 25 0d 02 d0  |...[OPT pass%...|
00000520  0a 2e 73 65 74 75 70 0d  02 da 1c 6c 64 72 20 72  |..setup....ldr r|
00000530  31 32 2c 62 69 67 5f 6e  6f 72 6d 61 6c 5f 74 61  |12,big_normal_ta|
00000540  62 6c 65 0d 02 e4 0d 6d  6f 76 20 72 31 2c 23 30  |ble....mov r1,#0|
00000550  0d 02 ee 0c 2e 6e 79 5f  6c 6f 6f 70 0d 02 f8 0d  |.....ny_loop....|
00000560  6d 6f 76 20 72 30 2c 23  30 0d 03 02 0c 2e 6e 78  |mov r0,#0.....nx|
00000570  5f 6c 6f 6f 70 0d 03 0c  04 0d 03 16 10 6d 75 6c  |_loop........mul|
00000580  20 72 32 2c 72 30 2c 72  30 0d 03 20 13 6d 6c 61  | r2,r0,r0.. .mla|
00000590  20 72 32 2c 72 31 2c 72  31 2c 72 32 0d 03 2a 14  | r2,r1,r1,r2..*.|
000005a0  6d 6f 76 20 72 32 2c 72  32 2c 6c 73 6c 23 31 30  |mov r2,r2,lsl#10|
000005b0  0d 03 34 04 0d 03 3e 10  3b 20 72 33 20 3d 20 b6  |..4...>.; r3 = .|
000005c0  28 72 32 29 0d 03 48 0d  6d 6f 76 20 72 33 2c 23  |(r2)..H.mov r3,#|
000005d0  30 0d 03 52 11 6d 6f 76  20 72 34 2c 23 31 3c 3c  |0..R.mov r4,#1<<|
000005e0  33 30 0d 03 5c 07 2e 6c  70 0d 03 66 10 61 64 64  |30..\..lp..f.add|
000005f0  20 72 35 2c 72 33 2c 72  34 0d 03 70 0d 63 6d 70  | r5,r3,r4..p.cmp|
00000600  20 72 35 2c 72 32 0d 03  7a 12 73 75 62 6c 65 20  | r5,r2..z.suble |
00000610  72 32 2c 72 32 2c 72 35  0d 03 84 12 61 64 64 6c  |r2,r2,r5....addl|
00000620  65 20 72 33 2c 72 35 2c  72 34 0d 03 8e 13 6d 6f  |e r3,r5,r4....mo|
00000630  76 20 72 33 2c 72 33 2c  61 73 72 23 31 0d 03 98  |v r3,r3,asr#1...|
00000640  14 6d 6f 76 73 20 72 34  2c 72 34 2c 61 73 72 23  |.movs r4,r4,asr#|
00000650  32 0d 03 a2 0a 62 6e 65  20 6c 70 0d 03 ac 04 0d  |2....bne lp.....|
00000660  03 b6 15 3b 20 72 32 20  3d 20 31 30 34 38 35 37  |...; r2 = 104857|
00000670  36 2f 72 33 0d 03 c0 13  6d 6f 76 20 72 34 2c 23  |6/r3....mov r4,#|
00000680  31 30 34 38 35 37 36 0d  03 ca 0d 6d 6f 76 20 72  |1048576....mov r|
00000690  35 2c 23 30 0d 03 d4 0d  6d 6f 76 20 72 32 2c 23  |5,#0....mov r2,#|
000006a0  30 0d 03 de 11 6d 6f 76  20 72 37 2c 23 31 3c 3c  |0....mov r7,#1<<|
000006b0  33 31 0d 03 e8 07 2e 6c  70 0d 03 f2 14 6d 6f 76  |31.....lp....mov|
000006c0  73 20 72 34 2c 72 34 2c  6c 73 6c 23 31 0d 03 fc  |s r4,r4,lsl#1...|
000006d0  10 61 64 63 20 72 35 2c  72 35 2c 72 35 0d 04 06  |.adc r5,r5,r5...|
000006e0  0d 63 6d 70 20 72 35 2c  72 33 0d 04 10 12 73 75  |.cmp r5,r3....su|
000006f0  62 67 65 20 72 35 2c 72  35 2c 72 33 0d 04 1a 12  |bge r5,r5,r3....|
00000700  6f 72 72 67 65 20 72 32  2c 72 32 2c 72 37 0d 04  |orrge r2,r2,r7..|
00000710  24 14 6d 6f 76 73 20 72  37 2c 72 37 2c 6c 73 72  |$.movs r7,r7,lsr|
00000720  23 31 0d 04 2e 0a 62 6e  65 20 6c 70 0d 04 38 04  |#1....bne lp..8.|
00000730  0d 04 42 10 6d 75 6c 20  72 33 2c 72 31 2c 72 32  |..B.mul r3,r1,r2|
00000740  0d 04 4c 10 6d 75 6c 20  72 32 2c 72 30 2c 72 32  |..L.mul r2,r0,r2|
00000750  0d 04 56 04 0d 04 60 16  73 74 6d 69 61 20 72 31  |..V...`.stmia r1|
00000760  32 21 2c 7b 72 32 2c 72  33 7d 0d 04 6a 04 0d 04  |2!,{r2,r3}..j...|
00000770  74 10 61 64 64 20 72 30  2c 72 30 2c 23 31 0d 04  |t.add r0,r0,#1..|
00000780  7e 0f 63 6d 70 20 72 30  2c 23 31 32 38 0d 04 88  |~.cmp r0,#128...|
00000790  0f 62 6c 74 20 6e 78 5f  6c 6f 6f 70 0d 04 92 04  |.blt nx_loop....|
000007a0  0d 04 9c 10 61 64 64 20  72 31 2c 72 31 2c 23 31  |....add r1,r1,#1|
000007b0  0d 04 a6 0f 63 6d 70 20  72 31 2c 23 31 32 38 0d  |....cmp r1,#128.|
000007c0  04 b0 0f 62 6c 74 20 6e  79 5f 6c 6f 6f 70 0d 04  |...blt ny_loop..|
000007d0  ba 04 0d 04 c4 14 6c 64  72 20 72 30 2c 64 69 76  |......ldr r0,div|
000007e0  5f 74 61 62 6c 65 0d 04  ce 0d 6d 6f 76 20 72 32  |_table....mov r2|
000007f0  2c 23 31 0d 04 d8 04 0d  04 e2 07 2e 64 6c 0d 04  |,#1.........dl..|
00000800  ec 11 6d 6f 76 20 72 34  2c 23 31 3c 3c 32 30 0d  |..mov r4,#1<<20.|
00000810  04 f6 27 6d 6f 76 20 72  35 2c 23 30 20 20 20 20  |..'mov r5,#0    |
00000820  20 20 20 20 20 20 20 20  20 20 20 3b 20 72 65 6d  |           ; rem|
00000830  61 69 6e 64 65 72 0d 05  00 26 6d 6f 76 20 72 36  |ainder...&mov r6|
00000840  2c 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#0             |
00000850  20 20 3b 20 71 75 6f 74  69 65 6e 74 0d 05 0a 11  |  ; quotient....|
00000860  6d 6f 76 20 72 37 2c 23  31 3c 3c 33 31 0d 05 14  |mov r7,#1<<31...|
00000870  0d 2e 64 69 76 5f 6c 6f  6f 70 0d 05 1e 14 6d 6f  |..div_loop....mo|
00000880  76 73 20 72 34 2c 72 34  2c 6c 73 6c 23 31 0d 05  |vs r4,r4,lsl#1..|
00000890  28 10 61 64 63 20 72 35  2c 72 35 2c 72 35 0d 05  |(.adc r5,r5,r5..|
000008a0  32 0d 63 6d 70 20 72 35  2c 72 32 0d 05 3c 12 73  |2.cmp r5,r2..<.s|
000008b0  75 62 67 65 20 72 35 2c  72 35 2c 72 32 0d 05 46  |ubge r5,r5,r2..F|
000008c0  12 6f 72 72 67 65 20 72  36 2c 72 36 2c 72 37 0d  |.orrge r6,r6,r7.|
000008d0  05 50 14 6d 6f 76 73 20  72 37 2c 72 37 2c 6c 73  |.P.movs r7,r7,ls|
000008e0  72 23 31 0d 05 5a 10 62  6e 65 20 64 69 76 5f 6c  |r#1..Z.bne div_l|
000008f0  6f 6f 70 0d 05 64 04 0d  05 6e 18 3b 20 72 36 20  |oop..d...n.; r6 |
00000900  3d 20 72 34 20 64 69 76  20 72 32 20 3d 20 73 0d  |= r4 div r2 = s.|
00000910  05 78 04 0d 05 82 13 73  74 72 20 72 36 2c 5b 72  |.x.....str r6,[r|
00000920  30 2c 23 34 5d 21 0d 05  8c 10 61 64 64 20 72 32  |0,#4]!....add r2|
00000930  2c 72 32 2c 23 31 0d 05  96 11 63 6d 70 20 72 32  |,r2,#1....cmp r2|
00000940  2c 23 33 32 37 36 38 0d  05 a0 0a 62 6c 65 20 64  |,#32768....ble d|
00000950  6c 0d 05 aa 04 0d 05 b4  0a 2e 6d 61 69 6e 31 0d  |l.........main1.|
00000960  05 be 0e 6d 6f 76 20 70  63 2c 72 31 34 0d 05 c8  |...mov pc,r14...|
00000970  04 0d 05 d2 04 0d 05 dc  0e 6d 6f 76 20 70 63 2c  |.........mov pc,|
00000980  72 31 34 0d 05 e6 04 0d  05 f0 15 2e 62 69 67 5f  |r14.........big_|
00000990  6e 6f 72 6d 61 6c 5f 74  61 62 6c 65 0d 05 fa 19  |normal_table....|
000009a0  64 63 64 20 62 69 67 5f  6e 6f 72 6d 61 6c 5f 74  |dcd big_normal_t|
000009b0  61 62 6c 65 25 0d 06 04  04 0d 06 0e 0b 2e 62 65  |able%.........be|
000009c0  7a 69 65 72 0d 06 18 14  73 74 6d 66 64 20 72 31  |zier....stmfd r1|
000009d0  33 21 2c 7b 72 31 34 7d  0d 06 22 12 73 74 72 20  |3!,{r14}..".str |
000009e0  72 31 33 2c 73 74 61 63  6b 70 0d 06 2c 12 61 64  |r13,stackp..,.ad|
000009f0  72 20 72 35 2c 71 5f 73  74 61 72 74 0d 06 36 04  |r r5,q_start..6.|
00000a00  0d 06 40 13 6d 6f 76 20  72 34 2c 23 71 5f 73 74  |..@.mov r4,#q_st|
00000a10  65 70 25 0d 06 4a 12 73  74 72 20 72 34 2c 75 5f  |ep%..J.str r4,u_|
00000a20  63 6f 75 6e 74 0d 06 54  04 0d 06 5e 15 6c 64 72  |count..T...^.ldr|
00000a30  20 72 34 2c 69 6e 64 65  78 5f 62 61 73 65 0d 06  | r4,index_base..|
00000a40  68 0d 73 74 72 20 72 34  2c 69 6e 0d 06 72 04 0d  |h.str r4,in..r..|
00000a50  06 7c 0a 2e 75 6c 6f 6f  70 0d 06 86 15 6c 64 6d  |.|..uloop....ldm|
00000a60  69 61 20 72 35 21 2c 7b  72 30 2d 72 33 7d 0d 06  |ia r5!,{r0-r3}..|
00000a70  90 10 73 74 72 20 72 35  2c 75 5f 70 74 72 0d 06  |..str r5,u_ptr..|
00000a80  9a 13 6c 64 72 20 72 31  34 2c 70 5f 73 74 61 72  |..ldr r14,p_star|
00000a90  74 0d 06 a4 17 6c 64 6d  69 61 20 72 31 34 21 2c  |t....ldmia r14!,|
00000aa0  7b 72 36 2d 72 31 33 7d  0d 06 ae 04 0d 06 b8 10  |{r6-r13}........|
00000ab0  6d 75 6c 20 72 36 2c 72  30 2c 72 36 0d 06 c2 13  |mul r6,r0,r6....|
00000ac0  6d 6c 61 20 72 36 2c 72  38 2c 72 31 2c 72 36 0d  |mla r6,r8,r1,r6.|
00000ad0  06 cc 14 6d 6c 61 20 72  36 2c 72 31 30 2c 72 32  |...mla r6,r10,r2|
00000ae0  2c 72 36 0d 06 d6 14 6d  6c 61 20 72 36 2c 72 31  |,r6....mla r6,r1|
00000af0  32 2c 72 33 2c 72 36 0d  06 e0 04 0d 06 ea 10 6d  |2,r3,r6........m|
00000b00  75 6c 20 72 37 2c 72 30  2c 72 37 0d 06 f4 13 6d  |ul r7,r0,r7....m|
00000b10  6c 61 20 72 37 2c 72 39  2c 72 31 2c 72 37 0d 06  |la r7,r9,r1,r7..|
00000b20  fe 14 6d 6c 61 20 72 37  2c 72 31 31 2c 72 32 2c  |..mla r7,r11,r2,|
00000b30  72 37 0d 07 08 14 6d 6c  61 20 72 37 2c 72 31 33  |r7....mla r7,r13|
00000b40  2c 72 33 2c 72 37 0d 07  12 04 0d 07 1c 1d 6c 64  |,r3,r7........ld|
00000b50  6d 69 61 20 72 31 34 21  2c 7b 72 34 2c 72 35 2c  |mia r14!,{r4,r5,|
00000b60  72 38 2d 72 31 33 7d 0d  07 26 04 0d 07 30 10 6d  |r8-r13}..&...0.m|
00000b70  75 6c 20 72 38 2c 72 31  2c 72 38 0d 07 3a 13 6d  |ul r8,r1,r8..:.m|
00000b80  6c 61 20 72 38 2c 72 34  2c 72 30 2c 72 38 0d 07  |la r8,r4,r0,r8..|
00000b90  44 14 6d 6c 61 20 72 38  2c 72 31 30 2c 72 32 2c  |D.mla r8,r10,r2,|
00000ba0  72 38 0d 07 4e 14 6d 6c  61 20 72 38 2c 72 31 32  |r8..N.mla r8,r12|
00000bb0  2c 72 33 2c 72 38 0d 07  58 04 0d 07 62 10 6d 75  |,r3,r8..X...b.mu|
00000bc0  6c 20 72 39 2c 72 31 2c  72 39 0d 07 6c 13 6d 6c  |l r9,r1,r9..l.ml|
00000bd0  61 20 72 39 2c 72 35 2c  72 30 2c 72 39 0d 07 76  |a r9,r5,r0,r9..v|
00000be0  14 6d 6c 61 20 72 39 2c  72 31 31 2c 72 32 2c 72  |.mla r9,r11,r2,r|
00000bf0  39 0d 07 80 14 6d 6c 61  20 72 39 2c 72 31 33 2c  |9....mla r9,r13,|
00000c00  72 33 2c 72 39 0d 07 8a  04 0d 07 94 1e 6c 64 6d  |r3,r9........ldm|
00000c10  69 61 20 72 31 34 21 2c  7b 72 34 2c 72 35 2c 72  |ia r14!,{r4,r5,r|
00000c20  31 30 2d 72 31 33 7d 0d  07 9e 04 0d 07 a8 12 6d  |10-r13}........m|
00000c30  75 6c 20 72 31 30 2c 72  31 2c 72 31 30 0d 07 b2  |ul r10,r1,r10...|
00000c40  15 6d 6c 61 20 72 31 30  2c 72 34 2c 72 30 2c 72  |.mla r10,r4,r0,r|
00000c50  31 30 0d 07 bc 16 6d 6c  61 20 72 31 30 2c 72 31  |10....mla r10,r1|
00000c60  32 2c 72 32 2c 72 31 30  0d 07 c6 04 0d 07 d0 12  |2,r2,r10........|
00000c70  6d 75 6c 20 72 31 31 2c  72 31 2c 72 31 31 0d 07  |mul r11,r1,r11..|
00000c80  da 15 6d 6c 61 20 72 31  31 2c 72 35 2c 72 30 2c  |..mla r11,r5,r0,|
00000c90  72 31 31 0d 07 e4 16 6d  6c 61 20 72 31 31 2c 72  |r11....mla r11,r|
00000ca0  31 33 2c 72 32 2c 72 31  31 0d 07 ee 04 0d 07 f8  |13,r2,r11.......|
00000cb0  18 6c 64 6d 69 61 20 72  31 34 21 2c 7b 72 31 32  |.ldmia r14!,{r12|
00000cc0  2c 72 31 33 7d 0d 08 02  04 0d 08 0c 16 6d 6c 61  |,r13}........mla|
00000cd0  20 72 31 30 2c 72 31 32  2c 72 33 2c 72 31 30 0d  | r10,r12,r3,r10.|
00000ce0  08 16 16 6d 6c 61 20 72  31 31 2c 72 31 33 2c 72  |...mla r11,r13,r|
00000cf0  33 2c 72 31 31 0d 08 20  04 0d 08 2a 1e 6c 64 6d  |3,r11.. ...*.ldm|
00000d00  69 61 20 72 31 34 21 2c  7b 72 34 2c 72 35 2c 72  |ia r14!,{r4,r5,r|
00000d10  31 32 2c 72 31 33 7d 0d  08 34 04 0d 08 3e 12 6d  |12,r13}..4...>.m|
00000d20  75 6c 20 72 31 32 2c 72  31 2c 72 31 32 0d 08 48  |ul r12,r1,r12..H|
00000d30  15 6d 6c 61 20 72 31 32  2c 72 34 2c 72 30 2c 72  |.mla r12,r4,r0,r|
00000d40  31 32 0d 08 52 04 0d 08  5c 12 6d 75 6c 20 72 31  |12..R...\.mul r1|
00000d50  33 2c 72 31 2c 72 31 33  0d 08 66 15 6d 6c 61 20  |3,r1,r13..f.mla |
00000d60  72 31 33 2c 72 35 2c 72  30 2c 72 31 33 0d 08 70  |r13,r5,r0,r13..p|
00000d70  04 0d 08 7a 16 6c 64 6d  69 61 20 72 31 34 21 2c  |...z.ldmia r14!,|
00000d80  7b 72 30 2c 72 31 7d 0d  08 84 15 6d 6c 61 20 72  |{r0,r1}....mla r|
00000d90  31 32 2c 72 30 2c 72 32  2c 72 31 32 0d 08 8e 15  |12,r0,r2,r12....|
00000da0  6d 6c 61 20 72 31 33 2c  72 31 2c 72 32 2c 72 31  |mla r13,r1,r2,r1|
00000db0  33 0d 08 98 04 0d 08 a2  16 6c 64 6d 69 61 20 72  |3........ldmia r|
00000dc0  31 34 21 2c 7b 72 30 2c  72 31 7d 0d 08 ac 15 6d  |14!,{r0,r1}....m|
00000dd0  6c 61 20 72 31 32 2c 72  30 2c 72 33 2c 72 31 32  |la r12,r0,r3,r12|
00000de0  0d 08 b6 15 6d 6c 61 20  72 31 33 2c 72 31 2c 72  |....mla r13,r1,r|
00000df0  33 2c 72 31 33 0d 08 c0  04 0d 08 ca 12 61 64 72  |3,r13........adr|
00000e00  20 72 33 2c 71 5f 73 74  61 72 74 0d 08 d4 13 6d  | r3,q_start....m|
00000e10  6f 76 20 72 35 2c 23 71  5f 73 74 65 70 25 0d 08  |ov r5,#q_step%..|
00000e20  de 04 0d 08 e8 14 6d 6f  76 20 72 36 2c 72 36 2c  |......mov r6,r6,|
00000e30  61 73 72 23 32 30 0d 08  f2 14 6d 6f 76 20 72 37  |asr#20....mov r7|
00000e40  2c 72 37 2c 61 73 72 23  32 30 0d 08 fc 14 6d 6f  |,r7,asr#20....mo|
00000e50  76 20 72 38 2c 72 38 2c  61 73 72 23 32 30 0d 09  |v r8,r8,asr#20..|
00000e60  06 14 6d 6f 76 20 72 39  2c 72 39 2c 61 73 72 23  |..mov r9,r9,asr#|
00000e70  32 30 0d 09 10 16 6d 6f  76 20 72 31 30 2c 72 31  |20....mov r10,r1|
00000e80  30 2c 61 73 72 23 32 30  0d 09 1a 16 6d 6f 76 20  |0,asr#20....mov |
00000e90  72 31 31 2c 72 31 31 2c  61 73 72 23 32 30 0d 09  |r11,r11,asr#20..|
00000ea0  24 16 6d 6f 76 20 72 31  32 2c 72 31 32 2c 61 73  |$.mov r12,r12,as|
00000eb0  72 23 32 30 0d 09 2e 16  6d 6f 76 20 72 31 33 2c  |r#20....mov r13,|
00000ec0  72 31 33 2c 61 73 72 23  32 30 0d 09 38 0d 6c 64  |r13,asr#20..8.ld|
00000ed0  72 20 72 34 2c 69 6e 0d  09 42 04 0d 09 4c 0a 2e  |r r4,in..B...L..|
00000ee0  76 6c 6f 6f 70 0d 09 56  12 6c 64 72 20 72 32 2c  |vloop..V.ldr r2,|
00000ef0  5b 72 33 5d 2c 23 34 0d  09 60 28 6d 75 6c 20 72  |[r3],#4..`(mul r|
00000f00  30 2c 72 36 2c 72 32 20  20 20 20 20 20 20 20 20  |0,r6,r2         |
00000f10  20 20 20 20 20 20 20 20  20 20 20 3b 20 61 78 0d  |           ; ax.|
00000f20  09 6a 28 6d 75 6c 20 72  31 2c 72 37 2c 72 32 20  |.j(mul r1,r7,r2 |
00000f30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f40  20 20 20 3b 20 61 79 0d  09 74 04 0d 09 7e 12 6c  |   ; ay..t...~.l|
00000f50  64 72 20 72 32 2c 5b 72  33 5d 2c 23 34 0d 09 88  |dr r2,[r3],#4...|
00000f60  28 6d 6c 61 20 72 30 2c  72 38 2c 72 32 2c 72 30  |(mla r0,r8,r2,r0|
00000f70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f80  20 3b 20 62 78 0d 09 92  28 6d 6c 61 20 72 31 2c  | ; bx...(mla r1,|
00000f90  72 39 2c 72 32 2c 72 31  20 20 20 20 20 20 20 20  |r9,r2,r1        |
00000fa0  20 20 20 20 20 20 20 20  20 3b 20 62 79 0d 09 9c  |         ; by...|
00000fb0  04 0d 09 a6 12 6c 64 72  20 72 32 2c 5b 72 33 5d  |.....ldr r2,[r3]|
00000fc0  2c 23 34 0d 09 b0 28 6d  6c 61 20 72 30 2c 72 31  |,#4...(mla r0,r1|
00000fd0  30 2c 72 32 2c 72 30 20  20 20 20 20 20 20 20 20  |0,r2,r0         |
00000fe0  20 20 20 20 20 20 20 3b  20 63 78 0d 09 ba 28 6d  |       ; cx...(m|
00000ff0  6c 61 20 72 31 2c 72 31  31 2c 72 32 2c 72 31 20  |la r1,r11,r2,r1 |
00001000  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001010  20 63 79 0d 09 c4 04 0d  09 ce 12 6c 64 72 20 72  | cy........ldr r|
00001020  32 2c 5b 72 33 5d 2c 23  34 0d 09 d8 28 6d 6c 61  |2,[r3],#4...(mla|
00001030  20 72 30 2c 72 31 32 2c  72 32 2c 72 30 20 20 20  | r0,r12,r2,r0   |
00001040  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
00001050  78 0d 09 e2 28 6d 6c 61  20 72 31 2c 72 31 33 2c  |x...(mla r1,r13,|
00001060  72 32 2c 72 31 20 20 20  20 20 20 20 20 20 20 20  |r2,r1           |
00001070  20 20 20 20 20 3b 20 64  79 0d 09 ec 04 0d 09 f6  |     ; dy.......|
00001080  14 6d 6f 76 20 72 30 2c  72 30 2c 61 73 72 23 32  |.mov r0,r0,asr#2|
00001090  30 0d 0a 00 14 6d 6f 76  20 72 31 2c 72 31 2c 61  |0....mov r1,r1,a|
000010a0  73 72 23 32 30 0d 0a 0a  15 73 74 6d 69 61 20 72  |sr#20....stmia r|
000010b0  34 21 2c 7b 72 30 2c 72  31 7d 0d 0a 14 04 0d 0a  |4!,{r0,r1}......|
000010c0  1e 11 73 75 62 73 20 72  35 2c 72 35 2c 23 31 0d  |..subs r5,r5,#1.|
000010d0  0a 28 0d 62 67 74 20 76  6c 6f 6f 70 0d 0a 32 04  |.(.bgt vloop..2.|
000010e0  0d 0a 3c 12 6c 64 72 20  72 35 2c 75 5f 63 6f 75  |..<.ldr r5,u_cou|
000010f0  6e 74 0d 0a 46 11 73 75  62 73 20 72 35 2c 72 35  |nt..F.subs r5,r5|
00001100  2c 23 31 0d 0a 50 14 73  74 72 67 74 20 72 35 2c  |,#1..P.strgt r5,|
00001110  75 5f 63 6f 75 6e 74 0d  0a 5a 12 6c 64 72 67 74  |u_count..Z.ldrgt|
00001120  20 72 35 2c 75 5f 70 74  72 0d 0a 64 0f 73 74 72  | r5,u_ptr..d.str|
00001130  67 74 20 72 34 2c 69 6e  0d 0a 6e 0d 62 67 74 20  |gt r4,in..n.bgt |
00001140  75 6c 6f 6f 70 0d 0a 78  04 0d 0a 82 15 6c 64 72  |uloop..x.....ldr|
00001150  20 72 30 2c 69 6e 64 65  78 5f 62 61 73 65 0d 0a  | r0,index_base..|
00001160  8c 17 6c 64 72 20 72 39  2c 69 6e 64 65 78 5f 6e  |..ldr r9,index_n|
00001170  6f 72 6d 61 6c 0d 0a 96  1c 6c 64 72 20 72 31 32  |ormal....ldr r12|
00001180  2c 62 69 67 5f 6e 6f 72  6d 61 6c 5f 74 61 62 6c  |,big_normal_tabl|
00001190  65 0d 0a a0 0f 6c 64 72  20 72 31 33 2c 6c 5f 78  |e....ldr r13,l_x|
000011a0  0d 0a aa 0f 6c 64 72 20  72 31 34 2c 6c 5f 79 0d  |....ldr r14,l_y.|
000011b0  0a b4 0d 6d 6f 76 20 72  31 2c 23 30 0d 0a be 0b  |...mov r1,#0....|
000011c0  2e 75 5f 6c 6f 6f 70 0d  0a c8 23 61 64 64 20 72  |.u_loop...#add r|
000011d0  32 2c 72 30 2c 72 31 2c  6c 73 6c 23 6c 6f 67 32  |2,r0,r1,lsl#log2|
000011e0  5f 71 5f 73 74 65 70 25  2b 33 0d 0a d2 24 61 64  |_q_step%+3...$ad|
000011f0  64 20 72 31 30 2c 72 39  2c 72 31 2c 6c 73 6c 23  |d r10,r9,r1,lsl#|
00001200  6c 6f 67 32 5f 71 5f 73  74 65 70 25 2b 32 0d 0a  |log2_q_step%+2..|
00001210  dc 10 61 64 64 20 72 33  2c 72 32 2c 23 34 0d 0a  |..add r3,r2,#4..|
00001220  e6 0d 6d 6f 76 20 72 34  2c 23 30 0d 0a f0 18 6c  |..mov r4,#0....l|
00001230  64 72 20 72 35 2c 5b 72  32 2c 72 34 2c 6c 73 6c  |dr r5,[r2,r4,lsl|
00001240  23 33 5d 0d 0a fa 18 6c  64 72 20 72 36 2c 5b 72  |#3]....ldr r6,[r|
00001250  33 2c 72 34 2c 6c 73 6c  23 33 5d 0d 0b 04 0d 6d  |3,r4,lsl#3]....m|
00001260  6f 76 20 72 34 2c 23 31  0d 0b 0e 0b 2e 76 5f 6c  |ov r4,#1.....v_l|
00001270  6f 6f 70 0d 0b 18 2f 6c  64 72 20 72 37 2c 5b 72  |oop.../ldr r7,[r|
00001280  32 2c 72 34 2c 6c 73 6c  23 33 5d 20 20 20 20 20  |2,r4,lsl#3]     |
00001290  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000012a0  20 78 0d 0b 22 2f 6c 64  72 20 72 38 2c 5b 72 33  | x.."/ldr r8,[r3|
000012b0  2c 72 34 2c 6c 73 6c 23  33 5d 20 20 20 20 20 20  |,r4,lsl#3]      |
000012c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000012d0  79 0d 0b 2c 11 73 75 62  73 20 72 35 2c 72 37 2c  |y..,.subs r5,r7,|
000012e0  72 35 0d 0b 36 12 72 73  62 6c 74 20 72 35 2c 72  |r5..6.rsblt r5,r|
000012f0  35 2c 23 30 0d 0b 40 11  3b 6d 6f 76 6c 74 20 72  |5,#0..@.;movlt r|
00001300  31 31 2c 23 31 0d 0b 4a  11 73 75 62 73 20 72 36  |11,#1..J.subs r6|
00001310  2c 72 38 2c 72 36 0d 0b  54 12 72 73 62 6c 74 20  |,r8,r6..T.rsblt |
00001320  72 36 2c 72 36 2c 23 30  0d 0b 5e 15 3b 6f 72 72  |r6,r6,#0..^.;orr|
00001330  6c 74 20 72 31 31 2c 72  31 31 2c 23 32 0d 0b 68  |lt r11,r11,#2..h|
00001340  07 2e 6c 70 0d 0b 72 0f  63 6d 70 20 72 35 2c 23  |..lp..r.cmp r5,#|
00001350  31 32 38 0d 0b 7c 11 63  6d 70 6c 74 20 72 36 2c  |128..|.cmplt r6,|
00001360  23 31 32 38 0d 0b 86 15  6d 6f 76 67 65 20 72 35  |#128....movge r5|
00001370  2c 72 35 2c 6c 73 72 23  31 0d 0b 90 15 6d 6f 76  |,r5,lsr#1....mov|
00001380  67 65 20 72 36 2c 72 36  2c 6c 73 72 23 31 0d 0b  |ge r6,r6,lsr#1..|
00001390  9a 0a 62 67 65 20 6c 70  0d 0b a4 04 0d 0b ae 16  |..bge lp........|
000013a0  61 64 64 20 72 35 2c 72  35 2c 72 36 2c 6c 73 6c  |add r5,r5,r6,lsl|
000013b0  23 37 0d 0b b8 17 61 64  64 20 72 35 2c 72 31 32  |#7....add r5,r12|
000013c0  2c 72 35 2c 6c 73 6c 23  33 0d 0b c2 44 6c 64 6d  |,r5,lsl#3...Dldm|
000013d0  69 61 20 72 35 2c 7b 72  35 2c 72 36 7d 20 20 20  |ia r5,{r5,r6}   |
000013e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000013f0  20 20 20 20 20 3b 20 67  65 74 20 6e 6f 72 6d 61  |     ; get norma|
00001400  6c 69 73 65 64 20 76 65  63 74 6f 72 73 0d 0b cc  |lised vectors...|
00001410  04 0d 0b d6 11 6d 75 6c  20 72 35 2c 72 31 33 2c  |.....mul r5,r13,|
00001420  72 35 0d 0b e0 3f 6d 6c  61 20 72 35 2c 72 31 34  |r5...?mla r5,r14|
00001430  2c 72 36 2c 72 35 20 20  20 20 20 20 20 20 20 20  |,r6,r5          |
00001440  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00001450  6e 78 2a 6c 78 2b 6e 79  2a 6c 79 20 3c 3c 20 32  |nx*lx+ny*ly << 2|
00001460  35 0d 0b ea 3a 6d 6f 76  73 20 72 35 2c 72 35 2c  |5...:movs r5,r5,|
00001470  61 73 72 23 31 34 20 20  20 20 20 20 20 20 20 20  |asr#14          |
00001480  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 6e  |             ; n|
00001490  6f 72 6d 61 6c 20 2a 20  73 68 64 0d 0b f4 18 73  |ormal * shd....s|
000014a0  75 62 73 20 72 35 2c 72  35 2c 23 31 30 32 34 2b  |ubs r5,r5,#1024+|
000014b0  33 38 34 0d 0b fe 0f 6d  6f 76 6c 74 20 72 35 2c  |384....movlt r5,|
000014c0  23 30 0d 0c 08 0f 63 6d  70 20 72 35 2c 23 32 32  |#0....cmp r5,#22|
000014d0  33 0d 0c 12 11 6d 6f 76  67 74 20 72 35 2c 23 32  |3....movgt r5,#2|
000014e0  32 33 0d 0c 1c 13 73 74  72 20 72 35 2c 5b 72 31  |23....str r5,[r1|
000014f0  30 5d 2c 23 34 0d 0c 26  04 0d 0c 30 0d 6d 6f 76  |0],#4..&...0.mov|
00001500  20 72 35 2c 72 37 0d 0c  3a 0d 6d 6f 76 20 72 36  | r5,r7..:.mov r6|
00001510  2c 72 38 0d 0c 44 10 61  64 64 20 72 34 2c 72 34  |,r8..D.add r4,r4|
00001520  2c 23 31 0d 0c 4e 13 63  6d 70 20 72 34 2c 23 71  |,#1..N.cmp r4,#q|
00001530  5f 73 74 65 70 25 0d 0c  58 0e 62 6c 65 20 76 5f  |_step%..X.ble v_|
00001540  6c 6f 6f 70 0d 0c 62 10  61 64 64 20 72 31 2c 72  |loop..b.add r1,r|
00001550  31 2c 23 31 0d 0c 6c 13  63 6d 70 20 72 31 2c 23  |1,#1..l.cmp r1,#|
00001560  71 5f 73 74 65 70 25 0d  0c 76 0e 62 6c 65 20 75  |q_step%..v.ble u|
00001570  5f 6c 6f 6f 70 0d 0c 80  04 0d 0c 8a 12 6c 64 72  |_loop........ldr|
00001580  20 72 31 33 2c 73 74 61  63 6b 70 0d 0c 94 04 0d  | r13,stackp.....|
00001590  0c 9e 17 6c 64 72 20 72  33 2c 69 6e 64 65 78 5f  |...ldr r3,index_|
000015a0  6e 6f 72 6d 61 6c 0d 0c  a8 15 6c 64 72 20 72 36  |normal....ldr r6|
000015b0  2c 69 6e 64 65 78 5f 62  61 73 65 0d 0c b2 27 6d  |,index_base...'m|
000015c0  6f 76 20 72 30 2c 23 30  20 20 20 20 20 20 20 20  |ov r0,#0        |
000015d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000015e0  20 78 0d 0c bc 0a 2e 78  6c 6f 6f 70 0d 0c c6 27  | x.....xloop...'|
000015f0  6d 6f 76 20 72 31 2c 23  30 20 20 20 20 20 20 20  |mov r1,#0       |
00001600  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001610  3b 20 79 0d 0c d0 0a 2e  79 6c 6f 6f 70 0d 0c da  |; y.....yloop...|
00001620  3d 61 64 64 20 72 32 2c  72 30 2c 72 31 2c 6c 73  |=add r2,r0,r1,ls|
00001630  6c 23 34 20 20 20 20 20  20 20 20 20 20 20 20 20  |l#4             |
00001640  20 3b 20 78 2b 79 2a 71  5f 73 74 65 70 25 2c 20  | ; x+y*q_step%, |
00001650  71 5f 73 74 65 70 25 3d  31 36 0d 0c e4 34 61 64  |q_step%=16...4ad|
00001660  64 20 72 34 2c 72 33 2c  72 32 2c 6c 73 6c 23 32  |d r4,r3,r2,lsl#2|
00001670  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00001680  6e 6f 72 6d 61 6c 2b 6f  66 73 25 3c 3c 32 0d 0c  |normal+ofs%<<2..|
00001690  ee 04 0d 0c f8 28 6c 64  72 20 72 35 2c 5b 72 34  |.....(ldr r5,[r4|
000016a0  2c 23 34 5d 20 20 20 20  20 20 20 20 20 20 20 20  |,#4]            |
000016b0  20 20 20 20 20 20 3b 20  6c 31 0d 0d 02 0d 73 74  |      ; l1....st|
000016c0  72 20 72 35 2c 61 63 0d  0d 0c 04 0d 0d 16 28 6c  |r r5,ac.......(l|
000016d0  64 72 20 72 35 2c 5b 72  34 5d 20 20 20 20 20 20  |dr r5,[r4]      |
000016e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000016f0  20 6c 32 0d 0d 20 0d 73  74 72 20 72 35 2c 62 63  | l2.. .str r5,bc|
00001700  0d 0d 2a 04 0d 0d 34 28  6c 64 72 20 72 35 2c 5b  |..*...4(ldr r5,[|
00001710  72 34 2c 23 34 2b 31 36  2a 34 5d 20 20 20 20 20  |r4,#4+16*4]     |
00001720  20 20 20 20 20 20 20 20  3b 20 6c 33 0d 0d 3e 0d  |        ; l3..>.|
00001730  73 74 72 20 72 35 2c 63  63 0d 0d 48 04 0d 0d 52  |str r5,cc..H...R|
00001740  34 61 64 64 20 72 37 2c  72 36 2c 72 32 2c 6c 73  |4add r7,r6,r2,ls|
00001750  6c 23 33 20 20 20 20 20  20 20 20 20 20 20 20 20  |l#3             |
00001760  20 3b 20 6f 75 74 70 75  74 2b 6f 66 73 25 3c 3c  | ; output+ofs%<<|
00001770  33 0d 0d 5c 04 0d 0d 66  31 6c 64 6d 69 61 20 72  |3..\...f1ldmia r|
00001780  37 2c 7b 72 38 2c 72 39  2c 72 31 30 2c 72 31 31  |7,{r8,r9,r10,r11|
00001790  7d 20 20 20 20 20 20 20  20 3b 20 62 78 2c 62 79  |}        ; bx,by|
000017a0  2c 61 78 2c 61 79 0d 0d  70 0d 73 74 72 20 72 38  |,ax,ay..p.str r8|
000017b0  2c 62 78 0d 0d 7a 0d 73  74 72 20 72 39 2c 62 79  |,bx..z.str r9,by|
000017c0  0d 0d 84 0e 73 74 72 20  72 31 30 2c 61 78 0d 0d  |....str r10,ax..|
000017d0  8e 0e 73 74 72 20 72 31  31 2c 61 79 0d 0d 98 04  |..str r11,ay....|
000017e0  0d 0d a2 17 6c 64 72 20  72 38 2c 5b 72 37 2c 23  |....ldr r8,[r7,#|
000017f0  38 2b 31 36 2a 38 5d 0d  0d ac 0d 73 74 72 20 72  |8+16*8]....str r|
00001800  38 2c 63 78 0d 0d b6 04  0d 0d c0 18 6c 64 72 20  |8,cx........ldr |
00001810  72 38 2c 5b 72 37 2c 23  31 32 2b 31 36 2a 38 5d  |r8,[r7,#12+16*8]|
00001820  0d 0d ca 0d 73 74 72 20  72 38 2c 63 79 0d 0d d4  |....str r8,cy...|
00001830  04 0d 0d de 39 6d 6f 76  20 72 38 2c 72 30 2c 6c  |....9mov r8,r0,l|
00001840  73 6c 23 34 20 20 20 20  20 20 20 20 20 20 20 20  |sl#4            |
00001850  20 20 20 20 20 3b 20 78  2a 73 73 74 65 70 25 2c  |     ; x*sstep%,|
00001860  20 73 73 74 65 70 25 3d  31 36 0d 0d e8 0d 73 74  | sstep%=16....st|
00001870  72 20 72 38 2c 62 76 0d  0d f2 11 61 64 64 20 72  |r r8,bv....add r|
00001880  38 2c 72 38 2c 23 31 36  0d 0d fc 0d 73 74 72 20  |8,r8,#16....str |
00001890  72 38 2c 61 76 0d 0e 06  0d 73 74 72 20 72 38 2c  |r8,av....str r8,|
000018a0  63 76 0d 0e 10 04 0d 0e  1a 2e 6d 6f 76 20 72 38  |cv........mov r8|
000018b0  2c 72 31 2c 6c 73 6c 23  34 20 20 20 20 20 20 20  |,r1,lsl#4       |
000018c0  20 20 20 20 20 20 20 20  20 20 3b 20 79 2a 73 73  |          ; y*ss|
000018d0  74 65 70 25 0d 0e 24 0d  73 74 72 20 72 38 2c 61  |tep%..$.str r8,a|
000018e0  75 0d 0e 2e 0d 73 74 72  20 72 38 2c 62 75 0d 0e  |u....str r8,bu..|
000018f0  38 11 61 64 64 20 72 38  2c 72 38 2c 23 31 36 0d  |8.add r8,r8,#16.|
00001900  0e 42 0d 73 74 72 20 72  38 2c 63 75 0d 0e 4c 04  |.B.str r8,cu..L.|
00001910  0d 0e 56 22 73 74 6d 66  64 20 72 31 33 21 2c 7b  |..V"stmfd r13!,{|
00001920  72 30 2c 72 31 2c 72 33  2c 72 34 2c 72 36 2d 72  |r0,r1,r3,r4,r6-r|
00001930  38 7d 0d 0e 60 17 62 6c  20 74 65 78 74 75 72 65  |8}..`.bl texture|
00001940  5f 74 72 69 61 6e 67 6c  65 0d 0e 6a 22 6c 64 6d  |_triangle..j"ldm|
00001950  66 64 20 72 31 33 21 2c  7b 72 30 2c 72 31 2c 72  |fd r13!,{r0,r1,r|
00001960  33 2c 72 34 2c 72 36 2d  72 38 7d 0d 0e 74 04 0d  |3,r4,r6-r8}..t..|
00001970  0e 7e 0d 73 74 72 20 72  38 2c 61 75 0d 0e 88 28  |.~.str r8,au...(|
00001980  6c 64 72 20 72 38 2c 5b  72 34 2c 23 31 36 2a 34  |ldr r8,[r4,#16*4|
00001990  5d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |]               |
000019a0  3b 20 6c 34 0d 0e 92 0d  73 74 72 20 72 38 2c 61  |; l4....str r8,a|
000019b0  63 0d 0e 9c 13 6d 6f 76  20 72 38 2c 72 30 2c 6c  |c....mov r8,r0,l|
000019c0  73 6c 23 34 0d 0e a6 0d  73 74 72 20 72 38 2c 61  |sl#4....str r8,a|
000019d0  76 0d 0e b0 04 0d 0e ba  15 6c 64 72 20 72 38 2c  |v........ldr r8,|
000019e0  5b 72 37 2c 23 31 36 2a  38 5d 0d 0e c4 0d 73 74  |[r7,#16*8]....st|
000019f0  72 20 72 38 2c 61 78 0d  0e ce 17 6c 64 72 20 72  |r r8,ax....ldr r|
00001a00  38 2c 5b 72 37 2c 23 34  2b 31 36 2a 38 5d 0d 0e  |8,[r7,#4+16*8]..|
00001a10  d8 0d 73 74 72 20 72 38  2c 61 79 0d 0e e2 04 0d  |..str r8,ay.....|
00001a20  0e ec 1c 73 74 6d 66 64  20 72 31 33 21 2c 7b 72  |...stmfd r13!,{r|
00001a30  30 2c 72 31 2c 72 33 2c  72 36 7d 0d 0e f6 04 0d  |0,r1,r3,r6}.....|
00001a40  0f 00 0d 61 64 72 20 72  30 2c 62 79 0d 0f 0a 1d  |...adr r0,by....|
00001a50  6c 64 6d 69 61 20 72 30  2c 7b 72 31 2c 72 32 2c  |ldmia r0,{r1,r2,|
00001a60  72 33 2c 72 34 2c 72 35  7d 0d 0f 14 04 0d 0f 1e  |r3,r4,r5}.......|
00001a70  0d 61 64 72 20 72 36 2c  63 79 0d 0f 28 1f 6c 64  |.adr r6,cy..(.ld|
00001a80  6d 69 61 20 72 36 2c 7b  72 37 2c 72 38 2c 72 39  |mia r6,{r7,r8,r9|
00001a90  2c 72 31 30 2c 72 31 31  7d 0d 0f 32 04 0d 0f 3c  |,r10,r11}..2...<|
00001aa0  14 73 74 6d 69 61 20 72  36 2c 7b 72 31 2d 72 35  |.stmia r6,{r1-r5|
00001ab0  7d 0d 0f 46 15 73 74 6d  69 61 20 72 30 2c 7b 72  |}..F.stmia r0,{r|
00001ac0  37 2d 72 31 31 7d 0d 0f  50 04 0d 0f 5a 17 62 6c  |7-r11}..P...Z.bl|
00001ad0  20 74 65 78 74 75 72 65  5f 74 72 69 61 6e 67 6c  | texture_triangl|
00001ae0  65 0d 0f 64 1c 6c 64 6d  66 64 20 72 31 33 21 2c  |e..d.ldmfd r13!,|
00001af0  7b 72 30 2c 72 31 2c 72  33 2c 72 36 7d 0d 0f 6e  |{r0,r1,r3,r6}..n|
00001b00  04 0d 0f 78 10 61 64 64  20 72 31 2c 72 31 2c 23  |...x.add r1,r1,#|
00001b10  31 0d 0f 82 0e 63 6d 70  20 72 31 2c 23 31 34 0d  |1....cmp r1,#14.|
00001b20  0f 8c 0d 62 6c 65 20 79  6c 6f 6f 70 0d 0f 96 04  |...ble yloop....|
00001b30  0d 0f a0 10 61 64 64 20  72 30 2c 72 30 2c 23 31  |....add r0,r0,#1|
00001b40  0d 0f aa 0e 63 6d 70 20  72 30 2c 23 31 34 0d 0f  |....cmp r0,#14..|
00001b50  b4 0d 62 6c 65 20 78 6c  6f 6f 70 0d 0f be 04 0d  |..ble xloop.....|
00001b60  0f c8 14 6c 64 6d 66 64  20 72 31 33 21 2c 7b 72  |...ldmfd r13!,{r|
00001b70  31 35 7d 0d 0f d2 04 0d  0f dc 0c 2e 75 5f 63 6f  |15}.........u_co|
00001b80  75 6e 74 0d 0f e6 09 64  63 64 20 30 0d 0f f0 04  |unt....dcd 0....|
00001b90  0d 0f fa 0a 2e 75 5f 70  74 72 0d 10 04 09 64 63  |.....u_ptr....dc|
00001ba0  64 20 30 0d 10 0e 04 0d  10 18 08 2e 6c 5f 78 0d  |d 0.........l_x.|
00001bb0  10 22 0f 64 63 64 20 6c  78 2a 31 30 32 34 0d 10  |.".dcd lx*1024..|
00001bc0  2c 08 2e 6c 5f 79 0d 10  36 0f 64 63 64 20 6c 79  |,..l_y..6.dcd ly|
00001bd0  2a 31 30 32 34 0d 10 40  04 0d 10 4a 07 2e 69 6e  |*1024..@...J..in|
00001be0  0d 10 54 09 64 63 64 20  30 0d 10 5e 04 0d 10 68  |..T.dcd 0..^...h|
00001bf0  0b 2e 73 74 61 63 6b 70  0d 10 72 09 64 63 64 20  |..stackp..r.dcd |
00001c00  30 0d 10 7c 04 0d 10 86  0c 2e 70 5f 73 74 61 72  |0..|......p_star|
00001c10  74 0d 10 90 10 64 63 64  20 70 5f 74 61 62 6c 65  |t....dcd p_table|
00001c20  25 0d 10 9a 04 0d 10 a4  0f 2e 69 6e 64 65 78 5f  |%.........index_|
00001c30  62 61 73 65 0d 10 ae 0f  64 63 64 20 6f 75 74 70  |base....dcd outp|
00001c40  75 74 25 0d 10 b8 04 0d  10 c2 11 2e 69 6e 64 65  |ut%.........inde|
00001c50  78 5f 6e 6f 72 6d 61 6c  0d 10 cc 0f 64 63 64 20  |x_normal....dcd |
00001c60  6e 6f 72 6d 61 6c 25 0d  10 d6 04 0d 10 e0 0c 2e  |normal%.........|
00001c70  71 5f 73 74 61 72 74 0d  10 ea 05 5d 0d 10 f4 14  |q_start....]....|
00001c80  50 25 2b 3d 38 31 39 32  2f 71 5f 73 74 65 70 25  |P%+=8192/q_step%|
00001c90  0d 10 fe 0e 5b 4f 50 54  20 70 61 73 73 25 0d 11  |....[OPT pass%..|
00001ca0  08 0e 2e 64 69 76 5f 74  61 62 6c 65 0d 11 12 12  |...div_table....|
00001cb0  64 63 64 20 64 69 76 5f  74 61 62 6c 65 25 0d 11  |dcd div_table%..|
00001cc0  1c 04 0d 11 26 04 0d 11  30 0b 2e 73 74 61 63 6b  |....&...0..stack|
00001cd0  70 0d 11 3a 09 64 63 64  20 30 0d 11 44 09 2e 6c  |p..:.dcd 0..D..l|
00001ce0  69 6e 6b 0d 11 4e 09 64  63 64 20 30 0d 11 58 0e  |ink..N.dcd 0..X.|
00001cf0  2e 64 69 76 5f 74 61 62  6c 65 0d 11 62 12 64 63  |.div_table..b.dc|
00001d00  64 20 64 69 76 5f 74 61  62 6c 65 25 0d 11 6c 0d  |d div_table%..l.|
00001d10  2e 63 6f 6c 74 61 62 6c  65 0d 11 76 0f 64 63 64  |.coltable..v.dcd|
00001d20  20 63 6f 6c 74 61 62 25  0d 11 80 0c 2e 72 5f 69  | coltab%.....r_i|
00001d30  6e 64 65 78 0d 11 8a 09  64 63 64 20 30 0d 11 94  |ndex....dcd 0...|
00001d40  0c 2e 6c 5f 69 6e 64 65  78 0d 11 9e 09 64 63 64  |..l_index....dcd|
00001d50  20 30 0d 11 a8 04 0d 11  b2 0a 2e 79 5f 65 6e 64  | 0.........y_end|
00001d60  0d 11 bc 09 64 63 64 20  30 0d 11 c6 04 0d 11 d0  |....dcd 0.......|
00001d70  0b 2e 73 70 72 69 74 65  0d 11 da 12 64 63 64 20  |..sprite....dcd |
00001d80  73 70 72 69 74 65 25 2b  35 36 0d 11 e4 0e 2e 73  |sprite%+56.....s|
00001d90  63 72 65 65 6e 61 64 72  0d 11 ee 15 64 63 64 20  |creenadr....dcd |
00001da0  a4 73 63 72 65 65 6e 61  64 72 28 32 29 0d 11 f8  |.screenadr(2)...|
00001db0  15 64 63 64 20 a4 73 63  72 65 65 6e 61 64 72 28  |.dcd .screenadr(|
00001dc0  31 29 0d 12 02 04 0d 12  0c 17 2e 61 79 3a 64 63  |1).........ay:dc|
00001dd0  64 20 30 3a 2e 61 78 3a  64 63 64 20 30 0d 12 16  |d 0:.ax:dcd 0...|
00001de0  0d 2e 61 63 3a 64 63 64  20 30 0d 12 20 17 2e 61  |..ac:dcd 0.. ..a|
00001df0  75 3a 64 63 64 20 30 3a  2e 61 76 3a 64 63 64 20  |u:dcd 0:.av:dcd |
00001e00  30 0d 12 2a 15 64 63 64  20 30 3a 64 63 64 20 30  |0..*.dcd 0:dcd 0|
00001e10  3a 64 63 64 20 30 0d 12  34 04 0d 12 3e 17 2e 62  |:dcd 0..4...>..b|
00001e20  79 3a 64 63 64 20 30 3a  2e 62 78 3a 64 63 64 20  |y:dcd 0:.bx:dcd |
00001e30  30 0d 12 48 0d 2e 62 63  3a 64 63 64 20 30 0d 12  |0..H..bc:dcd 0..|
00001e40  52 17 2e 62 75 3a 64 63  64 20 30 3a 2e 62 76 3a  |R..bu:dcd 0:.bv:|
00001e50  64 63 64 20 30 0d 12 5c  15 64 63 64 20 30 3a 64  |dcd 0..\.dcd 0:d|
00001e60  63 64 20 30 3a 64 63 64  20 30 0d 12 66 04 0d 12  |cd 0:dcd 0..f...|
00001e70  70 17 2e 63 79 3a 64 63  64 20 30 3a 2e 63 78 3a  |p..cy:dcd 0:.cx:|
00001e80  64 63 64 20 30 0d 12 7a  0d 2e 63 63 3a 64 63 64  |dcd 0..z..cc:dcd|
00001e90  20 30 0d 12 84 17 2e 63  75 3a 64 63 64 20 30 3a  | 0.....cu:dcd 0:|
00001ea0  2e 63 76 3a 64 63 64 20  30 0d 12 8e 15 64 63 64  |.cv:dcd 0....dcd|
00001eb0  20 30 3a 64 63 64 20 30  3a 64 63 64 20 30 0d 12  | 0:dcd 0:dcd 0..|
00001ec0  98 04 0d 12 a2 15 2e 74  65 78 74 75 72 65 5f 74  |.......texture_t|
00001ed0  72 69 61 6e 67 6c 65 0d  12 ac 0d 61 64 72 20 72  |riangle....adr r|
00001ee0  30 2c 61 79 0d 12 b6 13  6c 64 72 20 72 31 30 2c  |0,ay....ldr r10,|
00001ef0  5b 72 30 2c 23 30 5d 0d  12 c0 14 6c 64 72 20 72  |[r0,#0]....ldr r|
00001f00  31 31 2c 5b 72 30 2c 23  33 32 5d 0d 12 ca 0f 63  |11,[r0,#32]....c|
00001f10  6d 70 20 72 31 31 2c 72  31 30 0d 12 d4 10 6d 6f  |mp r11,r10....mo|
00001f20  76 6c 74 20 72 31 2c 72  31 31 0d 12 de 10 6d 6f  |vlt r1,r11....mo|
00001f30  76 67 65 20 72 31 2c 72  31 30 0d 12 e8 0f 6d 6f  |vge r1,r10....mo|
00001f40  76 6c 74 20 72 32 2c 23  31 0d 12 f2 0f 6d 6f 76  |vlt r2,#1....mov|
00001f50  67 65 20 72 32 2c 23 30  0d 12 fc 14 6c 64 72 20  |ge r2,#0....ldr |
00001f60  72 31 32 2c 5b 72 30 2c  23 36 34 5d 0d 13 06 0e  |r12,[r0,#64]....|
00001f70  63 6d 70 20 72 31 32 2c  72 31 0d 13 10 10 6d 6f  |cmp r12,r1....mo|
00001f80  76 6c 74 20 72 31 2c 72  31 32 0d 13 1a 0f 6d 6f  |vlt r1,r12....mo|
00001f90  76 6c 74 20 72 32 2c 23  32 0d 13 24 0f 63 6d 70  |vlt r2,#2..$.cmp|
00001fa0  20 72 31 2c 23 35 31 32  0d 13 2e 10 6d 6f 76 67  | r1,#512....movg|
00001fb0  65 20 70 63 2c 72 31 34  0d 13 38 0e 63 6d 70 20  |e pc,r14..8.cmp |
00001fc0  72 31 30 2c 23 30 0d 13  42 10 63 6d 70 6c 74 20  |r10,#0..B.cmplt |
00001fd0  72 31 31 2c 23 30 0d 13  4c 10 63 6d 70 6c 74 20  |r11,#0..L.cmplt |
00001fe0  72 31 32 2c 23 30 0d 13  56 10 6d 6f 76 6c 74 20  |r12,#0..V.movlt |
00001ff0  70 63 2c 72 31 34 0d 13  60 04 0d 13 6a 12 73 74  |pc,r14..`...j.st|
00002000  72 20 72 31 33 2c 73 74  61 63 6b 70 0d 13 74 04  |r r13,stackp..t.|
00002010  0d 13 7e 11 73 75 62 73  20 72 33 2c 72 32 2c 23  |..~.subs r3,r2,#|
00002020  31 0d 13 88 0f 6d 6f 76  6c 74 20 72 33 2c 23 32  |1....movlt r3,#2|
00002030  0d 13 92 04 0d 13 9c 16  61 64 64 20 72 32 2c 72  |........add r2,r|
00002040  30 2c 72 32 2c 6c 73 6c  23 35 0d 13 a6 3d 6c 64  |0,r2,lsl#5...=ld|
00002050  6d 69 62 20 72 32 2c 7b  72 35 2c 72 36 2c 72 37  |mib r2,{r5,r6,r7|
00002060  2c 72 38 7d 20 20 20 20  20 20 20 20 20 20 20 20  |,r8}            |
00002070  20 20 20 20 20 20 3b 20  78 5f 6b 2c 63 5f 6b 2c  |      ; x_k,c_k,|
00002080  75 5f 6b 2c 76 5f 6b 0d  13 b0 16 61 64 64 20 72  |u_k,v_k....add r|
00002090  34 2c 72 30 2c 72 33 2c  6c 73 6c 23 35 0d 13 ba  |4,r0,r3,lsl#5...|
000020a0  12 73 74 72 20 72 34 2c  6c 5f 69 6e 64 65 78 0d  |.str r4,l_index.|
000020b0  13 c4 11 73 75 62 73 20  72 33 2c 72 33 2c 23 31  |...subs r3,r3,#1|
000020c0  0d 13 ce 0f 6d 6f 76 6c  74 20 72 33 2c 23 32 0d  |....movlt r3,#2.|
000020d0  13 d8 16 61 64 64 20 72  30 2c 72 30 2c 72 33 2c  |...add r0,r0,r3,|
000020e0  6c 73 6c 23 35 0d 13 e2  12 73 74 72 20 72 30 2c  |lsl#5....str r0,|
000020f0  72 5f 69 6e 64 65 78 0d  13 ec 41 6c 64 6d 69 61  |r_index...Aldmia|
00002100  20 72 34 2c 7b 72 39 2c  72 31 30 2c 72 31 31 2c  | r4,{r9,r10,r11,|
00002110  72 31 32 2c 72 31 33 7d  20 20 20 20 20 20 20 20  |r12,r13}        |
00002120  20 20 20 3b 20 79 5f 6c  2c 78 5f 6c 2c 63 5f 6c  |   ; y_l,x_l,c_l|
00002130  2c 75 5f 6c 2c 76 5f 6c  0d 13 f6 04 0d 14 00 10  |,u_l,v_l........|
00002140  73 74 72 20 72 31 34 2c  6c 69 6e 6b 0d 14 0a 15  |str r14,link....|
00002150  6c 64 72 20 72 31 34 2c  64 69 76 5f 74 61 62 6c  |ldr r14,div_tabl|
00002160  65 0d 14 14 31 73 75 62  73 20 72 32 2c 72 39 2c  |e...1subs r2,r9,|
00002170  72 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r1              |
00002180  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
00002190  6c 79 0d 14 1e 37 6c 64  72 67 74 20 72 32 2c 5b  |ly...7ldrgt r2,[|
000021a0  72 31 34 2c 72 32 2c 6c  73 6c 23 32 5d 20 20 20  |r14,r2,lsl#2]   |
000021b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000021c0  31 3c 3c 32 30 2f 64 6c  79 0d 14 28 04 0d 14 32  |1<<20/dly..(...2|
000021d0  16 6d 6f 76 67 74 20 72  33 2c 72 35 2c 6c 73 6c  |.movgt r3,r5,lsl|
000021e0  23 31 30 0d 14 3c 17 6d  6f 76 65 71 20 72 33 2c  |#10..<.moveq r3,|
000021f0  72 31 30 2c 6c 73 6c 23  31 30 0d 14 46 13 73 75  |r10,lsl#10..F.su|
00002200  62 67 74 20 72 34 2c 72  31 30 2c 72 35 0d 14 50  |bgt r4,r10,r5..P|
00002210  35 6d 75 6c 20 72 34 2c  72 32 2c 72 34 20 20 20  |5mul r4,r2,r4   |
00002220  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002230  20 20 20 20 20 20 20 20  20 3b 20 64 6c 78 3c 3c  |         ; dlx<<|
00002240  32 30 0d 14 5a 0e 73 74  72 20 72 34 2c 64 6c 78  |20..Z.str r4,dlx|
00002250  0d 14 64 04 0d 14 6e 17  6d 6f 76 67 74 20 72 31  |..d...n.movgt r1|
00002260  30 2c 72 36 2c 6c 73 6c  23 31 30 0d 14 78 18 6d  |0,r6,lsl#10..x.m|
00002270  6f 76 65 71 20 72 31 30  2c 72 31 31 2c 6c 73 6c  |oveq r10,r11,lsl|
00002280  23 31 30 0d 14 82 0e 73  74 72 20 72 31 30 2c 6c  |#10....str r10,l|
00002290  63 0d 14 8c 13 73 75 62  67 74 20 72 34 2c 72 31  |c....subgt r4,r1|
000022a0  31 2c 72 36 0d 14 96 35  6d 75 6c 20 72 34 2c 72  |1,r6...5mul r4,r|
000022b0  32 2c 72 34 20 20 20 20  20 20 20 20 20 20 20 20  |2,r4            |
000022c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000022d0  3b 20 64 6c 63 3c 3c 32  30 0d 14 a0 0e 73 74 72  |; dlc<<20....str|
000022e0  20 72 34 2c 64 6c 63 0d  14 aa 04 0d 14 b4 17 6d  | r4,dlc........m|
000022f0  6f 76 67 74 20 72 31 30  2c 72 37 2c 6c 73 6c 23  |ovgt r10,r7,lsl#|
00002300  31 30 0d 14 be 18 6d 6f  76 65 71 20 72 31 30 2c  |10....moveq r10,|
00002310  72 31 32 2c 6c 73 6c 23  31 30 0d 14 c8 0e 73 74  |r12,lsl#10....st|
00002320  72 20 72 31 30 2c 6c 75  0d 14 d2 13 73 75 62 67  |r r10,lu....subg|
00002330  74 20 72 34 2c 72 31 32  2c 72 37 0d 14 dc 35 6d  |t r4,r12,r7...5m|
00002340  75 6c 20 72 34 2c 72 32  2c 72 34 20 20 20 20 20  |ul r4,r2,r4     |
00002350  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002360  20 20 20 20 20 20 20 3b  20 64 6c 75 3c 3c 32 30  |       ; dlu<<20|
00002370  0d 14 e6 0e 73 74 72 20  72 34 2c 64 6c 75 0d 14  |....str r4,dlu..|
00002380  f0 04 0d 14 fa 17 6d 6f  76 67 74 20 72 31 30 2c  |......movgt r10,|
00002390  72 38 2c 6c 73 6c 23 31  30 0d 15 04 18 6d 6f 76  |r8,lsl#10....mov|
000023a0  65 71 20 72 31 30 2c 72  31 33 2c 6c 73 6c 23 31  |eq r10,r13,lsl#1|
000023b0  30 0d 15 0e 0e 73 74 72  20 72 31 30 2c 6c 76 0d  |0....str r10,lv.|
000023c0  15 18 13 73 75 62 67 74  20 72 34 2c 72 31 33 2c  |...subgt r4,r13,|
000023d0  72 38 0d 15 22 35 6d 75  6c 20 72 34 2c 72 32 2c  |r8.."5mul r4,r2,|
000023e0  72 34 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r4              |
000023f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00002400  64 6c 76 3c 3c 32 30 0d  15 2c 0e 73 74 72 20 72  |dlv<<20..,.str r|
00002410  34 2c 64 6c 76 0d 15 36  04 0d 15 40 41 6c 64 6d  |4,dlv..6...@Aldm|
00002420  69 61 20 72 30 2c 7b 72  30 2c 72 31 30 2c 72 31  |ia r0,{r0,r10,r1|
00002430  31 2c 72 31 32 2c 72 31  33 7d 20 20 20 20 20 20  |1,r12,r13}      |
00002440  20 20 20 20 20 3b 20 79  5f 72 2c 78 5f 72 2c 63  |     ; y_r,x_r,c|
00002450  5f 72 2c 75 5f 72 2c 76  5f 72 0d 15 4a 31 73 75  |_r,u_r,v_r..J1su|
00002460  62 73 20 72 32 2c 72 30  2c 72 31 20 20 20 20 20  |bs r2,r0,r1     |
00002470  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002480  20 20 20 20 20 20 3b 20  64 72 79 0d 15 54 37 6c  |      ; dry..T7l|
00002490  64 72 67 74 20 72 32 2c  5b 72 31 34 2c 72 32 2c  |drgt r2,[r14,r2,|
000024a0  6c 73 6c 23 32 5d 20 20  20 20 20 20 20 20 20 20  |lsl#2]          |
000024b0  20 20 20 20 20 20 20 3b  20 31 3c 3c 32 30 2f 64  |       ; 1<<20/d|
000024c0  72 79 0d 15 5e 04 0d 15  68 16 6d 6f 76 67 74 20  |ry..^...h.movgt |
000024d0  72 34 2c 72 35 2c 6c 73  6c 23 31 30 0d 15 72 17  |r4,r5,lsl#10..r.|
000024e0  6d 6f 76 65 71 20 72 34  2c 72 31 30 2c 6c 73 6c  |moveq r4,r10,lsl|
000024f0  23 31 30 0d 15 7c 14 73  75 62 67 74 20 72 31 30  |#10..|.subgt r10|
00002500  2c 72 31 30 2c 72 35 0d  15 86 35 6d 75 6c 20 72  |,r10,r5...5mul r|
00002510  31 30 2c 72 32 2c 72 31  30 20 20 20 20 20 20 20  |10,r2,r10       |
00002520  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002530  20 20 20 3b 20 64 72 78  3c 3c 32 30 0d 15 90 0f  |   ; drx<<20....|
00002540  73 74 72 20 72 31 30 2c  64 72 78 0d 15 9a 04 0d  |str r10,drx.....|
00002550  15 a4 17 6d 6f 76 67 74  20 72 31 30 2c 72 36 2c  |...movgt r10,r6,|
00002560  6c 73 6c 23 31 30 0d 15  ae 18 6d 6f 76 65 71 20  |lsl#10....moveq |
00002570  72 31 30 2c 72 31 31 2c  6c 73 6c 23 31 30 0d 15  |r10,r11,lsl#10..|
00002580  b8 0e 73 74 72 20 72 31  30 2c 72 63 0d 15 c2 14  |..str r10,rc....|
00002590  73 75 62 67 74 20 72 31  30 2c 72 31 31 2c 72 36  |subgt r10,r11,r6|
000025a0  0d 15 cc 35 6d 75 6c 20  72 31 30 2c 72 32 2c 72  |...5mul r10,r2,r|
000025b0  31 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |10              |
000025c0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 64 72  |            ; dr|
000025d0  63 3c 3c 32 30 0d 15 d6  0f 73 74 72 20 72 31 30  |c<<20....str r10|
000025e0  2c 64 72 63 0d 15 e0 04  0d 15 ea 17 6d 6f 76 67  |,drc........movg|
000025f0  74 20 72 31 30 2c 72 37  2c 6c 73 6c 23 31 30 0d  |t r10,r7,lsl#10.|
00002600  15 f4 18 6d 6f 76 65 71  20 72 31 30 2c 72 31 32  |...moveq r10,r12|
00002610  2c 6c 73 6c 23 31 30 0d  15 fe 0e 73 74 72 20 72  |,lsl#10....str r|
00002620  31 30 2c 72 75 0d 16 08  14 73 75 62 67 74 20 72  |10,ru....subgt r|
00002630  31 30 2c 72 31 32 2c 72  37 0d 16 12 35 6d 75 6c  |10,r12,r7...5mul|
00002640  20 72 31 30 2c 72 32 2c  72 31 30 20 20 20 20 20  | r10,r2,r10     |
00002650  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002660  20 20 20 20 20 3b 20 64  72 75 3c 3c 32 30 0d 16  |     ; dru<<20..|
00002670  1c 0f 73 74 72 20 72 31  30 2c 64 72 75 0d 16 26  |..str r10,dru..&|
00002680  04 0d 16 30 17 6d 6f 76  67 74 20 72 31 30 2c 72  |...0.movgt r10,r|
00002690  38 2c 6c 73 6c 23 31 30  0d 16 3a 18 6d 6f 76 65  |8,lsl#10..:.move|
000026a0  71 20 72 31 30 2c 72 31  33 2c 6c 73 6c 23 31 30  |q r10,r13,lsl#10|
000026b0  0d 16 44 0e 73 74 72 20  72 31 30 2c 72 76 0d 16  |..D.str r10,rv..|
000026c0  4e 14 73 75 62 67 74 20  72 31 30 2c 72 31 33 2c  |N.subgt r10,r13,|
000026d0  72 38 0d 16 58 35 6d 75  6c 20 72 31 30 2c 72 32  |r8..X5mul r10,r2|
000026e0  2c 72 31 30 20 20 20 20  20 20 20 20 20 20 20 20  |,r10            |
000026f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00002700  64 72 76 3c 3c 32 30 0d  16 62 0f 73 74 72 20 72  |drv<<20..b.str r|
00002710  31 30 2c 64 72 76 0d 16  6c 04 0d 16 76 14 6c 64  |10,drv..l...v.ld|
00002720  72 20 72 32 2c 73 63 72  65 65 6e 61 64 72 0d 16  |r r2,screenadr..|
00002730  80 16 61 64 64 20 72 32  2c 72 32 2c 72 31 2c 6c  |..add r2,r2,r1,l|
00002740  73 6c 23 37 0d 16 8a 39  61 64 64 20 72 32 2c 72  |sl#7...9add r2,r|
00002750  32 2c 72 31 2c 6c 73 6c  23 39 20 20 20 20 20 20  |2,r1,lsl#9      |
00002760  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002770  3b 20 73 63 72 65 65 6e  20 6c 69 6e 65 0d 16 94  |; screen line...|
00002780  04 0d 16 9e 0e 4d 4f 56  20 52 31 34 2c 52 31 0d  |.....MOV R14,R1.|
00002790  16 a8 12 6c 64 72 20 72  31 30 2c 73 70 72 69 74  |...ldr r10,sprit|
000027a0  65 0d 16 b2 04 0d 16 bc  0d 63 6d 70 20 72 39 2c  |e........cmp r9,|
000027b0  72 30 0d 16 c6 12 73 74  72 6c 74 20 72 39 2c 79  |r0....strlt r9,y|
000027c0  5f 65 6e 64 0d 16 d0 12  73 74 72 67 65 20 72 30  |_end....strge r0|
000027d0  2c 79 5f 65 6e 64 0d 16  da 04 0d 16 e4 10 62 67  |,y_end........bg|
000027e0  74 20 6d 65 74 68 6f 64  5f 32 0d 16 ee 10 62 65  |t method_2....be|
000027f0  71 20 6c 61 73 74 5f 62  69 74 0d 16 f8 04 0d 17  |q last_bit......|
00002800  02 3c 2e 6d 65 74 68 6f  64 5f 31 20 20 20 20 20  |.<.method_1     |
00002810  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002820  20 20 20 20 20 20 20 20  20 20 3b 20 6c 65 66 74  |          ; left|
00002830  5f 79 3c 72 69 67 68 74  5f 79 0d 17 0c 04 0d 17  |_y<right_y......|
00002840  16 0a a4 79 6c 6f 6f 70  0d 17 20 04 0d 17 2a 0e  |...yloop.. ...*.|
00002850  3b 20 72 30 20 3d 20 79  5f 6c 0d 17 34 11 3b 20  |; r0 = y_l..4.; |
00002860  72 32 20 3d 20 73 63 6c  69 6e 65 0d 17 3e 0d 3b  |r2 = scline..>.;|
00002870  20 72 33 20 3d 20 6c 78  0d 17 48 0d 3b 20 72 34  | r3 = lx..H.; r4|
00002880  20 3d 20 72 78 0d 17 52  17 3b 20 72 31 2c 72 35  | = rx..R.; r1,r5|
00002890  2d 72 31 34 20 3d 20 65  6d 70 74 79 0d 17 5c 04  |-r14 = empty..\.|
000028a0  0d 17 66 20 3b 20 72 65  63 61 6c 63 75 61 74 65  |..f ; recalcuate|
000028b0  20 64 6c 78 2c 64 6c 75  2c 64 6c 76 2c 64 6c 63  | dlx,dlu,dlv,dlc|
000028c0  0d 17 70 12 6c 64 72 20  72 31 2c 6c 5f 69 6e 64  |..p.ldr r1,l_ind|
000028d0  65 78 0d 17 7a 3d 6c 64  6d 69 62 20 72 31 2c 7b  |ex..z=ldmib r1,{|
000028e0  72 33 2c 72 31 30 2c 72  31 31 2c 72 31 32 7d 20  |r3,r10,r11,r12} |
000028f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00002900  78 5f 6c 2c 63 5f 6c 2c  75 5f 6c 2c 76 5f 6c 0d  |x_l,c_l,u_l,v_l.|
00002910  17 84 12 6c 64 72 20 72  31 2c 72 5f 69 6e 64 65  |...ldr r1,r_inde|
00002920  78 0d 17 8e 41 6c 64 6d  69 61 20 72 31 2c 7b 72  |x...Aldmia r1,{r|
00002930  31 2c 72 35 2c 72 36 2c  72 37 2c 72 38 7d 20 20  |1,r5,r6,r7,r8}  |
00002940  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 79  |             ; y|
00002950  5f 72 2c 78 5f 72 2c 63  5f 72 2c 75 5f 72 2c 76  |_r,x_r,c_r,u_r,v|
00002960  5f 72 0d 17 98 10 73 74  72 20 72 31 2c 79 5f 65  |_r....str r1,y_e|
00002970  6e 64 0d 17 a2 04 0d 17  ac 31 73 75 62 73 20 72  |nd.......1subs r|
00002980  31 2c 72 31 2c 72 30 20  20 20 20 20 20 20 20 20  |1,r1,r0         |
00002990  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000029a0  20 20 3b 20 64 6c 79 0d  17 b6 15 6c 64 72 20 72  |  ; dly....ldr r|
000029b0  31 34 2c 64 69 76 5f 74  61 62 6c 65 0d 17 c0 04  |14,div_table....|
000029c0  0d 17 ca 37 6c 64 72 67  74 20 72 31 2c 5b 72 31  |...7ldrgt r1,[r1|
000029d0  34 2c 72 31 2c 6c 73 6c  23 32 5d 20 20 20 20 20  |4,r1,lsl#2]     |
000029e0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 31 3c  |            ; 1<|
000029f0  3c 32 30 2f 64 6c 79 0d  17 d4 13 73 75 62 67 74  |<20/dly....subgt|
00002a00  20 72 37 2c 72 37 2c 72  31 31 0d 17 de 35 6d 75  | r7,r7,r11...5mu|
00002a10  6c 20 72 37 2c 72 31 2c  72 37 20 20 20 20 20 20  |l r7,r1,r7      |
00002a20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002a30  20 20 20 20 20 20 3b 20  64 6c 75 3c 3c 32 30 0d  |      ; dlu<<20.|
00002a40  17 e8 0e 73 74 72 20 72  37 2c 64 6c 75 0d 17 f2  |...str r7,dlu...|
00002a50  12 73 75 62 67 74 20 72  35 2c 72 35 2c 72 33 0d  |.subgt r5,r5,r3.|
00002a60  17 fc 14 6d 6f 76 20 72  33 2c 72 33 2c 6c 73 6c  |...mov r3,r3,lsl|
00002a70  23 31 30 0d 18 06 35 6d  75 6c 20 72 35 2c 72 31  |#10...5mul r5,r1|
00002a80  2c 72 35 20 20 20 20 20  20 20 20 20 20 20 20 20  |,r5             |
00002a90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00002aa0  20 64 6c 78 3c 3c 32 30  0d 18 10 0e 73 74 72 20  | dlx<<20....str |
00002ab0  72 35 2c 64 6c 78 0d 18  1a 13 73 75 62 67 74 20  |r5,dlx....subgt |
00002ac0  72 35 2c 72 36 2c 72 31  30 0d 18 24 35 6d 75 6c  |r5,r6,r10..$5mul|
00002ad0  20 72 35 2c 72 31 2c 72  35 20 20 20 20 20 20 20  | r5,r1,r5       |
00002ae0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002af0  20 20 20 20 20 3b 20 64  6c 63 3c 3c 32 30 0d 18  |     ; dlc<<20..|
00002b00  2e 0e 73 74 72 20 72 35  2c 64 6c 63 0d 18 38 04  |..str r5,dlc..8.|
00002b10  0d 18 42 13 73 75 62 67  74 20 72 35 2c 72 38 2c  |..B.subgt r5,r8,|
00002b20  72 31 32 0d 18 4c 35 6d  75 6c 20 72 35 2c 72 31  |r12..L5mul r5,r1|
00002b30  2c 72 35 20 20 20 20 20  20 20 20 20 20 20 20 20  |,r5             |
00002b40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00002b50  20 64 6c 76 3c 3c 32 30  0d 18 56 0e 73 74 72 20  | dlv<<20..V.str |
00002b60  72 35 2c 64 6c 76 0d 18  60 04 0d 18 6a 12 6c 64  |r5,dlv..`...j.ld|
00002b70  72 20 72 31 30 2c 73 70  72 69 74 65 0d 18 74 04  |r r10,sprite..t.|
00002b80  0d 18 7e 0e 4d 4f 56 20  52 31 34 2c 52 30 0d 18  |..~.MOV R14,R0..|
00002b90  88 0d 2e 6c 61 73 74 5f  62 69 74 0d 18 92 0a a4  |...last_bit.....|
00002ba0  79 6c 6f 6f 70 0d 18 9c  04 0d 18 a6 12 6c 64 72  |yloop........ldr|
00002bb0  20 72 31 33 2c 73 74 61  63 6b 70 0d 18 b0 10 6c  | r13,stackp....l|
00002bc0  64 72 20 72 31 35 2c 6c  69 6e 6b 0d 18 ba 04 0d  |dr r15,link.....|
00002bd0  18 c4 04 0d 18 ce 3d 2e  6d 65 74 68 6f 64 5f 32  |......=.method_2|
00002be0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002bf0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00002c00  20 72 69 67 68 74 5f 79  3c 20 6c 65 66 74 5f 79  | right_y< left_y|
00002c10  0d 18 d8 0a a4 79 6c 6f  6f 70 0d 18 e2 04 0d 18  |.....yloop......|
00002c20  ec 0e 3b 20 72 30 20 3d  20 79 5f 6c 0d 18 f6 11  |..; r0 = y_l....|
00002c30  3b 20 72 32 20 3d 20 73  63 6c 69 6e 65 0d 19 00  |; r2 = scline...|
00002c40  0d 3b 20 72 33 20 3d 20  6c 78 0d 19 0a 0d 3b 20  |.; r3 = lx....; |
00002c50  72 34 20 3d 20 72 78 0d  19 14 17 3b 20 72 31 2c  |r4 = rx....; r1,|
00002c60  72 35 2d 72 31 34 20 3d  20 65 6d 70 74 79 0d 19  |r5-r14 = empty..|
00002c70  1e 04 0d 19 28 20 3b 20  72 65 63 61 6c 63 75 61  |....( ; recalcua|
00002c80  74 65 20 64 72 78 2c 64  72 75 2c 64 72 76 2c 64  |te drx,dru,drv,d|
00002c90  72 63 0d 19 32 12 6c 64  72 20 72 31 2c 72 5f 69  |rc..2.ldr r1,r_i|
00002ca0  6e 64 65 78 0d 19 3c 3d  6c 64 6d 69 62 20 72 31  |ndex..<=ldmib r1|
00002cb0  2c 7b 72 34 2c 72 31 30  2c 72 31 31 2c 72 31 32  |,{r4,r10,r11,r12|
00002cc0  7d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |}               |
00002cd0  3b 20 78 5f 72 2c 63 5f  72 2c 75 5f 72 2c 76 5f  |; x_r,c_r,u_r,v_|
00002ce0  72 0d 19 46 12 6c 64 72  20 72 31 2c 6c 5f 69 6e  |r..F.ldr r1,l_in|
00002cf0  64 65 78 0d 19 50 41 6c  64 6d 69 61 20 72 31 2c  |dex..PAldmia r1,|
00002d00  7b 72 31 2c 72 35 2c 72  36 2c 72 37 2c 72 38 7d  |{r1,r5,r6,r7,r8}|
00002d10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00002d20  20 79 5f 6c 2c 78 5f 6c  2c 63 5f 6c 2c 75 5f 6c  | y_l,x_l,c_l,u_l|
00002d30  2c 76 5f 6c 0d 19 5a 10  73 74 72 20 72 31 2c 79  |,v_l..Z.str r1,y|
00002d40  5f 65 6e 64 0d 19 64 04  0d 19 6e 31 73 75 62 73  |_end..d...n1subs|
00002d50  20 72 31 2c 72 31 2c 72  30 20 20 20 20 20 20 20  | r1,r1,r0       |
00002d60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002d70  20 20 20 20 3b 20 64 6c  79 0d 19 78 15 6c 64 72  |    ; dly..x.ldr|
00002d80  20 72 31 34 2c 64 69 76  5f 74 61 62 6c 65 0d 19  | r14,div_table..|
00002d90  82 04 0d 19 8c 37 6c 64  72 67 74 20 72 31 2c 5b  |.....7ldrgt r1,[|
00002da0  72 31 34 2c 72 31 2c 6c  73 6c 23 32 5d 20 20 20  |r14,r1,lsl#2]   |
00002db0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00002dc0  31 3c 3c 32 30 2f 64 6c  79 0d 19 96 12 73 75 62  |1<<20/dly....sub|
00002dd0  67 74 20 72 35 2c 72 35  2c 72 34 0d 19 a0 14 6d  |gt r5,r5,r4....m|
00002de0  6f 76 20 72 34 2c 72 34  2c 6c 73 6c 23 31 30 0d  |ov r4,r4,lsl#10.|
00002df0  19 aa 35 6d 75 6c 20 72  35 2c 72 31 2c 72 35 20  |..5mul r5,r1,r5 |
00002e00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002e10  20 20 20 20 20 20 20 20  20 20 20 3b 20 64 6c 78  |           ; dlx|
00002e20  3c 3c 32 30 0d 19 b4 0e  73 74 72 20 72 35 2c 64  |<<20....str r5,d|
00002e30  72 78 0d 19 be 13 73 75  62 67 74 20 72 35 2c 72  |rx....subgt r5,r|
00002e40  36 2c 72 31 30 0d 19 c8  35 6d 75 6c 20 72 35 2c  |6,r10...5mul r5,|
00002e50  72 31 2c 72 35 20 20 20  20 20 20 20 20 20 20 20  |r1,r5           |
00002e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002e70  20 3b 20 64 6c 63 3c 3c  32 30 0d 19 d2 0e 73 74  | ; dlc<<20....st|
00002e80  72 20 72 35 2c 64 72 63  0d 19 dc 13 73 75 62 67  |r r5,drc....subg|
00002e90  74 20 72 35 2c 72 37 2c  72 31 31 0d 19 e6 35 6d  |t r5,r7,r11...5m|
00002ea0  75 6c 20 72 35 2c 72 31  2c 72 35 20 20 20 20 20  |ul r5,r1,r5     |
00002eb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002ec0  20 20 20 20 20 20 20 3b  20 64 6c 75 3c 3c 32 30  |       ; dlu<<20|
00002ed0  0d 19 f0 0e 73 74 72 20  72 35 2c 64 72 75 0d 19  |....str r5,dru..|
00002ee0  fa 13 73 75 62 67 74 20  72 35 2c 72 38 2c 72 31  |..subgt r5,r8,r1|
00002ef0  32 0d 1a 04 35 6d 75 6c  20 72 35 2c 72 31 2c 72  |2...5mul r5,r1,r|
00002f00  35 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |5               |
00002f10  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
00002f20  6c 76 3c 3c 32 30 0d 1a  0e 0e 73 74 72 20 72 35  |lv<<20....str r5|
00002f30  2c 64 72 76 0d 1a 18 04  0d 1a 22 12 6c 64 72 20  |,drv......".ldr |
00002f40  72 31 30 2c 73 70 72 69  74 65 0d 1a 2c 0e 4d 4f  |r10,sprite..,.MO|
00002f50  56 20 52 31 34 2c 52 30  0d 1a 36 0a a4 79 6c 6f  |V R14,R0..6..ylo|
00002f60  6f 70 0d 1a 40 04 0d 1a  4a 12 6c 64 72 20 72 31  |op..@...J.ldr r1|
00002f70  33 2c 73 74 61 63 6b 70  0d 1a 54 10 6c 64 72 20  |3,stackp..T.ldr |
00002f80  72 31 35 2c 6c 69 6e 6b  0d 1a 5e 04 0d 1a 68 09  |r15,link..^...h.|
00002f90  2e 6c 69 6e 65 0d 1a 72  09 64 63 64 20 30 0d 1a  |.line..r.dcd 0..|
00002fa0  7c 04 0d 1a 86 0b 2e 63  6f 6f 72 64 73 0d 1a 90  ||......coords...|
00002fb0  17 2e 6c 75 3a 64 63 64  20 30 3a 2e 72 75 3a 64  |..lu:dcd 0:.ru:d|
00002fc0  63 64 20 30 0d 1a 9a 17  2e 6c 63 3a 64 63 64 20  |cd 0.....lc:dcd |
00002fd0  30 3a 2e 72 63 3a 64 63  64 20 30 0d 1a a4 17 2e  |0:.rc:dcd 0.....|
00002fe0  6c 76 3a 64 63 64 20 30  3a 2e 72 76 3a 64 63 64  |lv:dcd 0:.rv:dcd|
00002ff0  20 30 0d 1a ae 19 2e 64  6c 78 3a 64 63 64 20 30  | 0.....dlx:dcd 0|
00003000  3a 2e 64 72 78 3a 64 63  64 20 30 0d 1a b8 19 2e  |:.drx:dcd 0.....|
00003010  64 6c 63 3a 64 63 64 20  30 3a 2e 64 72 63 3a 64  |dlc:dcd 0:.drc:d|
00003020  63 64 20 30 0d 1a c2 19  2e 64 6c 75 3a 64 63 64  |cd 0.....dlu:dcd|
00003030  20 30 3a 2e 64 72 75 3a  64 63 64 20 30 0d 1a cc  | 0:.dru:dcd 0...|
00003040  19 2e 64 6c 76 3a 64 63  64 20 30 3a 2e 64 72 76  |..dlv:dcd 0:.drv|
00003050  3a 64 63 64 20 30 0d 1a  d6 04 0d 1a e0 05 5d 0d  |:dcd 0........].|
00003060  1a ea 05 ed 0d 1a f4 1f  70 25 3d 71 5f 73 74 61  |........p%=q_sta|
00003070  72 74 3a 73 74 70 3d 31  30 32 34 2f 71 5f 73 74  |rt:stp=1024/q_st|
00003080  65 70 25 0d 1a fe 16 e3  6e 25 3d 30 20 b8 20 31  |ep%.....n%=0 . 1|
00003090  30 32 34 20 88 20 73 74  70 0d 1b 08 31 71 6e 25  |024 . stp...1qn%|
000030a0  3d 31 30 32 34 2d 6e 25  3a 71 73 25 3d 28 71 6e  |=1024-n%:qs%=(qn|
000030b0  25 2a 71 6e 25 29 3e 3e  31 30 3a 6e 73 25 3d 28  |%*qn%)>>10:ns%=(|
000030c0  6e 25 2a 6e 25 29 3e 3e  31 30 0d 1b 12 0f 21 70  |n%*n%)>>10....!p|
000030d0  25 3d 71 73 25 2a 71 6e  25 0d 1b 1c 11 70 25 21  |%=qs%*qn%....p%!|
000030e0  34 3d 33 2a 71 73 25 2a  6e 25 0d 1b 26 12 70 25  |4=3*qs%*n%..&.p%|
000030f0  21 38 3d 33 2a 6e 73 25  2a 71 6e 25 0d 1b 30 10  |!8=3*ns%*qn%..0.|
00003100  70 25 21 31 32 3d 6e 73  25 2a 6e 25 0d 1b 3a 0a  |p%!12=ns%*n%..:.|
00003110  70 25 2b 3d 31 36 0d 1b  44 05 ed 0d 1b 4e 24 c8  |p%+=16..D....N$.|
00003120  99 22 4f 53 5f 46 69 6c  65 22 2c 31 36 2c 22 50  |."OS_File",16,"P|
00003130  69 63 74 75 72 65 22 2c  73 70 72 69 74 65 25 0d  |icture",sprite%.|
00003140  1b 58 23 c8 99 22 4f 53  5f 46 69 6c 65 22 2c 31  |.X#.."OS_File",1|
00003150  36 2c 22 43 6f 6c 54 61  62 22 2c 63 6f 6c 74 61  |6,"ColTab",colta|
00003160  62 25 0d 1b 62 05 e1 0d  1b 6c 05 3a 0d 1b 76 0b  |b%..b....l.:..v.|
00003170  dd a4 79 6c 6f 6f 70 0d  1b 80 0e 5b 4f 50 54 20  |..yloop....[OPT |
00003180  70 61 73 73 25 0d 1b 8a  0d 3b 20 72 32 20 3d 20  |pass%....; r2 = |
00003190  73 63 0d 1b 94 0d 3b 20  72 33 20 3d 20 6c 78 0d  |sc....; r3 = lx.|
000031a0  1b 9e 0d 3b 20 72 34 20  3d 20 72 78 0d 1b a8 0f  |...; r4 = rx....|
000031b0  3b 20 72 31 34 20 3d 20  79 5f 6b 0d 1b b2 04 0d  |; r14 = y_k.....|
000031c0  1b bc 0a 2e 79 6c 6f 6f  70 0d 1b c6 2c 73 75 62  |....yloop...,sub|
000031d0  73 20 72 30 2c 72 34 2c  72 33 20 20 20 20 20 20  |s r0,r4,r3      |
000031e0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
000031f0  78 3c 3c 31 30 0d 1b d0  2e 61 64 64 20 72 31 32  |x<<10....add r12|
00003200  2c 72 32 2c 72 33 2c 61  73 72 23 31 30 20 20 20  |,r2,r3,asr#10   |
00003210  20 20 20 20 20 20 20 20  20 3b 20 6c 65 66 74 20  |         ; left |
00003220  61 64 72 0d 1b da 0f 6c  64 72 20 72 31 33 2c 64  |adr....ldr r13,d|
00003230  6c 78 0d 1b e4 2d 61 64  64 20 72 33 2c 72 33 2c  |lx...-add r3,r3,|
00003240  72 31 33 2c 61 73 72 23  31 30 20 20 20 20 20 20  |r13,asr#10      |
00003250  20 20 20 20 20 20 3b 20  6c 78 2b 3d 64 6c 78 0d  |      ; lx+=dlx.|
00003260  1b ee 0f 6c 64 72 20 72  31 31 2c 64 72 78 0d 1b  |...ldr r11,drx..|
00003270  f8 2f 61 64 64 20 72 31  33 2c 72 32 2c 72 34 2c  |./add r13,r2,r4,|
00003280  61 73 72 23 31 30 20 20  20 20 20 20 20 20 20 20  |asr#10          |
00003290  20 20 3b 20 72 69 67 68  74 20 61 64 72 0d 1c 02  |  ; right adr...|
000032a0  2d 61 64 64 20 72 34 2c  72 34 2c 72 31 31 2c 61  |-add r4,r4,r11,a|
000032b0  73 72 23 31 30 20 20 20  20 20 20 20 20 20 20 20  |sr#10           |
000032c0  20 3b 20 72 78 2b 3d 64  72 78 0d 1c 0c 15 6c 64  | ; rx+=drx....ld|
000032d0  72 20 72 31 31 2c 64 69  76 5f 74 61 62 6c 65 0d  |r r11,div_table.|
000032e0  1c 16 13 6d 6f 76 20 72  30 2c 72 30 2c 61 73 72  |...mov r0,r0,asr|
000032f0  23 34 0d 1c 20 2e 6c 64  72 67 74 20 72 30 2c 5b  |#4.. .ldrgt r0,[|
00003300  72 31 31 2c 72 30 2c 6c  73 6c 23 32 5d 20 20 20  |r11,r0,lsl#2]   |
00003310  20 20 20 20 20 20 3b 20  31 3c 3c 31 38 2f 64 78  |      ; 1<<18/dx|
00003320  0d 1c 2a 0e 6c 64 72 20  72 31 31 2c 6c 63 0d 1c  |..*.ldr r11,lc..|
00003330  34 0d 6c 64 72 20 72 39  2c 72 63 0d 1c 3e 2c 73  |4.ldr r9,rc..>,s|
00003340  75 62 20 72 35 2c 72 39  2c 72 31 31 20 20 20 20  |ub r5,r9,r11    |
00003350  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003360  20 64 63 3c 3c 31 30 0d  1c 48 2c 6d 75 6c 20 72  | dc<<10..H,mul r|
00003370  35 2c 72 30 2c 72 35 20  20 20 20 20 20 20 20 20  |5,r0,r5         |
00003380  20 20 20 20 20 20 20 20  20 20 20 3b 20 64 63 3c  |           ; dc<|
00003390  3c 33 30 0d 1c 52 0e 6c  64 72 20 72 38 2c 64 72  |<30..R.ldr r8,dr|
000033a0  63 0d 1c 5c 17 61 64 64  20 72 39 2c 72 39 2c 72  |c..\.add r9,r9,r|
000033b0  38 2c 61 73 72 23 31 30  0d 1c 66 0d 73 74 72 20  |8,asr#10..f.str |
000033c0  72 39 2c 72 63 0d 1c 70  0e 6c 64 72 20 72 38 2c  |r9,rc..p.ldr r8,|
000033d0  64 6c 63 0d 1c 7a 18 61  64 64 20 72 39 2c 72 31  |dlc..z.add r9,r1|
000033e0  31 2c 72 38 2c 61 73 72  23 31 30 0d 1c 84 0d 73  |1,r8,asr#10....s|
000033f0  74 72 20 72 39 2c 6c 63  0d 1c 8e 0d 6c 64 72 20  |tr r9,lc....ldr |
00003400  72 39 2c 6c 75 0d 1c 98  0d 6c 64 72 20 72 38 2c  |r9,lu....ldr r8,|
00003410  72 75 0d 1c a2 04 0d 1c  ac 2c 73 75 62 20 72 36  |ru.......,sub r6|
00003420  2c 72 38 2c 72 39 20 20  20 20 20 20 20 20 20 20  |,r8,r9          |
00003430  20 20 20 20 20 20 20 20  20 20 3b 20 64 75 3c 3c  |          ; du<<|
00003440  31 30 0d 1c b6 2c 6d 75  6c 20 72 36 2c 72 30 2c  |10...,mul r6,r0,|
00003450  72 36 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r6              |
00003460  20 20 20 20 20 20 3b 20  64 75 3c 3c 32 34 0d 1c  |      ; du<<24..|
00003470  c0 04 0d 1c ca 0e 6c 64  72 20 72 37 2c 64 72 75  |......ldr r7,dru|
00003480  0d 1c d4 17 61 64 64 20  72 38 2c 72 38 2c 72 37  |....add r8,r8,r7|
00003490  2c 61 73 72 23 31 30 0d  1c de 0d 73 74 72 20 72  |,asr#10....str r|
000034a0  38 2c 72 75 0d 1c e8 04  0d 1c f2 0e 6c 64 72 20  |8,ru........ldr |
000034b0  72 37 2c 64 6c 75 0d 1c  fc 17 61 64 64 20 72 38  |r7,dlu....add r8|
000034c0  2c 72 39 2c 72 37 2c 61  73 72 23 31 30 0d 1d 06  |,r9,r7,asr#10...|
000034d0  0d 73 74 72 20 72 38 2c  6c 75 0d 1d 10 04 0d 1d  |.str r8,lu......|
000034e0  1a 0d 6c 64 72 20 72 38  2c 6c 76 0d 1d 24 0d 6c  |..ldr r8,lv..$.l|
000034f0  64 72 20 72 31 2c 72 76  0d 1d 2e 2c 73 75 62 20  |dr r1,rv...,sub |
00003500  72 37 2c 72 31 2c 72 38  20 20 20 20 20 20 20 20  |r7,r1,r8        |
00003510  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 64 76  |            ; dv|
00003520  3c 3c 31 30 0d 1d 38 2c  6d 75 6c 20 72 37 2c 72  |<<10..8,mul r7,r|
00003530  30 2c 72 37 20 20 20 20  20 20 20 20 20 20 20 20  |0,r7            |
00003540  20 20 20 20 20 20 20 20  3b 20 64 76 3c 3c 32 31  |        ; dv<<21|
00003550  0d 1d 42 0e 6c 64 72 20  72 30 2c 64 72 76 0d 1d  |..B.ldr r0,drv..|
00003560  4c 17 61 64 64 20 72 31  2c 72 31 2c 72 30 2c 61  |L.add r1,r1,r0,a|
00003570  73 72 23 31 30 0d 1d 56  0d 73 74 72 20 72 31 2c  |sr#10..V.str r1,|
00003580  72 76 0d 1d 60 0e 6c 64  72 20 72 30 2c 64 6c 76  |rv..`.ldr r0,dlv|
00003590  0d 1d 6a 17 61 64 64 20  72 30 2c 72 38 2c 72 30  |..j.add r0,r8,r0|
000035a0  2c 61 73 72 23 31 30 0d  1d 74 0d 73 74 72 20 72  |,asr#10..t.str r|
000035b0  30 2c 6c 76 0d 1d 7e 12  61 64 64 20 72 32 2c 72  |0,lv..~.add r2,r|
000035c0  32 2c 23 36 34 30 0d 1d  88 0f 73 74 72 20 72 32  |2,#640....str r2|
000035d0  2c 6c 69 6e 65 0d 1d 92  04 0d 1d 9c 14 6d 6f 76  |,line........mov|
000035e0  20 72 39 2c 72 39 2c 6c  73 6c 23 31 34 0d 1d a6  | r9,r9,lsl#14...|
000035f0  14 6d 6f 76 20 72 38 2c  72 38 2c 6c 73 6c 23 31  |.mov r8,r8,lsl#1|
00003600  34 0d 1d b0 16 6d 6f 76  20 72 31 31 2c 72 31 31  |4....mov r11,r11|
00003610  2c 6c 73 6c 23 31 34 0d  1d ba 04 0d 1d c4 0d 3b  |,lsl#14........;|
00003620  20 64 63 20 3d 20 72 35  0d 1d ce 0d 3b 20 64 75  | dc = r5....; du|
00003630  20 3d 20 72 36 0d 1d d8  0d 3b 20 64 76 20 3d 20  | = r6....; dv = |
00003640  72 37 0d 1d e2 0c 3b 20  76 20 3d 20 72 38 0d 1d  |r7....; v = r8..|
00003650  ec 0c 3b 20 75 20 3d 20  72 39 0d 1d f6 12 3b 20  |..; u = r9....; |
00003660  73 70 72 69 74 65 20 3d  20 72 31 30 0d 1e 00 0d  |sprite = r10....|
00003670  3b 20 63 20 3d 20 72 31  31 0d 1e 0a 14 3b 20 6c  |; c = r11....; l|
00003680  65 66 74 5f 61 64 72 20  3d 20 72 31 32 0d 1e 14  |eft_adr = r12...|
00003690  15 3b 20 72 69 67 68 74  5f 61 64 72 20 3d 20 72  |.; right_adr = r|
000036a0  31 33 0d 1e 1e 14 3b 20  72 31 20 3d 20 63 6f 6c  |13....; r1 = col|
000036b0  20 74 61 62 6c 65 0d 1e  28 04 0d 1e 32 13 6c 64  | table..(...2.ld|
000036c0  72 20 72 31 2c 63 6f 6c  74 61 62 6c 65 0d 1e 3c  |r r1,coltable..<|
000036d0  0e 74 73 74 20 72 31 32  2c 23 31 0d 1e 46 13 6d  |.tst r12,#1..F.m|
000036e0  6f 76 65 71 20 72 32 2c  23 31 3c 3c 33 31 0d 1e  |oveq r2,#1<<31..|
000036f0  50 0f 6d 6f 76 6e 65 20  72 32 2c 23 30 0d 1e 5a  |P.movne r2,#0..Z|
00003700  0a 2e 78 6c 6f 6f 70 0d  1e 64 16 61 6e 64 20 72  |..xloop..d.and r|
00003710  30 2c 72 38 2c 23 32 35  35 3c 3c 32 34 0d 1e 6e  |0,r8,#255<<24..n|
00003720  16 6f 72 72 20 72 30 2c  72 30 2c 72 39 2c 6c 73  |.orr r0,r0,r9,ls|
00003730  72 23 38 0d 1e 78 1b 6c  64 72 62 20 72 30 2c 5b  |r#8..x.ldrb r0,[|
00003740  72 31 30 2c 72 30 2c 6c  73 72 23 31 36 5d 0d 1e  |r10,r0,lsr#16]..|
00003750  82 2f 61 64 64 20 72 30  2c 72 31 2c 72 30 2c 6c  |./add r0,r1,r0,l|
00003760  73 6c 23 35 20 20 20 20  20 20 20 20 20 20 20 20  |sl#5            |
00003770  20 20 3b 20 33 32 20 6c  65 76 65 6c 73 0d 1e 8c  |  ; 32 levels...|
00003780  17 61 64 64 20 72 30 2c  72 30 2c 72 32 2c 6c 73  |.add r0,r0,r2,ls|
00003790  72 23 33 31 0d 1e 96 2f  6c 64 72 62 20 72 30 2c  |r#31.../ldrb r0,|
000037a0  5b 72 30 2c 72 31 31 2c  6c 73 72 23 32 37 5d 20  |[r0,r11,lsr#27] |
000037b0  20 20 20 20 20 20 20 20  3b 20 33 32 20 6c 65 76  |        ; 32 lev|
000037c0  65 6c 73 0d 1e a0 14 73  74 72 62 20 72 30 2c 5b  |els....strb r0,[|
000037d0  72 31 32 5d 2c 23 31 0d  1e aa 0f 63 6d 70 20 72  |r12],#1....cmp r|
000037e0  31 32 2c 72 31 33 0d 1e  b4 16 61 64 64 6c 65 20  |12,r13....addle |
000037f0  72 32 2c 72 32 2c 23 31  3c 3c 33 31 0d 1e be 12  |r2,r2,#1<<31....|
00003800  61 64 64 6c 65 20 72 38  2c 72 38 2c 72 37 0d 1e  |addle r8,r8,r7..|
00003810  c8 12 61 64 64 6c 65 20  72 39 2c 72 39 2c 72 36  |..addle r9,r9,r6|
00003820  0d 1e d2 14 61 64 64 6c  65 20 72 31 31 2c 72 31  |....addle r11,r1|
00003830  31 2c 72 35 0d 1e dc 0d  62 6c 65 20 78 6c 6f 6f  |1,r5....ble xloo|
00003840  70 0d 1e e6 04 0d 1e f0  0f 6c 64 72 20 72 32 2c  |p........ldr r2,|
00003850  6c 69 6e 65 0d 1e fa 10  6c 64 72 20 72 30 2c 79  |line....ldr r0,y|
00003860  5f 65 6e 64 0d 1f 04 12  61 64 64 20 72 31 34 2c  |_end....add r14,|
00003870  72 31 34 2c 23 31 0d 1f  0e 0e 63 6d 70 20 72 31  |r14,#1....cmp r1|
00003880  34 2c 72 30 0d 1f 18 0d  62 6c 74 20 79 6c 6f 6f  |4,r0....blt yloo|
00003890  70 0d 1f 22 04 0d 1f 2c  05 5d 0d 1f 36 06 3d 30  |p.."...,.]..6.=0|
000038a0  0d 1f 40 05 3a 0d 1f 4a  14 dd a4 73 63 72 65 65  |..@.:..J...scree|
000038b0  6e 61 64 72 28 62 6b 25  29 0d 1f 54 17 c8 99 22  |nadr(bk%)..T..."|
000038c0  4f 53 5f 42 79 74 65 22  2c 31 31 32 2c 62 6b 25  |OS_Byte",112,bk%|
000038d0  0d 1f 5e 17 c8 99 22 4f  53 5f 42 79 74 65 22 2c  |..^..."OS_Byte",|
000038e0  31 31 33 2c 62 6b 25 0d  1f 68 0a de 20 71 25 20  |113,bk%..h.. q% |
000038f0  38 0d 1f 72 13 21 71 25  3d 31 34 38 3a 71 25 21  |8..r.!q%=148:q%!|
00003900  34 3d 2d 31 0d 1f 7c 21  c8 99 22 4f 53 5f 52 65  |4=-1..|!.."OS_Re|
00003910  61 64 56 64 75 56 61 72  69 61 62 6c 65 73 22 2c  |adVduVariables",|
00003920  71 25 2c 71 25 0d 1f 86  08 3d 21 71 25 0d ff     |q%,q%....=!q%..|
0000392f