Home » Archimedes archive » Acorn User » AU 1997-08 B.adf » Regulars » starinfo/Tunnel/Taylor/!Tunnel/Tunnel

starinfo/Tunnel/Taylor/!Tunnel/Tunnel

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

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

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-08 B.adf » Regulars
Filename: starinfo/Tunnel/Taylor/!Tunnel/Tunnel
Read OK:
File size: 989A bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > <Tunnel$Dir>.Tunnel
   20REM Ray Taylor, 48 West Drive, Handsworth, Birmingham B20 3SU
   30ON ERROR MODE 0:PRINTREPORT$" at line ";ERL:END
   40MODE 27
   50PROCinit_palette
   60PROCtables
   70PROCinit_data
   80PROCinit_track
   90PROCasm
  100PROCinit_buffer
  110PROCswap_screen
  120REPEAT
  130 PROCswap_screen
  140 CALL transform
  150 CALL draw
  160 PROCstep
  170UNTIL 0
  180END
  190
  200DEF PROCrotate(RETURN x%,RETURN y%,RETURN z%,ax%,ay%,az%)
  210LOCAL x1%,y1%,z1%,x2%,y2%,z2%
  220REM --- Rotate about x axis ---
  230x1%=x%
  240y1%=(y%*cos8%!(ax%<<2)-(z%*sin8%!(ax%<<2)))>>8
  250z1%=(y%*sin8%!(ax%<<2)+(z%*cos8%!(ax%<<2)))>>8
  260REM --- Rotate about y axis ---
  270x2%=(x1%*cos8%!(ay%<<2)+(z1%*sin8%!(ay%<<2)))>>8
  280y2%=y1%
  290z2%=(z1%*cos8%!(ay%<<2)-(x1%*sin8%!(ay%<<2)))>>8
  300REM --- Rotate about z axis ---
  310x%=(x2%*cos8%!(az%<<2)-(y2%*sin8%!(az%<<2)))>>8
  320y%=(x2%*sin8%!(az%<<2)+(y2%*cos8%!(az%<<2)))>>8
  330z%=z2%
  340ENDPROC
  350
  360DEF PROCstep
  370LOCAL ptr%,dx%,dy%,dz%,step_dir%,wx%,wy%,wz%,ax%,ay%,az%
  380REM -- Generate co-ord increments for a new step, dx,dy,dz --
  390dx%=0
  400dy%=trk_step%
  410dz%=0
  420ax%=!trk_wax
  430ay%=!trk_way
  440az%=!trk_waz
  450PROCrotate(dx%,dy%,dz%,ax%,ay%,az%)
  460REM -- Get co_ords of furthest old step, wx,wy,wz  --
  470ptr%=!new_ptr
  480wx%=buf_wx%!(ptr%<<2)
  490wy%=buf_wy%!(ptr%<<2)
  500wz%=buf_wz%!(ptr%<<2)
  510REM -- Bump buffer pointers --
  520ptr%+=1
  530IF ptr%>max_ptr% THEN ptr%=0
  540!new_ptr=ptr%
  550ptr%=!obs_ptr
  560ptr%+=1
  570IF ptr%>max_ptr% THEN ptr%=0
  580!obs_ptr=ptr%
  590ptr%=!view_ptr
  600ptr%+=1
  610IF ptr%>max_ptr% THEN ptr%=0
  620!view_ptr=ptr%
  630REM -- Add increment to old step co-ords to get new step --
  640ptr%=!new_ptr
  650buf_wx%!(ptr%<<2)=wx%+dx%
  660buf_wy%!(ptr%<<2)=wy%+dy%
  670buf_wz%!(ptr%<<2)=wz%+dz%
  680REM -- Decrement steps-to-go --
  690!step_count-=1
  700REM -- If no more steps in segment, get next segment curvature --
  710IF !step_count<0 THEN
  720 ptr%=!trk_ptr
  730 !step_count=seg_len%!(ptr%<<2)-1
  740 step_dir%=trk_dir%!(ptr%<<2)
  750 ptr%+=1
  760 IF ptr%>trk_len% THEN ptr%=0
  770 !trk_ptr=ptr%
  780 !step_dir=step_dir%
  790ENDIF
  800REM -- Apply curvature to new step --
  810step_dir%=!step_dir
  820CASE step_dir% OF
  830 WHEN s_step%
  840  REM No action
  850 WHEN l_step%
  860  !trk_waz-=trk_daz%
  870  IF !trk_waz<0 THEN !trk_waz+=360
  880 WHEN r_step%
  890  !trk_waz+=trk_daz%
  900  IF !trk_waz>=360 THEN !trk_waz-=360
  910 WHEN u_step%
  920  !trk_wax+=trk_dax%
  930  IF !trk_wax>=360 THEN !trk_wax-=360
  940 WHEN d_step%
  950  !trk_wax-=trk_dax%
  960  IF !trk_wax<0 THEN !trk_wax+=360
  970ENDCASE
  980REM -- Transfer track curvature to new step in buffer at new_ptr --
  990ptr%=!new_ptr
 1000buf_wax%!(ptr%<<2)=!trk_wax
 1010buf_way%!(ptr%<<2)=!trk_way
 1020buf_waz%!(ptr%<<2)=!trk_waz
 1030REM -- Copy observer co-ords from buffer at obs_ptr --
 1040ptr%=!obs_ptr
 1050!obs_wx=buf_wx%!(ptr%<<2)
 1060!obs_wy=buf_wy%!(ptr%<<2)
 1070!obs_wz=buf_wz%!(ptr%<<2)
 1080REM -- Copy observer orientation from buffer at obs_ptr --
 1090!obs_wax=buf_wax%!(ptr%<<2)
 1100!obs_way=buf_way%!(ptr%<<2)
 1110!obs_waz=buf_waz%!(ptr%<<2)
 1120ENDPROC
 1130
 1140DEF PROCswap_screen
 1150CASE !scr_no OF
 1160WHEN 1
 1170*FX113,1
 1180WAIT:*FX112,2
 1190!scr_no=2
 1200WHEN 2
 1210*FX113,2
 1220WAIT:*FX112,1
 1230!scr_no=1
 1240ENDCASE
 1250CLS
 1260ENDPROC
 1270
 1280DEF PROCtables
 1290LOCAL a%,p%
 1300p%=2^8
 1310DIM sin8% 360*4,cos8% 360*4
 1320FOR a%=0 TO 359
 1330 sin8%!(a%<<2)=SINRAD(a%)*p%
 1340 cos8%!(a%<<2)=COSRAD(a%)*p%
 1350NEXT a%
 1360ENDPROC
 1370
 1380DEF PROCinit_buffer
 1390LOCAL ptr%
 1400!new_ptr=0
 1410!obs_ptr=1
 1420!view_ptr=2
 1430FOR ptr%=0 TO max_ptr%
 1440 buf_wx%!(ptr%<<2)=0
 1450 buf_wy%!(ptr%<<2)=0
 1460 buf_wz%!(ptr%<<2)=0
 1470 buf_wax%!(ptr%<<2)=0
 1480 buf_way%!(ptr%<<2)=0
 1490 buf_waz%!(ptr%<<2)=0
 1500 buf_col%!(ptr%<<2)=(ptr% MOD 15)+1
 1510NEXT ptr%
 1520FOR ptr%=0 TO max_ptr%
 1530 PROCstep
 1540NEXT ptr%
 1550ENDPROC
 1560
 1570DEF PROCinit_palette
 1580LOCAL c%,v%,a%
 1590FOR c%=1 TO 15
 1600 a%=c%*360/16
 1610 v%=96-SINRAD(a%)*64
 1620 COLOUR c%,v%,v%,0
 1630NEXT c%
 1640ENDPROC
 1650
 1660DEF PROCinit_data
 1670max_ptr%=32
 1680DIM buf_wx% max_ptr%*4
 1690DIM buf_wy% max_ptr%*4
 1700DIM buf_wz% max_ptr%*4
 1710DIM buf_wax% max_ptr%*4
 1720DIM buf_way% max_ptr%*4
 1730DIM buf_waz% max_ptr%*4
 1740DIM buf_col% max_ptr%*4
 1750DIM sx0% max_ptr%*4
 1760DIM sx1% max_ptr%*4
 1770DIM sx2% max_ptr%*4
 1780DIM sx3% max_ptr%*4
 1790DIM sy0% max_ptr%*4
 1800DIM sy1% max_ptr%*4
 1810DIM sy2% max_ptr%*4
 1820DIM sy3% max_ptr%*4
 1830DIM sz0% max_ptr%*4
 1840DIM sz1% max_ptr%*4
 1850DIM sz2% max_ptr%*4
 1860DIM sz3% max_ptr%*4
 1870DIM poly_sx% 3*4        
 1880DIM poly_sy% 3*4
 1890DIM poly_sz% 3*4
 1900DIM sort_key% 3*4
 1910DIM left_sxbuf% 480*4   
 1920DIM right_sxbuf% 480*4  
 1930trk_wx%=0
 1940trk_wy%=0
 1950trk_wz%=0
 1960trk_wax%=0
 1970trk_way%=0
 1980trk_waz%=0
 1990obs_wx%=0
 2000obs_wy%=0
 2010obs_wz%=0
 2020obs_wax%=0
 2030obs_way%=0
 2040obs_waz%=0
 2050trk_dax%=1
 2060trk_day%=2
 2070trk_daz%=1
 2080trk_step%=320
 2090seg_rad%=100
 2100scale%=3000
 2110ENDPROC
 2120
 2130DEF PROCinit_track
 2140LOCAL seg%,dir$
 2150s_step%=0
 2160l_step%=1
 2170r_step%=2
 2180u_step%=3
 2190d_step%=4
 2200RESTORE +0
 2210READ trk_len%
 2220DIM trk_dir% trk_len%*4
 2230DIM seg_len% trk_len%*4
 2240FOR seg%=0 TO trk_len%
 2250 READ seg_len%!(seg%<<2),dir$
 2260 trk_dir%!(seg%<<2)=EVAL(dir$)
 2270NEXT seg%
 2280trk_ptr%=0
 2290step_count%=0
 2300ENDPROC
 2310
 2320DATA 18
 2330DATA 20,s_step%
 2340DATA 10,l_step%
 2350DATA 20,r_step%
 2360DATA 10,l_step%
 2370DATA 5,u_step%
 2380DATA 10,d_step%
 2390DATA 5,u_step%
 2400DATA 20,s_step%
 2410DATA 10,d_step%
 2420DATA 20,u_step%
 2430DATA 20,d_step%
 2440DATA 10,u_step%
 2450DATA 4,l_step%
 2460DATA 8,r_step%
 2470DATA 8,l_step%
 2480DATA 8,r_step%
 2490DATA 4,l_step%
 2500DATA 10,d_step%
 2510DATA 10,u_step%
 2520
 2530DEF PROCasm
 2540code_size%=4000
 2550DIM code% code_size%
 2560FOR pass%=0 TO 2 STEP 2
 2570P%=code%
 2580
 2590left%=0: right%=1
 2600up%=0: down%=1
 2610cw%=0: acw%=1
 2620
 2630rlink=14
 2640
 2650REM - Registers for transform -
 2660rptr=2
 2670rvert=3
 2680rsx=4
 2690rsy=5
 2700rsz=6
 2710rx=7
 2720ry=8
 2730rz=9
 2740rax=10
 2750ray=11
 2760raz=12
 2770
 2780[OPT pass%
 2790.transform
 2800MOV rptr,#0                       \FOR ptr%=0 TO max_ptr%
 2810.transform_loop_ptr
 2820MOV rvert,#0                      \ FOR vert%=0 TO 3
 2830.transform_loop_vert
 2840CMP rvert,#0                      \  CASE vert% OF
 2850BEQ transform_case_0
 2860CMP rvert,#1
 2870BEQ transform_case_1
 2880CMP rvert,#2
 2890BEQ transform_case_2
 2900CMP rvert,#3
 2910BEQ transform_case_3
 2920.transform_case_0                 \   WHEN 0
 2930MOV rx,#seg_rad%                  \    x%=-seg_rad%
 2940RSB rx,rx,#0
 2950MOV rz,#seg_rad%                  \    z%=-seg_rad%
 2960RSB rz,rz,#0
 2970LDR rsx,sx0                       \    sx%=sx0%
 2980LDR rsy,sy0                       \    sy%=sy0%
 2990LDR rsz,sz0                       \    sz%=sz0%
 3000B transform_endcase
 3010.transform_case_1                 \   WHEN 1
 3020MOV rx,#seg_rad%                  \    x%=-seg_rad%
 3030RSB rx,rx,#0
 3040MOV rz,#seg_rad%                  \    z%=seg_rad%
 3050LDR rsx,sx1                       \    sx%=sx1%
 3060LDR rsy,sy1                       \    sy%=sy1%
 3070LDR rsz,sz1                       \    sz%=sz1%
 3080B transform_endcase
 3090.transform_case_2                 \   WHEN 2
 3100MOV rx,#seg_rad%                  \    x%=seg_rad%
 3110MOV rz,#seg_rad%                  \    z%=seg_rad%
 3120LDR rsx,sx2                       \    sx%=sx2%
 3130LDR rsy,sy2                       \    sy%=sy2%
 3140LDR rsz,sz2                       \    sz%=sz2%
 3150B transform_endcase
 3160.transform_case_3                 \   WHEN 3
 3170MOV rx,#seg_rad%                  \    x%=seg_rad%
 3180MOV rz,#seg_rad%                  \    z%=-seg_rad%
 3190RSB rz,rz,#0
 3200LDR rsx,sx3                       \    sx%=sx3%
 3210LDR rsy,sy3                       \    sy%=sy3%
 3220LDR rsz,sz3                       \    sz%=sz3%
 3230.transform_endcase                \  ENDCASE
 3240MOV ry,#0                         \  y%=0
 3250LDR r0,buf_wax                    \  ax%=buf_wax%!(ptr%<<2)
 3260LDR rax,[r0,rptr,LSL#2]
 3270CMP rax,#0                        \  IF ax%>0 THEN ax%=360-ax%
 3280RSBGT rax,rax,#360
 3290LDR r0,buf_way                    \  ay%=buf_way%!(ptr%<<2)
 3300LDR ray,[r0,rptr,LSL#2]
 3310CMP ray,#0                        \  IF ay%>0 THEN ay%=360-ay%
 3320RSBGT ray,ray,#360
 3330LDR r0,buf_waz                    \  az%=buf_waz%!(ptr%<<2)
 3340LDR raz,[r0,rptr,LSL#2]
 3350CMP raz,#0                        \  IF az%>0 THEN az%=360-az%
 3360RSBGT raz,raz,#360
 3370STMFD r13 !,{r1-r12,rlink}        \  PROCrotate(x%,y%,z%,ax%,ay%,az%)
 3380BL rotate
 3390LDMFD r13 !,{r1-r12,rlink}
 3400LDR r0,buf_wx                     \  x%+=(buf_wx%!(ptr%<<2)-!obs_wx)
 3410LDR r0,[r0,rptr,LSL#2]
 3420LDR r1,obs_wx
 3430ADD rx,rx,r0
 3440SUB rx,rx,r1
 3450LDR r0,buf_wy                     \  y%+=(buf_wy%!(ptr%<<2)-!obs_wy)
 3460LDR r0,[r0,rptr,LSL#2]
 3470LDR r1,obs_wy
 3480ADD ry,ry,r0
 3490SUB ry,ry,r1
 3500LDR r0,buf_wz                     \  z%+=(buf_wz%!(ptr%<<2)-!obs_wz)
 3510LDR r0,[r0,rptr,LSL#2]
 3520LDR r1,obs_wz
 3530ADD rz,rz,r0
 3540SUB rz,rz,r1
 3550LDR rax,obs_wax                   \  ax%=!obs_wax
 3560CMP rax,#0                        \  IF ax%>0 THEN ax%=360-ax%
 3570RSBGT rax,rax,#360
 3580LDR ray,obs_way                   \  ay%=!obs_way
 3590CMP ray,#0                        \  IF ay%>0 THEN ay%=360-ay%
 3600RSBGT ray,ray,#360
 3610LDR raz,obs_waz                   \  az%=!obs_waz
 3620CMP raz,#0                        \  IF az%>0 THEN az%=360-az%
 3630RSBGT raz,raz,#360
 3640STMFD r13 !,{r1-r12,rlink} \  PROCrotate(x%,y%,z%,ax%,ay%,az%)
 3650BL rotate
 3660LDMFD r13 !,{r1-r12,rlink}
 3670CMP ry,#1                         \  IF y%<1 THEN y%=1
 3680MOVLT ry,#1
 3690LDR r0,scale                      \  sx%!(ptr%<<2)=640+x%*!scale DIV y%
 3700MUL r0,rx,r0
 3710MOV r1,ry
 3720STMFD r13 !,{r2-r6,rlink}
 3730BL divide
 3740LDMFD r13 !,{r2-r6,rlink}
 3750ADD r0,r0,#640
 3760STR r0,[rsx,rptr,LSL#2]
 3770LDR r0,scale                      \  sy%!(ptr%<<2)=480+z%*!scale DIV y%
 3780MUL r0,rz,r0
 3790MOV r1,ry
 3800STMFD r13 !,{r2-r6,rlink}
 3810BL divide
 3820LDMFD r13 !,{r2-r6,rlink}
 3830ADD r0,r0,#480
 3840STR r0,[rsy,rptr,LSL#2]
 3850STR ry,[rsz,rptr,LSL#2]           \  sz%!(ptr%<<2)=y%
 3860ADD rvert,rvert,#1                \ NEXT vert%
 3870CMP rvert,#3
 3880BLE transform_loop_vert
 3890ADD rptr,rptr,#1                  \NEXT ptr%
 3900CMP rptr,#max_ptr%
 3910BLE transform_loop_ptr
 3920MOV PC,rlink                      \ENDPROC
 3930]
 3940
 3950REM - Registers for rotate -
 3960REM - Local vars -
 3970rx1=1
 3980ry1=2
 3990rz1=3
 4000rx2=4
 4010ry2=5
 4020rz2=6
 4030rx=7
 4040ry=8
 4050rz=9
 4060rax=10
 4070ray=11
 4080raz=12
 4090
 4100[OPT pass%
 4110.rotate
 4120REM --- Rotate about x axis ---
 4130MOV rx1,rx                   \x1%=x%
 4140LDR r0,cos8                  \y1%=y%*cos8%!(ax%<<2)-(z%*sin8%!(ax%<<2))
 4150LDR r0,[r0,rax,LSL#2]
 4160MUL ry1,ry,r0
 4170LDR r0,sin8
 4180LDR r0,[r0,rax,LSL#2]
 4190MUL r0,rz,r0
 4200SUB ry1,ry1,r0
 4210MOV ry1,ry1,ASR#8            \y1%=y1%>>8
 4220LDR r0,sin8                  \z1%=y%*sin8%!(ax%<<2)+(z%*cos8%!(ax%<<2))
 4230LDR r0,[r0,rax,LSL#2]
 4240MUL rz1,ry,r0
 4250LDR r0,cos8
 4260LDR r0,[r0,rax,LSL#2]
 4270MUL r0,rz,r0
 4280ADD rz1,rz1,r0
 4290MOV rz1,rz1,ASR#8            \z1%=z1%>>8
 4300REM --- Rotate about y axis ---
 4310LDR r0,cos8                  \x2%=x1%*cos8%!(ay%<<2)+(z1%*sin8%!(ay%<<2))
 4320LDR r0,[r0,ray,LSL#2]
 4330MUL rx2,rx1,r0
 4340LDR r0,sin8
 4350LDR r0,[r0,ray,LSL#2]
 4360MUL r0,rz1,r0
 4370ADD rx2,rx2,r0
 4380MOV rx2,rx2,ASR#8            \x2%=x2%>>8
 4390MOV ry2,ry1                  \y2%=y1%
 4400LDR r0,cos8                  \z2%=z1%*cos8%!(ay%<<2)-(x1%*sin8%!(ay%<<2))
 4410LDR r0,[r0,ray,LSL#2]
 4420MUL rz2,rz1,r0
 4430LDR r0,sin8
 4440LDR r0,[r0,ray,LSL#2]
 4450MUL r0,rx1,r0
 4460SUB rz2,rz2,r0
 4470MOV rz2,rz2,ASR#8            \z2%=z2%>>8
 4480REM --- Rotate about z axis ---
 4490LDR r0,cos8                  \x%=x2%*cos8%!(az%<<2)-(y2%*sin8%!(az%<<2))
 4500LDR r0,[r0,raz,LSL#2]
 4510MUL rx,rx2,r0
 4520LDR r0,sin8
 4530LDR r0,[r0,raz,LSL#2]
 4540MUL r0,ry2,r0
 4550SUB rx,rx,r0
 4560MOV rx,rx,ASR#8              \x%=x%>>8
 4570LDR r0,sin8                  \y%=x2%*sin8%!(az%<<2)+(y2%*cos8%!(az%<<2))
 4580LDR r0,[r0,raz,LSL#2]
 4590MUL ry,rx2,r0
 4600LDR r0,cos8
 4610LDR r0,[r0,raz,LSL#2]
 4620MUL r0,ry2,r0
 4630SUB ry,ry,r0
 4640MOV ry,ry,ASR#8              \y%=y%>>8
 4650MOV rz,rz2                   \z%=z2%
 4660MOV PC,rlink                 \ENDPROC
 4670]
 4680
 4690REM - Registers for draw -
 4700REM - O/P params for draw_poly -
 4710rpoly=2
 4720rptr0=3
 4730rptr1=4
 4740REM - Local var -
 4750rview_ptr=5
 4760
 4770[OPT pass%
 4780.draw
 4790LDR rview_ptr,view_ptr
 4800LDR rptr0,new_ptr                     \ptr0%=!new_ptr
 4810ADD rptr1,rptr0,#1                    \ptr1%=!new_ptr+1
 4820.draw_repeat_1                        \REPEAT
 4830SUBS rptr0,rptr0,#1                   \ ptr0%-=1
 4840MOVLT rptr0,#max_ptr%                 \ IF ptr0%<0 THEN ptr0%=max_ptr%
 4850SUBS rptr1,rptr1,#1                   \ ptr1%-=1
 4860MOVLT rptr1,#max_ptr%                 \ IF ptr1%<0 THEN ptr1%=max_ptr%
 4870MOV rpoly,#0                          \ FOR poly%=0 TO 3
 4880.draw_loop_1
 4890STMFD r13 !,{r2-r5,rlink}             \  CALL draw_poly
 4900BL draw_poly
 4910LDMFD r13 !,{r2-r5,rlink}
 4920ADD rpoly,rpoly,#1                    \ NEXT poly%
 4930CMP rpoly,#3
 4940BLE draw_loop_1
 4950CMP rptr0,rview_ptr                   \UNTIL ptr0%=!view_ptr
 4960BNE draw_repeat_1
 4970MOV PC,rlink                          \ENDPROC
 4980]
 4990
 5000REM - Registers for draw_poly -
 5010REM - Input params -
 5020rpoly=2
 5030rptr0=3
 5040rptr1=4
 5050REM - Local vars -
 5060rcol=5
 5070rpoly_sx=6 :REM must match r6 in outside
 5080rpoly_sy=7 :REM must match r7 in outside
 5090rsxa=8
 5100rsxb=9
 5110rsya=10
 5120rsyb=11
 5130
 5140[OPT pass%
 5150.draw_poly
 5160LDR rpoly_sx,poly_sx            \poly_sx%=!poly_sx
 5170LDR rpoly_sy,poly_sy            \poly_sy%=!poly_sy
 5180CMP rpoly,#0                    \CASE poly% OF
 5190BEQ draw_poly_when_0
 5200CMP rpoly,#1
 5210BEQ draw_poly_when_1
 5220CMP rpoly,#2
 5230BEQ draw_poly_when_2
 5240CMP rpoly,#3
 5250BEQ draw_poly_when_3
 5260 REM -- Left wall --
 5270.draw_poly_when_0               \ WHEN 0
 5280LDR rsxa,sx0                    \  sxa%=!sx0
 5290LDR rsya,sy0                    \  sya%=!sy0
 5300LDR rsxb,sx1                    \  sxb%=!sx1
 5310LDR rsyb,sy1                    \  syb%=!sy1
 5320LDR r0,buf_col                  \  col%=buf_col%!(ptr0%<<2)
 5330LDR rcol,[r0,rptr0,LSL#2]
 5340B draw_poly_endcase
 5350 REM -- Roof --
 5360.draw_poly_when_1               \ WHEN 1
 5370LDR rsxa,sx1                    \  sxa%=!sx1
 5380LDR rsya,sy1                    \  sya%=!sy1
 5390LDR rsxb,sx2                    \  sxb%=!sx2
 5400LDR rsyb,sy2                    \  syb%=!sy2
 5410MOV rcol,rptr0                  \  col%=ptr0% MOD AND %11
 5420AND rcol,rcol,#%11
 5430ADD rcol,rcol,#4
 5440B draw_poly_endcase
 5450 REM -- Right wall --
 5460.draw_poly_when_2               \ WHEN 2
 5470LDR rsxa,sx2                    \  sxa%=!sx2
 5480LDR rsya,sy2                    \  sya%=!sy2
 5490LDR rsxb,sx3                    \  sxb%=!sx3
 5500LDR rsyb,sy3                    \  syb%=!sy3
 5510LDR r0,buf_col                  \  col%=buf_col%!(ptr0%<<2)
 5520LDR rcol,[r0,rptr0,LSL#2]
 5530B draw_poly_endcase
 5540 REM -- Floor --
 5550.draw_poly_when_3               \ WHEN 3
 5560LDR rsxa,sx3                    \  sxa%=!sx3
 5570LDR rsya,sy3                    \  sya%=!sy3
 5580LDR rsxb,sx0                    \  sxb%=!sx0
 5590LDR rsyb,sy0                    \  syb%=!sy0
 5600MOV rcol,rptr0                  \  col%=ptr0% AND %11
 5610AND rcol,rcol,#%11
 5620ADD rcol,rcol,#4
 5630.draw_poly_endcase              \ENDCASE
 5640
 5650LDR r0,[rsxa,rptr0,LSL#2]       \poly_sx%!0=sxa%!(ptr0%<<2) DIV 2
 5660MOV r0,r0,ASR#1
 5670STR r0,[rpoly_sx,#0]
 5680
 5690LDR r0,[rsya,rptr0,LSL#2]       \poly_sy%!0=479-sya%!(ptr0%<<2) DIV 2
 5700MOV r0,r0,ASR#1
 5710RSB r0,r0,#480
 5720SUB r0,r0,#1
 5730STR r0,[rpoly_sy,#0]
 5740
 5750LDR r0,[rsxb,rptr0,LSL#2]       \poly_sx%!4=sxb%!(ptr0%<<2) DIV 2
 5760MOV r0,r0,ASR#1
 5770STR r0,[rpoly_sx,#4]
 5780
 5790LDR r0,[rsyb,rptr0,LSL#2]       \poly_sy%!4=479-syb%!(ptr0%<<2) DIV 2
 5800MOV r0,r0,ASR#1
 5810RSB r0,r0,#480
 5820SUB r0,r0,#1
 5830STR r0,[rpoly_sy,#4]
 5840
 5850LDR r0,[rsxb,rptr1,LSL#2]       \poly_sx%!8=sxb%!(ptr1%<<2) DIV 2
 5860MOV r0,r0,ASR#1
 5870STR r0,[rpoly_sx,#8]
 5880
 5890LDR r0,[rsyb,rptr1,LSL#2]       \poly_sy%!8=479-syb%!(ptr1%<<2) DIV 2
 5900MOV r0,r0,ASR#1
 5910RSB r0,r0,#480
 5920SUB r0,r0,#1
 5930STR r0,[rpoly_sy,#8]
 5940
 5950LDR r0,[rsxa,rptr1,LSL#2]       \poly_sx%!12=sxa%!(ptr1%<<2) DIV 2
 5960MOV r0,r0,ASR#1
 5970STR r0,[rpoly_sx,#12]
 5980
 5990LDR r0,[rsya,rptr1,LSL#2]       \poly_sy%!12=479-sya%!(ptr1%<<2) DIV 2
 6000MOV r0,r0,ASR#1
 6010RSB r0,r0,#480
 6020SUB r0,r0,#1
 6030STR r0,[rpoly_sy,#12]
 6040STR rcol,poly_colour            \!poly_colour=col%
 6050STMFD r13 !,{r2-r11,rlink}      \CALL draw_polygon
 6060BL draw_polygon
 6070LDMFD r13 !,{r2-r11,rlink}
 6080MOV PC,rlink                    \ENDPROC
 6090]
 6100
 6110REM - divide -
 6120REM subroutine (caller saves r2..r6)
 6130REM input: dividend in R0, divisor in R1
 6140REM output: quotient in R0, remainder in R1
 6150
 6160[OPT pass%
 6170.divide
 6180ANDS r6,r0,#1<<31      ; r6=sign of remainder
 6190RSBMI r0,r0,#0
 6200EOR r5,r6,R1           ; r5=sign of quotient
 6210CMP r1,#0
 6220RSBMI r1,r1,#0
 6230MOV r3,#0
 6240MOV r2,#0
 6250MOV r4,#1<<31
 6260.divloop
 6270  MOVS r0,r0,ASL#1
 6280  ADC r3,r3,r3
 6290  CMP r3,r1
 6300  SUBGE r3,r3,r1
 6310  ORRGE r2,r2,r4
 6320  MOVS r4,r4,LSR#1
 6330  BNE divloop
 6340CMP r5,#0
 6350RSBMI r2,r2,#0
 6360CMP r6,#0
 6370RSBMI r3,r3,#0
 6380MOV r0,r2
 6390MOV r1,r3
 6400MOV PC,rlink
 6410]
 6420
 6430REM uses r0 only - no params
 6440
 6450[OPT pass%
 6460.draw_polygon
 6470MOV r0,#4
 6480STR r0,n_verts
 6490STMFD r13 !,{rlink}                 \ CALL find_bounds
 6500 BL find_bounds
 6510LDMFD r13 !,{rlink}
 6520LDR r0,skip_poly                    \ IF !skip_poly=0 THEN
 6530CMP r0,#0
 6540BNE draw_polygon_endif1
 6550STMFD r13 !,{rlink}                 \  CALL bresenham
 6560 BL bresenham
 6570 BL fill_poly                       \  CALL fill_polyx
 6580LDMFD r13 !,{rlink}
 6590.draw_polygon_endif1                \ ENDIF
 6600MOV PC,rlink                        \ENDPROC
 6610]
 6620
 6630REM - Registers for find_bounds -
 6640
 6650rpoly_sx=1
 6660rpoly_sy=2
 6670rtop_v=3
 6680rbtm_v=4
 6690rleft_v=5
 6700rright_v=6
 6710rtop_sy=7
 6720rbtm_sy=8
 6730rleft_sx=9
 6740rright_sx=10
 6750rv=11
 6760rmaxv=12
 6770
 6780[OPT pass%
 6790.find_bounds
 6800LDR rmaxv,n_verts                    \maxv%=!n_verts-1
 6810SUB rmaxv,rmaxv,#1
 6820LDR rpoly_sx,poly_sx                 \poly_sx%=!poly_sx
 6830LDR rpoly_sy,poly_sy                 \poly_sy%=!poly_sy
 6840MOV rtop_v,#0                        \top_v%=0
 6850MOV rbtm_v,#0                        \btm_v%=0
 6860MOV rleft_v,#0                       \left_v%=0
 6870MOV rright_v,#0                      \right_v%=0
 6880MOV rtop_sy,#0                       \top_sy%=0
 6890MOV rbtm_sy,#0                       \btm_sy%=0
 6900MOV rleft_sx,#0                      \left_sx%=0
 6910MOV rright_sx,#0                     \right_sx%=0
 6920MOV rv,#0                            \FOR v%=0 TO maxv%
 6930.find_bounds_loop1
 6940LDR r0,[rpoly_sy,rv,LSL#2]           \ y%=poly_sy%!(v%<<2)  (r0 is y)
 6950CMP r0,rtop_sy                       \ IF y%<top_sy% OR v%=0 THEN
 6960MOVLT rtop_sy,r0                     \  top_sy%=y%
 6970MOVLT rtop_v,rv                      \  top_v%=v%
 6980CMP rv,#0
 6990MOVEQ rtop_sy,r0
 7000MOVEQ rtop_v,rv
 7010                                     \ ENDIF
 7020CMP r0,rbtm_sy                       \ IF y%>btm_sy% OR v%=0 THEN
 7030MOVGT rbtm_sy,r0                     \  btm_sy%=y%
 7040MOVGT rbtm_v,rv                      \  btm_v%=v%
 7050CMP rv,#0
 7060MOVEQ rbtm_sy,r0
 7070MOVEQ rbtm_v,rv
 7080                                     \ ENDIF
 7090LDR r0,[rpoly_sx,rv,LSL#2]           \ x%=poly_sx%!(v%<<2)  (r0 is x)
 7100CMP r0,rleft_sx                      \ IF x%<left_sx% OR v%=0 THEN
 7110MOVLT rleft_sx,r0                    \  left_sx%=x%
 7120MOVLT rleft_v,rv                     \  left_v%=v%
 7130CMP rv,#0
 7140MOVEQ rleft_sx,r0
 7150MOVEQ rleft_v,rv
 7160                                     \ ENDIF
 7170CMP r0,rright_sx                     \ IF x%>right_sx% OR v%=0 THEN
 7180MOVGT rright_sx,r0                   \  right_sx%=x%
 7190MOVGT rright_v,rv                    \  right_v%=v%
 7200CMP rv,#0
 7210MOVEQ rright_sx,r0
 7220MOVEQ rright_v,rv
 7230                                     \ ENDIF
 7240ADD rv,rv,#1                         \NEXT v%
 7250CMP rv,rmaxv
 7260BLE find_bounds_loop1
 7270MOV r0,#0                            \!skip_poly=0
 7280STR r0,skip_poly
 7290MOV r0,#1
 7300CMP rbtm_sy,#0                       \IF btm_sy%<0 THEN...
 7310STRLT r0,skip_poly                   \...!skip_poly=1:\ ENDPROC
 7320MOVLT PC,rlink
 7330CMP rtop_sy,#480                     \IF top_sy%>479 THEN...
 7340STRGE r0,skip_poly                   \...!skip_poly=1:\ ENDPROC
 7350MOVGT PC,rlink
 7360CMP rright_sx,#0                     \IF right_sx%<0 THEN...
 7370STRLT r0,skip_poly                   \...!skip_poly=1:\ ENDPROC
 7380MOVLT PC,rlink
 7390CMP rleft_sx,#640                    \IF left_sx%>=640 THEN...
 7400STRGE r0,skip_poly                   \...!skip_poly=1:\ ENDPROC
 7410MOVGE PC,rlink
 7420STR rtop_v,top_vert                  \!top_vert=top_v%
 7430STR rbtm_v,btm_vert                  \!btm_vert=btm_v%
 7440STR rleft_v,left_vert                \!left_vert=left_v%
 7450STR rright_v,right_vert              \!right_vert=right_v%
 7460CMP rbtm_sy,#480                     \IF btm_sy%>479 THEN...
 7470MOVGE rbtm_sy,#480                   \...btm_sy%=479
 7480SUBGE rbtm_sy,rbtm_sy,#1
 7490CMP rtop_sy,#0                       \IF top_sy%<0 THEN...
 7500MOVLT rtop_sy,#0                     \...top_sy%=0
 7510STR rtop_sy,top_sy                   \!top_sy=top_sy%
 7520STR rbtm_sy,btm_sy                   \!btm_sy=btm_sy%
 7530STR rleft_sx,left_sx                 \!left_sx=left_sx%
 7540STR rright_sx,right_sx               \!right_sx=right_sx%
 7550MOV PC,rlink                         \ENDPROC
 7560]
 7570
 7580REM - Bresenham uses only r0 and rlink -
 7590
 7600[OPT pass%
 7610.bresenham
 7620LDR r0,btm_sy                        \IF !btm_sy<480
 7630CMP r0,#480
 7640BGE bresenham_elsif1
 7650MOV r0,#up%                          \ !bres_dir=up%
 7660STR r0,bres_dir
 7670MOV r0,#cw%                          \ !bres_ang_dir=cw%
 7680STR r0,bres_ang_dir
 7690MOV r0,#left%                        \ !edge_no=left%
 7700STR r0,edge_no
 7710STMFD r13 !,{rlink}                  \ CALL bres
 7720BL bres
 7730LDMFD r13 !,{rlink}
 7740MOV r0,#up%                          \ !bres_dir=up%
 7750STR r0,bres_dir
 7760MOV r0,#acw%                         \ !bres_ang_dir=acw%
 7770STR r0,bres_ang_dir
 7780MOV r0,#right%                       \ !edge_no=right%
 7790STR r0,edge_no
 7800STMFD r13 !,{rlink}                  \ CALL bres
 7810BL bres
 7820LDMFD r13 !,{rlink}
 7830MOV PC,rlink
 7840.bresenham_elsif1                    \ELSE
 7850MOV r0,#up%                          \ !bres_dir=up%
 7860STR r0,bres_dir
 7870MOV r0,#cw%                          \ !bres_ang_dir=cw%
 7880STR r0,bres_ang_dir
 7890MOV r0,#left%                        \ !edge_no=left%
 7900STR r0,edge_no
 7910STR rlink,bres_link                  \ CALL bres
 7920BL bres
 7930LDR rlink,bres_link
 7940MOV r0,#up%                          \ !bres_dir=up%
 7950STR r0,bres_dir
 7960MOV r0,#acw%                         \ !bres_ang_dir=acw%
 7970STR r0,bres_ang_dir
 7980MOV r0,#right%                       \ !edge_no=right%
 7990STR r0,edge_no
 8000STR rlink,bres_link                  \ CALL bres
 8010BL bres
 8020LDR PC,bres_link                     \ENDIF
 8030                                     \ENDPROC
 8040.bres_link     EQUD 0
 8050]
 8060
 8070REM - Registers for bres -
 8080
 8090rvert=3
 8100rnext_vert=4
 8110rx_buf=5
 8120rdx=6
 8130rdy=7
 8140rsx=8
 8150rsy=9
 8160rx1=10
 8170ry1=11
 8180re=12
 8190
 8200[OPT pass%
 8210.bres
 8220LDR r0,bres_dir                      \IF !bres_dir=up% THEN
 8230CMP r0,#up%
 8240LDREQ rvert,btm_vert                 \ vert%=!btm_vert
 8250                                     \ELSE
 8260LDRNE rvert,top_vert                 \ vert%=!top_vert
 8270                                     \ENDIF
 8280LDR r0,edge_no                       \IF !edge_no=left% THEN
 8290CMP r0,#left%
 8300LDREQ rx_buf,left_sxbuf              \ x_buf%=!left_sxbuf
 8310                                     \ELSE
 8320LDRNE rx_buf,right_sxbuf             \ x_buf%=!right_sxbuf
 8330                                     \ENDIF
 8340.bres_repeat1                        \REPEAT
 8350LDR r0,n_verts                       \ r0%=!n_verts
 8360LDR r1,bres_ang_dir                  \ IF !bres_ang_dir=cw% THEN
 8370CMP r1,#cw%
 8380ADDEQ rnext_vert,rvert,#1            \  next_vert%=vert%+1
 8390                                     \ ELSE
 8400SUBNE rnext_vert,rvert,#1            \  next_vert%=vert%-1
 8410                                     \ ENDIF
 8420CMP rnext_vert,#0                    \ IF next_vert%<0 THEN...
 8430SUBLT rnext_vert,r0,#1               \...next_vert%=r0%-1
 8440CMP rnext_vert,r0                    \ IF next_vert%>=r0%...
 8450MOVGE rnext_vert,#0                  \...THEN next_vert%=0
 8460LDR r0,poly_sx                       \ r0%=!poly_sx
 8470LDR rx1,[r0,rvert,LSL#2]             \ x1%=r0%!(vert%<<2)
 8480LDR r0,poly_sy                       \ r0%=!poly_sy
 8490LDR ry1,[r0,rvert,LSL#2]             \ y1%=r0%!(vert%<<2)
 8500LDR r0,poly_sx                       \ r0%=!poly_sx
 8510LDR r1,[r0,rnext_vert,LSL#2]         \ x2%=r0%!(next_vert%<<2)  (r1 is x2)
 8520STR r1,bres_x2
 8530LDR r0,poly_sy                       \ r0%=!poly_sy
 8540LDR r2,[r0,rnext_vert,LSL#2]         \ y2%=r0%!(next_vert%<<2)  (r2 is y2)
 8550STR r2,bres_y2
 8560SUB rdx,r1,rx1                       \ dx%=ABS(x2%-x1%)
 8570CMP rdx,#0
 8580RSBLT rdx,rdx,#0
 8590SUB rdy,r2,ry1                       \ dy%=ABS(y2%-y1%)
 8600CMP rdy,#0
 8610RSBLT rdy,rdy,#0
 8620CMP r1,rx1                           \ sx%=SGN(x2%-x1%)
 8630MOVGT rsx,#1
 8640MOVEQ rsx,#0
 8650MVNLT rsx,#0
 8660CMP r2,ry1                           \ sy%=SGN(y2%-y1%)
 8670MOVGT rsy,#1
 8680MOVEQ rsy,#0
 8690MVNLT rsy,#0
 8700CMP rdx,rdy                          \ IF dx%>dy% THEN
 8710BLE bres_else1
 8720MOV re,rdy,ASL#1                     \  e%=dy%*2-dx%
 8730SUB re,re,rdx
 8740.bres_repeat2                        \  REPEAT
 8750CMP re,#0                            \   IF e%>0 THEN
 8760BLE bres_else2
 8770CMP ry1,#0                           \    IF y1%>=0 AND...
 8780BLT bres_endif3
 8790CMP ry1,#480                         \    ...y1%<480 THEN
 8800STRLT rx1,[rx_buf,ry1,LSL#2]         \     x_buf%!(y1%<<2)=x1%
 8810.bres_endif3                         \    ENDIF
 8820ADD ry1,ry1,rsy                      \    y1%+=sy%
 8830SUB r0,rdy,rdx                       \    e%+=(dy%-dx%)*2
 8840ADD re,re,r0,ASL#1
 8850B bres_endif2
 8860.bres_else2                          \   ELSE
 8870ADD re,re,rdy,ASL#1                  \    e%+=dy%*2
 8880.bres_endif2                         \   ENDIF
 8890ADD rx1,rx1,rsx                      \   x1%+=sx%
 8900LDR r0,bres_x2                       \  UNTIL x1%=x2%
 8910CMP rx1,r0
 8920BNE bres_repeat2
 8930B bres_endif1
 8940.bres_else1                          \ ELSE
 8950MOV re,rdx,ASL#1                     \  e%=dx%*2-dy%
 8960SUB re,re,rdy
 8970.bres_repeat3                        \  REPEAT
 8980CMP ry1,#0                           \   IF y1%>=0...
 8990BLT bres_endif4
 9000CMP ry1,#480                         \   ...AND y1%<480 THEN
 9010STRLT rx1,[rx_buf,ry1,LSL#2]         \    x_buf%!(y1%<<2)=x1%
 9020.bres_endif4                         \   ENDIF
 9030CMP re,#0                            \   IF e%>0 THEN
 9040ADDGT rx1,rx1,rsx                    \    x1%+=sx%
 9050SUBGT r0,rdx,rdy                     \    e%+=(dx%-dy%)*2
 9060ADDGT re,re,r0,LSL#1
 9070                                     \   ELSE
 9080ADDLE re,re,rdx,LSL#1                \    e%+=dx%*2
 9090                                     \   ENDIF
 9100ADD ry1,ry1,rsy                      \   y1%+=sy%
 9110LDR r0,bres_y2                       \  UNTIL y1%=y2%
 9120CMP ry1,r0
 9130BNE bres_repeat3
 9140.bres_endif1                         \ ENDIF
 9150CMP ry1,#0                           \ IF y1%>=0...
 9160BLT bres_endif5
 9170CMP ry1,#480                         \ ...AND y1%<480 THEN
 9180STRLT rx1,[rx_buf,ry1,LSL#2]         \  x_buf%!(y1%<<2)=x1%
 9190.bres_endif5                         \ ENDIF
 9200MOV rvert,rnext_vert                 \ vert%=next_vert%
 9210MOV r0,#0                            \ r0%=0
 9220LDR r1,bres_dir                      \ IF !bres_dir=up% THEN
 9230CMP r1,#up%
 9240BNE bres_endif6
 9250CMP ry1,#0                           \  IF y1%<=0 THEN r0%=1
 9260MOVLE r0,#1
 9270LDR r2,top_vert                      \  IF vert%=!top_vert THEN r0%=1
 9280CMP rvert,r2
 9290MOVEQ r0,#1
 9300.bres_endif6                         \ ENDIF
 9310CMP r1,#down%                        \ IF !bres_dir=down% THEN (still r1)
 9320BNE bres_endif7
 9330CMP ry1,#480                         \  IF y1%>=480 THEN r0%=1
 9340MOVGE r0,#1
 9350LDR r2,btm_vert                      \  IF vert%=!btm_vert THEN r0%=1
 9360CMP rvert,r2
 9370MOVEQ r0,#1
 9380.bres_endif7                         \ ENDIF
 9390CMP r0,#1                            \UNTIL r0%=1
 9400BNE bres_repeat1
 9410MOV PC,rlink                         \ENDPROC
 9420]
 9430
 9440REM - Registers for fill_poly -
 9450
 9460REM - Params for hline -
 9470rx1=1
 9480rx2=2
 9490ry=3
 9500rcolour=4
 9510REM - Vars -
 9520ry1=5
 9530ry2=6
 9540rleft_sxbuf=7
 9550rright_sxbuf=8
 9560rlink=14
 9570
 9580[OPT pass%
 9590.fill_poly
 9600LDR rleft_sxbuf,left_sxbuf           \left_sxbuf%=!left_sxbuf
 9610LDR rright_sxbuf,right_sxbuf         \right_sxbuf%=!right_sxbuf
 9620LDR rcolour,poly_colour              \GCOL !poly_colour
 9630LDR ry1,top_sy                       \y1%=!top_sy
 9640LDR ry2,btm_sy                       \y2%=!btm_sy
 9650MOV ry,ry1                           \FOR y%=y1% TO y2%
 9660.fill_poly_loop1
 9670                                     \ - Get and clip line ends -
 9680LDR rx1,[rleft_sxbuf,ry,LSL#2]       \ x1%=left_sxbuf%!(y%<<2)
 9690CMP rx1,#640                         \ IF x1%>=640 THEN go next y
 9700BGE fill_poly_next1
 9710CMP rx1,#0                           \ IF x1%<0 THEN x1%=0
 9720MOVLT rx1,#0
 9730LDR rx2,[rright_sxbuf,ry,LSL#2]      \ x2%=right_sxbuf%!(y%<<2)
 9740CMP rx2,#0                           \ IF x2%<0 THEN go next y
 9750BLT fill_poly_next1
 9760CMP rx2,#640                         \ IF x2%>=640 THEN x2%=639
 9770MOVGE rx2,#640
 9780SUBGE rx2,rx2,#1
 9790                                     \ - Draw line -
 9800STMFD r13 !,{r3-r8,rlink}            \ PROChline(x1%,x2%,y%)
 9810 BL hline
 9820LDMFD r13 !,{r3-r8,rlink}
 9830.fill_poly_next1                     \NEXT y%
 9840ADD ry,ry,#1
 9850CMP ry,ry2
 9860BLE fill_poly_loop1
 9870MOV PC,rlink                         \ENDPROC
 9880]
 9890
 9900REM - Registers for hline -
 9910
 9920REM - Input params -
 9930rx1=1         :REM left end of line (pixels)
 9940rx2=2         :REM right do.
 9950ry=3          :REM y (pixels) form bottom of screen
 9960rcolour=4     :REM 0..15
 9970
 9980REM - Vars -
 9990rbase=5       :REM base addr (top-left) of current screen
10000rword1=6      :REM addr of word containing x1 (relative to base)
10010rword2=7      :REM do. x2
10020rwordcont=8   :REM contents of a word
10030rmask1=9      :REM mask for point or left end of line
10040rmask2=10     :REM mask for right end of line
10050rinvmask=11   :REM logical inverse of current mask
10060
10070[OPT pass%
10080.hline  \ Draw a horizontal line (zaps r1-r11)
10090\ Mode 27 - 80 words per line, 8 pixels per word
10100\ x1 in r1, x2 in r2, y in r3, colour (0-15) in r4
10110\ 4 cases - 1, x1=x2 (point)
10120\           2, x1,x2 in same word
10130\           3, x1,x2 in adjacent words
10140\           4, x1,x2 in non_adjacent words
10150
10160ADR r0,colour_table                  \start of colour table
10170LDR rcolour,[r0,rcolour,LSL#2]       \32 bits of colour
10180
10190CMP rx1,rx2
10200BEQ point                            \if x1=x2 then plot a point at x1,y
10210
10220LDR r0,scr_no                        \screen 1 or screen 2 for display
10230CMP r0,#1
10240LDREQ rbase,scr_base1
10250LDRNE rbase,scr_base2                \base addr of current screen
10260
10270MOV r0,ry,LSL#6                      \y times 64
10280ADD r0,r0,ry,LSL#4                   \plus y times 16 (= y times 80)
10290ADD rword1,r0,rx1,LSR#3              \plus x div 8 - word containing x1
10300ADD rword2,r0,rx2,LSR#3              \do. x2
10310
10320CMP rword1,rword2
10330BEQ shortline                        \x1 and x2 in same word
10340
10350\Draw left end (part-word) of line...
10360
10370LDR rwordcont,[rbase,rword1,LSL#2]   \get contents of left end word
10380AND r0,rx1,#%111                     \r0 is pixel no AND %111
10390ADR rmask1,left_masks                \start of left mask table
10400LDR rmask1,[rmask1,r0,LSL#2]         \32-bit mask
10410MVN rinvmask,rmask1                  \inverse mask
10420AND r0,rcolour,rinvmask              \colour mask
10430AND rwordcont,rwordcont,rmask1       \mask out line seg
10440ORR rwordcont,rwordcont,r0           \replace line seg with colour
10450STR rwordcont,[rbase,rword1,LSL#2]   \store modified word
10460
10470\Draw right end (part-word) of line...
10480
10490LDR rwordcont,[rbase,rword2,LSL#2]   \get contents of right end word
10500AND r0,rx2,#%111                     \r0 is pixel no AND %111
10510ADR rmask2,right_masks               \start of right mask table
10520LDR rmask2,[rmask2,r0,LSL#2]         \32-bit mask
10530MVN rinvmask,rmask2                  \inverse mask
10540AND r0,rcolour,rinvmask              \colour mask
10550AND rwordcont,rwordcont,rmask2       \mask out line seg
10560ORR rwordcont,rwordcont,r0           \replace line seg with colour
10570STR rwordcont,[rbase,rword2,LSL#2]   \store modified word
10580
10590MOV rword1,rword1,LSL#2
10600ADD rword1,rword1,rbase              \left end absolute address
10610MOV rword2,rword2,LSL#2
10620ADD rword2,rword2,rbase              \right end do.
10630SUB r0,rword2,rword1                 \line length (bytes)
10640
10650CMP r0,#4
10660MOVLE PC,rlink                       \quit if end words adjacent
10670
10680\Draw middle (whole words) of line...
10690
10700RSB r0,r0,#320                       \size of STR block minus line length
10710ADD r15,r15,r0                       \skip appropriate number of STR's
10720]
10730
10740FOR I%=1 TO 80                       :REM 80 of these (320 bytes)...
10750Z%=FNstore(pass%)                    :REM STR rcolour,[rword1,#4] !
10760NEXT                                 :REM ...to avoid loop overhead
10770
10780[OPT pass%
10790
10800MOV PC,rlink                         \quit long line case
10810
10820.point    \ Plot point x1,y
10830
10840LDR r0,scr_no                        \screen 1 or screen 2 for display
10850CMP r0,#1
10860LDREQ rbase,scr_base1
10870LDRNE rbase,scr_base2                \base addr of current screen
10880
10890MOV rword1,ry,LSL#6                  \y times 64
10900ADD rword1,rword1,ry,LSL#4           \plus y times 16
10910ADD rword1,rword1,rx1,LSR#3          \plus x1 div 8 - word y*80+(x DIV 8)
10920
10930LDR rwordcont,[rbase,rword1,LSL#2]   \get contents of word
10940AND r0,rx1,#%111                     \r0 is pixel no AND %111
10950ADR rmask1,point_masks               \start of mask table
10960LDR rmask1,[rmask1,r0,LSL#2]         \32-bit mask  - %0000 at pixel pos'n
10970MVN rinvmask,rmask1                  \inverse mask - %1111 at pixel pos'n
10980AND r0,rcolour,rinvmask              \mask has 4-bit colour at pixel pos'n
10990AND rwordcont,rwordcont,rmask1       \mask out pixel
11000ORR rwordcont,rwordcont,r0           \replace pixel with colour
11010STR rwordcont,[rbase,rword1,LSL#2]   \store modified word
11020
11030MOV PC,rlink                         \quit point case
11040
11050.shortline \ Draw a line where x1 and x2 are in same word
11060
11070LDR rwordcont,[rbase,rword1,LSL#2]   \get contents of word
11080AND r0,rx1,#%111                     \r0 is pixel no AND %111
11090ADR rmask1,left_masks
11100LDR rmask1,[rmask1,r0,LSL#2]         \32-bit mask - left end
11110
11120AND r0,rx2,#%111                     \r0 is pixel no AND %111
11130ADR rmask2,right_masks
11140LDR rmask2,[rmask2,r0,LSL#2]         \32-bit mask - right end
11150
11160ORR rmask1,rmask1,rmask2             \combined mask
11170
11180MVN rinvmask,rmask1                  \inverse mask
11190AND r0,rcolour,rinvmask              \colour mask
11200AND rwordcont,rwordcont,rmask1       \mask out line seg
11210ORR rwordcont,rwordcont,r0           \replace line seg with colour
11220STR rwordcont,[rbase,rword1,LSL#2]   \store modified word
11230
11240MOV PC,rlink                         \quit short line case
11250
11260.scr_no        EQUD 1                \current screen bank (1 or 2)
11270.scr_base1     EQUD FNsaddr(pass%,1) \address of bank 1
11280.scr_base2     EQUD FNsaddr(pass%,2) \address of bank 2
11290.scr_base      EQUD !scr_base1       \address of current bank
11300.colour_table  EQUD &00000000        \32-bit versions of mode 27 colours
11310               EQUD &11111111
11320               EQUD &22222222
11330               EQUD &33333333
11340               EQUD &44444444
11350               EQUD &55555555
11360               EQUD &66666666
11370               EQUD &77777777
11380               EQUD &88888888
11390               EQUD &99999999
11400               EQUD &AAAAAAAA
11410               EQUD &BBBBBBBB
11420               EQUD &CCCCCCCC
11430               EQUD &DDDDDDDD
11440               EQUD &EEEEEEEE
11450               EQUD &FFFFFFFF
11460.point_masks   EQUD &FFFFFFF0        \pixel position in word
11470               EQUD &FFFFFF0F
11480               EQUD &FFFFF0FF
11490               EQUD &FFFF0FFF
11500               EQUD &FFF0FFFF
11510               EQUD &FF0FFFFF
11520               EQUD &F0FFFFFF
11530               EQUD &0FFFFFFF
11540.left_masks    EQUD &00000000        \line starts within word
11550               EQUD &0000000F
11560               EQUD &000000FF
11570               EQUD &00000FFF
11580               EQUD &0000FFFF
11590               EQUD &000FFFFF
11600               EQUD &00FFFFFF
11610               EQUD &0FFFFFFF
11620.right_masks   EQUD &FFFFFFF0        \line ends within word
11630               EQUD &FFFFFF00
11640               EQUD &FFFFF000
11650               EQUD &FFFF0000
11660               EQUD &FFF00000
11670               EQUD &FF000000
11680               EQUD &F0000000
11690               EQUD &00000000
11700\ - Track buffer -
11710.buf_wx        EQUD buf_wx%
11720.buf_wy        EQUD buf_wy%
11730.buf_wz        EQUD buf_wz%
11740.buf_wax       EQUD buf_wax%
11750.buf_way       EQUD buf_way%
11760.buf_waz       EQUD buf_waz%
11770.buf_col       EQUD buf_col%
11780\ - Screen co-ord arrays for polygon vertices -
11790.sx0           EQUD sx0%
11800.sx1           EQUD sx1%
11810.sx2           EQUD sx2%
11820.sx3           EQUD sx3%
11830.sy0           EQUD sy0%
11840.sy1           EQUD sy1%
11850.sy2           EQUD sy2%
11860.sy3           EQUD sy3%
11870.sz0           EQUD sz0%
11880.sz1           EQUD sz1%
11890.sz2           EQUD sz2%
11900.sz3           EQUD sz3%
11910\ - Track -
11920.trk_wx        EQUD trk_wx%
11930.trk_wy        EQUD trk_wy%
11940.trk_wz        EQUD trk_wz%
11950.trk_wax       EQUD trk_wax%
11960.trk_way       EQUD trk_way%
11970.trk_waz       EQUD trk_waz%
11980.seg_rad       EQUD seg_rad%
11990\ - Observer -
12000.obs_wx        EQUD obs_wx%
12010.obs_wy        EQUD obs_wy%
12020.obs_wz        EQUD obs_wz%
12030.obs_wax       EQUD obs_wax%
12040.obs_way       EQUD obs_way%
12050.obs_waz       EQUD obs_waz%
12060.scale         EQUD scale%
12070\ - Buffer pointers -
12080.new_ptr       EQUD 0
12090.view_ptr      EQUD 0
12100.obs_ptr       EQUD 0
12110\ - Track details -
12120.step_count    EQUD 0
12130.seg_len       EQUD seg_len%
12140.trk_dir       EQUD trk_dir%
12150.trk_ptr       EQUD 0
12160.step_dir      EQUD 0
12170
12180\ - Screen description of current polygon -
12190.n_verts       EQUD 0                  \no of vertices
12200.poly_colour   EQUD 0                  \polygon colour
12210.poly_sx       EQUD poly_sx%           \screen co-ods of vertices...
12220.poly_sy       EQUD poly_sy%
12230.poly_sz       EQUD poly_sz%
12240.sort_key      EQUD sort_key%
12250.sin8          EQUD sin8%
12260.cos8          EQUD cos8%
12270.top_vert      EQUD 0                  \bounding vertices...
12280.btm_vert      EQUD 0
12290.left_vert     EQUD 0
12300.right_vert    EQUD 0
12310.top_sy        EQUD 0                  \screen xy of poly bounding rect...
12320.btm_sy        EQUD 0
12330.left_sx       EQUD 0
12340.right_sx      EQUD 0
12350.left_sxbuf    EQUD left_sxbuf%        \x co-ords of l and r sides...
12360.right_sxbuf   EQUD right_sxbuf%
12370.bres_dir      EQUD 0                  \Bresenham direction, 0=up, 1=down
12380.bres_ang_dir  EQUD 0                  \do. angular dir, 0=cw, 1=acw
12390.edge_no       EQUD 0                  \do. polygon edge, 0=left, 1=right
12400.skip_poly     EQUD 0                  \flag - set if all poly off screen
12410\\\ misc \\\
12420.bres_x2       EQUD 0                  \temp
12430.bres_y2       EQUD 0                  \temp
12440]
12450NEXT pass%
12460ENDPROC
12470
12480DEF FNstore(pass%)
12490[OPT pass%
12500 STR rcolour,[rword1,#4] !
12510]
12520=0
12530
12540DEF FNsaddr(pass%,screen%)
12550LOCAL b%
12560IF pass%>0 THEN
12570 DIM b% 8
12580 !b%=149
12590 b%!4=-1
12600 CASE screen% OF
12610  WHEN 1
12620   *FX112,1
12630   *FX113,1
12640  WHEN 2
12650   *FX112,2
12660   *FX113,2
12670 ENDCASE
12680 SYS "OS_ReadVduVariables",b%,b%
12690 *FX112,1
12700 *FX113,1
12710ENDIF
12720=!b%

� > <Tunnel$Dir>.Tunnel
?� Ray Taylor, 48 West Drive, Handsworth, Birmingham B20 3SU
� � � 0:�$" at line ";�:�
(� 27
2�init_palette
<�tables
F�init_data
P�init_track
Z�asm
d�init_buffer
n�swap_screen
x�
� �swap_screen
� � transform
� � draw
�
 �step
�� 0
��
�
�)� �rotate(� x%,� y%,� z%,ax%,ay%,az%)
�� x1%,y1%,z1%,x2%,y2%,z2%
�!� --- Rotate about x axis ---
�
x1%=x%
�2y1%=(y%*cos8%!(ax%<<2)-(z%*sin8%!(ax%<<2)))>>8
�2z1%=(y%*sin8%!(ax%<<2)+(z%*cos8%!(ax%<<2)))>>8
!� --- Rotate about y axis ---
4x2%=(x1%*cos8%!(ay%<<2)+(z1%*sin8%!(ay%<<2)))>>8
y2%=y1%
"4z2%=(z1%*cos8%!(ay%<<2)-(x1%*sin8%!(ay%<<2)))>>8
,!� --- Rotate about z axis ---
63x%=(x2%*cos8%!(az%<<2)-(y2%*sin8%!(az%<<2)))>>8
@3y%=(x2%*sin8%!(az%<<2)+(y2%*cos8%!(az%<<2)))>>8
J
z%=z2%
T�
^
h� �step
r8� ptr%,dx%,dy%,dz%,step_dir%,wx%,wy%,wz%,ax%,ay%,az%
|?� -- Generate co-ord increments for a new step, dx,dy,dz --
�	dx%=0
�dy%=trk_step%
�	dz%=0
�ax%=!trk_wax
�ay%=!trk_way
�az%=!trk_waz
�$�rotate(dx%,dy%,dz%,ax%,ay%,az%)
�7� -- Get co_ords of furthest old step, wx,wy,wz  --
�ptr%=!new_ptr
�wx%=buf_wx%!(ptr%<<2)
�wy%=buf_wy%!(ptr%<<2)
�wz%=buf_wz%!(ptr%<<2)
� � -- Bump buffer pointers --
ptr%+=1
� ptr%>max_ptr% � ptr%=0
!new_ptr=ptr%
&ptr%=!obs_ptr
0ptr%+=1
:� ptr%>max_ptr% � ptr%=0
D!obs_ptr=ptr%
Nptr%=!view_ptr
Xptr%+=1
b� ptr%>max_ptr% � ptr%=0
l!view_ptr=ptr%
v=� -- Add increment to old step co-ords to get new step --
�ptr%=!new_ptr
�buf_wx%!(ptr%<<2)=wx%+dx%
�buf_wy%!(ptr%<<2)=wy%+dy%
�buf_wz%!(ptr%<<2)=wz%+dz%
�!� -- Decrement steps-to-go --
�!step_count-=1
�C� -- If no more steps in segment, get next segment curvature --
�� !step_count<0 �
� ptr%=!trk_ptr
�% !step_count=seg_len%!(ptr%<<2)-1
�! step_dir%=trk_dir%!(ptr%<<2)
� ptr%+=1
� � ptr%>trk_len% � ptr%=0
 !trk_ptr=ptr%
 !step_dir=step_dir%
�
 '� -- Apply curvature to new step --
*step_dir%=!step_dir
4Ȏ step_dir% �
> � s_step%
H  � No action
R � l_step%
\  !trk_waz-=trk_daz%
f"  � !trk_waz<0 � !trk_waz+=360
p � r_step%
z  !trk_waz+=trk_daz%
�%  � !trk_waz>=360 � !trk_waz-=360
� � u_step%
�  !trk_wax+=trk_dax%
�%  � !trk_wax>=360 � !trk_wax-=360
� � d_step%
�  !trk_wax-=trk_dax%
�"  � !trk_wax<0 � !trk_wax+=360
��
�E� -- Transfer track curvature to new step in buffer at new_ptr --
�ptr%=!new_ptr
�buf_wax%!(ptr%<<2)=!trk_wax
�buf_way%!(ptr%<<2)=!trk_way
�buf_waz%!(ptr%<<2)=!trk_waz
8� -- Copy observer co-ords from buffer at obs_ptr --
ptr%=!obs_ptr
!obs_wx=buf_wx%!(ptr%<<2)
$!obs_wy=buf_wy%!(ptr%<<2)
.!obs_wz=buf_wz%!(ptr%<<2)
8<� -- Copy observer orientation from buffer at obs_ptr --
B!obs_wax=buf_wax%!(ptr%<<2)
L!obs_way=buf_way%!(ptr%<<2)
V!obs_waz=buf_waz%!(ptr%<<2)
`�
j
t� �swap_screen
~Ȏ !scr_no �
�� 1
�*FX113,1
�Ȗ:*FX112,2
�
!scr_no=2
�� 2
�*FX113,2
�Ȗ:*FX112,1
�
!scr_no=1
��
��
��
�

� �tables

� a%,p%

p%=2^8
� sin8% 360*4,cos8% 360*4
(� a%=0 � 359
2 sin8%!(a%<<2)=��(a%)*p%
< cos8%!(a%<<2)=��(a%)*p%
F� a%
P�
Z
d� �init_buffer
n
� ptr%
x!new_ptr=0
�!obs_ptr=1
�!view_ptr=2
�� ptr%=0 � max_ptr%
� buf_wx%!(ptr%<<2)=0
� buf_wy%!(ptr%<<2)=0
� buf_wz%!(ptr%<<2)=0
� buf_wax%!(ptr%<<2)=0
� buf_way%!(ptr%<<2)=0
� buf_waz%!(ptr%<<2)=0
�% buf_col%!(ptr%<<2)=(ptr% � 15)+1
�
� ptr%
�� ptr%=0 � max_ptr%
�
 �step

� ptr%
�

"� �init_palette
,� c%,v%,a%
6� c%=1 � 15
@ a%=c%*360/16
J v%=96-��(a%)*64
T � c%,v%,v%,0
^� c%
h�
r
|� �init_data
�max_ptr%=32
�� buf_wx% max_ptr%*4
�� buf_wy% max_ptr%*4
�� buf_wz% max_ptr%*4
�� buf_wax% max_ptr%*4
�� buf_way% max_ptr%*4
�� buf_waz% max_ptr%*4
�� buf_col% max_ptr%*4
�� sx0% max_ptr%*4
�� sx1% max_ptr%*4
�� sx2% max_ptr%*4
�� sx3% max_ptr%*4
�� sy0% max_ptr%*4
� sy1% max_ptr%*4
� sy2% max_ptr%*4
� sy3% max_ptr%*4
&� sz0% max_ptr%*4
0� sz1% max_ptr%*4
:� sz2% max_ptr%*4
D� sz3% max_ptr%*4
N� poly_sx% 3*4        
X� poly_sy% 3*4
b� poly_sz% 3*4
l� sort_key% 3*4
v� left_sxbuf% 480*4   
�� right_sxbuf% 480*4  
�
trk_wx%=0
�
trk_wy%=0
�
trk_wz%=0
�trk_wax%=0
�trk_way%=0
�trk_waz%=0
�
obs_wx%=0
�
obs_wy%=0
�
obs_wz%=0
�obs_wax%=0
�obs_way%=0
�obs_waz%=0
trk_dax%=1
trk_day%=2
trk_daz%=1
 trk_step%=320
*seg_rad%=100
4scale%=3000
>�
H
R� �init_track
\� seg%,dir$
f
s_step%=0
p
l_step%=1
z
r_step%=2
�
u_step%=3
�
d_step%=4
�� +0
�� trk_len%
�� trk_dir% trk_len%*4
�� seg_len% trk_len%*4
�� seg%=0 � trk_len%
� � seg_len%!(seg%<<2),dir$
� trk_dir%!(seg%<<2)=�(dir$)
�
� seg%
�trk_ptr%=0
�step_count%=0
��
	
	� 18
	� 20,s_step%
	$� 10,l_step%
	.� 20,r_step%
	8� 10,l_step%
	B� 5,u_step%
	L� 10,d_step%
	V� 5,u_step%
	`� 20,s_step%
	j� 10,d_step%
	t� 20,u_step%
	~� 20,d_step%
	�� 10,u_step%
	�� 4,l_step%
	�� 8,r_step%
	�� 8,l_step%
	�� 8,r_step%
	�� 4,l_step%
	�� 10,d_step%
	�� 10,u_step%
	�
	�
� �asm
	�code_size%=4000
	�� code% code_size%
� pass%=0 � 2 � 2

P%=code%

left%=0: right%=1
(up%=0: down%=1
2cw%=0: acw%=1
<
Frlink=14
P
Z!� - Registers for transform -
d
rptr=2
nrvert=3
x	rsx=4
�	rsy=5
�	rsz=6
�rx=7
�ry=8
�rz=9
�
rax=10
�
ray=11
�
raz=12
�
�[OPT pass%
�.transform
�:MOV rptr,#0                       \� ptr%=0 � max_ptr%
�.transform_loop_ptr
5MOV rvert,#0                      \ � vert%=0 � 3
.transform_loop_vert
3CMP rvert,#0                      \  Ȏ vert% �
"BEQ transform_case_0
,CMP rvert,#1
6BEQ transform_case_1
@CMP rvert,#2
JBEQ transform_case_2
TCMP rvert,#3
^BEQ transform_case_3
h-.transform_case_0                 \   � 0
r7MOV rx,#seg_rad%                  \    x%=-seg_rad%
|RSB rx,rx,#0
�7MOV rz,#seg_rad%                  \    z%=-seg_rad%
�RSB rz,rz,#0
�3LDR rsx,sx0                       \    sx%=sx0%
�3LDR rsy,sy0                       \    sy%=sy0%
�3LDR rsz,sz0                       \    sz%=sz0%
�B transform_endcase
�-.transform_case_1                 \   � 1
�7MOV rx,#seg_rad%                  \    x%=-seg_rad%
�RSB rx,rx,#0
�6MOV rz,#seg_rad%                  \    z%=seg_rad%
�3LDR rsx,sx1                       \    sx%=sx1%
�3LDR rsy,sy1                       \    sy%=sy1%
�3LDR rsz,sz1                       \    sz%=sz1%
B transform_endcase
-.transform_case_2                 \   � 2
6MOV rx,#seg_rad%                  \    x%=seg_rad%
&6MOV rz,#seg_rad%                  \    z%=seg_rad%
03LDR rsx,sx2                       \    sx%=sx2%
:3LDR rsy,sy2                       \    sy%=sy2%
D3LDR rsz,sz2                       \    sz%=sz2%
NB transform_endcase
X-.transform_case_3                 \   � 3
b6MOV rx,#seg_rad%                  \    x%=seg_rad%
l7MOV rz,#seg_rad%                  \    z%=-seg_rad%
vRSB rz,rz,#0
�3LDR rsx,sx3                       \    sx%=sx3%
�3LDR rsy,sy3                       \    sy%=sy3%
�3LDR rsz,sz3                       \    sz%=sz3%
�*.transform_endcase                \  �
�-MOV ry,#0                         \  y%=0
�?LDR r0,buf_wax                    \  ax%=buf_wax%!(ptr%<<2)
�LDR rax,[r0,rptr,LSL#2]
�>CMP rax,#0                        \  � ax%>0 � ax%=360-ax%
�RSBGT rax,rax,#360
�?LDR r0,buf_way                    \  ay%=buf_way%!(ptr%<<2)
�LDR ray,[r0,rptr,LSL#2]
�>CMP ray,#0                        \  � ay%>0 � ay%=360-ay%
�RSBGT ray,ray,#360

?LDR r0,buf_waz                    \  az%=buf_waz%!(ptr%<<2)

LDR raz,[r0,rptr,LSL#2]

>CMP raz,#0                        \  � az%>0 � az%=360-az%

 RSBGT raz,raz,#360

*FSTMFD r13 !,{r1-r12,rlink}        \  �rotate(x%,y%,z%,ax%,ay%,az%)

4
BL rotate

>LDMFD r13 !,{r1-r12,rlink}

HHLDR r0,buf_wx                     \  x%+=(buf_wx%!(ptr%<<2)-!obs_wx)

RLDR r0,[r0,rptr,LSL#2]

\LDR r1,obs_wx

fADD rx,rx,r0

pSUB rx,rx,r1

zHLDR r0,buf_wy                     \  y%+=(buf_wy%!(ptr%<<2)-!obs_wy)

�LDR r0,[r0,rptr,LSL#2]

�LDR r1,obs_wy

�ADD ry,ry,r0

�SUB ry,ry,r1

�HLDR r0,buf_wz                     \  z%+=(buf_wz%!(ptr%<<2)-!obs_wz)

�LDR r0,[r0,rptr,LSL#2]

�LDR r1,obs_wz

�ADD rz,rz,r0

�SUB rz,rz,r1

�5LDR rax,obs_wax                   \  ax%=!obs_wax

�>CMP rax,#0                        \  � ax%>0 � ax%=360-ax%

�RSBGT rax,rax,#360

�5LDR ray,obs_way                   \  ay%=!obs_way
>CMP ray,#0                        \  � ay%>0 � ay%=360-ay%
RSBGT ray,ray,#360
5LDR raz,obs_waz                   \  az%=!obs_waz
$>CMP raz,#0                        \  � az%>0 � az%=360-az%
.RSBGT raz,raz,#360
8?STMFD r13 !,{r1-r12,rlink} \  �rotate(x%,y%,z%,ax%,ay%,az%)
B
BL rotate
LLDMFD r13 !,{r1-r12,rlink}
V6CMP ry,#1                         \  � y%<1 � y%=1
`MOVLT ry,#1
jILDR r0,scale                      \  sx%!(ptr%<<2)=640+x%*!scale � y%
tMUL r0,rx,r0
~
MOV r1,ry
�STMFD r13 !,{r2-r6,rlink}
�
BL divide
�LDMFD r13 !,{r2-r6,rlink}
�ADD r0,r0,#640
�STR r0,[rsx,rptr,LSL#2]
�ILDR r0,scale                      \  sy%!(ptr%<<2)=480+z%*!scale � y%
�MUL r0,rz,r0
�
MOV r1,ry
�STMFD r13 !,{r2-r6,rlink}
�
BL divide
�LDMFD r13 !,{r2-r6,rlink}
�ADD r0,r0,#480
STR r0,[rsy,rptr,LSL#2]

9STR ry,[rsz,rptr,LSL#2]           \  sz%!(ptr%<<2)=y%
/ADD rvert,rvert,#1                \ � vert%
CMP rvert,#3
(BLE transform_loop_vert
2-ADD rptr,rptr,#1                  \� ptr%
<CMP rptr,#max_ptr%
FBLE transform_loop_ptr
P(MOV PC,rlink                      \�
Z]
d
n� - Registers for rotate -
x� - Local vars -
�	rx1=1
�	ry1=2
�	rz1=3
�	rx2=4
�	ry2=5
�	rz2=6
�rx=7
�ry=8
�rz=9
�
rax=10
�
ray=11
�
raz=12
�
[OPT pass%
.rotate
!� --- Rotate about x axis ---
"(MOV rx1,rx                   \x1%=x%
,KLDR r0,cos8                  \y1%=y%*cos8%!(ax%<<2)-(z%*sin8%!(ax%<<2))
6LDR r0,[r0,rax,LSL#2]
@MUL ry1,ry,r0
JLDR r0,sin8
TLDR r0,[r0,rax,LSL#2]
^MUL r0,rz,r0
hSUB ry1,ry1,r0
r,MOV ry1,ry1,ASR#8            \y1%=y1%>>8
|KLDR r0,sin8                  \z1%=y%*sin8%!(ax%<<2)+(z%*cos8%!(ax%<<2))
�LDR r0,[r0,rax,LSL#2]
�MUL rz1,ry,r0
�LDR r0,cos8
�LDR r0,[r0,rax,LSL#2]
�MUL r0,rz,r0
�ADD rz1,rz1,r0
�,MOV rz1,rz1,ASR#8            \z1%=z1%>>8
�!� --- Rotate about y axis ---
�MLDR r0,cos8                  \x2%=x1%*cos8%!(ay%<<2)+(z1%*sin8%!(ay%<<2))
�LDR r0,[r0,ray,LSL#2]
�MUL rx2,rx1,r0
�LDR r0,sin8
�LDR r0,[r0,ray,LSL#2]
MUL r0,rz1,r0
ADD rx2,rx2,r0
,MOV rx2,rx2,ASR#8            \x2%=x2%>>8
&)MOV ry2,ry1                  \y2%=y1%
0MLDR r0,cos8                  \z2%=z1%*cos8%!(ay%<<2)-(x1%*sin8%!(ay%<<2))
:LDR r0,[r0,ray,LSL#2]
DMUL rz2,rz1,r0
NLDR r0,sin8
XLDR r0,[r0,ray,LSL#2]
bMUL r0,rx1,r0
lSUB rz2,rz2,r0
v,MOV rz2,rz2,ASR#8            \z2%=z2%>>8
�!� --- Rotate about z axis ---
�LLDR r0,cos8                  \x%=x2%*cos8%!(az%<<2)-(y2%*sin8%!(az%<<2))
�LDR r0,[r0,raz,LSL#2]
�MUL rx,rx2,r0
�LDR r0,sin8
�LDR r0,[r0,raz,LSL#2]
�MUL r0,ry2,r0
�SUB rx,rx,r0
�*MOV rx,rx,ASR#8              \x%=x%>>8
�LLDR r0,sin8                  \y%=x2%*sin8%!(az%<<2)+(y2%*cos8%!(az%<<2))
�LDR r0,[r0,raz,LSL#2]
�MUL ry,rx2,r0
�LDR r0,cos8
LDR r0,[r0,raz,LSL#2]
MUL r0,ry2,r0
SUB ry,ry,r0
 *MOV ry,ry,ASR#8              \y%=y%>>8
*(MOV rz,rz2                   \z%=z2%
4#MOV PC,rlink                 \�
>]
H
R� - Registers for draw -
\"� - O/P params for draw_poly -
frpoly=2
prptr0=3
zrptr1=4
�� - Local var -
�rview_ptr=5
�
�[OPT pass%
�	.draw
�LDR rview_ptr,view_ptr
�9LDR rptr0,new_ptr                     \ptr0%=!new_ptr
�;ADD rptr1,rptr0,#1                    \ptr1%=!new_ptr+1
�,.draw_repeat_1                        \�
�4SUBS rptr0,rptr0,#1                   \ ptr0%-=1
�FMOVLT rptr0,#max_ptr%                 \ � ptr0%<0 � ptr0%=max_ptr%
�4SUBS rptr1,rptr1,#1                   \ ptr1%-=1
�FMOVLT rptr1,#max_ptr%                 \ � ptr1%<0 � ptr1%=max_ptr%
9MOV rpoly,#0                          \ � poly%=0 � 3
.draw_loop_1
8STMFD r13 !,{r2-r5,rlink}             \  � draw_poly
$BL draw_poly
.LDMFD r13 !,{r2-r5,rlink}
83ADD rpoly,rpoly,#1                    \ � poly%
BCMP rpoly,#3
LBLE draw_loop_1
V<CMP rptr0,rview_ptr                   \� ptr0%=!view_ptr
`BNE draw_repeat_1
j,MOV PC,rlink                          \�
t]
~
�!� - Registers for draw_poly -
�� - Input params -
�rpoly=2
�rptr0=3
�rptr1=4
�� - Local vars -
�
rcol=5
�*rpoly_sx=6 :� must match r6 in outside
�*rpoly_sy=7 :� must match r7 in outside
�
rsxa=8
�
rsxb=9
�rsya=10
rsyb=11


[OPT pass%
.draw_poly
(6LDR rpoly_sx,poly_sx            \poly_sx%=!poly_sx
26LDR rpoly_sy,poly_sy            \poly_sy%=!poly_sy
</CMP rpoly,#0                    \Ȏ poly% �
FBEQ draw_poly_when_0
PCMP rpoly,#1
ZBEQ draw_poly_when_1
dCMP rpoly,#2
nBEQ draw_poly_when_2
xCMP rpoly,#3
�BEQ draw_poly_when_3
� � -- Left wall --
�).draw_poly_when_0               \ � 0
�0LDR rsxa,sx0                    \  sxa%=!sx0
�0LDR rsya,sy0                    \  sya%=!sy0
�0LDR rsxb,sx1                    \  sxb%=!sx1
�0LDR rsyb,sy1                    \  syb%=!sy1
�?LDR r0,buf_col                  \  col%=buf_col%!(ptr0%<<2)
�LDR rcol,[r0,rptr0,LSL#2]
�B draw_poly_endcase
� � -- Roof --
�).draw_poly_when_1               \ � 1
�0LDR rsxa,sx1                    \  sxa%=!sx1
0LDR rsya,sy1                    \  sya%=!sy1
0LDR rsxb,sx2                    \  sxb%=!sx2
0LDR rsyb,sy2                    \  syb%=!sy2
"9MOV rcol,rptr0                  \  col%=ptr0% � � %11
,� rcol,rcol,#%11
6ADD rcol,rcol,#4
@B draw_poly_endcase
J � -- Right wall --
T).draw_poly_when_2               \ � 2
^0LDR rsxa,sx2                    \  sxa%=!sx2
h0LDR rsya,sy2                    \  sya%=!sy2
r0LDR rsxb,sx3                    \  sxb%=!sx3
|0LDR rsyb,sy3                    \  syb%=!sy3
�?LDR r0,buf_col                  \  col%=buf_col%!(ptr0%<<2)
�LDR rcol,[r0,rptr0,LSL#2]
�B draw_poly_endcase
� � -- Floor --
�).draw_poly_when_3               \ � 3
�0LDR rsxa,sx3                    \  sxa%=!sx3
�0LDR rsya,sy3                    \  sya%=!sy3
�0LDR rsxb,sx0                    \  sxb%=!sx0
�0LDR rsyb,sy0                    \  syb%=!sy0
�7MOV rcol,rptr0                  \  col%=ptr0% � %11
�� rcol,rcol,#%11
�ADD rcol,rcol,#4
�&.draw_poly_endcase              \�

CLDR r0,[rsxa,rptr0,LSL#2]       \poly_sx%!0=sxa%!(ptr0%<<2) � 2
MOV r0,r0,ASR#1
&STR r0,[rpoly_sx,#0]
0
:GLDR r0,[rsya,rptr0,LSL#2]       \poly_sy%!0=479-sya%!(ptr0%<<2) � 2
DMOV r0,r0,ASR#1
NRSB r0,r0,#480
XSUB r0,r0,#1
bSTR r0,[rpoly_sy,#0]
l
vCLDR r0,[rsxb,rptr0,LSL#2]       \poly_sx%!4=sxb%!(ptr0%<<2) � 2
�MOV r0,r0,ASR#1
�STR r0,[rpoly_sx,#4]
�
�GLDR r0,[rsyb,rptr0,LSL#2]       \poly_sy%!4=479-syb%!(ptr0%<<2) � 2
�MOV r0,r0,ASR#1
�RSB r0,r0,#480
�SUB r0,r0,#1
�STR r0,[rpoly_sy,#4]
�
�CLDR r0,[rsxb,rptr1,LSL#2]       \poly_sx%!8=sxb%!(ptr1%<<2) � 2
�MOV r0,r0,ASR#1
�STR r0,[rpoly_sx,#8]
�
GLDR r0,[rsyb,rptr1,LSL#2]       \poly_sy%!8=479-syb%!(ptr1%<<2) � 2
MOV r0,r0,ASR#1
RSB r0,r0,#480
 SUB r0,r0,#1
*STR r0,[rpoly_sy,#8]
4
>DLDR r0,[rsxa,rptr1,LSL#2]       \poly_sx%!12=sxa%!(ptr1%<<2) � 2
HMOV r0,r0,ASR#1
RSTR r0,[rpoly_sx,#12]
\
fHLDR r0,[rsya,rptr1,LSL#2]       \poly_sy%!12=479-sya%!(ptr1%<<2) � 2
pMOV r0,r0,ASR#1
zRSB r0,r0,#480
�SUB r0,r0,#1
�STR r0,[rpoly_sy,#12]
�6STR rcol,poly_colour            \!poly_colour=col%
�3STMFD r13 !,{r2-r11,rlink}      \� draw_polygon
�BL draw_polygon
�LDMFD r13 !,{r2-r11,rlink}
�&MOV PC,rlink                    \�
�]
�
�� - divide -
�&� subroutine (caller saves r2..r6)
�*� input: dividend in R0, divisor in R1
�-� output: quotient in R0, remainder in R1

[OPT pass%
.divide
$/�S r6,r0,#1<<31      ; r6=sign of remainder
.RSBMI r0,r0,#0
8.� r5,r6,R1           ; r5=sign of quotient
B
CMP r1,#0
LRSBMI r1,r1,#0
V
MOV r3,#0
`
MOV r2,#0
jMOV r4,#1<<31
t.divloop
~  MOVS r0,r0,ASL#1
�  ADC r3,r3,r3
�  CMP r3,r1
�  SUBGE r3,r3,r1
�  �RGE r2,r2,r4
�  MOVS r4,r4,LSR#1
�  BNE divloop
�
CMP r5,#0
�RSBMI r2,r2,#0
�
CMP r6,#0
�RSBMI r3,r3,#0
�
MOV r0,r2
�
MOV r1,r3
MOV PC,rlink

]

� uses r0 only - no params
(
2[OPT pass%
<.draw_polygon
F
MOV r0,#4
PSTR r0,n_verts
Z7STMFD r13 !,{rlink}                 \ � find_bounds
d BL find_bounds
nLDMFD r13 !,{rlink}
x:LDR r0,skip_poly                    \ � !skip_poly=0 �
�
CMP r0,#0
�BNE draw_polygon_endif1
�6STMFD r13 !,{rlink}                 \  � bresenham
� BL bresenham
�7 BL fill_poly                       \  � fill_polyx
�LDMFD r13 !,{rlink}
�+.draw_polygon_endif1                \ �
�*MOV PC,rlink                        \�
�]
�
�#� - Registers for find_bounds -
�
�rpoly_sx=1
rpoly_sy=2
rtop_v=3
rbtm_v=4
"
rleft_v=5
,rright_v=6
6
rtop_sy=7
@
rbtm_sy=8
Jrleft_sx=9
Trright_sx=10
^	rv=11
hrmaxv=12
r
|[OPT pass%
�.find_bounds
�:LDR rmaxv,n_verts                    \maxv%=!n_verts-1
�SUB rmaxv,rmaxv,#1
�;LDR rpoly_sx,poly_sx                 \poly_sx%=!poly_sx
�;LDR rpoly_sy,poly_sy                 \poly_sy%=!poly_sy
�2MOV rtop_v,#0                        \top_v%=0
�2MOV rbtm_v,#0                        \btm_v%=0
�3MOV rleft_v,#0                       \left_v%=0
�4MOV rright_v,#0                      \right_v%=0
�3MOV rtop_sy,#0                       \top_sy%=0
�3MOV rbtm_sy,#0                       \btm_sy%=0
�4MOV rleft_sx,#0                      \left_sx%=0
�5MOV rright_sx,#0                     \right_sx%=0
8MOV rv,#0                            \� v%=0 � maxv%
.find_bounds_loop1
ILDR r0,[rpoly_sy,rv,LSL#2]           \ y%=poly_sy%!(v%<<2)  (r0 is y)
&@CMP r0,rtop_sy                       \ � y%<top_sy% � v%=0 �
06MOVLT rtop_sy,r0                     \  top_sy%=y%
:5MOVLT rtop_v,rv                      \  top_v%=v%
D
CMP rv,#0
N�Q rtop_sy,r0
X�Q rtop_v,rv
b,                                     \ �
l@CMP r0,rbtm_sy                       \ � y%>btm_sy% � v%=0 �
v6MOVGT rbtm_sy,r0                     \  btm_sy%=y%
�5MOVGT rbtm_v,rv                      \  btm_v%=v%
�
CMP rv,#0
��Q rbtm_sy,r0
��Q rbtm_v,rv
�,                                     \ �
�ILDR r0,[rpoly_sx,rv,LSL#2]           \ x%=poly_sx%!(v%<<2)  (r0 is x)
�ACMP r0,rleft_sx                      \ � x%<left_sx% � v%=0 �
�7MOVLT rleft_sx,r0                    \  left_sx%=x%
�6MOVLT rleft_v,rv                     \  left_v%=v%
�
CMP rv,#0
��Q rleft_sx,r0
��Q rleft_v,rv
�,                                     \ �
BCMP r0,rright_sx                     \ � x%>right_sx% � v%=0 �
8MOVGT rright_sx,r0                   \  right_sx%=x%
7MOVGT rright_v,rv                    \  right_v%=v%
 
CMP rv,#0
*�Q rright_sx,r0
4�Q rright_v,rv
>,                                     \ �
H.ADD rv,rv,#1                         \� v%
RCMP rv,rmaxv
\BLE find_bounds_loop1
f6MOV r0,#0                            \!skip_poly=0
pSTR r0,skip_poly
z
MOV r0,#1
�:CMP rbtm_sy,#0                       \� btm_sy%<0 �...
�=STRLT r0,skip_poly                   \...!skip_poly=1:\ �
�MOVLT PC,rlink
�<CMP rtop_sy,#480                     \� top_sy%>479 �...
�=STRGE r0,skip_poly                   \...!skip_poly=1:\ �
�MOVGT PC,rlink
�<CMP rright_sx,#0                     \� right_sx%<0 �...
�=STRLT r0,skip_poly                   \...!skip_poly=1:\ �
�MOVLT PC,rlink
�>CMP rleft_sx,#640                    \� left_sx%>=640 �...
�=STRGE r0,skip_poly                   \...!skip_poly=1:\ �
�MOVGE PC,rlink
�:STR rtop_v,top_vert                  \!top_vert=top_v%
:STR rbtm_v,btm_vert                  \!btm_vert=btm_v%
<STR rleft_v,left_vert                \!left_vert=left_v%
>STR rright_v,right_vert              \!right_vert=right_v%
$<CMP rbtm_sy,#480                     \� btm_sy%>479 �...
.8MOVGE rbtm_sy,#480                   \...btm_sy%=479
8SUBGE rbtm_sy,rbtm_sy,#1
B:CMP rtop_sy,#0                       \� top_sy%<0 �...
L6MOVLT rtop_sy,#0                     \...top_sy%=0
V9STR rtop_sy,top_sy                   \!top_sy=top_sy%
`9STR rbtm_sy,btm_sy                   \!btm_sy=btm_sy%
j;STR rleft_sx,left_sx                 \!left_sx=left_sx%
t=STR rright_sx,right_sx               \!right_sx=right_sx%
~+MOV PC,rlink                         \�
�]
�
�*� - Bresenham uses only r0 and rlink -
�
�[OPT pass%
�.bresenham
�7LDR r0,btm_sy                        \� !btm_sy<480
�CMP r0,#480
�BGE bresenham_elsif1
�8MOV r0,#up%                          \ !bres_dir=up%
�STR r0,bres_dir
�<MOV r0,#cw%                          \ !bres_ang_dir=cw%
STR r0,bres_ang_dir

9MOV r0,#left%                        \ !edge_no=left%
STR r0,edge_no
1STMFD r13 !,{rlink}                  \ � bres
(BL bres
2LDMFD r13 !,{rlink}
<8MOV r0,#up%                          \ !bres_dir=up%
FSTR r0,bres_dir
P=MOV r0,#acw%                         \ !bres_ang_dir=acw%
ZSTR r0,bres_ang_dir
d:MOV r0,#right%                       \ !edge_no=right%
nSTR r0,edge_no
x1STMFD r13 !,{rlink}                  \ � bres
�BL bres
�LDMFD r13 !,{rlink}
�MOV PC,rlink
�+.bresenham_elsif1                    \�
�8MOV r0,#up%                          \ !bres_dir=up%
�STR r0,bres_dir
�<MOV r0,#cw%                          \ !bres_ang_dir=cw%
�STR r0,bres_ang_dir
�9MOV r0,#left%                        \ !edge_no=left%
�STR r0,edge_no
�1STR rlink,bres_link                  \ � bres
�BL bres
�LDR rlink,bres_link
8MOV r0,#up%                          \ !bres_dir=up%
STR r0,bres_dir
=MOV r0,#acw%                         \ !bres_ang_dir=acw%
"STR r0,bres_ang_dir
,:MOV r0,#right%                       \ !edge_no=right%
6STR r0,edge_no
@1STR rlink,bres_link                  \ � bres
JBL bres
T+LDR PC,bres_link                     \�
^+                                     \�
h.bres_link     EQUD 0
r]
|
�� - Registers for bres -
�
�rvert=3
�rnext_vert=4
�rx_buf=5
�	rdx=6
�	rdy=7
�	rsx=8
�	rsy=9
�
rx1=10
�
ry1=11
�	re=12
�
 [OPT pass%
 	.bres
 ;LDR r0,bres_dir                      \� !bres_dir=up% �
 &CMP r0,#up%
 0:LDREQ rvert,btm_vert                 \ vert%=!btm_vert
 :+                                     \�
 D:LDRNE rvert,top_vert                 \ vert%=!top_vert
 N+                                     \�
 X<LDR r0,edge_no                       \� !edge_no=left% �
 bCMP r0,#left%
 l=LDREQ rx_buf,left_sxbuf              \ x_buf%=!left_sxbuf
 v+                                     \�
 �>LDRNE rx_buf,right_sxbuf             \ x_buf%=!right_sxbuf
 �+                                     \�
 �+.bres_repeat1                        \�
 �7LDR r0,n_verts                       \ r0%=!n_verts
 �@LDR r1,bres_ang_dir                  \ � !bres_ang_dir=cw% �
 �CMP r1,#cw%
 �>ADDEQ rnext_vert,rvert,#1            \  next_vert%=vert%+1
 �,                                     \ �
 �>SUBNE rnext_vert,rvert,#1            \  next_vert%=vert%-1
 �,                                     \ �
 �>CMP rnext_vert,#0                    \ � next_vert%<0 �...
 �=SUBLT rnext_vert,r0,#1               \...next_vert%=r0%-1
 �?CMP rnext_vert,r0                    \ � next_vert%>=r0%...
!;MOVGE rnext_vert,#0                  \...� next_vert%=0
!7LDR r0,poly_sx                       \ r0%=!poly_sx
!=LDR rx1,[r0,rvert,LSL#2]             \ x1%=r0%!(vert%<<2)
! 7LDR r0,poly_sy                       \ r0%=!poly_sy
!*=LDR ry1,[r0,rvert,LSL#2]             \ y1%=r0%!(vert%<<2)
!47LDR r0,poly_sx                       \ r0%=!poly_sx
!>NLDR r1,[r0,rnext_vert,LSL#2]         \ x2%=r0%!(next_vert%<<2)  (r1 is x2)
!HSTR r1,bres_x2
!R7LDR r0,poly_sy                       \ r0%=!poly_sy
!\NLDR r2,[r0,rnext_vert,LSL#2]         \ y2%=r0%!(next_vert%<<2)  (r2 is y2)
!fSTR r2,bres_y2
!p9SUB rdx,r1,rx1                       \ dx%=�(x2%-x1%)
!zCMP rdx,#0
!�RSBLT rdx,rdx,#0
!�9SUB rdy,r2,ry1                       \ dy%=�(y2%-y1%)
!�CMP rdy,#0
!�RSBLT rdy,rdy,#0
!�9CMP r1,rx1                           \ sx%=�(x2%-x1%)
!�MOVGT rsx,#1
!�
�Q rsx,#0
!�MVNLT rsx,#0
!�9CMP r2,ry1                           \ sy%=�(y2%-y1%)
!�MOVGT rsy,#1
!�
�Q rsy,#0
!�MVNLT rsy,#0
!�6CMP rdx,rdy                          \ � dx%>dy% �
"BLE bres_else1
"8MOV re,rdy,ASL#1                     \  e%=dy%*2-dx%
"SUB re,re,rdx
"$-.bres_repeat2                        \  �
".5CMP re,#0                            \   � e%>0 �
"8BLE bres_else2
"B;CMP ry1,#0                           \    � y1%>=0 �...
"LBLT bres_endif3
"V:CMP ry1,#480                         \    ...y1%<480 �
"`BSTRLT rx1,[rx_buf,ry1,LSL#2]         \     x_buf%!(y1%<<2)=x1%
"j/.bres_endif3                         \    �
"t6ADD ry1,ry1,rsy                      \    y1%+=sy%
"~=SUB r0,rdy,rdx                       \    e%+=(dy%-dx%)*2
"�ADD re,re,r0,ASL#1
"�B bres_endif2
"�..bres_else2                          \   �
"�7ADD re,re,rdy,ASL#1                  \    e%+=dy%*2
"�..bres_endif2                         \   �
"�5ADD rx1,rx1,rsx                      \   x1%+=sx%
"�5LDR r0,bres_x2                       \  � x1%=x2%
"�CMP rx1,r0
"�BNE bres_repeat2
"�B bres_endif1
"�,.bres_else1                          \ �
"�8MOV re,rdx,ASL#1                     \  e%=dx%*2-dy%
#SUB re,re,rdy
#
-.bres_repeat3                        \  �
#8CMP ry1,#0                           \   � y1%>=0...
#BLT bres_endif4
#(;CMP ry1,#480                         \   ...� y1%<480 �
#2ASTRLT rx1,[rx_buf,ry1,LSL#2]         \    x_buf%!(y1%<<2)=x1%
#<..bres_endif4                         \   �
#F5CMP re,#0                            \   � e%>0 �
#P6ADDGT rx1,rx1,rsx                    \    x1%+=sx%
#Z=SUBGT r0,rdx,rdy                     \    e%+=(dx%-dy%)*2
#dADDGT re,re,r0,LSL#1
#n.                                     \   �
#x7ADDLE re,re,rdx,LSL#1                \    e%+=dx%*2
#�.                                     \   �
#�5ADD ry1,ry1,rsy                      \   y1%+=sy%
#�5LDR r0,bres_y2                       \  � y1%=y2%
#�CMP ry1,r0
#�BNE bres_repeat3
#�,.bres_endif1                         \ �
#�6CMP ry1,#0                           \ � y1%>=0...
#�BLT bres_endif5
#�9CMP ry1,#480                         \ ...� y1%<480 �
#�?STRLT rx1,[rx_buf,ry1,LSL#2]         \  x_buf%!(y1%<<2)=x1%
#�,.bres_endif5                         \ �
#�;MOV rvert,rnext_vert                 \ vert%=next_vert%
#�0MOV r0,#0                            \ r0%=0
$<LDR r1,bres_dir                      \ � !bres_dir=up% �
$CMP r1,#up%
$BNE bres_endif6
$"<CMP ry1,#0                           \  � y1%<=0 � r0%=1
$,MOVLE r0,#1
$6ELDR r2,top_vert                      \  � vert%=!top_vert � r0%=1
$@CMP rvert,r2
$J�Q r0,#1
$T,.bres_endif6                         \ �
$^ICMP r1,#down%                        \ � !bres_dir=down% � (still r1)
$hBNE bres_endif7
$r>CMP ry1,#480                         \  � y1%>=480 � r0%=1
$|MOVGE r0,#1
$�ELDR r2,btm_vert                      \  � vert%=!btm_vert � r0%=1
$�CMP rvert,r2
$��Q r0,#1
$�,.bres_endif7                         \ �
$�1CMP r0,#1                            \� r0%=1
$�BNE bres_repeat1
$�+MOV PC,rlink                         \�
$�]
$�
$�!� - Registers for fill_poly -
$�
$�� - Params for hline -
$�	rx1=1
%	rx2=2
%ry=3
%
rcolour=4
%&� - Vars -
%0	ry1=5
%:	ry2=6
%Drleft_sxbuf=7
%Nrright_sxbuf=8
%Xrlink=14
%b
%l[OPT pass%
%v.fill_poly
%�ALDR rleft_sxbuf,left_sxbuf           \left_sxbuf%=!left_sxbuf
%�CLDR rright_sxbuf,right_sxbuf         \right_sxbuf%=!right_sxbuf
%�8LDR rcolour,poly_colour              \� !poly_colour
%�5LDR ry1,top_sy                       \y1%=!top_sy
%�5LDR ry2,btm_sy                       \y2%=!btm_sy
%�8MOV ry,ry1                           \� y%=y1% � y2%
%�.fill_poly_loop1
%�E                                     \ - Get and clip line ends -
%�BLDR rx1,[rleft_sxbuf,ry,LSL#2]       \ x1%=left_sxbuf%!(y%<<2)
%�ACMP rx1,#640                         \ � x1%>=640 � go next y
%�BGE fill_poly_next1
%�:CMP rx1,#0                           \ � x1%<0 � x1%=0
%�MOVLT rx1,#0
&CLDR rx2,[rright_sxbuf,ry,LSL#2]      \ x2%=right_sxbuf%!(y%<<2)
&>CMP rx2,#0                           \ � x2%<0 � go next y
&BLT fill_poly_next1
& ?CMP rx2,#640                         \ � x2%>=640 � x2%=639
&*MOVGE rx2,#640
&4SUBGE rx2,rx2,#1
&>8                                     \ - Draw line -
&H=STMFD r13 !,{r3-r8,rlink}            \ �hline(x1%,x2%,y%)
&R
 BL hline
&\LDMFD r13 !,{r3-r8,rlink}
&f..fill_poly_next1                     \� y%
&pADD ry,ry,#1
&zCMP ry,ry2
&�BLE fill_poly_loop1
&�+MOV PC,rlink                         \�
&�]
&�
&�� - Registers for hline -
&�
&�� - Input params -
&�.rx1=1         :� left end of line (pixels)
&�rx2=2         :� right do.
&�5ry=3          :� y (pixels) form bottom of screen
&�rcolour=4     :� 0..15
&�
&�� - Vars -
';rbase=5       :� base addr (top-left) of current screen
'Brword1=6      :� addr of word containing x1 (relative to base)
'rword2=7      :� do. x2
'$'rwordcont=8   :� contents of a word
'.7rmask1=9      :� mask for point or left end of line
'8/rmask2=10     :� mask for right end of line
'B4rinvmask=11   :� logical inverse of current mask
'L
'V[OPT pass%
'`2.hline  \ Draw a horizontal line (zaps r1-r11)
'j4\ Mode 27 - 80 words per line, 8 pixels per word
't6\ x1 in r1, x2 in r2, y in r3, colour (0-15) in r4
'~ \ 4 cases - 1, x1=x2 (point)
'�%\           2, x1,x2 in same word
'�*\           3, x1,x2 in adjacent words
'�.\           4, x1,x2 in non_adjacent words
'�
'�?ADR r0,colour_table                  \start of colour table
'�;LDR rcolour,[r0,rcolour,LSL#2]       \32 bits of colour
'�
'�CMP rx1,rx2
'�LBEQ point                            \if x1=x2 then plot a point at x1,y
'�
'�JLDR r0,scr_no                        \screen 1 or screen 2 for display
'�
CMP r0,#1
(LDREQ rbase,scr_base1
(
ELDRNE rbase,scr_base2                \base addr of current screen
(
(4MOV r0,ry,LSL#6                      \y times 64
((HADD r0,r0,ry,LSL#4                   \plus y times 16 (= y times 80)
(2KADD rword1,r0,rx1,LSR#3              \plus x div 8 - word containing x1
(<0ADD rword2,r0,rx2,LSR#3              \do. x2
(F
(PCMP rword1,rword2
(Z@BEQ shortline                        \x1 and x2 in same word
(d
(n)\Draw left end (part-word) of line...
(x
(�GLDR rwordcont,[rbase,rword1,LSL#2]   \get contents of left end word
(�=� r0,rx1,#%111                     \r0 is pixel no � %111
(�BADR rmask1,left_masks                \start of left mask table
(�5LDR rmask1,[rmask1,r0,LSL#2]         \32-bit mask
(�6MVN rinvmask,rmask1                  \inverse mask
(�3� r0,rcolour,rinvmask              \colour mask
(�9� rwordcont,rwordcont,rmask1       \mask out line seg
(�E�R rwordcont,rwordcont,r0           \replace line seg with colour
(�=STR rwordcont,[rbase,rword1,LSL#2]   \store modified word
(�
(�*\Draw right end (part-word) of line...
(�
(�HLDR rwordcont,[rbase,rword2,LSL#2]   \get contents of right end word
)=� r0,rx2,#%111                     \r0 is pixel no � %111
)CADR rmask2,right_masks               \start of right mask table
)5LDR rmask2,[rmask2,r0,LSL#2]         \32-bit mask
)"6MVN rinvmask,rmask2                  \inverse mask
),3� r0,rcolour,rinvmask              \colour mask
)69� rwordcont,rwordcont,rmask2       \mask out line seg
)@E�R rwordcont,rwordcont,r0           \replace line seg with colour
)J=STR rwordcont,[rbase,rword2,LSL#2]   \store modified word
)T
)^MOV rword1,rword1,LSL#2
)hCADD rword1,rword1,rbase              \left end absolute address
)rMOV rword2,rword2,LSL#2
)|7ADD rword2,rword2,rbase              \right end do.
)�=SUB r0,rword2,rword1                 \line length (bytes)
)�
)�
CMP r0,#4
)�DMOVLE PC,rlink                       \quit if end words adjacent
)�
)�)\Draw middle (whole words) of line...
)�
)�MRSB r0,r0,#320                       \size of STR block minus line length
)�JADD r15,r15,r0                       \skip appropriate number of STR's
)�]
)�
)�C� I%=1 � 80                       :� 80 of these (320 bytes)...
)�DZ%=�store(pass%)                    :� STR rcolour,[rword1,#4] !
*B�                                 :� ...to avoid loop overhead
*
*[OPT pass%
*&
*0=MOV PC,rlink                         \quit long line case
*:
*D.point    \ Plot point x1,y
*N
*XJLDR r0,scr_no                        \screen 1 or screen 2 for display
*b
CMP r0,#1
*lLDREQ rbase,scr_base1
*vELDRNE rbase,scr_base2                \base addr of current screen
*�
*�4MOV rword1,ry,LSL#6                  \y times 64
*�9ADD rword1,rword1,ry,LSL#4           \plus y times 16
*�KADD rword1,rword1,rx1,LSR#3          \plus x1 div 8 - word y*80+(x � 8)
*�
*�>LDR rwordcont,[rbase,rword1,LSL#2]   \get contents of word
*�=� r0,rx1,#%111                     \r0 is pixel no � %111
*�=ADR rmask1,point_masks               \start of mask table
*�MLDR rmask1,[rmask1,r0,LSL#2]         \32-bit mask  - %0000 at pixel pos'n
*�MMVN rinvmask,rmask1                  \inverse mask - %1111 at pixel pos'n
*�L� r0,rcolour,rinvmask              \mask has 4-bit colour at pixel pos'n
*�6� rwordcont,rwordcont,rmask1       \mask out pixel
*�B�R rwordcont,rwordcont,r0           \replace pixel with colour
+=STR rwordcont,[rbase,rword1,LSL#2]   \store modified word
+
+9MOV PC,rlink                         \quit point case
+ 
+*=.shortline \ Draw a line where x1 and x2 are in same word
+4
+>>LDR rwordcont,[rbase,rword1,LSL#2]   \get contents of word
+H=� r0,rx1,#%111                     \r0 is pixel no � %111
+RADR rmask1,left_masks
+\@LDR rmask1,[rmask1,r0,LSL#2]         \32-bit mask - left end
+f
+p=� r0,rx2,#%111                     \r0 is pixel no � %111
+zADR rmask2,right_masks
+�ALDR rmask2,[rmask2,r0,LSL#2]         \32-bit mask - right end
+�
+�6�R rmask1,rmask1,rmask2             \combined mask
+�
+�6MVN rinvmask,rmask1                  \inverse mask
+�3� r0,rcolour,rinvmask              \colour mask
+�9� rwordcont,rwordcont,rmask1       \mask out line seg
+�E�R rwordcont,rwordcont,r0           \replace line seg with colour
+�=STR rwordcont,[rbase,rword1,LSL#2]   \store modified word
+�
+�>MOV PC,rlink                         \quit short line case
+�
+�F.scr_no        EQUD 1                \current screen bank (1 or 2)
,:.scr_base1     EQUD �saddr(pass%,1) \address of bank 1
,:.scr_base2     EQUD �saddr(pass%,2) \address of bank 2
,A.scr_base      EQUD !scr_base1       \address of current bank
,$L.colour_table  EQUD &00000000        \32-bit versions of mode 27 colours
,.!               EQUD &11111111
,8!               EQUD &22222222
,B!               EQUD &33333333
,L!               EQUD &44444444
,V!               EQUD &55555555
,`!               EQUD &66666666
,j!               EQUD &77777777
,t!               EQUD &88888888
,~!               EQUD &99999999
,�!               EQUD &AAAAAAAA
,�!               EQUD &BBBBBBBB
,�!               EQUD &CCCCCCCC
,�!               EQUD &DDDDDDDD
,�!               EQUD &EEEEEEEE
,�!               EQUD &FFFFFFFF
,�@.point_masks   EQUD &FFFFFFF0        \pixel position in word
,�!               EQUD &FFFFFF0F
,�!               EQUD &FFFFF0FF
,�!               EQUD &FFFF0FFF
,�!               EQUD &FFF0FFFF
,�!               EQUD &FF0FFFFF
-!               EQUD &F0FFFFFF
-
!               EQUD &0FFFFFFF
-A.left_masks    EQUD &00000000        \line starts within word
-!               EQUD &0000000F
-(!               EQUD &000000FF
-2!               EQUD &00000FFF
-<!               EQUD &0000FFFF
-F!               EQUD &000FFFFF
-P!               EQUD &00FFFFFF
-Z!               EQUD &0FFFFFFF
-d?.right_masks   EQUD &FFFFFFF0        \line ends within word
-n!               EQUD &FFFFFF00
-x!               EQUD &FFFFF000
-�!               EQUD &FFFF0000
-�!               EQUD &FFF00000
-�!               EQUD &FF000000
-�!               EQUD &F0000000
-�!               EQUD &00000000
-�\ - Track buffer -
-�.buf_wx        EQUD buf_wx%
-�.buf_wy        EQUD buf_wy%
-�.buf_wz        EQUD buf_wz%
-� .buf_wax       EQUD buf_wax%
-� .buf_way       EQUD buf_way%
-� .buf_waz       EQUD buf_waz%
-� .buf_col       EQUD buf_col%
.3\ - Screen co-ord arrays for polygon vertices -
..sx0           EQUD sx0%
..sx1           EQUD sx1%
.".sx2           EQUD sx2%
.,.sx3           EQUD sx3%
.6.sy0           EQUD sy0%
.@.sy1           EQUD sy1%
.J.sy2           EQUD sy2%
.T.sy3           EQUD sy3%
.^.sz0           EQUD sz0%
.h.sz1           EQUD sz1%
.r.sz2           EQUD sz2%
.|.sz3           EQUD sz3%
.�\ - Track -
.�.trk_wx        EQUD trk_wx%
.�.trk_wy        EQUD trk_wy%
.�.trk_wz        EQUD trk_wz%
.� .trk_wax       EQUD trk_wax%
.� .trk_way       EQUD trk_way%
.� .trk_waz       EQUD trk_waz%
.� .seg_rad       EQUD seg_rad%
.�\ - Observer -
.�.obs_wx        EQUD obs_wx%
.�.obs_wy        EQUD obs_wy%
.�.obs_wz        EQUD obs_wz%
.� .obs_wax       EQUD obs_wax%
/ .obs_way       EQUD obs_way%
/ .obs_waz       EQUD obs_waz%
/.scale         EQUD scale%
/&\ - Buffer pointers -
/0.new_ptr       EQUD 0
/:.view_ptr      EQUD 0
/D.obs_ptr       EQUD 0
/N\ - Track details -
/X.step_count    EQUD 0
/b .seg_len       EQUD seg_len%
/l .trk_dir       EQUD trk_dir%
/v.trk_ptr       EQUD 0
/�.step_dir      EQUD 0
/�
/�/\ - Screen description of current polygon -
/�:.n_verts       EQUD 0                  \no of vertices
/�:.poly_colour   EQUD 0                  \polygon colour
/�H.poly_sx       EQUD poly_sx%           \screen co-ods of vertices...
/� .poly_sy       EQUD poly_sy%
/� .poly_sz       EQUD poly_sz%
/�!.sort_key      EQUD sort_key%
/�.sin8          EQUD sin8%
/�.cos8          EQUD cos8%
/�@.top_vert      EQUD 0                  \bounding vertices...
/�.btm_vert      EQUD 0
0.left_vert     EQUD 0
0.right_vert    EQUD 0
0N.top_sy        EQUD 0                  \screen xy of poly bounding rect...
0 .btm_sy        EQUD 0
0*.left_sx       EQUD 0
04.right_sx      EQUD 0
0>I.left_sxbuf    EQUD left_sxbuf%        \x co-ords of l and r sides...
0H$.right_sxbuf   EQUD right_sxbuf%
0RM.bres_dir      EQUD 0                  \Bresenham direction, 0=up, 1=down
0\H.bres_ang_dir  EQUD 0                  \do. angular dir, 0=cw, 1=acw
0fM.edge_no       EQUD 0                  \do. polygon edge, 0=left, 1=right
0pM.skip_poly     EQUD 0                  \flag - set if all poly off screen
0z\\\ misc \\\
0�0.bres_x2       EQUD 0                  \temp
0�0.bres_y2       EQUD 0                  \temp
0�]
0�� pass%
0��
0�
0�� �store(pass%)
0�[OPT pass%
0� STR rcolour,[rword1,#4] !
0�]
0�=0
0�
0�� �saddr(pass%,screen%)
1� b%
1� pass%>0 �
1 � b% 8
1$ !b%=149
1. b%!4=-1
18 Ȏ screen% �
1B	  � 1
1L   *FX112,1
1V   *FX113,1
1`	  � 2
1j   *FX112,2
1t   *FX113,2
1~ �
1�# ș "OS_ReadVduVariables",b%,b%
1�
 *FX112,1
1�
 *FX113,1
1��
1�=!b%
�
00000000  0d 00 0a 1b f4 20 3e 20  3c 54 75 6e 6e 65 6c 24  |..... > <Tunnel$|
00000010  44 69 72 3e 2e 54 75 6e  6e 65 6c 0d 00 14 3f f4  |Dir>.Tunnel...?.|
00000020  20 52 61 79 20 54 61 79  6c 6f 72 2c 20 34 38 20  | Ray Taylor, 48 |
00000030  57 65 73 74 20 44 72 69  76 65 2c 20 48 61 6e 64  |West Drive, Hand|
00000040  73 77 6f 72 74 68 2c 20  42 69 72 6d 69 6e 67 68  |sworth, Birmingh|
00000050  61 6d 20 42 32 30 20 33  53 55 0d 00 1e 1e ee 20  |am B20 3SU..... |
00000060  85 20 eb 20 30 3a f1 f6  24 22 20 61 74 20 6c 69  |. . 0:..$" at li|
00000070  6e 65 20 22 3b 9e 3a e0  0d 00 28 08 eb 20 32 37  |ne ";.:...(.. 27|
00000080  0d 00 32 11 f2 69 6e 69  74 5f 70 61 6c 65 74 74  |..2..init_palett|
00000090  65 0d 00 3c 0b f2 74 61  62 6c 65 73 0d 00 46 0e  |e..<..tables..F.|
000000a0  f2 69 6e 69 74 5f 64 61  74 61 0d 00 50 0f f2 69  |.init_data..P..i|
000000b0  6e 69 74 5f 74 72 61 63  6b 0d 00 5a 08 f2 61 73  |nit_track..Z..as|
000000c0  6d 0d 00 64 10 f2 69 6e  69 74 5f 62 75 66 66 65  |m..d..init_buffe|
000000d0  72 0d 00 6e 10 f2 73 77  61 70 5f 73 63 72 65 65  |r..n..swap_scree|
000000e0  6e 0d 00 78 05 f5 0d 00  82 11 20 f2 73 77 61 70  |n..x...... .swap|
000000f0  5f 73 63 72 65 65 6e 0d  00 8c 10 20 d6 20 74 72  |_screen.... . tr|
00000100  61 6e 73 66 6f 72 6d 0d  00 96 0b 20 d6 20 64 72  |ansform.... . dr|
00000110  61 77 0d 00 a0 0a 20 f2  73 74 65 70 0d 00 aa 07  |aw.... .step....|
00000120  fd 20 30 0d 00 b4 05 e0  0d 00 be 04 0d 00 c8 29  |. 0............)|
00000130  dd 20 f2 72 6f 74 61 74  65 28 f8 20 78 25 2c f8  |. .rotate(. x%,.|
00000140  20 79 25 2c f8 20 7a 25  2c 61 78 25 2c 61 79 25  | y%,. z%,ax%,ay%|
00000150  2c 61 7a 25 29 0d 00 d2  1d ea 20 78 31 25 2c 79  |,az%)..... x1%,y|
00000160  31 25 2c 7a 31 25 2c 78  32 25 2c 79 32 25 2c 7a  |1%,z1%,x2%,y2%,z|
00000170  32 25 0d 00 dc 21 f4 20  2d 2d 2d 20 52 6f 74 61  |2%...!. --- Rota|
00000180  74 65 20 61 62 6f 75 74  20 78 20 61 78 69 73 20  |te about x axis |
00000190  2d 2d 2d 0d 00 e6 0a 78  31 25 3d 78 25 0d 00 f0  |---....x1%=x%...|
000001a0  32 79 31 25 3d 28 79 25  2a 63 6f 73 38 25 21 28  |2y1%=(y%*cos8%!(|
000001b0  61 78 25 3c 3c 32 29 2d  28 7a 25 2a 73 69 6e 38  |ax%<<2)-(z%*sin8|
000001c0  25 21 28 61 78 25 3c 3c  32 29 29 29 3e 3e 38 0d  |%!(ax%<<2)))>>8.|
000001d0  00 fa 32 7a 31 25 3d 28  79 25 2a 73 69 6e 38 25  |..2z1%=(y%*sin8%|
000001e0  21 28 61 78 25 3c 3c 32  29 2b 28 7a 25 2a 63 6f  |!(ax%<<2)+(z%*co|
000001f0  73 38 25 21 28 61 78 25  3c 3c 32 29 29 29 3e 3e  |s8%!(ax%<<2)))>>|
00000200  38 0d 01 04 21 f4 20 2d  2d 2d 20 52 6f 74 61 74  |8...!. --- Rotat|
00000210  65 20 61 62 6f 75 74 20  79 20 61 78 69 73 20 2d  |e about y axis -|
00000220  2d 2d 0d 01 0e 34 78 32  25 3d 28 78 31 25 2a 63  |--...4x2%=(x1%*c|
00000230  6f 73 38 25 21 28 61 79  25 3c 3c 32 29 2b 28 7a  |os8%!(ay%<<2)+(z|
00000240  31 25 2a 73 69 6e 38 25  21 28 61 79 25 3c 3c 32  |1%*sin8%!(ay%<<2|
00000250  29 29 29 3e 3e 38 0d 01  18 0b 79 32 25 3d 79 31  |)))>>8....y2%=y1|
00000260  25 0d 01 22 34 7a 32 25  3d 28 7a 31 25 2a 63 6f  |%.."4z2%=(z1%*co|
00000270  73 38 25 21 28 61 79 25  3c 3c 32 29 2d 28 78 31  |s8%!(ay%<<2)-(x1|
00000280  25 2a 73 69 6e 38 25 21  28 61 79 25 3c 3c 32 29  |%*sin8%!(ay%<<2)|
00000290  29 29 3e 3e 38 0d 01 2c  21 f4 20 2d 2d 2d 20 52  |))>>8..,!. --- R|
000002a0  6f 74 61 74 65 20 61 62  6f 75 74 20 7a 20 61 78  |otate about z ax|
000002b0  69 73 20 2d 2d 2d 0d 01  36 33 78 25 3d 28 78 32  |is ---..63x%=(x2|
000002c0  25 2a 63 6f 73 38 25 21  28 61 7a 25 3c 3c 32 29  |%*cos8%!(az%<<2)|
000002d0  2d 28 79 32 25 2a 73 69  6e 38 25 21 28 61 7a 25  |-(y2%*sin8%!(az%|
000002e0  3c 3c 32 29 29 29 3e 3e  38 0d 01 40 33 79 25 3d  |<<2)))>>8..@3y%=|
000002f0  28 78 32 25 2a 73 69 6e  38 25 21 28 61 7a 25 3c  |(x2%*sin8%!(az%<|
00000300  3c 32 29 2b 28 79 32 25  2a 63 6f 73 38 25 21 28  |<2)+(y2%*cos8%!(|
00000310  61 7a 25 3c 3c 32 29 29  29 3e 3e 38 0d 01 4a 0a  |az%<<2)))>>8..J.|
00000320  7a 25 3d 7a 32 25 0d 01  54 05 e1 0d 01 5e 04 0d  |z%=z2%..T....^..|
00000330  01 68 0b dd 20 f2 73 74  65 70 0d 01 72 38 ea 20  |.h.. .step..r8. |
00000340  70 74 72 25 2c 64 78 25  2c 64 79 25 2c 64 7a 25  |ptr%,dx%,dy%,dz%|
00000350  2c 73 74 65 70 5f 64 69  72 25 2c 77 78 25 2c 77  |,step_dir%,wx%,w|
00000360  79 25 2c 77 7a 25 2c 61  78 25 2c 61 79 25 2c 61  |y%,wz%,ax%,ay%,a|
00000370  7a 25 0d 01 7c 3f f4 20  2d 2d 20 47 65 6e 65 72  |z%..|?. -- Gener|
00000380  61 74 65 20 63 6f 2d 6f  72 64 20 69 6e 63 72 65  |ate co-ord incre|
00000390  6d 65 6e 74 73 20 66 6f  72 20 61 20 6e 65 77 20  |ments for a new |
000003a0  73 74 65 70 2c 20 64 78  2c 64 79 2c 64 7a 20 2d  |step, dx,dy,dz -|
000003b0  2d 0d 01 86 09 64 78 25  3d 30 0d 01 90 11 64 79  |-....dx%=0....dy|
000003c0  25 3d 74 72 6b 5f 73 74  65 70 25 0d 01 9a 09 64  |%=trk_step%....d|
000003d0  7a 25 3d 30 0d 01 a4 10  61 78 25 3d 21 74 72 6b  |z%=0....ax%=!trk|
000003e0  5f 77 61 78 0d 01 ae 10  61 79 25 3d 21 74 72 6b  |_wax....ay%=!trk|
000003f0  5f 77 61 79 0d 01 b8 10  61 7a 25 3d 21 74 72 6b  |_way....az%=!trk|
00000400  5f 77 61 7a 0d 01 c2 24  f2 72 6f 74 61 74 65 28  |_waz...$.rotate(|
00000410  64 78 25 2c 64 79 25 2c  64 7a 25 2c 61 78 25 2c  |dx%,dy%,dz%,ax%,|
00000420  61 79 25 2c 61 7a 25 29  0d 01 cc 37 f4 20 2d 2d  |ay%,az%)...7. --|
00000430  20 47 65 74 20 63 6f 5f  6f 72 64 73 20 6f 66 20  | Get co_ords of |
00000440  66 75 72 74 68 65 73 74  20 6f 6c 64 20 73 74 65  |furthest old ste|
00000450  70 2c 20 77 78 2c 77 79  2c 77 7a 20 20 2d 2d 0d  |p, wx,wy,wz  --.|
00000460  01 d6 11 70 74 72 25 3d  21 6e 65 77 5f 70 74 72  |...ptr%=!new_ptr|
00000470  0d 01 e0 19 77 78 25 3d  62 75 66 5f 77 78 25 21  |....wx%=buf_wx%!|
00000480  28 70 74 72 25 3c 3c 32  29 0d 01 ea 19 77 79 25  |(ptr%<<2)....wy%|
00000490  3d 62 75 66 5f 77 79 25  21 28 70 74 72 25 3c 3c  |=buf_wy%!(ptr%<<|
000004a0  32 29 0d 01 f4 19 77 7a  25 3d 62 75 66 5f 77 7a  |2)....wz%=buf_wz|
000004b0  25 21 28 70 74 72 25 3c  3c 32 29 0d 01 fe 20 f4  |%!(ptr%<<2)... .|
000004c0  20 2d 2d 20 42 75 6d 70  20 62 75 66 66 65 72 20  | -- Bump buffer |
000004d0  70 6f 69 6e 74 65 72 73  20 2d 2d 0d 02 08 0b 70  |pointers --....p|
000004e0  74 72 25 2b 3d 31 0d 02  12 1c e7 20 70 74 72 25  |tr%+=1..... ptr%|
000004f0  3e 6d 61 78 5f 70 74 72  25 20 8c 20 70 74 72 25  |>max_ptr% . ptr%|
00000500  3d 30 0d 02 1c 11 21 6e  65 77 5f 70 74 72 3d 70  |=0....!new_ptr=p|
00000510  74 72 25 0d 02 26 11 70  74 72 25 3d 21 6f 62 73  |tr%..&.ptr%=!obs|
00000520  5f 70 74 72 0d 02 30 0b  70 74 72 25 2b 3d 31 0d  |_ptr..0.ptr%+=1.|
00000530  02 3a 1c e7 20 70 74 72  25 3e 6d 61 78 5f 70 74  |.:.. ptr%>max_pt|
00000540  72 25 20 8c 20 70 74 72  25 3d 30 0d 02 44 11 21  |r% . ptr%=0..D.!|
00000550  6f 62 73 5f 70 74 72 3d  70 74 72 25 0d 02 4e 12  |obs_ptr=ptr%..N.|
00000560  70 74 72 25 3d 21 76 69  65 77 5f 70 74 72 0d 02  |ptr%=!view_ptr..|
00000570  58 0b 70 74 72 25 2b 3d  31 0d 02 62 1c e7 20 70  |X.ptr%+=1..b.. p|
00000580  74 72 25 3e 6d 61 78 5f  70 74 72 25 20 8c 20 70  |tr%>max_ptr% . p|
00000590  74 72 25 3d 30 0d 02 6c  12 21 76 69 65 77 5f 70  |tr%=0..l.!view_p|
000005a0  74 72 3d 70 74 72 25 0d  02 76 3d f4 20 2d 2d 20  |tr=ptr%..v=. -- |
000005b0  41 64 64 20 69 6e 63 72  65 6d 65 6e 74 20 74 6f  |Add increment to|
000005c0  20 6f 6c 64 20 73 74 65  70 20 63 6f 2d 6f 72 64  | old step co-ord|
000005d0  73 20 74 6f 20 67 65 74  20 6e 65 77 20 73 74 65  |s to get new ste|
000005e0  70 20 2d 2d 0d 02 80 11  70 74 72 25 3d 21 6e 65  |p --....ptr%=!ne|
000005f0  77 5f 70 74 72 0d 02 8a  1d 62 75 66 5f 77 78 25  |w_ptr....buf_wx%|
00000600  21 28 70 74 72 25 3c 3c  32 29 3d 77 78 25 2b 64  |!(ptr%<<2)=wx%+d|
00000610  78 25 0d 02 94 1d 62 75  66 5f 77 79 25 21 28 70  |x%....buf_wy%!(p|
00000620  74 72 25 3c 3c 32 29 3d  77 79 25 2b 64 79 25 0d  |tr%<<2)=wy%+dy%.|
00000630  02 9e 1d 62 75 66 5f 77  7a 25 21 28 70 74 72 25  |...buf_wz%!(ptr%|
00000640  3c 3c 32 29 3d 77 7a 25  2b 64 7a 25 0d 02 a8 21  |<<2)=wz%+dz%...!|
00000650  f4 20 2d 2d 20 44 65 63  72 65 6d 65 6e 74 20 73  |. -- Decrement s|
00000660  74 65 70 73 2d 74 6f 2d  67 6f 20 2d 2d 0d 02 b2  |teps-to-go --...|
00000670  12 21 73 74 65 70 5f 63  6f 75 6e 74 2d 3d 31 0d  |.!step_count-=1.|
00000680  02 bc 43 f4 20 2d 2d 20  49 66 20 6e 6f 20 6d 6f  |..C. -- If no mo|
00000690  72 65 20 73 74 65 70 73  20 69 6e 20 73 65 67 6d  |re steps in segm|
000006a0  65 6e 74 2c 20 67 65 74  20 6e 65 78 74 20 73 65  |ent, get next se|
000006b0  67 6d 65 6e 74 20 63 75  72 76 61 74 75 72 65 20  |gment curvature |
000006c0  2d 2d 0d 02 c6 15 e7 20  21 73 74 65 70 5f 63 6f  |--..... !step_co|
000006d0  75 6e 74 3c 30 20 8c 0d  02 d0 12 20 70 74 72 25  |unt<0 ..... ptr%|
000006e0  3d 21 74 72 6b 5f 70 74  72 0d 02 da 25 20 21 73  |=!trk_ptr...% !s|
000006f0  74 65 70 5f 63 6f 75 6e  74 3d 73 65 67 5f 6c 65  |tep_count=seg_le|
00000700  6e 25 21 28 70 74 72 25  3c 3c 32 29 2d 31 0d 02  |n%!(ptr%<<2)-1..|
00000710  e4 21 20 73 74 65 70 5f  64 69 72 25 3d 74 72 6b  |.! step_dir%=trk|
00000720  5f 64 69 72 25 21 28 70  74 72 25 3c 3c 32 29 0d  |_dir%!(ptr%<<2).|
00000730  02 ee 0c 20 70 74 72 25  2b 3d 31 0d 02 f8 1d 20  |... ptr%+=1.... |
00000740  e7 20 70 74 72 25 3e 74  72 6b 5f 6c 65 6e 25 20  |. ptr%>trk_len% |
00000750  8c 20 70 74 72 25 3d 30  0d 03 02 12 20 21 74 72  |. ptr%=0.... !tr|
00000760  6b 5f 70 74 72 3d 70 74  72 25 0d 03 0c 18 20 21  |k_ptr=ptr%.... !|
00000770  73 74 65 70 5f 64 69 72  3d 73 74 65 70 5f 64 69  |step_dir=step_di|
00000780  72 25 0d 03 16 05 cd 0d  03 20 27 f4 20 2d 2d 20  |r%....... '. -- |
00000790  41 70 70 6c 79 20 63 75  72 76 61 74 75 72 65 20  |Apply curvature |
000007a0  74 6f 20 6e 65 77 20 73  74 65 70 20 2d 2d 0d 03  |to new step --..|
000007b0  2a 17 73 74 65 70 5f 64  69 72 25 3d 21 73 74 65  |*.step_dir%=!ste|
000007c0  70 5f 64 69 72 0d 03 34  12 c8 8e 20 73 74 65 70  |p_dir..4... step|
000007d0  5f 64 69 72 25 20 ca 0d  03 3e 0e 20 c9 20 73 5f  |_dir% ...>. . s_|
000007e0  73 74 65 70 25 0d 03 48  11 20 20 f4 20 4e 6f 20  |step%..H.  . No |
000007f0  61 63 74 69 6f 6e 0d 03  52 0e 20 c9 20 6c 5f 73  |action..R. . l_s|
00000800  74 65 70 25 0d 03 5c 18  20 20 21 74 72 6b 5f 77  |tep%..\.  !trk_w|
00000810  61 7a 2d 3d 74 72 6b 5f  64 61 7a 25 0d 03 66 22  |az-=trk_daz%..f"|
00000820  20 20 e7 20 21 74 72 6b  5f 77 61 7a 3c 30 20 8c  |  . !trk_waz<0 .|
00000830  20 21 74 72 6b 5f 77 61  7a 2b 3d 33 36 30 0d 03  | !trk_waz+=360..|
00000840  70 0e 20 c9 20 72 5f 73  74 65 70 25 0d 03 7a 18  |p. . r_step%..z.|
00000850  20 20 21 74 72 6b 5f 77  61 7a 2b 3d 74 72 6b 5f  |  !trk_waz+=trk_|
00000860  64 61 7a 25 0d 03 84 25  20 20 e7 20 21 74 72 6b  |daz%...%  . !trk|
00000870  5f 77 61 7a 3e 3d 33 36  30 20 8c 20 21 74 72 6b  |_waz>=360 . !trk|
00000880  5f 77 61 7a 2d 3d 33 36  30 0d 03 8e 0e 20 c9 20  |_waz-=360.... . |
00000890  75 5f 73 74 65 70 25 0d  03 98 18 20 20 21 74 72  |u_step%....  !tr|
000008a0  6b 5f 77 61 78 2b 3d 74  72 6b 5f 64 61 78 25 0d  |k_wax+=trk_dax%.|
000008b0  03 a2 25 20 20 e7 20 21  74 72 6b 5f 77 61 78 3e  |..%  . !trk_wax>|
000008c0  3d 33 36 30 20 8c 20 21  74 72 6b 5f 77 61 78 2d  |=360 . !trk_wax-|
000008d0  3d 33 36 30 0d 03 ac 0e  20 c9 20 64 5f 73 74 65  |=360.... . d_ste|
000008e0  70 25 0d 03 b6 18 20 20  21 74 72 6b 5f 77 61 78  |p%....  !trk_wax|
000008f0  2d 3d 74 72 6b 5f 64 61  78 25 0d 03 c0 22 20 20  |-=trk_dax%..."  |
00000900  e7 20 21 74 72 6b 5f 77  61 78 3c 30 20 8c 20 21  |. !trk_wax<0 . !|
00000910  74 72 6b 5f 77 61 78 2b  3d 33 36 30 0d 03 ca 05  |trk_wax+=360....|
00000920  cb 0d 03 d4 45 f4 20 2d  2d 20 54 72 61 6e 73 66  |....E. -- Transf|
00000930  65 72 20 74 72 61 63 6b  20 63 75 72 76 61 74 75  |er track curvatu|
00000940  72 65 20 74 6f 20 6e 65  77 20 73 74 65 70 20 69  |re to new step i|
00000950  6e 20 62 75 66 66 65 72  20 61 74 20 6e 65 77 5f  |n buffer at new_|
00000960  70 74 72 20 2d 2d 0d 03  de 11 70 74 72 25 3d 21  |ptr --....ptr%=!|
00000970  6e 65 77 5f 70 74 72 0d  03 e8 1f 62 75 66 5f 77  |new_ptr....buf_w|
00000980  61 78 25 21 28 70 74 72  25 3c 3c 32 29 3d 21 74  |ax%!(ptr%<<2)=!t|
00000990  72 6b 5f 77 61 78 0d 03  f2 1f 62 75 66 5f 77 61  |rk_wax....buf_wa|
000009a0  79 25 21 28 70 74 72 25  3c 3c 32 29 3d 21 74 72  |y%!(ptr%<<2)=!tr|
000009b0  6b 5f 77 61 79 0d 03 fc  1f 62 75 66 5f 77 61 7a  |k_way....buf_waz|
000009c0  25 21 28 70 74 72 25 3c  3c 32 29 3d 21 74 72 6b  |%!(ptr%<<2)=!trk|
000009d0  5f 77 61 7a 0d 04 06 38  f4 20 2d 2d 20 43 6f 70  |_waz...8. -- Cop|
000009e0  79 20 6f 62 73 65 72 76  65 72 20 63 6f 2d 6f 72  |y observer co-or|
000009f0  64 73 20 66 72 6f 6d 20  62 75 66 66 65 72 20 61  |ds from buffer a|
00000a00  74 20 6f 62 73 5f 70 74  72 20 2d 2d 0d 04 10 11  |t obs_ptr --....|
00000a10  70 74 72 25 3d 21 6f 62  73 5f 70 74 72 0d 04 1a  |ptr%=!obs_ptr...|
00000a20  1d 21 6f 62 73 5f 77 78  3d 62 75 66 5f 77 78 25  |.!obs_wx=buf_wx%|
00000a30  21 28 70 74 72 25 3c 3c  32 29 0d 04 24 1d 21 6f  |!(ptr%<<2)..$.!o|
00000a40  62 73 5f 77 79 3d 62 75  66 5f 77 79 25 21 28 70  |bs_wy=buf_wy%!(p|
00000a50  74 72 25 3c 3c 32 29 0d  04 2e 1d 21 6f 62 73 5f  |tr%<<2)....!obs_|
00000a60  77 7a 3d 62 75 66 5f 77  7a 25 21 28 70 74 72 25  |wz=buf_wz%!(ptr%|
00000a70  3c 3c 32 29 0d 04 38 3c  f4 20 2d 2d 20 43 6f 70  |<<2)..8<. -- Cop|
00000a80  79 20 6f 62 73 65 72 76  65 72 20 6f 72 69 65 6e  |y observer orien|
00000a90  74 61 74 69 6f 6e 20 66  72 6f 6d 20 62 75 66 66  |tation from buff|
00000aa0  65 72 20 61 74 20 6f 62  73 5f 70 74 72 20 2d 2d  |er at obs_ptr --|
00000ab0  0d 04 42 1f 21 6f 62 73  5f 77 61 78 3d 62 75 66  |..B.!obs_wax=buf|
00000ac0  5f 77 61 78 25 21 28 70  74 72 25 3c 3c 32 29 0d  |_wax%!(ptr%<<2).|
00000ad0  04 4c 1f 21 6f 62 73 5f  77 61 79 3d 62 75 66 5f  |.L.!obs_way=buf_|
00000ae0  77 61 79 25 21 28 70 74  72 25 3c 3c 32 29 0d 04  |way%!(ptr%<<2)..|
00000af0  56 1f 21 6f 62 73 5f 77  61 7a 3d 62 75 66 5f 77  |V.!obs_waz=buf_w|
00000b00  61 7a 25 21 28 70 74 72  25 3c 3c 32 29 0d 04 60  |az%!(ptr%<<2)..`|
00000b10  05 e1 0d 04 6a 04 0d 04  74 12 dd 20 f2 73 77 61  |....j...t.. .swa|
00000b20  70 5f 73 63 72 65 65 6e  0d 04 7e 10 c8 8e 20 21  |p_screen..~... !|
00000b30  73 63 72 5f 6e 6f 20 ca  0d 04 88 07 c9 20 31 0d  |scr_no ...... 1.|
00000b40  04 92 0c 2a 46 58 31 31  33 2c 31 0d 04 9c 0f c8  |...*FX113,1.....|
00000b50  96 3a 2a 46 58 31 31 32  2c 32 0d 04 a6 0d 21 73  |.:*FX112,2....!s|
00000b60  63 72 5f 6e 6f 3d 32 0d  04 b0 07 c9 20 32 0d 04  |cr_no=2..... 2..|
00000b70  ba 0c 2a 46 58 31 31 33  2c 32 0d 04 c4 0f c8 96  |..*FX113,2......|
00000b80  3a 2a 46 58 31 31 32 2c  31 0d 04 ce 0d 21 73 63  |:*FX112,1....!sc|
00000b90  72 5f 6e 6f 3d 31 0d 04  d8 05 cb 0d 04 e2 05 db  |r_no=1..........|
00000ba0  0d 04 ec 05 e1 0d 04 f6  04 0d 05 00 0d dd 20 f2  |.............. .|
00000bb0  74 61 62 6c 65 73 0d 05  0a 0b ea 20 61 25 2c 70  |tables..... a%,p|
00000bc0  25 0d 05 14 0a 70 25 3d  32 5e 38 0d 05 1e 1d de  |%....p%=2^8.....|
00000bd0  20 73 69 6e 38 25 20 33  36 30 2a 34 2c 63 6f 73  | sin8% 360*4,cos|
00000be0  38 25 20 33 36 30 2a 34  0d 05 28 10 e3 20 61 25  |8% 360*4..(.. a%|
00000bf0  3d 30 20 b8 20 33 35 39  0d 05 32 1c 20 73 69 6e  |=0 . 359..2. sin|
00000c00  38 25 21 28 61 25 3c 3c  32 29 3d b5 b2 28 61 25  |8%!(a%<<2)=..(a%|
00000c10  29 2a 70 25 0d 05 3c 1c  20 63 6f 73 38 25 21 28  |)*p%..<. cos8%!(|
00000c20  61 25 3c 3c 32 29 3d 9b  b2 28 61 25 29 2a 70 25  |a%<<2)=..(a%)*p%|
00000c30  0d 05 46 08 ed 20 61 25  0d 05 50 05 e1 0d 05 5a  |..F.. a%..P....Z|
00000c40  04 0d 05 64 12 dd 20 f2  69 6e 69 74 5f 62 75 66  |...d.. .init_buf|
00000c50  66 65 72 0d 05 6e 0a ea  20 70 74 72 25 0d 05 78  |fer..n.. ptr%..x|
00000c60  0e 21 6e 65 77 5f 70 74  72 3d 30 0d 05 82 0e 21  |.!new_ptr=0....!|
00000c70  6f 62 73 5f 70 74 72 3d  31 0d 05 8c 0f 21 76 69  |obs_ptr=1....!vi|
00000c80  65 77 5f 70 74 72 3d 32  0d 05 96 17 e3 20 70 74  |ew_ptr=2..... pt|
00000c90  72 25 3d 30 20 b8 20 6d  61 78 5f 70 74 72 25 0d  |r%=0 . max_ptr%.|
00000ca0  05 a0 18 20 62 75 66 5f  77 78 25 21 28 70 74 72  |... buf_wx%!(ptr|
00000cb0  25 3c 3c 32 29 3d 30 0d  05 aa 18 20 62 75 66 5f  |%<<2)=0.... buf_|
00000cc0  77 79 25 21 28 70 74 72  25 3c 3c 32 29 3d 30 0d  |wy%!(ptr%<<2)=0.|
00000cd0  05 b4 18 20 62 75 66 5f  77 7a 25 21 28 70 74 72  |... buf_wz%!(ptr|
00000ce0  25 3c 3c 32 29 3d 30 0d  05 be 19 20 62 75 66 5f  |%<<2)=0.... buf_|
00000cf0  77 61 78 25 21 28 70 74  72 25 3c 3c 32 29 3d 30  |wax%!(ptr%<<2)=0|
00000d00  0d 05 c8 19 20 62 75 66  5f 77 61 79 25 21 28 70  |.... buf_way%!(p|
00000d10  74 72 25 3c 3c 32 29 3d  30 0d 05 d2 19 20 62 75  |tr%<<2)=0.... bu|
00000d20  66 5f 77 61 7a 25 21 28  70 74 72 25 3c 3c 32 29  |f_waz%!(ptr%<<2)|
00000d30  3d 30 0d 05 dc 25 20 62  75 66 5f 63 6f 6c 25 21  |=0...% buf_col%!|
00000d40  28 70 74 72 25 3c 3c 32  29 3d 28 70 74 72 25 20  |(ptr%<<2)=(ptr% |
00000d50  83 20 31 35 29 2b 31 0d  05 e6 0a ed 20 70 74 72  |. 15)+1..... ptr|
00000d60  25 0d 05 f0 17 e3 20 70  74 72 25 3d 30 20 b8 20  |%..... ptr%=0 . |
00000d70  6d 61 78 5f 70 74 72 25  0d 05 fa 0a 20 f2 73 74  |max_ptr%.... .st|
00000d80  65 70 0d 06 04 0a ed 20  70 74 72 25 0d 06 0e 05  |ep..... ptr%....|
00000d90  e1 0d 06 18 04 0d 06 22  13 dd 20 f2 69 6e 69 74  |.......".. .init|
00000da0  5f 70 61 6c 65 74 74 65  0d 06 2c 0e ea 20 63 25  |_palette..,.. c%|
00000db0  2c 76 25 2c 61 25 0d 06  36 0f e3 20 63 25 3d 31  |,v%,a%..6.. c%=1|
00000dc0  20 b8 20 31 35 0d 06 40  11 20 61 25 3d 63 25 2a  | . 15..@. a%=c%*|
00000dd0  33 36 30 2f 31 36 0d 06  4a 14 20 76 25 3d 39 36  |360/16..J. v%=96|
00000de0  2d b5 b2 28 61 25 29 2a  36 34 0d 06 54 11 20 fb  |-..(a%)*64..T. .|
00000df0  20 63 25 2c 76 25 2c 76  25 2c 30 0d 06 5e 08 ed  | c%,v%,v%,0..^..|
00000e00  20 63 25 0d 06 68 05 e1  0d 06 72 04 0d 06 7c 10  | c%..h....r...|.|
00000e10  dd 20 f2 69 6e 69 74 5f  64 61 74 61 0d 06 86 0f  |. .init_data....|
00000e20  6d 61 78 5f 70 74 72 25  3d 33 32 0d 06 90 18 de  |max_ptr%=32.....|
00000e30  20 62 75 66 5f 77 78 25  20 6d 61 78 5f 70 74 72  | buf_wx% max_ptr|
00000e40  25 2a 34 0d 06 9a 18 de  20 62 75 66 5f 77 79 25  |%*4..... buf_wy%|
00000e50  20 6d 61 78 5f 70 74 72  25 2a 34 0d 06 a4 18 de  | max_ptr%*4.....|
00000e60  20 62 75 66 5f 77 7a 25  20 6d 61 78 5f 70 74 72  | buf_wz% max_ptr|
00000e70  25 2a 34 0d 06 ae 19 de  20 62 75 66 5f 77 61 78  |%*4..... buf_wax|
00000e80  25 20 6d 61 78 5f 70 74  72 25 2a 34 0d 06 b8 19  |% max_ptr%*4....|
00000e90  de 20 62 75 66 5f 77 61  79 25 20 6d 61 78 5f 70  |. buf_way% max_p|
00000ea0  74 72 25 2a 34 0d 06 c2  19 de 20 62 75 66 5f 77  |tr%*4..... buf_w|
00000eb0  61 7a 25 20 6d 61 78 5f  70 74 72 25 2a 34 0d 06  |az% max_ptr%*4..|
00000ec0  cc 19 de 20 62 75 66 5f  63 6f 6c 25 20 6d 61 78  |... buf_col% max|
00000ed0  5f 70 74 72 25 2a 34 0d  06 d6 15 de 20 73 78 30  |_ptr%*4..... sx0|
00000ee0  25 20 6d 61 78 5f 70 74  72 25 2a 34 0d 06 e0 15  |% max_ptr%*4....|
00000ef0  de 20 73 78 31 25 20 6d  61 78 5f 70 74 72 25 2a  |. sx1% max_ptr%*|
00000f00  34 0d 06 ea 15 de 20 73  78 32 25 20 6d 61 78 5f  |4..... sx2% max_|
00000f10  70 74 72 25 2a 34 0d 06  f4 15 de 20 73 78 33 25  |ptr%*4..... sx3%|
00000f20  20 6d 61 78 5f 70 74 72  25 2a 34 0d 06 fe 15 de  | max_ptr%*4.....|
00000f30  20 73 79 30 25 20 6d 61  78 5f 70 74 72 25 2a 34  | sy0% max_ptr%*4|
00000f40  0d 07 08 15 de 20 73 79  31 25 20 6d 61 78 5f 70  |..... sy1% max_p|
00000f50  74 72 25 2a 34 0d 07 12  15 de 20 73 79 32 25 20  |tr%*4..... sy2% |
00000f60  6d 61 78 5f 70 74 72 25  2a 34 0d 07 1c 15 de 20  |max_ptr%*4..... |
00000f70  73 79 33 25 20 6d 61 78  5f 70 74 72 25 2a 34 0d  |sy3% max_ptr%*4.|
00000f80  07 26 15 de 20 73 7a 30  25 20 6d 61 78 5f 70 74  |.&.. sz0% max_pt|
00000f90  72 25 2a 34 0d 07 30 15  de 20 73 7a 31 25 20 6d  |r%*4..0.. sz1% m|
00000fa0  61 78 5f 70 74 72 25 2a  34 0d 07 3a 15 de 20 73  |ax_ptr%*4..:.. s|
00000fb0  7a 32 25 20 6d 61 78 5f  70 74 72 25 2a 34 0d 07  |z2% max_ptr%*4..|
00000fc0  44 15 de 20 73 7a 33 25  20 6d 61 78 5f 70 74 72  |D.. sz3% max_ptr|
00000fd0  25 2a 34 0d 07 4e 1a de  20 70 6f 6c 79 5f 73 78  |%*4..N.. poly_sx|
00000fe0  25 20 33 2a 34 20 20 20  20 20 20 20 20 0d 07 58  |% 3*4        ..X|
00000ff0  12 de 20 70 6f 6c 79 5f  73 79 25 20 33 2a 34 0d  |.. poly_sy% 3*4.|
00001000  07 62 12 de 20 70 6f 6c  79 5f 73 7a 25 20 33 2a  |.b.. poly_sz% 3*|
00001010  34 0d 07 6c 13 de 20 73  6f 72 74 5f 6b 65 79 25  |4..l.. sort_key%|
00001020  20 33 2a 34 0d 07 76 1a  de 20 6c 65 66 74 5f 73  | 3*4..v.. left_s|
00001030  78 62 75 66 25 20 34 38  30 2a 34 20 20 20 0d 07  |xbuf% 480*4   ..|
00001040  80 1a de 20 72 69 67 68  74 5f 73 78 62 75 66 25  |... right_sxbuf%|
00001050  20 34 38 30 2a 34 20 20  0d 07 8a 0d 74 72 6b 5f  | 480*4  ....trk_|
00001060  77 78 25 3d 30 0d 07 94  0d 74 72 6b 5f 77 79 25  |wx%=0....trk_wy%|
00001070  3d 30 0d 07 9e 0d 74 72  6b 5f 77 7a 25 3d 30 0d  |=0....trk_wz%=0.|
00001080  07 a8 0e 74 72 6b 5f 77  61 78 25 3d 30 0d 07 b2  |...trk_wax%=0...|
00001090  0e 74 72 6b 5f 77 61 79  25 3d 30 0d 07 bc 0e 74  |.trk_way%=0....t|
000010a0  72 6b 5f 77 61 7a 25 3d  30 0d 07 c6 0d 6f 62 73  |rk_waz%=0....obs|
000010b0  5f 77 78 25 3d 30 0d 07  d0 0d 6f 62 73 5f 77 79  |_wx%=0....obs_wy|
000010c0  25 3d 30 0d 07 da 0d 6f  62 73 5f 77 7a 25 3d 30  |%=0....obs_wz%=0|
000010d0  0d 07 e4 0e 6f 62 73 5f  77 61 78 25 3d 30 0d 07  |....obs_wax%=0..|
000010e0  ee 0e 6f 62 73 5f 77 61  79 25 3d 30 0d 07 f8 0e  |..obs_way%=0....|
000010f0  6f 62 73 5f 77 61 7a 25  3d 30 0d 08 02 0e 74 72  |obs_waz%=0....tr|
00001100  6b 5f 64 61 78 25 3d 31  0d 08 0c 0e 74 72 6b 5f  |k_dax%=1....trk_|
00001110  64 61 79 25 3d 32 0d 08  16 0e 74 72 6b 5f 64 61  |day%=2....trk_da|
00001120  7a 25 3d 31 0d 08 20 11  74 72 6b 5f 73 74 65 70  |z%=1.. .trk_step|
00001130  25 3d 33 32 30 0d 08 2a  10 73 65 67 5f 72 61 64  |%=320..*.seg_rad|
00001140  25 3d 31 30 30 0d 08 34  0f 73 63 61 6c 65 25 3d  |%=100..4.scale%=|
00001150  33 30 30 30 0d 08 3e 05  e1 0d 08 48 04 0d 08 52  |3000..>....H...R|
00001160  11 dd 20 f2 69 6e 69 74  5f 74 72 61 63 6b 0d 08  |.. .init_track..|
00001170  5c 0f ea 20 73 65 67 25  2c 64 69 72 24 0d 08 66  |\.. seg%,dir$..f|
00001180  0d 73 5f 73 74 65 70 25  3d 30 0d 08 70 0d 6c 5f  |.s_step%=0..p.l_|
00001190  73 74 65 70 25 3d 31 0d  08 7a 0d 72 5f 73 74 65  |step%=1..z.r_ste|
000011a0  70 25 3d 32 0d 08 84 0d  75 5f 73 74 65 70 25 3d  |p%=2....u_step%=|
000011b0  33 0d 08 8e 0d 64 5f 73  74 65 70 25 3d 34 0d 08  |3....d_step%=4..|
000011c0  98 08 f7 20 2b 30 0d 08  a2 0e f3 20 74 72 6b 5f  |... +0..... trk_|
000011d0  6c 65 6e 25 0d 08 ac 19  de 20 74 72 6b 5f 64 69  |len%..... trk_di|
000011e0  72 25 20 74 72 6b 5f 6c  65 6e 25 2a 34 0d 08 b6  |r% trk_len%*4...|
000011f0  19 de 20 73 65 67 5f 6c  65 6e 25 20 74 72 6b 5f  |.. seg_len% trk_|
00001200  6c 65 6e 25 2a 34 0d 08  c0 17 e3 20 73 65 67 25  |len%*4..... seg%|
00001210  3d 30 20 b8 20 74 72 6b  5f 6c 65 6e 25 0d 08 ca  |=0 . trk_len%...|
00001220  1e 20 f3 20 73 65 67 5f  6c 65 6e 25 21 28 73 65  |. . seg_len%!(se|
00001230  67 25 3c 3c 32 29 2c 64  69 72 24 0d 08 d4 1f 20  |g%<<2),dir$.... |
00001240  74 72 6b 5f 64 69 72 25  21 28 73 65 67 25 3c 3c  |trk_dir%!(seg%<<|
00001250  32 29 3d a0 28 64 69 72  24 29 0d 08 de 0a ed 20  |2)=.(dir$)..... |
00001260  73 65 67 25 0d 08 e8 0e  74 72 6b 5f 70 74 72 25  |seg%....trk_ptr%|
00001270  3d 30 0d 08 f2 11 73 74  65 70 5f 63 6f 75 6e 74  |=0....step_count|
00001280  25 3d 30 0d 08 fc 05 e1  0d 09 06 04 0d 09 10 08  |%=0.............|
00001290  dc 20 31 38 0d 09 1a 10  dc 20 32 30 2c 73 5f 73  |. 18..... 20,s_s|
000012a0  74 65 70 25 0d 09 24 10  dc 20 31 30 2c 6c 5f 73  |tep%..$.. 10,l_s|
000012b0  74 65 70 25 0d 09 2e 10  dc 20 32 30 2c 72 5f 73  |tep%..... 20,r_s|
000012c0  74 65 70 25 0d 09 38 10  dc 20 31 30 2c 6c 5f 73  |tep%..8.. 10,l_s|
000012d0  74 65 70 25 0d 09 42 0f  dc 20 35 2c 75 5f 73 74  |tep%..B.. 5,u_st|
000012e0  65 70 25 0d 09 4c 10 dc  20 31 30 2c 64 5f 73 74  |ep%..L.. 10,d_st|
000012f0  65 70 25 0d 09 56 0f dc  20 35 2c 75 5f 73 74 65  |ep%..V.. 5,u_ste|
00001300  70 25 0d 09 60 10 dc 20  32 30 2c 73 5f 73 74 65  |p%..`.. 20,s_ste|
00001310  70 25 0d 09 6a 10 dc 20  31 30 2c 64 5f 73 74 65  |p%..j.. 10,d_ste|
00001320  70 25 0d 09 74 10 dc 20  32 30 2c 75 5f 73 74 65  |p%..t.. 20,u_ste|
00001330  70 25 0d 09 7e 10 dc 20  32 30 2c 64 5f 73 74 65  |p%..~.. 20,d_ste|
00001340  70 25 0d 09 88 10 dc 20  31 30 2c 75 5f 73 74 65  |p%..... 10,u_ste|
00001350  70 25 0d 09 92 0f dc 20  34 2c 6c 5f 73 74 65 70  |p%..... 4,l_step|
00001360  25 0d 09 9c 0f dc 20 38  2c 72 5f 73 74 65 70 25  |%..... 8,r_step%|
00001370  0d 09 a6 0f dc 20 38 2c  6c 5f 73 74 65 70 25 0d  |..... 8,l_step%.|
00001380  09 b0 0f dc 20 38 2c 72  5f 73 74 65 70 25 0d 09  |.... 8,r_step%..|
00001390  ba 0f dc 20 34 2c 6c 5f  73 74 65 70 25 0d 09 c4  |... 4,l_step%...|
000013a0  10 dc 20 31 30 2c 64 5f  73 74 65 70 25 0d 09 ce  |.. 10,d_step%...|
000013b0  10 dc 20 31 30 2c 75 5f  73 74 65 70 25 0d 09 d8  |.. 10,u_step%...|
000013c0  04 0d 09 e2 0a dd 20 f2  61 73 6d 0d 09 ec 13 63  |...... .asm....c|
000013d0  6f 64 65 5f 73 69 7a 65  25 3d 34 30 30 30 0d 09  |ode_size%=4000..|
000013e0  f6 16 de 20 63 6f 64 65  25 20 63 6f 64 65 5f 73  |... code% code_s|
000013f0  69 7a 65 25 0d 0a 00 15  e3 20 70 61 73 73 25 3d  |ize%..... pass%=|
00001400  30 20 b8 20 32 20 88 20  32 0d 0a 0a 0c 50 25 3d  |0 . 2 . 2....P%=|
00001410  63 6f 64 65 25 0d 0a 14  04 0d 0a 1e 15 6c 65 66  |code%........lef|
00001420  74 25 3d 30 3a 20 72 69  67 68 74 25 3d 31 0d 0a  |t%=0: right%=1..|
00001430  28 12 75 70 25 3d 30 3a  20 64 6f 77 6e 25 3d 31  |(.up%=0: down%=1|
00001440  0d 0a 32 11 63 77 25 3d  30 3a 20 61 63 77 25 3d  |..2.cw%=0: acw%=|
00001450  31 0d 0a 3c 04 0d 0a 46  0c 72 6c 69 6e 6b 3d 31  |1..<...F.rlink=1|
00001460  34 0d 0a 50 04 0d 0a 5a  21 f4 20 2d 20 52 65 67  |4..P...Z!. - Reg|
00001470  69 73 74 65 72 73 20 66  6f 72 20 74 72 61 6e 73  |isters for trans|
00001480  66 6f 72 6d 20 2d 0d 0a  64 0a 72 70 74 72 3d 32  |form -..d.rptr=2|
00001490  0d 0a 6e 0b 72 76 65 72  74 3d 33 0d 0a 78 09 72  |..n.rvert=3..x.r|
000014a0  73 78 3d 34 0d 0a 82 09  72 73 79 3d 35 0d 0a 8c  |sx=4....rsy=5...|
000014b0  09 72 73 7a 3d 36 0d 0a  96 08 72 78 3d 37 0d 0a  |.rsz=6....rx=7..|
000014c0  a0 08 72 79 3d 38 0d 0a  aa 08 72 7a 3d 39 0d 0a  |..ry=8....rz=9..|
000014d0  b4 0a 72 61 78 3d 31 30  0d 0a be 0a 72 61 79 3d  |..rax=10....ray=|
000014e0  31 31 0d 0a c8 0a 72 61  7a 3d 31 32 0d 0a d2 04  |11....raz=12....|
000014f0  0d 0a dc 0e 5b 4f 50 54  20 70 61 73 73 25 0d 0a  |....[OPT pass%..|
00001500  e6 0e 2e 74 72 61 6e 73  66 6f 72 6d 0d 0a f0 3a  |...transform...:|
00001510  4d 4f 56 20 72 70 74 72  2c 23 30 20 20 20 20 20  |MOV rptr,#0     |
00001520  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001530  20 20 5c e3 20 70 74 72  25 3d 30 20 b8 20 6d 61  |  \. ptr%=0 . ma|
00001540  78 5f 70 74 72 25 0d 0a  fa 17 2e 74 72 61 6e 73  |x_ptr%.....trans|
00001550  66 6f 72 6d 5f 6c 6f 6f  70 5f 70 74 72 0d 0b 04  |form_loop_ptr...|
00001560  35 4d 4f 56 20 72 76 65  72 74 2c 23 30 20 20 20  |5MOV rvert,#0   |
00001570  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001580  20 20 20 5c 20 e3 20 76  65 72 74 25 3d 30 20 b8  |   \ . vert%=0 .|
00001590  20 33 0d 0b 0e 18 2e 74  72 61 6e 73 66 6f 72 6d  | 3.....transform|
000015a0  5f 6c 6f 6f 70 5f 76 65  72 74 0d 0b 18 33 43 4d  |_loop_vert...3CM|
000015b0  50 20 72 76 65 72 74 2c  23 30 20 20 20 20 20 20  |P rvert,#0      |
000015c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000015d0  5c 20 20 c8 8e 20 76 65  72 74 25 20 ca 0d 0b 22  |\  .. vert% ..."|
000015e0  18 42 45 51 20 74 72 61  6e 73 66 6f 72 6d 5f 63  |.BEQ transform_c|
000015f0  61 73 65 5f 30 0d 0b 2c  10 43 4d 50 20 72 76 65  |ase_0..,.CMP rve|
00001600  72 74 2c 23 31 0d 0b 36  18 42 45 51 20 74 72 61  |rt,#1..6.BEQ tra|
00001610  6e 73 66 6f 72 6d 5f 63  61 73 65 5f 31 0d 0b 40  |nsform_case_1..@|
00001620  10 43 4d 50 20 72 76 65  72 74 2c 23 32 0d 0b 4a  |.CMP rvert,#2..J|
00001630  18 42 45 51 20 74 72 61  6e 73 66 6f 72 6d 5f 63  |.BEQ transform_c|
00001640  61 73 65 5f 32 0d 0b 54  10 43 4d 50 20 72 76 65  |ase_2..T.CMP rve|
00001650  72 74 2c 23 33 0d 0b 5e  18 42 45 51 20 74 72 61  |rt,#3..^.BEQ tra|
00001660  6e 73 66 6f 72 6d 5f 63  61 73 65 5f 33 0d 0b 68  |nsform_case_3..h|
00001670  2d 2e 74 72 61 6e 73 66  6f 72 6d 5f 63 61 73 65  |-.transform_case|
00001680  5f 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |_0              |
00001690  20 20 20 5c 20 20 20 c9  20 30 0d 0b 72 37 4d 4f  |   \   . 0..r7MO|
000016a0  56 20 72 78 2c 23 73 65  67 5f 72 61 64 25 20 20  |V rx,#seg_rad%  |
000016b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000016c0  5c 20 20 20 20 78 25 3d  2d 73 65 67 5f 72 61 64  |\    x%=-seg_rad|
000016d0  25 0d 0b 7c 10 52 53 42  20 72 78 2c 72 78 2c 23  |%..|.RSB rx,rx,#|
000016e0  30 0d 0b 86 37 4d 4f 56  20 72 7a 2c 23 73 65 67  |0...7MOV rz,#seg|
000016f0  5f 72 61 64 25 20 20 20  20 20 20 20 20 20 20 20  |_rad%           |
00001700  20 20 20 20 20 20 20 5c  20 20 20 20 7a 25 3d 2d  |       \    z%=-|
00001710  73 65 67 5f 72 61 64 25  0d 0b 90 10 52 53 42 20  |seg_rad%....RSB |
00001720  72 7a 2c 72 7a 2c 23 30  0d 0b 9a 33 4c 44 52 20  |rz,rz,#0...3LDR |
00001730  72 73 78 2c 73 78 30 20  20 20 20 20 20 20 20 20  |rsx,sx0         |
00001740  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00001750  20 20 20 73 78 25 3d 73  78 30 25 0d 0b a4 33 4c  |   sx%=sx0%...3L|
00001760  44 52 20 72 73 79 2c 73  79 30 20 20 20 20 20 20  |DR rsy,sy0      |
00001770  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001780  20 5c 20 20 20 20 73 79  25 3d 73 79 30 25 0d 0b  | \    sy%=sy0%..|
00001790  ae 33 4c 44 52 20 72 73  7a 2c 73 7a 30 20 20 20  |.3LDR rsz,sz0   |
000017a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000017b0  20 20 20 20 5c 20 20 20  20 73 7a 25 3d 73 7a 30  |    \    sz%=sz0|
000017c0  25 0d 0b b8 17 42 20 74  72 61 6e 73 66 6f 72 6d  |%....B transform|
000017d0  5f 65 6e 64 63 61 73 65  0d 0b c2 2d 2e 74 72 61  |_endcase...-.tra|
000017e0  6e 73 66 6f 72 6d 5f 63  61 73 65 5f 31 20 20 20  |nsform_case_1   |
000017f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00001800  20 20 c9 20 31 0d 0b cc  37 4d 4f 56 20 72 78 2c  |  . 1...7MOV rx,|
00001810  23 73 65 67 5f 72 61 64  25 20 20 20 20 20 20 20  |#seg_rad%       |
00001820  20 20 20 20 20 20 20 20  20 20 20 5c 20 20 20 20  |           \    |
00001830  78 25 3d 2d 73 65 67 5f  72 61 64 25 0d 0b d6 10  |x%=-seg_rad%....|
00001840  52 53 42 20 72 78 2c 72  78 2c 23 30 0d 0b e0 36  |RSB rx,rx,#0...6|
00001850  4d 4f 56 20 72 7a 2c 23  73 65 67 5f 72 61 64 25  |MOV rz,#seg_rad%|
00001860  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001870  20 20 5c 20 20 20 20 7a  25 3d 73 65 67 5f 72 61  |  \    z%=seg_ra|
00001880  64 25 0d 0b ea 33 4c 44  52 20 72 73 78 2c 73 78  |d%...3LDR rsx,sx|
00001890  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
000018a0  20 20 20 20 20 20 20 20  5c 20 20 20 20 73 78 25  |        \    sx%|
000018b0  3d 73 78 31 25 0d 0b f4  33 4c 44 52 20 72 73 79  |=sx1%...3LDR rsy|
000018c0  2c 73 79 31 20 20 20 20  20 20 20 20 20 20 20 20  |,sy1            |
000018d0  20 20 20 20 20 20 20 20  20 20 20 5c 20 20 20 20  |           \    |
000018e0  73 79 25 3d 73 79 31 25  0d 0b fe 33 4c 44 52 20  |sy%=sy1%...3LDR |
000018f0  72 73 7a 2c 73 7a 31 20  20 20 20 20 20 20 20 20  |rsz,sz1         |
00001900  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00001910  20 20 20 73 7a 25 3d 73  7a 31 25 0d 0c 08 17 42  |   sz%=sz1%....B|
00001920  20 74 72 61 6e 73 66 6f  72 6d 5f 65 6e 64 63 61  | transform_endca|
00001930  73 65 0d 0c 12 2d 2e 74  72 61 6e 73 66 6f 72 6d  |se...-.transform|
00001940  5f 63 61 73 65 5f 32 20  20 20 20 20 20 20 20 20  |_case_2         |
00001950  20 20 20 20 20 20 20 20  5c 20 20 20 c9 20 32 0d  |        \   . 2.|
00001960  0c 1c 36 4d 4f 56 20 72  78 2c 23 73 65 67 5f 72  |..6MOV rx,#seg_r|
00001970  61 64 25 20 20 20 20 20  20 20 20 20 20 20 20 20  |ad%             |
00001980  20 20 20 20 20 5c 20 20  20 20 78 25 3d 73 65 67  |     \    x%=seg|
00001990  5f 72 61 64 25 0d 0c 26  36 4d 4f 56 20 72 7a 2c  |_rad%..&6MOV rz,|
000019a0  23 73 65 67 5f 72 61 64  25 20 20 20 20 20 20 20  |#seg_rad%       |
000019b0  20 20 20 20 20 20 20 20  20 20 20 5c 20 20 20 20  |           \    |
000019c0  7a 25 3d 73 65 67 5f 72  61 64 25 0d 0c 30 33 4c  |z%=seg_rad%..03L|
000019d0  44 52 20 72 73 78 2c 73  78 32 20 20 20 20 20 20  |DR rsx,sx2      |
000019e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000019f0  20 5c 20 20 20 20 73 78  25 3d 73 78 32 25 0d 0c  | \    sx%=sx2%..|
00001a00  3a 33 4c 44 52 20 72 73  79 2c 73 79 32 20 20 20  |:3LDR rsy,sy2   |
00001a10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001a20  20 20 20 20 5c 20 20 20  20 73 79 25 3d 73 79 32  |    \    sy%=sy2|
00001a30  25 0d 0c 44 33 4c 44 52  20 72 73 7a 2c 73 7a 32  |%..D3LDR rsz,sz2|
00001a40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001a50  20 20 20 20 20 20 20 5c  20 20 20 20 73 7a 25 3d  |       \    sz%=|
00001a60  73 7a 32 25 0d 0c 4e 17  42 20 74 72 61 6e 73 66  |sz2%..N.B transf|
00001a70  6f 72 6d 5f 65 6e 64 63  61 73 65 0d 0c 58 2d 2e  |orm_endcase..X-.|
00001a80  74 72 61 6e 73 66 6f 72  6d 5f 63 61 73 65 5f 33  |transform_case_3|
00001a90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001aa0  20 5c 20 20 20 c9 20 33  0d 0c 62 36 4d 4f 56 20  | \   . 3..b6MOV |
00001ab0  72 78 2c 23 73 65 67 5f  72 61 64 25 20 20 20 20  |rx,#seg_rad%    |
00001ac0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00001ad0  20 20 20 78 25 3d 73 65  67 5f 72 61 64 25 0d 0c  |   x%=seg_rad%..|
00001ae0  6c 37 4d 4f 56 20 72 7a  2c 23 73 65 67 5f 72 61  |l7MOV rz,#seg_ra|
00001af0  64 25 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |d%              |
00001b00  20 20 20 20 5c 20 20 20  20 7a 25 3d 2d 73 65 67  |    \    z%=-seg|
00001b10  5f 72 61 64 25 0d 0c 76  10 52 53 42 20 72 7a 2c  |_rad%..v.RSB rz,|
00001b20  72 7a 2c 23 30 0d 0c 80  33 4c 44 52 20 72 73 78  |rz,#0...3LDR rsx|
00001b30  2c 73 78 33 20 20 20 20  20 20 20 20 20 20 20 20  |,sx3            |
00001b40  20 20 20 20 20 20 20 20  20 20 20 5c 20 20 20 20  |           \    |
00001b50  73 78 25 3d 73 78 33 25  0d 0c 8a 33 4c 44 52 20  |sx%=sx3%...3LDR |
00001b60  72 73 79 2c 73 79 33 20  20 20 20 20 20 20 20 20  |rsy,sy3         |
00001b70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00001b80  20 20 20 73 79 25 3d 73  79 33 25 0d 0c 94 33 4c  |   sy%=sy3%...3L|
00001b90  44 52 20 72 73 7a 2c 73  7a 33 20 20 20 20 20 20  |DR rsz,sz3      |
00001ba0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001bb0  20 5c 20 20 20 20 73 7a  25 3d 73 7a 33 25 0d 0c  | \    sz%=sz3%..|
00001bc0  9e 2a 2e 74 72 61 6e 73  66 6f 72 6d 5f 65 6e 64  |.*.transform_end|
00001bd0  63 61 73 65 20 20 20 20  20 20 20 20 20 20 20 20  |case            |
00001be0  20 20 20 20 5c 20 20 cb  0d 0c a8 2d 4d 4f 56 20  |    \  ....-MOV |
00001bf0  72 79 2c 23 30 20 20 20  20 20 20 20 20 20 20 20  |ry,#0           |
00001c00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00001c10  20 79 25 3d 30 0d 0c b2  3f 4c 44 52 20 72 30 2c  | y%=0...?LDR r0,|
00001c20  62 75 66 5f 77 61 78 20  20 20 20 20 20 20 20 20  |buf_wax         |
00001c30  20 20 20 20 20 20 20 20  20 20 20 5c 20 20 61 78  |           \  ax|
00001c40  25 3d 62 75 66 5f 77 61  78 25 21 28 70 74 72 25  |%=buf_wax%!(ptr%|
00001c50  3c 3c 32 29 0d 0c bc 1b  4c 44 52 20 72 61 78 2c  |<<2)....LDR rax,|
00001c60  5b 72 30 2c 72 70 74 72  2c 4c 53 4c 23 32 5d 0d  |[r0,rptr,LSL#2].|
00001c70  0c c6 3e 43 4d 50 20 72  61 78 2c 23 30 20 20 20  |..>CMP rax,#0   |
00001c80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001c90  20 20 20 20 20 5c 20 20  e7 20 61 78 25 3e 30 20  |     \  . ax%>0 |
00001ca0  8c 20 61 78 25 3d 33 36  30 2d 61 78 25 0d 0c d0  |. ax%=360-ax%...|
00001cb0  16 52 53 42 47 54 20 72  61 78 2c 72 61 78 2c 23  |.RSBGT rax,rax,#|
00001cc0  33 36 30 0d 0c da 3f 4c  44 52 20 72 30 2c 62 75  |360...?LDR r0,bu|
00001cd0  66 5f 77 61 79 20 20 20  20 20 20 20 20 20 20 20  |f_way           |
00001ce0  20 20 20 20 20 20 20 20  20 5c 20 20 61 79 25 3d  |         \  ay%=|
00001cf0  62 75 66 5f 77 61 79 25  21 28 70 74 72 25 3c 3c  |buf_way%!(ptr%<<|
00001d00  32 29 0d 0c e4 1b 4c 44  52 20 72 61 79 2c 5b 72  |2)....LDR ray,[r|
00001d10  30 2c 72 70 74 72 2c 4c  53 4c 23 32 5d 0d 0c ee  |0,rptr,LSL#2]...|
00001d20  3e 43 4d 50 20 72 61 79  2c 23 30 20 20 20 20 20  |>CMP ray,#0     |
00001d30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001d40  20 20 20 5c 20 20 e7 20  61 79 25 3e 30 20 8c 20  |   \  . ay%>0 . |
00001d50  61 79 25 3d 33 36 30 2d  61 79 25 0d 0c f8 16 52  |ay%=360-ay%....R|
00001d60  53 42 47 54 20 72 61 79  2c 72 61 79 2c 23 33 36  |SBGT ray,ray,#36|
00001d70  30 0d 0d 02 3f 4c 44 52  20 72 30 2c 62 75 66 5f  |0...?LDR r0,buf_|
00001d80  77 61 7a 20 20 20 20 20  20 20 20 20 20 20 20 20  |waz             |
00001d90  20 20 20 20 20 20 20 5c  20 20 61 7a 25 3d 62 75  |       \  az%=bu|
00001da0  66 5f 77 61 7a 25 21 28  70 74 72 25 3c 3c 32 29  |f_waz%!(ptr%<<2)|
00001db0  0d 0d 0c 1b 4c 44 52 20  72 61 7a 2c 5b 72 30 2c  |....LDR raz,[r0,|
00001dc0  72 70 74 72 2c 4c 53 4c  23 32 5d 0d 0d 16 3e 43  |rptr,LSL#2]...>C|
00001dd0  4d 50 20 72 61 7a 2c 23  30 20 20 20 20 20 20 20  |MP raz,#0       |
00001de0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001df0  20 5c 20 20 e7 20 61 7a  25 3e 30 20 8c 20 61 7a  | \  . az%>0 . az|
00001e00  25 3d 33 36 30 2d 61 7a  25 0d 0d 20 16 52 53 42  |%=360-az%.. .RSB|
00001e10  47 54 20 72 61 7a 2c 72  61 7a 2c 23 33 36 30 0d  |GT raz,raz,#360.|
00001e20  0d 2a 46 53 54 4d 46 44  20 72 31 33 20 21 2c 7b  |.*FSTMFD r13 !,{|
00001e30  72 31 2d 72 31 32 2c 72  6c 69 6e 6b 7d 20 20 20  |r1-r12,rlink}   |
00001e40  20 20 20 20 20 5c 20 20  f2 72 6f 74 61 74 65 28  |     \  .rotate(|
00001e50  78 25 2c 79 25 2c 7a 25  2c 61 78 25 2c 61 79 25  |x%,y%,z%,ax%,ay%|
00001e60  2c 61 7a 25 29 0d 0d 34  0d 42 4c 20 72 6f 74 61  |,az%)..4.BL rota|
00001e70  74 65 0d 0d 3e 1e 4c 44  4d 46 44 20 72 31 33 20  |te..>.LDMFD r13 |
00001e80  21 2c 7b 72 31 2d 72 31  32 2c 72 6c 69 6e 6b 7d  |!,{r1-r12,rlink}|
00001e90  0d 0d 48 48 4c 44 52 20  72 30 2c 62 75 66 5f 77  |..HHLDR r0,buf_w|
00001ea0  78 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |x               |
00001eb0  20 20 20 20 20 20 5c 20  20 78 25 2b 3d 28 62 75  |      \  x%+=(bu|
00001ec0  66 5f 77 78 25 21 28 70  74 72 25 3c 3c 32 29 2d  |f_wx%!(ptr%<<2)-|
00001ed0  21 6f 62 73 5f 77 78 29  0d 0d 52 1a 4c 44 52 20  |!obs_wx)..R.LDR |
00001ee0  72 30 2c 5b 72 30 2c 72  70 74 72 2c 4c 53 4c 23  |r0,[r0,rptr,LSL#|
00001ef0  32 5d 0d 0d 5c 11 4c 44  52 20 72 31 2c 6f 62 73  |2]..\.LDR r1,obs|
00001f00  5f 77 78 0d 0d 66 10 41  44 44 20 72 78 2c 72 78  |_wx..f.ADD rx,rx|
00001f10  2c 72 30 0d 0d 70 10 53  55 42 20 72 78 2c 72 78  |,r0..p.SUB rx,rx|
00001f20  2c 72 31 0d 0d 7a 48 4c  44 52 20 72 30 2c 62 75  |,r1..zHLDR r0,bu|
00001f30  66 5f 77 79 20 20 20 20  20 20 20 20 20 20 20 20  |f_wy            |
00001f40  20 20 20 20 20 20 20 20  20 5c 20 20 79 25 2b 3d  |         \  y%+=|
00001f50  28 62 75 66 5f 77 79 25  21 28 70 74 72 25 3c 3c  |(buf_wy%!(ptr%<<|
00001f60  32 29 2d 21 6f 62 73 5f  77 79 29 0d 0d 84 1a 4c  |2)-!obs_wy)....L|
00001f70  44 52 20 72 30 2c 5b 72  30 2c 72 70 74 72 2c 4c  |DR r0,[r0,rptr,L|
00001f80  53 4c 23 32 5d 0d 0d 8e  11 4c 44 52 20 72 31 2c  |SL#2]....LDR r1,|
00001f90  6f 62 73 5f 77 79 0d 0d  98 10 41 44 44 20 72 79  |obs_wy....ADD ry|
00001fa0  2c 72 79 2c 72 30 0d 0d  a2 10 53 55 42 20 72 79  |,ry,r0....SUB ry|
00001fb0  2c 72 79 2c 72 31 0d 0d  ac 48 4c 44 52 20 72 30  |,ry,r1...HLDR r0|
00001fc0  2c 62 75 66 5f 77 7a 20  20 20 20 20 20 20 20 20  |,buf_wz         |
00001fd0  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 20 7a  |            \  z|
00001fe0  25 2b 3d 28 62 75 66 5f  77 7a 25 21 28 70 74 72  |%+=(buf_wz%!(ptr|
00001ff0  25 3c 3c 32 29 2d 21 6f  62 73 5f 77 7a 29 0d 0d  |%<<2)-!obs_wz)..|
00002000  b6 1a 4c 44 52 20 72 30  2c 5b 72 30 2c 72 70 74  |..LDR r0,[r0,rpt|
00002010  72 2c 4c 53 4c 23 32 5d  0d 0d c0 11 4c 44 52 20  |r,LSL#2]....LDR |
00002020  72 31 2c 6f 62 73 5f 77  7a 0d 0d ca 10 41 44 44  |r1,obs_wz....ADD|
00002030  20 72 7a 2c 72 7a 2c 72  30 0d 0d d4 10 53 55 42  | rz,rz,r0....SUB|
00002040  20 72 7a 2c 72 7a 2c 72  31 0d 0d de 35 4c 44 52  | rz,rz,r1...5LDR|
00002050  20 72 61 78 2c 6f 62 73  5f 77 61 78 20 20 20 20  | rax,obs_wax    |
00002060  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00002070  20 20 61 78 25 3d 21 6f  62 73 5f 77 61 78 0d 0d  |  ax%=!obs_wax..|
00002080  e8 3e 43 4d 50 20 72 61  78 2c 23 30 20 20 20 20  |.>CMP rax,#0    |
00002090  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000020a0  20 20 20 20 5c 20 20 e7  20 61 78 25 3e 30 20 8c  |    \  . ax%>0 .|
000020b0  20 61 78 25 3d 33 36 30  2d 61 78 25 0d 0d f2 16  | ax%=360-ax%....|
000020c0  52 53 42 47 54 20 72 61  78 2c 72 61 78 2c 23 33  |RSBGT rax,rax,#3|
000020d0  36 30 0d 0d fc 35 4c 44  52 20 72 61 79 2c 6f 62  |60...5LDR ray,ob|
000020e0  73 5f 77 61 79 20 20 20  20 20 20 20 20 20 20 20  |s_way           |
000020f0  20 20 20 20 20 20 20 20  5c 20 20 61 79 25 3d 21  |        \  ay%=!|
00002100  6f 62 73 5f 77 61 79 0d  0e 06 3e 43 4d 50 20 72  |obs_way...>CMP r|
00002110  61 79 2c 23 30 20 20 20  20 20 20 20 20 20 20 20  |ay,#0           |
00002120  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 20  |             \  |
00002130  e7 20 61 79 25 3e 30 20  8c 20 61 79 25 3d 33 36  |. ay%>0 . ay%=36|
00002140  30 2d 61 79 25 0d 0e 10  16 52 53 42 47 54 20 72  |0-ay%....RSBGT r|
00002150  61 79 2c 72 61 79 2c 23  33 36 30 0d 0e 1a 35 4c  |ay,ray,#360...5L|
00002160  44 52 20 72 61 7a 2c 6f  62 73 5f 77 61 7a 20 20  |DR raz,obs_waz  |
00002170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002180  20 5c 20 20 61 7a 25 3d  21 6f 62 73 5f 77 61 7a  | \  az%=!obs_waz|
00002190  0d 0e 24 3e 43 4d 50 20  72 61 7a 2c 23 30 20 20  |..$>CMP raz,#0  |
000021a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000021b0  20 20 20 20 20 20 5c 20  20 e7 20 61 7a 25 3e 30  |      \  . az%>0|
000021c0  20 8c 20 61 7a 25 3d 33  36 30 2d 61 7a 25 0d 0e  | . az%=360-az%..|
000021d0  2e 16 52 53 42 47 54 20  72 61 7a 2c 72 61 7a 2c  |..RSBGT raz,raz,|
000021e0  23 33 36 30 0d 0e 38 3f  53 54 4d 46 44 20 72 31  |#360..8?STMFD r1|
000021f0  33 20 21 2c 7b 72 31 2d  72 31 32 2c 72 6c 69 6e  |3 !,{r1-r12,rlin|
00002200  6b 7d 20 5c 20 20 f2 72  6f 74 61 74 65 28 78 25  |k} \  .rotate(x%|
00002210  2c 79 25 2c 7a 25 2c 61  78 25 2c 61 79 25 2c 61  |,y%,z%,ax%,ay%,a|
00002220  7a 25 29 0d 0e 42 0d 42  4c 20 72 6f 74 61 74 65  |z%)..B.BL rotate|
00002230  0d 0e 4c 1e 4c 44 4d 46  44 20 72 31 33 20 21 2c  |..L.LDMFD r13 !,|
00002240  7b 72 31 2d 72 31 32 2c  72 6c 69 6e 6b 7d 0d 0e  |{r1-r12,rlink}..|
00002250  56 36 43 4d 50 20 72 79  2c 23 31 20 20 20 20 20  |V6CMP ry,#1     |
00002260  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002270  20 20 20 20 5c 20 20 e7  20 79 25 3c 31 20 8c 20  |    \  . y%<1 . |
00002280  79 25 3d 31 0d 0e 60 0f  4d 4f 56 4c 54 20 72 79  |y%=1..`.MOVLT ry|
00002290  2c 23 31 0d 0e 6a 49 4c  44 52 20 72 30 2c 73 63  |,#1..jILDR r0,sc|
000022a0  61 6c 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ale             |
000022b0  20 20 20 20 20 20 20 20  20 5c 20 20 73 78 25 21  |         \  sx%!|
000022c0  28 70 74 72 25 3c 3c 32  29 3d 36 34 30 2b 78 25  |(ptr%<<2)=640+x%|
000022d0  2a 21 73 63 61 6c 65 20  81 20 79 25 0d 0e 74 10  |*!scale . y%..t.|
000022e0  4d 55 4c 20 72 30 2c 72  78 2c 72 30 0d 0e 7e 0d  |MUL r0,rx,r0..~.|
000022f0  4d 4f 56 20 72 31 2c 72  79 0d 0e 88 1d 53 54 4d  |MOV r1,ry....STM|
00002300  46 44 20 72 31 33 20 21  2c 7b 72 32 2d 72 36 2c  |FD r13 !,{r2-r6,|
00002310  72 6c 69 6e 6b 7d 0d 0e  92 0d 42 4c 20 64 69 76  |rlink}....BL div|
00002320  69 64 65 0d 0e 9c 1d 4c  44 4d 46 44 20 72 31 33  |ide....LDMFD r13|
00002330  20 21 2c 7b 72 32 2d 72  36 2c 72 6c 69 6e 6b 7d  | !,{r2-r6,rlink}|
00002340  0d 0e a6 12 41 44 44 20  72 30 2c 72 30 2c 23 36  |....ADD r0,r0,#6|
00002350  34 30 0d 0e b0 1b 53 54  52 20 72 30 2c 5b 72 73  |40....STR r0,[rs|
00002360  78 2c 72 70 74 72 2c 4c  53 4c 23 32 5d 0d 0e ba  |x,rptr,LSL#2]...|
00002370  49 4c 44 52 20 72 30 2c  73 63 61 6c 65 20 20 20  |ILDR r0,scale   |
00002380  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002390  20 20 20 5c 20 20 73 79  25 21 28 70 74 72 25 3c  |   \  sy%!(ptr%<|
000023a0  3c 32 29 3d 34 38 30 2b  7a 25 2a 21 73 63 61 6c  |<2)=480+z%*!scal|
000023b0  65 20 81 20 79 25 0d 0e  c4 10 4d 55 4c 20 72 30  |e . y%....MUL r0|
000023c0  2c 72 7a 2c 72 30 0d 0e  ce 0d 4d 4f 56 20 72 31  |,rz,r0....MOV r1|
000023d0  2c 72 79 0d 0e d8 1d 53  54 4d 46 44 20 72 31 33  |,ry....STMFD r13|
000023e0  20 21 2c 7b 72 32 2d 72  36 2c 72 6c 69 6e 6b 7d  | !,{r2-r6,rlink}|
000023f0  0d 0e e2 0d 42 4c 20 64  69 76 69 64 65 0d 0e ec  |....BL divide...|
00002400  1d 4c 44 4d 46 44 20 72  31 33 20 21 2c 7b 72 32  |.LDMFD r13 !,{r2|
00002410  2d 72 36 2c 72 6c 69 6e  6b 7d 0d 0e f6 12 41 44  |-r6,rlink}....AD|
00002420  44 20 72 30 2c 72 30 2c  23 34 38 30 0d 0f 00 1b  |D r0,r0,#480....|
00002430  53 54 52 20 72 30 2c 5b  72 73 79 2c 72 70 74 72  |STR r0,[rsy,rptr|
00002440  2c 4c 53 4c 23 32 5d 0d  0f 0a 39 53 54 52 20 72  |,LSL#2]...9STR r|
00002450  79 2c 5b 72 73 7a 2c 72  70 74 72 2c 4c 53 4c 23  |y,[rsz,rptr,LSL#|
00002460  32 5d 20 20 20 20 20 20  20 20 20 20 20 5c 20 20  |2]           \  |
00002470  73 7a 25 21 28 70 74 72  25 3c 3c 32 29 3d 79 25  |sz%!(ptr%<<2)=y%|
00002480  0d 0f 14 2f 41 44 44 20  72 76 65 72 74 2c 72 76  |.../ADD rvert,rv|
00002490  65 72 74 2c 23 31 20 20  20 20 20 20 20 20 20 20  |ert,#1          |
000024a0  20 20 20 20 20 20 5c 20  ed 20 76 65 72 74 25 0d  |      \ . vert%.|
000024b0  0f 1e 10 43 4d 50 20 72  76 65 72 74 2c 23 33 0d  |...CMP rvert,#3.|
000024c0  0f 28 1b 42 4c 45 20 74  72 61 6e 73 66 6f 72 6d  |.(.BLE transform|
000024d0  5f 6c 6f 6f 70 5f 76 65  72 74 0d 0f 32 2d 41 44  |_loop_vert..2-AD|
000024e0  44 20 72 70 74 72 2c 72  70 74 72 2c 23 31 20 20  |D rptr,rptr,#1  |
000024f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002500  5c ed 20 70 74 72 25 0d  0f 3c 16 43 4d 50 20 72  |\. ptr%..<.CMP r|
00002510  70 74 72 2c 23 6d 61 78  5f 70 74 72 25 0d 0f 46  |ptr,#max_ptr%..F|
00002520  1a 42 4c 45 20 74 72 61  6e 73 66 6f 72 6d 5f 6c  |.BLE transform_l|
00002530  6f 6f 70 5f 70 74 72 0d  0f 50 28 4d 4f 56 20 50  |oop_ptr..P(MOV P|
00002540  43 2c 72 6c 69 6e 6b 20  20 20 20 20 20 20 20 20  |C,rlink         |
00002550  20 20 20 20 20 20 20 20  20 20 20 20 20 5c e1 0d  |             \..|
00002560  0f 5a 05 5d 0d 0f 64 04  0d 0f 6e 1e f4 20 2d 20  |.Z.]..d...n.. - |
00002570  52 65 67 69 73 74 65 72  73 20 66 6f 72 20 72 6f  |Registers for ro|
00002580  74 61 74 65 20 2d 0d 0f  78 14 f4 20 2d 20 4c 6f  |tate -..x.. - Lo|
00002590  63 61 6c 20 76 61 72 73  20 2d 0d 0f 82 09 72 78  |cal vars -....rx|
000025a0  31 3d 31 0d 0f 8c 09 72  79 31 3d 32 0d 0f 96 09  |1=1....ry1=2....|
000025b0  72 7a 31 3d 33 0d 0f a0  09 72 78 32 3d 34 0d 0f  |rz1=3....rx2=4..|
000025c0  aa 09 72 79 32 3d 35 0d  0f b4 09 72 7a 32 3d 36  |..ry2=5....rz2=6|
000025d0  0d 0f be 08 72 78 3d 37  0d 0f c8 08 72 79 3d 38  |....rx=7....ry=8|
000025e0  0d 0f d2 08 72 7a 3d 39  0d 0f dc 0a 72 61 78 3d  |....rz=9....rax=|
000025f0  31 30 0d 0f e6 0a 72 61  79 3d 31 31 0d 0f f0 0a  |10....ray=11....|
00002600  72 61 7a 3d 31 32 0d 0f  fa 04 0d 10 04 0e 5b 4f  |raz=12........[O|
00002610  50 54 20 70 61 73 73 25  0d 10 0e 0b 2e 72 6f 74  |PT pass%.....rot|
00002620  61 74 65 0d 10 18 21 f4  20 2d 2d 2d 20 52 6f 74  |ate...!. --- Rot|
00002630  61 74 65 20 61 62 6f 75  74 20 78 20 61 78 69 73  |ate about x axis|
00002640  20 2d 2d 2d 0d 10 22 28  4d 4f 56 20 72 78 31 2c  | ---.."(MOV rx1,|
00002650  72 78 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |rx              |
00002660  20 20 20 20 20 5c 78 31  25 3d 78 25 0d 10 2c 4b  |     \x1%=x%..,K|
00002670  4c 44 52 20 72 30 2c 63  6f 73 38 20 20 20 20 20  |LDR r0,cos8     |
00002680  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 79 31  |             \y1|
00002690  25 3d 79 25 2a 63 6f 73  38 25 21 28 61 78 25 3c  |%=y%*cos8%!(ax%<|
000026a0  3c 32 29 2d 28 7a 25 2a  73 69 6e 38 25 21 28 61  |<2)-(z%*sin8%!(a|
000026b0  78 25 3c 3c 32 29 29 0d  10 36 19 4c 44 52 20 72  |x%<<2))..6.LDR r|
000026c0  30 2c 5b 72 30 2c 72 61  78 2c 4c 53 4c 23 32 5d  |0,[r0,rax,LSL#2]|
000026d0  0d 10 40 11 4d 55 4c 20  72 79 31 2c 72 79 2c 72  |..@.MUL ry1,ry,r|
000026e0  30 0d 10 4a 0f 4c 44 52  20 72 30 2c 73 69 6e 38  |0..J.LDR r0,sin8|
000026f0  0d 10 54 19 4c 44 52 20  72 30 2c 5b 72 30 2c 72  |..T.LDR r0,[r0,r|
00002700  61 78 2c 4c 53 4c 23 32  5d 0d 10 5e 10 4d 55 4c  |ax,LSL#2]..^.MUL|
00002710  20 72 30 2c 72 7a 2c 72  30 0d 10 68 12 53 55 42  | r0,rz,r0..h.SUB|
00002720  20 72 79 31 2c 72 79 31  2c 72 30 0d 10 72 2c 4d  | ry1,ry1,r0..r,M|
00002730  4f 56 20 72 79 31 2c 72  79 31 2c 41 53 52 23 38  |OV ry1,ry1,ASR#8|
00002740  20 20 20 20 20 20 20 20  20 20 20 20 5c 79 31 25  |            \y1%|
00002750  3d 79 31 25 3e 3e 38 0d  10 7c 4b 4c 44 52 20 72  |=y1%>>8..|KLDR r|
00002760  30 2c 73 69 6e 38 20 20  20 20 20 20 20 20 20 20  |0,sin8          |
00002770  20 20 20 20 20 20 20 20  5c 7a 31 25 3d 79 25 2a  |        \z1%=y%*|
00002780  73 69 6e 38 25 21 28 61  78 25 3c 3c 32 29 2b 28  |sin8%!(ax%<<2)+(|
00002790  7a 25 2a 63 6f 73 38 25  21 28 61 78 25 3c 3c 32  |z%*cos8%!(ax%<<2|
000027a0  29 29 0d 10 86 19 4c 44  52 20 72 30 2c 5b 72 30  |))....LDR r0,[r0|
000027b0  2c 72 61 78 2c 4c 53 4c  23 32 5d 0d 10 90 11 4d  |,rax,LSL#2]....M|
000027c0  55 4c 20 72 7a 31 2c 72  79 2c 72 30 0d 10 9a 0f  |UL rz1,ry,r0....|
000027d0  4c 44 52 20 72 30 2c 63  6f 73 38 0d 10 a4 19 4c  |LDR r0,cos8....L|
000027e0  44 52 20 72 30 2c 5b 72  30 2c 72 61 78 2c 4c 53  |DR r0,[r0,rax,LS|
000027f0  4c 23 32 5d 0d 10 ae 10  4d 55 4c 20 72 30 2c 72  |L#2]....MUL r0,r|
00002800  7a 2c 72 30 0d 10 b8 12  41 44 44 20 72 7a 31 2c  |z,r0....ADD rz1,|
00002810  72 7a 31 2c 72 30 0d 10  c2 2c 4d 4f 56 20 72 7a  |rz1,r0...,MOV rz|
00002820  31 2c 72 7a 31 2c 41 53  52 23 38 20 20 20 20 20  |1,rz1,ASR#8     |
00002830  20 20 20 20 20 20 20 5c  7a 31 25 3d 7a 31 25 3e  |       \z1%=z1%>|
00002840  3e 38 0d 10 cc 21 f4 20  2d 2d 2d 20 52 6f 74 61  |>8...!. --- Rota|
00002850  74 65 20 61 62 6f 75 74  20 79 20 61 78 69 73 20  |te about y axis |
00002860  2d 2d 2d 0d 10 d6 4d 4c  44 52 20 72 30 2c 63 6f  |---...MLDR r0,co|
00002870  73 38 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |s8              |
00002880  20 20 20 20 5c 78 32 25  3d 78 31 25 2a 63 6f 73  |    \x2%=x1%*cos|
00002890  38 25 21 28 61 79 25 3c  3c 32 29 2b 28 7a 31 25  |8%!(ay%<<2)+(z1%|
000028a0  2a 73 69 6e 38 25 21 28  61 79 25 3c 3c 32 29 29  |*sin8%!(ay%<<2))|
000028b0  0d 10 e0 19 4c 44 52 20  72 30 2c 5b 72 30 2c 72  |....LDR r0,[r0,r|
000028c0  61 79 2c 4c 53 4c 23 32  5d 0d 10 ea 12 4d 55 4c  |ay,LSL#2]....MUL|
000028d0  20 72 78 32 2c 72 78 31  2c 72 30 0d 10 f4 0f 4c  | rx2,rx1,r0....L|
000028e0  44 52 20 72 30 2c 73 69  6e 38 0d 10 fe 19 4c 44  |DR r0,sin8....LD|
000028f0  52 20 72 30 2c 5b 72 30  2c 72 61 79 2c 4c 53 4c  |R r0,[r0,ray,LSL|
00002900  23 32 5d 0d 11 08 11 4d  55 4c 20 72 30 2c 72 7a  |#2]....MUL r0,rz|
00002910  31 2c 72 30 0d 11 12 12  41 44 44 20 72 78 32 2c  |1,r0....ADD rx2,|
00002920  72 78 32 2c 72 30 0d 11  1c 2c 4d 4f 56 20 72 78  |rx2,r0...,MOV rx|
00002930  32 2c 72 78 32 2c 41 53  52 23 38 20 20 20 20 20  |2,rx2,ASR#8     |
00002940  20 20 20 20 20 20 20 5c  78 32 25 3d 78 32 25 3e  |       \x2%=x2%>|
00002950  3e 38 0d 11 26 29 4d 4f  56 20 72 79 32 2c 72 79  |>8..&)MOV ry2,ry|
00002960  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
00002970  20 20 20 5c 79 32 25 3d  79 31 25 0d 11 30 4d 4c  |   \y2%=y1%..0ML|
00002980  44 52 20 72 30 2c 63 6f  73 38 20 20 20 20 20 20  |DR r0,cos8      |
00002990  20 20 20 20 20 20 20 20  20 20 20 20 5c 7a 32 25  |            \z2%|
000029a0  3d 7a 31 25 2a 63 6f 73  38 25 21 28 61 79 25 3c  |=z1%*cos8%!(ay%<|
000029b0  3c 32 29 2d 28 78 31 25  2a 73 69 6e 38 25 21 28  |<2)-(x1%*sin8%!(|
000029c0  61 79 25 3c 3c 32 29 29  0d 11 3a 19 4c 44 52 20  |ay%<<2))..:.LDR |
000029d0  72 30 2c 5b 72 30 2c 72  61 79 2c 4c 53 4c 23 32  |r0,[r0,ray,LSL#2|
000029e0  5d 0d 11 44 12 4d 55 4c  20 72 7a 32 2c 72 7a 31  |]..D.MUL rz2,rz1|
000029f0  2c 72 30 0d 11 4e 0f 4c  44 52 20 72 30 2c 73 69  |,r0..N.LDR r0,si|
00002a00  6e 38 0d 11 58 19 4c 44  52 20 72 30 2c 5b 72 30  |n8..X.LDR r0,[r0|
00002a10  2c 72 61 79 2c 4c 53 4c  23 32 5d 0d 11 62 11 4d  |,ray,LSL#2]..b.M|
00002a20  55 4c 20 72 30 2c 72 78  31 2c 72 30 0d 11 6c 12  |UL r0,rx1,r0..l.|
00002a30  53 55 42 20 72 7a 32 2c  72 7a 32 2c 72 30 0d 11  |SUB rz2,rz2,r0..|
00002a40  76 2c 4d 4f 56 20 72 7a  32 2c 72 7a 32 2c 41 53  |v,MOV rz2,rz2,AS|
00002a50  52 23 38 20 20 20 20 20  20 20 20 20 20 20 20 5c  |R#8            \|
00002a60  7a 32 25 3d 7a 32 25 3e  3e 38 0d 11 80 21 f4 20  |z2%=z2%>>8...!. |
00002a70  2d 2d 2d 20 52 6f 74 61  74 65 20 61 62 6f 75 74  |--- Rotate about|
00002a80  20 7a 20 61 78 69 73 20  2d 2d 2d 0d 11 8a 4c 4c  | z axis ---...LL|
00002a90  44 52 20 72 30 2c 63 6f  73 38 20 20 20 20 20 20  |DR r0,cos8      |
00002aa0  20 20 20 20 20 20 20 20  20 20 20 20 5c 78 25 3d  |            \x%=|
00002ab0  78 32 25 2a 63 6f 73 38  25 21 28 61 7a 25 3c 3c  |x2%*cos8%!(az%<<|
00002ac0  32 29 2d 28 79 32 25 2a  73 69 6e 38 25 21 28 61  |2)-(y2%*sin8%!(a|
00002ad0  7a 25 3c 3c 32 29 29 0d  11 94 19 4c 44 52 20 72  |z%<<2))....LDR r|
00002ae0  30 2c 5b 72 30 2c 72 61  7a 2c 4c 53 4c 23 32 5d  |0,[r0,raz,LSL#2]|
00002af0  0d 11 9e 11 4d 55 4c 20  72 78 2c 72 78 32 2c 72  |....MUL rx,rx2,r|
00002b00  30 0d 11 a8 0f 4c 44 52  20 72 30 2c 73 69 6e 38  |0....LDR r0,sin8|
00002b10  0d 11 b2 19 4c 44 52 20  72 30 2c 5b 72 30 2c 72  |....LDR r0,[r0,r|
00002b20  61 7a 2c 4c 53 4c 23 32  5d 0d 11 bc 11 4d 55 4c  |az,LSL#2]....MUL|
00002b30  20 72 30 2c 72 79 32 2c  72 30 0d 11 c6 10 53 55  | r0,ry2,r0....SU|
00002b40  42 20 72 78 2c 72 78 2c  72 30 0d 11 d0 2a 4d 4f  |B rx,rx,r0...*MO|
00002b50  56 20 72 78 2c 72 78 2c  41 53 52 23 38 20 20 20  |V rx,rx,ASR#8   |
00002b60  20 20 20 20 20 20 20 20  20 20 20 5c 78 25 3d 78  |           \x%=x|
00002b70  25 3e 3e 38 0d 11 da 4c  4c 44 52 20 72 30 2c 73  |%>>8...LLDR r0,s|
00002b80  69 6e 38 20 20 20 20 20  20 20 20 20 20 20 20 20  |in8             |
00002b90  20 20 20 20 20 5c 79 25  3d 78 32 25 2a 73 69 6e  |     \y%=x2%*sin|
00002ba0  38 25 21 28 61 7a 25 3c  3c 32 29 2b 28 79 32 25  |8%!(az%<<2)+(y2%|
00002bb0  2a 63 6f 73 38 25 21 28  61 7a 25 3c 3c 32 29 29  |*cos8%!(az%<<2))|
00002bc0  0d 11 e4 19 4c 44 52 20  72 30 2c 5b 72 30 2c 72  |....LDR r0,[r0,r|
00002bd0  61 7a 2c 4c 53 4c 23 32  5d 0d 11 ee 11 4d 55 4c  |az,LSL#2]....MUL|
00002be0  20 72 79 2c 72 78 32 2c  72 30 0d 11 f8 0f 4c 44  | ry,rx2,r0....LD|
00002bf0  52 20 72 30 2c 63 6f 73  38 0d 12 02 19 4c 44 52  |R r0,cos8....LDR|
00002c00  20 72 30 2c 5b 72 30 2c  72 61 7a 2c 4c 53 4c 23  | r0,[r0,raz,LSL#|
00002c10  32 5d 0d 12 0c 11 4d 55  4c 20 72 30 2c 72 79 32  |2]....MUL r0,ry2|
00002c20  2c 72 30 0d 12 16 10 53  55 42 20 72 79 2c 72 79  |,r0....SUB ry,ry|
00002c30  2c 72 30 0d 12 20 2a 4d  4f 56 20 72 79 2c 72 79  |,r0.. *MOV ry,ry|
00002c40  2c 41 53 52 23 38 20 20  20 20 20 20 20 20 20 20  |,ASR#8          |
00002c50  20 20 20 20 5c 79 25 3d  79 25 3e 3e 38 0d 12 2a  |    \y%=y%>>8..*|
00002c60  28 4d 4f 56 20 72 7a 2c  72 7a 32 20 20 20 20 20  |(MOV rz,rz2     |
00002c70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 7a  |              \z|
00002c80  25 3d 7a 32 25 0d 12 34  23 4d 4f 56 20 50 43 2c  |%=z2%..4#MOV PC,|
00002c90  72 6c 69 6e 6b 20 20 20  20 20 20 20 20 20 20 20  |rlink           |
00002ca0  20 20 20 20 20 20 5c e1  0d 12 3e 05 5d 0d 12 48  |      \...>.]..H|
00002cb0  04 0d 12 52 1c f4 20 2d  20 52 65 67 69 73 74 65  |...R.. - Registe|
00002cc0  72 73 20 66 6f 72 20 64  72 61 77 20 2d 0d 12 5c  |rs for draw -..\|
00002cd0  22 f4 20 2d 20 4f 2f 50  20 70 61 72 61 6d 73 20  |". - O/P params |
00002ce0  66 6f 72 20 64 72 61 77  5f 70 6f 6c 79 20 2d 0d  |for draw_poly -.|
00002cf0  12 66 0b 72 70 6f 6c 79  3d 32 0d 12 70 0b 72 70  |.f.rpoly=2..p.rp|
00002d00  74 72 30 3d 33 0d 12 7a  0b 72 70 74 72 31 3d 34  |tr0=3..z.rptr1=4|
00002d10  0d 12 84 13 f4 20 2d 20  4c 6f 63 61 6c 20 76 61  |..... - Local va|
00002d20  72 20 2d 0d 12 8e 0f 72  76 69 65 77 5f 70 74 72  |r -....rview_ptr|
00002d30  3d 35 0d 12 98 04 0d 12  a2 0e 5b 4f 50 54 20 70  |=5........[OPT p|
00002d40  61 73 73 25 0d 12 ac 09  2e 64 72 61 77 0d 12 b6  |ass%.....draw...|
00002d50  1a 4c 44 52 20 72 76 69  65 77 5f 70 74 72 2c 76  |.LDR rview_ptr,v|
00002d60  69 65 77 5f 70 74 72 0d  12 c0 39 4c 44 52 20 72  |iew_ptr...9LDR r|
00002d70  70 74 72 30 2c 6e 65 77  5f 70 74 72 20 20 20 20  |ptr0,new_ptr    |
00002d80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002d90  20 5c 70 74 72 30 25 3d  21 6e 65 77 5f 70 74 72  | \ptr0%=!new_ptr|
00002da0  0d 12 ca 3b 41 44 44 20  72 70 74 72 31 2c 72 70  |...;ADD rptr1,rp|
00002db0  74 72 30 2c 23 31 20 20  20 20 20 20 20 20 20 20  |tr0,#1          |
00002dc0  20 20 20 20 20 20 20 20  20 20 5c 70 74 72 31 25  |          \ptr1%|
00002dd0  3d 21 6e 65 77 5f 70 74  72 2b 31 0d 12 d4 2c 2e  |=!new_ptr+1...,.|
00002de0  64 72 61 77 5f 72 65 70  65 61 74 5f 31 20 20 20  |draw_repeat_1   |
00002df0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002e00  20 20 20 20 20 5c f5 0d  12 de 34 53 55 42 53 20  |     \....4SUBS |
00002e10  72 70 74 72 30 2c 72 70  74 72 30 2c 23 31 20 20  |rptr0,rptr0,#1  |
00002e20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002e30  20 5c 20 70 74 72 30 25  2d 3d 31 0d 12 e8 46 4d  | \ ptr0%-=1...FM|
00002e40  4f 56 4c 54 20 72 70 74  72 30 2c 23 6d 61 78 5f  |OVLT rptr0,#max_|
00002e50  70 74 72 25 20 20 20 20  20 20 20 20 20 20 20 20  |ptr%            |
00002e60  20 20 20 20 20 5c 20 e7  20 70 74 72 30 25 3c 30  |     \ . ptr0%<0|
00002e70  20 8c 20 70 74 72 30 25  3d 6d 61 78 5f 70 74 72  | . ptr0%=max_ptr|
00002e80  25 0d 12 f2 34 53 55 42  53 20 72 70 74 72 31 2c  |%...4SUBS rptr1,|
00002e90  72 70 74 72 31 2c 23 31  20 20 20 20 20 20 20 20  |rptr1,#1        |
00002ea0  20 20 20 20 20 20 20 20  20 20 20 5c 20 70 74 72  |           \ ptr|
00002eb0  31 25 2d 3d 31 0d 12 fc  46 4d 4f 56 4c 54 20 72  |1%-=1...FMOVLT r|
00002ec0  70 74 72 31 2c 23 6d 61  78 5f 70 74 72 25 20 20  |ptr1,#max_ptr%  |
00002ed0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00002ee0  20 e7 20 70 74 72 31 25  3c 30 20 8c 20 70 74 72  | . ptr1%<0 . ptr|
00002ef0  31 25 3d 6d 61 78 5f 70  74 72 25 0d 13 06 39 4d  |1%=max_ptr%...9M|
00002f00  4f 56 20 72 70 6f 6c 79  2c 23 30 20 20 20 20 20  |OV rpoly,#0     |
00002f10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002f20  20 20 20 20 20 5c 20 e3  20 70 6f 6c 79 25 3d 30  |     \ . poly%=0|
00002f30  20 b8 20 33 0d 13 10 10  2e 64 72 61 77 5f 6c 6f  | . 3.....draw_lo|
00002f40  6f 70 5f 31 0d 13 1a 38  53 54 4d 46 44 20 72 31  |op_1...8STMFD r1|
00002f50  33 20 21 2c 7b 72 32 2d  72 35 2c 72 6c 69 6e 6b  |3 !,{r2-r5,rlink|
00002f60  7d 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |}             \ |
00002f70  20 d6 20 64 72 61 77 5f  70 6f 6c 79 0d 13 24 10  | . draw_poly..$.|
00002f80  42 4c 20 64 72 61 77 5f  70 6f 6c 79 0d 13 2e 1d  |BL draw_poly....|
00002f90  4c 44 4d 46 44 20 72 31  33 20 21 2c 7b 72 32 2d  |LDMFD r13 !,{r2-|
00002fa0  72 35 2c 72 6c 69 6e 6b  7d 0d 13 38 33 41 44 44  |r5,rlink}..83ADD|
00002fb0  20 72 70 6f 6c 79 2c 72  70 6f 6c 79 2c 23 31 20  | rpoly,rpoly,#1 |
00002fc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002fd0  20 20 20 5c 20 ed 20 70  6f 6c 79 25 0d 13 42 10  |   \ . poly%..B.|
00002fe0  43 4d 50 20 72 70 6f 6c  79 2c 23 33 0d 13 4c 13  |CMP rpoly,#3..L.|
00002ff0  42 4c 45 20 64 72 61 77  5f 6c 6f 6f 70 5f 31 0d  |BLE draw_loop_1.|
00003000  13 56 3c 43 4d 50 20 72  70 74 72 30 2c 72 76 69  |.V<CMP rptr0,rvi|
00003010  65 77 5f 70 74 72 20 20  20 20 20 20 20 20 20 20  |ew_ptr          |
00003020  20 20 20 20 20 20 20 20  20 5c fd 20 70 74 72 30  |         \. ptr0|
00003030  25 3d 21 76 69 65 77 5f  70 74 72 0d 13 60 15 42  |%=!view_ptr..`.B|
00003040  4e 45 20 64 72 61 77 5f  72 65 70 65 61 74 5f 31  |NE draw_repeat_1|
00003050  0d 13 6a 2c 4d 4f 56 20  50 43 2c 72 6c 69 6e 6b  |..j,MOV PC,rlink|
00003060  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003070  20 20 20 20 20 20 20 20  20 20 5c e1 0d 13 74 05  |          \...t.|
00003080  5d 0d 13 7e 04 0d 13 88  21 f4 20 2d 20 52 65 67  |]..~....!. - Reg|
00003090  69 73 74 65 72 73 20 66  6f 72 20 64 72 61 77 5f  |isters for draw_|
000030a0  70 6f 6c 79 20 2d 0d 13  92 16 f4 20 2d 20 49 6e  |poly -..... - In|
000030b0  70 75 74 20 70 61 72 61  6d 73 20 2d 0d 13 9c 0b  |put params -....|
000030c0  72 70 6f 6c 79 3d 32 0d  13 a6 0b 72 70 74 72 30  |rpoly=2....rptr0|
000030d0  3d 33 0d 13 b0 0b 72 70  74 72 31 3d 34 0d 13 ba  |=3....rptr1=4...|
000030e0  14 f4 20 2d 20 4c 6f 63  61 6c 20 76 61 72 73 20  |.. - Local vars |
000030f0  2d 0d 13 c4 0a 72 63 6f  6c 3d 35 0d 13 ce 2a 72  |-....rcol=5...*r|
00003100  70 6f 6c 79 5f 73 78 3d  36 20 3a f4 20 6d 75 73  |poly_sx=6 :. mus|
00003110  74 20 6d 61 74 63 68 20  72 36 20 69 6e 20 6f 75  |t match r6 in ou|
00003120  74 73 69 64 65 0d 13 d8  2a 72 70 6f 6c 79 5f 73  |tside...*rpoly_s|
00003130  79 3d 37 20 3a f4 20 6d  75 73 74 20 6d 61 74 63  |y=7 :. must matc|
00003140  68 20 72 37 20 69 6e 20  6f 75 74 73 69 64 65 0d  |h r7 in outside.|
00003150  13 e2 0a 72 73 78 61 3d  38 0d 13 ec 0a 72 73 78  |...rsxa=8....rsx|
00003160  62 3d 39 0d 13 f6 0b 72  73 79 61 3d 31 30 0d 14  |b=9....rsya=10..|
00003170  00 0b 72 73 79 62 3d 31  31 0d 14 0a 04 0d 14 14  |..rsyb=11.......|
00003180  0e 5b 4f 50 54 20 70 61  73 73 25 0d 14 1e 0e 2e  |.[OPT pass%.....|
00003190  64 72 61 77 5f 70 6f 6c  79 0d 14 28 36 4c 44 52  |draw_poly..(6LDR|
000031a0  20 72 70 6f 6c 79 5f 73  78 2c 70 6f 6c 79 5f 73  | rpoly_sx,poly_s|
000031b0  78 20 20 20 20 20 20 20  20 20 20 20 20 5c 70 6f  |x            \po|
000031c0  6c 79 5f 73 78 25 3d 21  70 6f 6c 79 5f 73 78 0d  |ly_sx%=!poly_sx.|
000031d0  14 32 36 4c 44 52 20 72  70 6f 6c 79 5f 73 79 2c  |.26LDR rpoly_sy,|
000031e0  70 6f 6c 79 5f 73 79 20  20 20 20 20 20 20 20 20  |poly_sy         |
000031f0  20 20 20 5c 70 6f 6c 79  5f 73 79 25 3d 21 70 6f  |   \poly_sy%=!po|
00003200  6c 79 5f 73 79 0d 14 3c  2f 43 4d 50 20 72 70 6f  |ly_sy..</CMP rpo|
00003210  6c 79 2c 23 30 20 20 20  20 20 20 20 20 20 20 20  |ly,#0           |
00003220  20 20 20 20 20 20 20 20  20 5c c8 8e 20 70 6f 6c  |         \.. pol|
00003230  79 25 20 ca 0d 14 46 18  42 45 51 20 64 72 61 77  |y% ...F.BEQ draw|
00003240  5f 70 6f 6c 79 5f 77 68  65 6e 5f 30 0d 14 50 10  |_poly_when_0..P.|
00003250  43 4d 50 20 72 70 6f 6c  79 2c 23 31 0d 14 5a 18  |CMP rpoly,#1..Z.|
00003260  42 45 51 20 64 72 61 77  5f 70 6f 6c 79 5f 77 68  |BEQ draw_poly_wh|
00003270  65 6e 5f 31 0d 14 64 10  43 4d 50 20 72 70 6f 6c  |en_1..d.CMP rpol|
00003280  79 2c 23 32 0d 14 6e 18  42 45 51 20 64 72 61 77  |y,#2..n.BEQ draw|
00003290  5f 70 6f 6c 79 5f 77 68  65 6e 5f 32 0d 14 78 10  |_poly_when_2..x.|
000032a0  43 4d 50 20 72 70 6f 6c  79 2c 23 33 0d 14 82 18  |CMP rpoly,#3....|
000032b0  42 45 51 20 64 72 61 77  5f 70 6f 6c 79 5f 77 68  |BEQ draw_poly_wh|
000032c0  65 6e 5f 33 0d 14 8c 16  20 f4 20 2d 2d 20 4c 65  |en_3.... . -- Le|
000032d0  66 74 20 77 61 6c 6c 20  2d 2d 0d 14 96 29 2e 64  |ft wall --...).d|
000032e0  72 61 77 5f 70 6f 6c 79  5f 77 68 65 6e 5f 30 20  |raw_poly_when_0 |
000032f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00003300  c9 20 30 0d 14 a0 30 4c  44 52 20 72 73 78 61 2c  |. 0...0LDR rsxa,|
00003310  73 78 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |sx0             |
00003320  20 20 20 20 20 20 20 5c  20 20 73 78 61 25 3d 21  |       \  sxa%=!|
00003330  73 78 30 0d 14 aa 30 4c  44 52 20 72 73 79 61 2c  |sx0...0LDR rsya,|
00003340  73 79 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |sy0             |
00003350  20 20 20 20 20 20 20 5c  20 20 73 79 61 25 3d 21  |       \  sya%=!|
00003360  73 79 30 0d 14 b4 30 4c  44 52 20 72 73 78 62 2c  |sy0...0LDR rsxb,|
00003370  73 78 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |sx1             |
00003380  20 20 20 20 20 20 20 5c  20 20 73 78 62 25 3d 21  |       \  sxb%=!|
00003390  73 78 31 0d 14 be 30 4c  44 52 20 72 73 79 62 2c  |sx1...0LDR rsyb,|
000033a0  73 79 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |sy1             |
000033b0  20 20 20 20 20 20 20 5c  20 20 73 79 62 25 3d 21  |       \  syb%=!|
000033c0  73 79 31 0d 14 c8 3f 4c  44 52 20 72 30 2c 62 75  |sy1...?LDR r0,bu|
000033d0  66 5f 63 6f 6c 20 20 20  20 20 20 20 20 20 20 20  |f_col           |
000033e0  20 20 20 20 20 20 20 5c  20 20 63 6f 6c 25 3d 62  |       \  col%=b|
000033f0  75 66 5f 63 6f 6c 25 21  28 70 74 72 30 25 3c 3c  |uf_col%!(ptr0%<<|
00003400  32 29 0d 14 d2 1d 4c 44  52 20 72 63 6f 6c 2c 5b  |2)....LDR rcol,[|
00003410  72 30 2c 72 70 74 72 30  2c 4c 53 4c 23 32 5d 0d  |r0,rptr0,LSL#2].|
00003420  14 dc 17 42 20 64 72 61  77 5f 70 6f 6c 79 5f 65  |...B draw_poly_e|
00003430  6e 64 63 61 73 65 0d 14  e6 11 20 f4 20 2d 2d 20  |ndcase.... . -- |
00003440  52 6f 6f 66 20 2d 2d 0d  14 f0 29 2e 64 72 61 77  |Roof --...).draw|
00003450  5f 70 6f 6c 79 5f 77 68  65 6e 5f 31 20 20 20 20  |_poly_when_1    |
00003460  20 20 20 20 20 20 20 20  20 20 20 5c 20 c9 20 31  |           \ . 1|
00003470  0d 14 fa 30 4c 44 52 20  72 73 78 61 2c 73 78 31  |...0LDR rsxa,sx1|
00003480  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003490  20 20 20 20 5c 20 20 73  78 61 25 3d 21 73 78 31  |    \  sxa%=!sx1|
000034a0  0d 15 04 30 4c 44 52 20  72 73 79 61 2c 73 79 31  |...0LDR rsya,sy1|
000034b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000034c0  20 20 20 20 5c 20 20 73  79 61 25 3d 21 73 79 31  |    \  sya%=!sy1|
000034d0  0d 15 0e 30 4c 44 52 20  72 73 78 62 2c 73 78 32  |...0LDR rsxb,sx2|
000034e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000034f0  20 20 20 20 5c 20 20 73  78 62 25 3d 21 73 78 32  |    \  sxb%=!sx2|
00003500  0d 15 18 30 4c 44 52 20  72 73 79 62 2c 73 79 32  |...0LDR rsyb,sy2|
00003510  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003520  20 20 20 20 5c 20 20 73  79 62 25 3d 21 73 79 32  |    \  syb%=!sy2|
00003530  0d 15 22 39 4d 4f 56 20  72 63 6f 6c 2c 72 70 74  |.."9MOV rcol,rpt|
00003540  72 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r0              |
00003550  20 20 20 20 5c 20 20 63  6f 6c 25 3d 70 74 72 30  |    \  col%=ptr0|
00003560  25 20 83 20 80 20 25 31  31 0d 15 2c 14 80 20 72  |% . . %11..,.. r|
00003570  63 6f 6c 2c 72 63 6f 6c  2c 23 25 31 31 0d 15 36  |col,rcol,#%11..6|
00003580  14 41 44 44 20 72 63 6f  6c 2c 72 63 6f 6c 2c 23  |.ADD rcol,rcol,#|
00003590  34 0d 15 40 17 42 20 64  72 61 77 5f 70 6f 6c 79  |4..@.B draw_poly|
000035a0  5f 65 6e 64 63 61 73 65  0d 15 4a 17 20 f4 20 2d  |_endcase..J. . -|
000035b0  2d 20 52 69 67 68 74 20  77 61 6c 6c 20 2d 2d 0d  |- Right wall --.|
000035c0  15 54 29 2e 64 72 61 77  5f 70 6f 6c 79 5f 77 68  |.T).draw_poly_wh|
000035d0  65 6e 5f 32 20 20 20 20  20 20 20 20 20 20 20 20  |en_2            |
000035e0  20 20 20 5c 20 c9 20 32  0d 15 5e 30 4c 44 52 20  |   \ . 2..^0LDR |
000035f0  72 73 78 61 2c 73 78 32  20 20 20 20 20 20 20 20  |rsxa,sx2        |
00003600  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 20 73  |            \  s|
00003610  78 61 25 3d 21 73 78 32  0d 15 68 30 4c 44 52 20  |xa%=!sx2..h0LDR |
00003620  72 73 79 61 2c 73 79 32  20 20 20 20 20 20 20 20  |rsya,sy2        |
00003630  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 20 73  |            \  s|
00003640  79 61 25 3d 21 73 79 32  0d 15 72 30 4c 44 52 20  |ya%=!sy2..r0LDR |
00003650  72 73 78 62 2c 73 78 33  20 20 20 20 20 20 20 20  |rsxb,sx3        |
00003660  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 20 73  |            \  s|
00003670  78 62 25 3d 21 73 78 33  0d 15 7c 30 4c 44 52 20  |xb%=!sx3..|0LDR |
00003680  72 73 79 62 2c 73 79 33  20 20 20 20 20 20 20 20  |rsyb,sy3        |
00003690  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 20 73  |            \  s|
000036a0  79 62 25 3d 21 73 79 33  0d 15 86 3f 4c 44 52 20  |yb%=!sy3...?LDR |
000036b0  72 30 2c 62 75 66 5f 63  6f 6c 20 20 20 20 20 20  |r0,buf_col      |
000036c0  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 20 63  |            \  c|
000036d0  6f 6c 25 3d 62 75 66 5f  63 6f 6c 25 21 28 70 74  |ol%=buf_col%!(pt|
000036e0  72 30 25 3c 3c 32 29 0d  15 90 1d 4c 44 52 20 72  |r0%<<2)....LDR r|
000036f0  63 6f 6c 2c 5b 72 30 2c  72 70 74 72 30 2c 4c 53  |col,[r0,rptr0,LS|
00003700  4c 23 32 5d 0d 15 9a 17  42 20 64 72 61 77 5f 70  |L#2]....B draw_p|
00003710  6f 6c 79 5f 65 6e 64 63  61 73 65 0d 15 a4 12 20  |oly_endcase.... |
00003720  f4 20 2d 2d 20 46 6c 6f  6f 72 20 2d 2d 0d 15 ae  |. -- Floor --...|
00003730  29 2e 64 72 61 77 5f 70  6f 6c 79 5f 77 68 65 6e  |).draw_poly_when|
00003740  5f 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |_3              |
00003750  20 5c 20 c9 20 33 0d 15  b8 30 4c 44 52 20 72 73  | \ . 3...0LDR rs|
00003760  78 61 2c 73 78 33 20 20  20 20 20 20 20 20 20 20  |xa,sx3          |
00003770  20 20 20 20 20 20 20 20  20 20 5c 20 20 73 78 61  |          \  sxa|
00003780  25 3d 21 73 78 33 0d 15  c2 30 4c 44 52 20 72 73  |%=!sx3...0LDR rs|
00003790  79 61 2c 73 79 33 20 20  20 20 20 20 20 20 20 20  |ya,sy3          |
000037a0  20 20 20 20 20 20 20 20  20 20 5c 20 20 73 79 61  |          \  sya|
000037b0  25 3d 21 73 79 33 0d 15  cc 30 4c 44 52 20 72 73  |%=!sy3...0LDR rs|
000037c0  78 62 2c 73 78 30 20 20  20 20 20 20 20 20 20 20  |xb,sx0          |
000037d0  20 20 20 20 20 20 20 20  20 20 5c 20 20 73 78 62  |          \  sxb|
000037e0  25 3d 21 73 78 30 0d 15  d6 30 4c 44 52 20 72 73  |%=!sx0...0LDR rs|
000037f0  79 62 2c 73 79 30 20 20  20 20 20 20 20 20 20 20  |yb,sy0          |
00003800  20 20 20 20 20 20 20 20  20 20 5c 20 20 73 79 62  |          \  syb|
00003810  25 3d 21 73 79 30 0d 15  e0 37 4d 4f 56 20 72 63  |%=!sy0...7MOV rc|
00003820  6f 6c 2c 72 70 74 72 30  20 20 20 20 20 20 20 20  |ol,rptr0        |
00003830  20 20 20 20 20 20 20 20  20 20 5c 20 20 63 6f 6c  |          \  col|
00003840  25 3d 70 74 72 30 25 20  80 20 25 31 31 0d 15 ea  |%=ptr0% . %11...|
00003850  14 80 20 72 63 6f 6c 2c  72 63 6f 6c 2c 23 25 31  |.. rcol,rcol,#%1|
00003860  31 0d 15 f4 14 41 44 44  20 72 63 6f 6c 2c 72 63  |1....ADD rcol,rc|
00003870  6f 6c 2c 23 34 0d 15 fe  26 2e 64 72 61 77 5f 70  |ol,#4...&.draw_p|
00003880  6f 6c 79 5f 65 6e 64 63  61 73 65 20 20 20 20 20  |oly_endcase     |
00003890  20 20 20 20 20 20 20 20  20 5c cb 0d 16 08 04 0d  |         \......|
000038a0  16 12 43 4c 44 52 20 72  30 2c 5b 72 73 78 61 2c  |..CLDR r0,[rsxa,|
000038b0  72 70 74 72 30 2c 4c 53  4c 23 32 5d 20 20 20 20  |rptr0,LSL#2]    |
000038c0  20 20 20 5c 70 6f 6c 79  5f 73 78 25 21 30 3d 73  |   \poly_sx%!0=s|
000038d0  78 61 25 21 28 70 74 72  30 25 3c 3c 32 29 20 81  |xa%!(ptr0%<<2) .|
000038e0  20 32 0d 16 1c 13 4d 4f  56 20 72 30 2c 72 30 2c  | 2....MOV r0,r0,|
000038f0  41 53 52 23 31 0d 16 26  18 53 54 52 20 72 30 2c  |ASR#1..&.STR r0,|
00003900  5b 72 70 6f 6c 79 5f 73  78 2c 23 30 5d 0d 16 30  |[rpoly_sx,#0]..0|
00003910  04 0d 16 3a 47 4c 44 52  20 72 30 2c 5b 72 73 79  |...:GLDR r0,[rsy|
00003920  61 2c 72 70 74 72 30 2c  4c 53 4c 23 32 5d 20 20  |a,rptr0,LSL#2]  |
00003930  20 20 20 20 20 5c 70 6f  6c 79 5f 73 79 25 21 30  |     \poly_sy%!0|
00003940  3d 34 37 39 2d 73 79 61  25 21 28 70 74 72 30 25  |=479-sya%!(ptr0%|
00003950  3c 3c 32 29 20 81 20 32  0d 16 44 13 4d 4f 56 20  |<<2) . 2..D.MOV |
00003960  72 30 2c 72 30 2c 41 53  52 23 31 0d 16 4e 12 52  |r0,r0,ASR#1..N.R|
00003970  53 42 20 72 30 2c 72 30  2c 23 34 38 30 0d 16 58  |SB r0,r0,#480..X|
00003980  10 53 55 42 20 72 30 2c  72 30 2c 23 31 0d 16 62  |.SUB r0,r0,#1..b|
00003990  18 53 54 52 20 72 30 2c  5b 72 70 6f 6c 79 5f 73  |.STR r0,[rpoly_s|
000039a0  79 2c 23 30 5d 0d 16 6c  04 0d 16 76 43 4c 44 52  |y,#0]..l...vCLDR|
000039b0  20 72 30 2c 5b 72 73 78  62 2c 72 70 74 72 30 2c  | r0,[rsxb,rptr0,|
000039c0  4c 53 4c 23 32 5d 20 20  20 20 20 20 20 5c 70 6f  |LSL#2]       \po|
000039d0  6c 79 5f 73 78 25 21 34  3d 73 78 62 25 21 28 70  |ly_sx%!4=sxb%!(p|
000039e0  74 72 30 25 3c 3c 32 29  20 81 20 32 0d 16 80 13  |tr0%<<2) . 2....|
000039f0  4d 4f 56 20 72 30 2c 72  30 2c 41 53 52 23 31 0d  |MOV r0,r0,ASR#1.|
00003a00  16 8a 18 53 54 52 20 72  30 2c 5b 72 70 6f 6c 79  |...STR r0,[rpoly|
00003a10  5f 73 78 2c 23 34 5d 0d  16 94 04 0d 16 9e 47 4c  |_sx,#4].......GL|
00003a20  44 52 20 72 30 2c 5b 72  73 79 62 2c 72 70 74 72  |DR r0,[rsyb,rptr|
00003a30  30 2c 4c 53 4c 23 32 5d  20 20 20 20 20 20 20 5c  |0,LSL#2]       \|
00003a40  70 6f 6c 79 5f 73 79 25  21 34 3d 34 37 39 2d 73  |poly_sy%!4=479-s|
00003a50  79 62 25 21 28 70 74 72  30 25 3c 3c 32 29 20 81  |yb%!(ptr0%<<2) .|
00003a60  20 32 0d 16 a8 13 4d 4f  56 20 72 30 2c 72 30 2c  | 2....MOV r0,r0,|
00003a70  41 53 52 23 31 0d 16 b2  12 52 53 42 20 72 30 2c  |ASR#1....RSB r0,|
00003a80  72 30 2c 23 34 38 30 0d  16 bc 10 53 55 42 20 72  |r0,#480....SUB r|
00003a90  30 2c 72 30 2c 23 31 0d  16 c6 18 53 54 52 20 72  |0,r0,#1....STR r|
00003aa0  30 2c 5b 72 70 6f 6c 79  5f 73 79 2c 23 34 5d 0d  |0,[rpoly_sy,#4].|
00003ab0  16 d0 04 0d 16 da 43 4c  44 52 20 72 30 2c 5b 72  |......CLDR r0,[r|
00003ac0  73 78 62 2c 72 70 74 72  31 2c 4c 53 4c 23 32 5d  |sxb,rptr1,LSL#2]|
00003ad0  20 20 20 20 20 20 20 5c  70 6f 6c 79 5f 73 78 25  |       \poly_sx%|
00003ae0  21 38 3d 73 78 62 25 21  28 70 74 72 31 25 3c 3c  |!8=sxb%!(ptr1%<<|
00003af0  32 29 20 81 20 32 0d 16  e4 13 4d 4f 56 20 72 30  |2) . 2....MOV r0|
00003b00  2c 72 30 2c 41 53 52 23  31 0d 16 ee 18 53 54 52  |,r0,ASR#1....STR|
00003b10  20 72 30 2c 5b 72 70 6f  6c 79 5f 73 78 2c 23 38  | r0,[rpoly_sx,#8|
00003b20  5d 0d 16 f8 04 0d 17 02  47 4c 44 52 20 72 30 2c  |].......GLDR r0,|
00003b30  5b 72 73 79 62 2c 72 70  74 72 31 2c 4c 53 4c 23  |[rsyb,rptr1,LSL#|
00003b40  32 5d 20 20 20 20 20 20  20 5c 70 6f 6c 79 5f 73  |2]       \poly_s|
00003b50  79 25 21 38 3d 34 37 39  2d 73 79 62 25 21 28 70  |y%!8=479-syb%!(p|
00003b60  74 72 31 25 3c 3c 32 29  20 81 20 32 0d 17 0c 13  |tr1%<<2) . 2....|
00003b70  4d 4f 56 20 72 30 2c 72  30 2c 41 53 52 23 31 0d  |MOV r0,r0,ASR#1.|
00003b80  17 16 12 52 53 42 20 72  30 2c 72 30 2c 23 34 38  |...RSB r0,r0,#48|
00003b90  30 0d 17 20 10 53 55 42  20 72 30 2c 72 30 2c 23  |0.. .SUB r0,r0,#|
00003ba0  31 0d 17 2a 18 53 54 52  20 72 30 2c 5b 72 70 6f  |1..*.STR r0,[rpo|
00003bb0  6c 79 5f 73 79 2c 23 38  5d 0d 17 34 04 0d 17 3e  |ly_sy,#8]..4...>|
00003bc0  44 4c 44 52 20 72 30 2c  5b 72 73 78 61 2c 72 70  |DLDR r0,[rsxa,rp|
00003bd0  74 72 31 2c 4c 53 4c 23  32 5d 20 20 20 20 20 20  |tr1,LSL#2]      |
00003be0  20 5c 70 6f 6c 79 5f 73  78 25 21 31 32 3d 73 78  | \poly_sx%!12=sx|
00003bf0  61 25 21 28 70 74 72 31  25 3c 3c 32 29 20 81 20  |a%!(ptr1%<<2) . |
00003c00  32 0d 17 48 13 4d 4f 56  20 72 30 2c 72 30 2c 41  |2..H.MOV r0,r0,A|
00003c10  53 52 23 31 0d 17 52 19  53 54 52 20 72 30 2c 5b  |SR#1..R.STR r0,[|
00003c20  72 70 6f 6c 79 5f 73 78  2c 23 31 32 5d 0d 17 5c  |rpoly_sx,#12]..\|
00003c30  04 0d 17 66 48 4c 44 52  20 72 30 2c 5b 72 73 79  |...fHLDR r0,[rsy|
00003c40  61 2c 72 70 74 72 31 2c  4c 53 4c 23 32 5d 20 20  |a,rptr1,LSL#2]  |
00003c50  20 20 20 20 20 5c 70 6f  6c 79 5f 73 79 25 21 31  |     \poly_sy%!1|
00003c60  32 3d 34 37 39 2d 73 79  61 25 21 28 70 74 72 31  |2=479-sya%!(ptr1|
00003c70  25 3c 3c 32 29 20 81 20  32 0d 17 70 13 4d 4f 56  |%<<2) . 2..p.MOV|
00003c80  20 72 30 2c 72 30 2c 41  53 52 23 31 0d 17 7a 12  | r0,r0,ASR#1..z.|
00003c90  52 53 42 20 72 30 2c 72  30 2c 23 34 38 30 0d 17  |RSB r0,r0,#480..|
00003ca0  84 10 53 55 42 20 72 30  2c 72 30 2c 23 31 0d 17  |..SUB r0,r0,#1..|
00003cb0  8e 19 53 54 52 20 72 30  2c 5b 72 70 6f 6c 79 5f  |..STR r0,[rpoly_|
00003cc0  73 79 2c 23 31 32 5d 0d  17 98 36 53 54 52 20 72  |sy,#12]...6STR r|
00003cd0  63 6f 6c 2c 70 6f 6c 79  5f 63 6f 6c 6f 75 72 20  |col,poly_colour |
00003ce0  20 20 20 20 20 20 20 20  20 20 20 5c 21 70 6f 6c  |           \!pol|
00003cf0  79 5f 63 6f 6c 6f 75 72  3d 63 6f 6c 25 0d 17 a2  |y_colour=col%...|
00003d00  33 53 54 4d 46 44 20 72  31 33 20 21 2c 7b 72 32  |3STMFD r13 !,{r2|
00003d10  2d 72 31 31 2c 72 6c 69  6e 6b 7d 20 20 20 20 20  |-r11,rlink}     |
00003d20  20 5c d6 20 64 72 61 77  5f 70 6f 6c 79 67 6f 6e  | \. draw_polygon|
00003d30  0d 17 ac 13 42 4c 20 64  72 61 77 5f 70 6f 6c 79  |....BL draw_poly|
00003d40  67 6f 6e 0d 17 b6 1e 4c  44 4d 46 44 20 72 31 33  |gon....LDMFD r13|
00003d50  20 21 2c 7b 72 32 2d 72  31 31 2c 72 6c 69 6e 6b  | !,{r2-r11,rlink|
00003d60  7d 0d 17 c0 26 4d 4f 56  20 50 43 2c 72 6c 69 6e  |}...&MOV PC,rlin|
00003d70  6b 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |k               |
00003d80  20 20 20 20 20 5c e1 0d  17 ca 05 5d 0d 17 d4 04  |     \.....]....|
00003d90  0d 17 de 10 f4 20 2d 20  64 69 76 69 64 65 20 2d  |..... - divide -|
00003da0  0d 17 e8 26 f4 20 73 75  62 72 6f 75 74 69 6e 65  |...&. subroutine|
00003db0  20 28 63 61 6c 6c 65 72  20 73 61 76 65 73 20 72  | (caller saves r|
00003dc0  32 2e 2e 72 36 29 0d 17  f2 2a f4 20 69 6e 70 75  |2..r6)...*. inpu|
00003dd0  74 3a 20 64 69 76 69 64  65 6e 64 20 69 6e 20 52  |t: dividend in R|
00003de0  30 2c 20 64 69 76 69 73  6f 72 20 69 6e 20 52 31  |0, divisor in R1|
00003df0  0d 17 fc 2d f4 20 6f 75  74 70 75 74 3a 20 71 75  |...-. output: qu|
00003e00  6f 74 69 65 6e 74 20 69  6e 20 52 30 2c 20 72 65  |otient in R0, re|
00003e10  6d 61 69 6e 64 65 72 20  69 6e 20 52 31 0d 18 06  |mainder in R1...|
00003e20  04 0d 18 10 0e 5b 4f 50  54 20 70 61 73 73 25 0d  |.....[OPT pass%.|
00003e30  18 1a 0b 2e 64 69 76 69  64 65 0d 18 24 2f 80 53  |....divide..$/.S|
00003e40  20 72 36 2c 72 30 2c 23  31 3c 3c 33 31 20 20 20  | r6,r0,#1<<31   |
00003e50  20 20 20 3b 20 72 36 3d  73 69 67 6e 20 6f 66 20  |   ; r6=sign of |
00003e60  72 65 6d 61 69 6e 64 65  72 0d 18 2e 12 52 53 42  |remainder....RSB|
00003e70  4d 49 20 72 30 2c 72 30  2c 23 30 0d 18 38 2e 82  |MI r0,r0,#0..8..|
00003e80  20 72 35 2c 72 36 2c 52  31 20 20 20 20 20 20 20  | r5,r6,R1       |
00003e90  20 20 20 20 3b 20 72 35  3d 73 69 67 6e 20 6f 66  |    ; r5=sign of|
00003ea0  20 71 75 6f 74 69 65 6e  74 0d 18 42 0d 43 4d 50  | quotient..B.CMP|
00003eb0  20 72 31 2c 23 30 0d 18  4c 12 52 53 42 4d 49 20  | r1,#0..L.RSBMI |
00003ec0  72 31 2c 72 31 2c 23 30  0d 18 56 0d 4d 4f 56 20  |r1,r1,#0..V.MOV |
00003ed0  72 33 2c 23 30 0d 18 60  0d 4d 4f 56 20 72 32 2c  |r3,#0..`.MOV r2,|
00003ee0  23 30 0d 18 6a 11 4d 4f  56 20 72 34 2c 23 31 3c  |#0..j.MOV r4,#1<|
00003ef0  3c 33 31 0d 18 74 0c 2e  64 69 76 6c 6f 6f 70 0d  |<31..t..divloop.|
00003f00  18 7e 16 20 20 4d 4f 56  53 20 72 30 2c 72 30 2c  |.~.  MOVS r0,r0,|
00003f10  41 53 4c 23 31 0d 18 88  12 20 20 41 44 43 20 72  |ASL#1....  ADC r|
00003f20  33 2c 72 33 2c 72 33 0d  18 92 0f 20 20 43 4d 50  |3,r3,r3....  CMP|
00003f30  20 72 33 2c 72 31 0d 18  9c 14 20 20 53 55 42 47  | r3,r1....  SUBG|
00003f40  45 20 72 33 2c 72 33 2c  72 31 0d 18 a6 13 20 20  |E r3,r3,r1....  |
00003f50  84 52 47 45 20 72 32 2c  72 32 2c 72 34 0d 18 b0  |.RGE r2,r2,r4...|
00003f60  16 20 20 4d 4f 56 53 20  72 34 2c 72 34 2c 4c 53  |.  MOVS r4,r4,LS|
00003f70  52 23 31 0d 18 ba 11 20  20 42 4e 45 20 64 69 76  |R#1....  BNE div|
00003f80  6c 6f 6f 70 0d 18 c4 0d  43 4d 50 20 72 35 2c 23  |loop....CMP r5,#|
00003f90  30 0d 18 ce 12 52 53 42  4d 49 20 72 32 2c 72 32  |0....RSBMI r2,r2|
00003fa0  2c 23 30 0d 18 d8 0d 43  4d 50 20 72 36 2c 23 30  |,#0....CMP r6,#0|
00003fb0  0d 18 e2 12 52 53 42 4d  49 20 72 33 2c 72 33 2c  |....RSBMI r3,r3,|
00003fc0  23 30 0d 18 ec 0d 4d 4f  56 20 72 30 2c 72 32 0d  |#0....MOV r0,r2.|
00003fd0  18 f6 0d 4d 4f 56 20 72  31 2c 72 33 0d 19 00 10  |...MOV r1,r3....|
00003fe0  4d 4f 56 20 50 43 2c 72  6c 69 6e 6b 0d 19 0a 05  |MOV PC,rlink....|
00003ff0  5d 0d 19 14 04 0d 19 1e  1e f4 20 75 73 65 73 20  |]......... uses |
00004000  72 30 20 6f 6e 6c 79 20  2d 20 6e 6f 20 70 61 72  |r0 only - no par|
00004010  61 6d 73 0d 19 28 04 0d  19 32 0e 5b 4f 50 54 20  |ams..(...2.[OPT |
00004020  70 61 73 73 25 0d 19 3c  11 2e 64 72 61 77 5f 70  |pass%..<..draw_p|
00004030  6f 6c 79 67 6f 6e 0d 19  46 0d 4d 4f 56 20 72 30  |olygon..F.MOV r0|
00004040  2c 23 34 0d 19 50 12 53  54 52 20 72 30 2c 6e 5f  |,#4..P.STR r0,n_|
00004050  76 65 72 74 73 0d 19 5a  37 53 54 4d 46 44 20 72  |verts..Z7STMFD r|
00004060  31 33 20 21 2c 7b 72 6c  69 6e 6b 7d 20 20 20 20  |13 !,{rlink}    |
00004070  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 d6  |             \ .|
00004080  20 66 69 6e 64 5f 62 6f  75 6e 64 73 0d 19 64 13  | find_bounds..d.|
00004090  20 42 4c 20 66 69 6e 64  5f 62 6f 75 6e 64 73 0d  | BL find_bounds.|
000040a0  19 6e 17 4c 44 4d 46 44  20 72 31 33 20 21 2c 7b  |.n.LDMFD r13 !,{|
000040b0  72 6c 69 6e 6b 7d 0d 19  78 3a 4c 44 52 20 72 30  |rlink}..x:LDR r0|
000040c0  2c 73 6b 69 70 5f 70 6f  6c 79 20 20 20 20 20 20  |,skip_poly      |
000040d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
000040e0  e7 20 21 73 6b 69 70 5f  70 6f 6c 79 3d 30 20 8c  |. !skip_poly=0 .|
000040f0  0d 19 82 0d 43 4d 50 20  72 30 2c 23 30 0d 19 8c  |....CMP r0,#0...|
00004100  1b 42 4e 45 20 64 72 61  77 5f 70 6f 6c 79 67 6f  |.BNE draw_polygo|
00004110  6e 5f 65 6e 64 69 66 31  0d 19 96 36 53 54 4d 46  |n_endif1...6STMF|
00004120  44 20 72 31 33 20 21 2c  7b 72 6c 69 6e 6b 7d 20  |D r13 !,{rlink} |
00004130  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004140  5c 20 20 d6 20 62 72 65  73 65 6e 68 61 6d 0d 19  |\  . bresenham..|
00004150  a0 11 20 42 4c 20 62 72  65 73 65 6e 68 61 6d 0d  |.. BL bresenham.|
00004160  19 aa 37 20 42 4c 20 66  69 6c 6c 5f 70 6f 6c 79  |..7 BL fill_poly|
00004170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004180  20 20 20 20 20 20 20 5c  20 20 d6 20 66 69 6c 6c  |       \  . fill|
00004190  5f 70 6f 6c 79 78 0d 19  b4 17 4c 44 4d 46 44 20  |_polyx....LDMFD |
000041a0  72 31 33 20 21 2c 7b 72  6c 69 6e 6b 7d 0d 19 be  |r13 !,{rlink}...|
000041b0  2b 2e 64 72 61 77 5f 70  6f 6c 79 67 6f 6e 5f 65  |+.draw_polygon_e|
000041c0  6e 64 69 66 31 20 20 20  20 20 20 20 20 20 20 20  |ndif1           |
000041d0  20 20 20 20 20 5c 20 cd  0d 19 c8 2a 4d 4f 56 20  |     \ ....*MOV |
000041e0  50 43 2c 72 6c 69 6e 6b  20 20 20 20 20 20 20 20  |PC,rlink        |
000041f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004200  5c e1 0d 19 d2 05 5d 0d  19 dc 04 0d 19 e6 23 f4  |\.....].......#.|
00004210  20 2d 20 52 65 67 69 73  74 65 72 73 20 66 6f 72  | - Registers for|
00004220  20 66 69 6e 64 5f 62 6f  75 6e 64 73 20 2d 0d 19  | find_bounds -..|
00004230  f0 04 0d 19 fa 0e 72 70  6f 6c 79 5f 73 78 3d 31  |......rpoly_sx=1|
00004240  0d 1a 04 0e 72 70 6f 6c  79 5f 73 79 3d 32 0d 1a  |....rpoly_sy=2..|
00004250  0e 0c 72 74 6f 70 5f 76  3d 33 0d 1a 18 0c 72 62  |..rtop_v=3....rb|
00004260  74 6d 5f 76 3d 34 0d 1a  22 0d 72 6c 65 66 74 5f  |tm_v=4..".rleft_|
00004270  76 3d 35 0d 1a 2c 0e 72  72 69 67 68 74 5f 76 3d  |v=5..,.rright_v=|
00004280  36 0d 1a 36 0d 72 74 6f  70 5f 73 79 3d 37 0d 1a  |6..6.rtop_sy=7..|
00004290  40 0d 72 62 74 6d 5f 73  79 3d 38 0d 1a 4a 0e 72  |@.rbtm_sy=8..J.r|
000042a0  6c 65 66 74 5f 73 78 3d  39 0d 1a 54 10 72 72 69  |left_sx=9..T.rri|
000042b0  67 68 74 5f 73 78 3d 31  30 0d 1a 5e 09 72 76 3d  |ght_sx=10..^.rv=|
000042c0  31 31 0d 1a 68 0c 72 6d  61 78 76 3d 31 32 0d 1a  |11..h.rmaxv=12..|
000042d0  72 04 0d 1a 7c 0e 5b 4f  50 54 20 70 61 73 73 25  |r...|.[OPT pass%|
000042e0  0d 1a 86 10 2e 66 69 6e  64 5f 62 6f 75 6e 64 73  |.....find_bounds|
000042f0  0d 1a 90 3a 4c 44 52 20  72 6d 61 78 76 2c 6e 5f  |...:LDR rmaxv,n_|
00004300  76 65 72 74 73 20 20 20  20 20 20 20 20 20 20 20  |verts           |
00004310  20 20 20 20 20 20 20 20  20 5c 6d 61 78 76 25 3d  |         \maxv%=|
00004320  21 6e 5f 76 65 72 74 73  2d 31 0d 1a 9a 16 53 55  |!n_verts-1....SU|
00004330  42 20 72 6d 61 78 76 2c  72 6d 61 78 76 2c 23 31  |B rmaxv,rmaxv,#1|
00004340  0d 1a a4 3b 4c 44 52 20  72 70 6f 6c 79 5f 73 78  |...;LDR rpoly_sx|
00004350  2c 70 6f 6c 79 5f 73 78  20 20 20 20 20 20 20 20  |,poly_sx        |
00004360  20 20 20 20 20 20 20 20  20 5c 70 6f 6c 79 5f 73  |         \poly_s|
00004370  78 25 3d 21 70 6f 6c 79  5f 73 78 0d 1a ae 3b 4c  |x%=!poly_sx...;L|
00004380  44 52 20 72 70 6f 6c 79  5f 73 79 2c 70 6f 6c 79  |DR rpoly_sy,poly|
00004390  5f 73 79 20 20 20 20 20  20 20 20 20 20 20 20 20  |_sy             |
000043a0  20 20 20 20 5c 70 6f 6c  79 5f 73 79 25 3d 21 70  |    \poly_sy%=!p|
000043b0  6f 6c 79 5f 73 79 0d 1a  b8 32 4d 4f 56 20 72 74  |oly_sy...2MOV rt|
000043c0  6f 70 5f 76 2c 23 30 20  20 20 20 20 20 20 20 20  |op_v,#0         |
000043d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
000043e0  74 6f 70 5f 76 25 3d 30  0d 1a c2 32 4d 4f 56 20  |top_v%=0...2MOV |
000043f0  72 62 74 6d 5f 76 2c 23  30 20 20 20 20 20 20 20  |rbtm_v,#0       |
00004400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004410  20 5c 62 74 6d 5f 76 25  3d 30 0d 1a cc 33 4d 4f  | \btm_v%=0...3MO|
00004420  56 20 72 6c 65 66 74 5f  76 2c 23 30 20 20 20 20  |V rleft_v,#0    |
00004430  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004440  20 20 20 5c 6c 65 66 74  5f 76 25 3d 30 0d 1a d6  |   \left_v%=0...|
00004450  34 4d 4f 56 20 72 72 69  67 68 74 5f 76 2c 23 30  |4MOV rright_v,#0|
00004460  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004470  20 20 20 20 20 20 5c 72  69 67 68 74 5f 76 25 3d  |      \right_v%=|
00004480  30 0d 1a e0 33 4d 4f 56  20 72 74 6f 70 5f 73 79  |0...3MOV rtop_sy|
00004490  2c 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#0             |
000044a0  20 20 20 20 20 20 20 20  20 20 5c 74 6f 70 5f 73  |          \top_s|
000044b0  79 25 3d 30 0d 1a ea 33  4d 4f 56 20 72 62 74 6d  |y%=0...3MOV rbtm|
000044c0  5f 73 79 2c 23 30 20 20  20 20 20 20 20 20 20 20  |_sy,#0          |
000044d0  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 62 74  |             \bt|
000044e0  6d 5f 73 79 25 3d 30 0d  1a f4 34 4d 4f 56 20 72  |m_sy%=0...4MOV r|
000044f0  6c 65 66 74 5f 73 78 2c  23 30 20 20 20 20 20 20  |left_sx,#0      |
00004500  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004510  5c 6c 65 66 74 5f 73 78  25 3d 30 0d 1a fe 35 4d  |\left_sx%=0...5M|
00004520  4f 56 20 72 72 69 67 68  74 5f 73 78 2c 23 30 20  |OV rright_sx,#0 |
00004530  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004540  20 20 20 20 5c 72 69 67  68 74 5f 73 78 25 3d 30  |    \right_sx%=0|
00004550  0d 1b 08 38 4d 4f 56 20  72 76 2c 23 30 20 20 20  |...8MOV rv,#0   |
00004560  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004570  20 20 20 20 20 20 20 20  20 5c e3 20 76 25 3d 30  |         \. v%=0|
00004580  20 b8 20 6d 61 78 76 25  0d 1b 12 16 2e 66 69 6e  | . maxv%.....fin|
00004590  64 5f 62 6f 75 6e 64 73  5f 6c 6f 6f 70 31 0d 1b  |d_bounds_loop1..|
000045a0  1c 49 4c 44 52 20 72 30  2c 5b 72 70 6f 6c 79 5f  |.ILDR r0,[rpoly_|
000045b0  73 79 2c 72 76 2c 4c 53  4c 23 32 5d 20 20 20 20  |sy,rv,LSL#2]    |
000045c0  20 20 20 20 20 20 20 5c  20 79 25 3d 70 6f 6c 79  |       \ y%=poly|
000045d0  5f 73 79 25 21 28 76 25  3c 3c 32 29 20 20 28 72  |_sy%!(v%<<2)  (r|
000045e0  30 20 69 73 20 79 29 0d  1b 26 40 43 4d 50 20 72  |0 is y)..&@CMP r|
000045f0  30 2c 72 74 6f 70 5f 73  79 20 20 20 20 20 20 20  |0,rtop_sy       |
00004600  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004610  5c 20 e7 20 79 25 3c 74  6f 70 5f 73 79 25 20 84  |\ . y%<top_sy% .|
00004620  20 76 25 3d 30 20 8c 0d  1b 30 36 4d 4f 56 4c 54  | v%=0 ...06MOVLT|
00004630  20 72 74 6f 70 5f 73 79  2c 72 30 20 20 20 20 20  | rtop_sy,r0     |
00004640  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004650  5c 20 20 74 6f 70 5f 73  79 25 3d 79 25 0d 1b 3a  |\  top_sy%=y%..:|
00004660  35 4d 4f 56 4c 54 20 72  74 6f 70 5f 76 2c 72 76  |5MOVLT rtop_v,rv|
00004670  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004680  20 20 20 20 20 20 5c 20  20 74 6f 70 5f 76 25 3d  |      \  top_v%=|
00004690  76 25 0d 1b 44 0d 43 4d  50 20 72 76 2c 23 30 0d  |v%..D.CMP rv,#0.|
000046a0  1b 4e 11 ec 51 20 72 74  6f 70 5f 73 79 2c 72 30  |.N..Q rtop_sy,r0|
000046b0  0d 1b 58 10 ec 51 20 72  74 6f 70 5f 76 2c 72 76  |..X..Q rtop_v,rv|
000046c0  0d 1b 62 2c 20 20 20 20  20 20 20 20 20 20 20 20  |..b,            |
000046d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000046e0  20 20 20 20 20 20 20 20  20 5c 20 cd 0d 1b 6c 40  |         \ ...l@|
000046f0  43 4d 50 20 72 30 2c 72  62 74 6d 5f 73 79 20 20  |CMP r0,rbtm_sy  |
00004700  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004710  20 20 20 20 20 5c 20 e7  20 79 25 3e 62 74 6d 5f  |     \ . y%>btm_|
00004720  73 79 25 20 84 20 76 25  3d 30 20 8c 0d 1b 76 36  |sy% . v%=0 ...v6|
00004730  4d 4f 56 47 54 20 72 62  74 6d 5f 73 79 2c 72 30  |MOVGT rbtm_sy,r0|
00004740  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004750  20 20 20 20 20 5c 20 20  62 74 6d 5f 73 79 25 3d  |     \  btm_sy%=|
00004760  79 25 0d 1b 80 35 4d 4f  56 47 54 20 72 62 74 6d  |y%...5MOVGT rbtm|
00004770  5f 76 2c 72 76 20 20 20  20 20 20 20 20 20 20 20  |_v,rv           |
00004780  20 20 20 20 20 20 20 20  20 20 20 5c 20 20 62 74  |           \  bt|
00004790  6d 5f 76 25 3d 76 25 0d  1b 8a 0d 43 4d 50 20 72  |m_v%=v%....CMP r|
000047a0  76 2c 23 30 0d 1b 94 11  ec 51 20 72 62 74 6d 5f  |v,#0.....Q rbtm_|
000047b0  73 79 2c 72 30 0d 1b 9e  10 ec 51 20 72 62 74 6d  |sy,r0.....Q rbtm|
000047c0  5f 76 2c 72 76 0d 1b a8  2c 20 20 20 20 20 20 20  |_v,rv...,       |
000047d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000047e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
000047f0  cd 0d 1b b2 49 4c 44 52  20 72 30 2c 5b 72 70 6f  |....ILDR r0,[rpo|
00004800  6c 79 5f 73 78 2c 72 76  2c 4c 53 4c 23 32 5d 20  |ly_sx,rv,LSL#2] |
00004810  20 20 20 20 20 20 20 20  20 20 5c 20 78 25 3d 70  |          \ x%=p|
00004820  6f 6c 79 5f 73 78 25 21  28 76 25 3c 3c 32 29 20  |oly_sx%!(v%<<2) |
00004830  20 28 72 30 20 69 73 20  78 29 0d 1b bc 41 43 4d  | (r0 is x)...ACM|
00004840  50 20 72 30 2c 72 6c 65  66 74 5f 73 78 20 20 20  |P r0,rleft_sx   |
00004850  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004860  20 20 20 5c 20 e7 20 78  25 3c 6c 65 66 74 5f 73  |   \ . x%<left_s|
00004870  78 25 20 84 20 76 25 3d  30 20 8c 0d 1b c6 37 4d  |x% . v%=0 ....7M|
00004880  4f 56 4c 54 20 72 6c 65  66 74 5f 73 78 2c 72 30  |OVLT rleft_sx,r0|
00004890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000048a0  20 20 20 20 5c 20 20 6c  65 66 74 5f 73 78 25 3d  |    \  left_sx%=|
000048b0  78 25 0d 1b d0 36 4d 4f  56 4c 54 20 72 6c 65 66  |x%...6MOVLT rlef|
000048c0  74 5f 76 2c 72 76 20 20  20 20 20 20 20 20 20 20  |t_v,rv          |
000048d0  20 20 20 20 20 20 20 20  20 20 20 5c 20 20 6c 65  |           \  le|
000048e0  66 74 5f 76 25 3d 76 25  0d 1b da 0d 43 4d 50 20  |ft_v%=v%....CMP |
000048f0  72 76 2c 23 30 0d 1b e4  12 ec 51 20 72 6c 65 66  |rv,#0.....Q rlef|
00004900  74 5f 73 78 2c 72 30 0d  1b ee 11 ec 51 20 72 6c  |t_sx,r0.....Q rl|
00004910  65 66 74 5f 76 2c 72 76  0d 1b f8 2c 20 20 20 20  |eft_v,rv...,    |
00004920  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00004940  20 5c 20 cd 0d 1c 02 42  43 4d 50 20 72 30 2c 72  | \ ....BCMP r0,r|
00004950  72 69 67 68 74 5f 73 78  20 20 20 20 20 20 20 20  |right_sx        |
00004960  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 e7  |             \ .|
00004970  20 78 25 3e 72 69 67 68  74 5f 73 78 25 20 84 20  | x%>right_sx% . |
00004980  76 25 3d 30 20 8c 0d 1c  0c 38 4d 4f 56 47 54 20  |v%=0 ....8MOVGT |
00004990  72 72 69 67 68 74 5f 73  78 2c 72 30 20 20 20 20  |rright_sx,r0    |
000049a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
000049b0  20 20 72 69 67 68 74 5f  73 78 25 3d 78 25 0d 1c  |  right_sx%=x%..|
000049c0  16 37 4d 4f 56 47 54 20  72 72 69 67 68 74 5f 76  |.7MOVGT rright_v|
000049d0  2c 72 76 20 20 20 20 20  20 20 20 20 20 20 20 20  |,rv             |
000049e0  20 20 20 20 20 20 20 5c  20 20 72 69 67 68 74 5f  |       \  right_|
000049f0  76 25 3d 76 25 0d 1c 20  0d 43 4d 50 20 72 76 2c  |v%=v%.. .CMP rv,|
00004a00  23 30 0d 1c 2a 13 ec 51  20 72 72 69 67 68 74 5f  |#0..*..Q rright_|
00004a10  73 78 2c 72 30 0d 1c 34  12 ec 51 20 72 72 69 67  |sx,r0..4..Q rrig|
00004a20  68 74 5f 76 2c 72 76 0d  1c 3e 2c 20 20 20 20 20  |ht_v,rv..>,     |
00004a30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00004a50  5c 20 cd 0d 1c 48 2e 41  44 44 20 72 76 2c 72 76  |\ ...H.ADD rv,rv|
00004a60  2c 23 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#1             |
00004a70  20 20 20 20 20 20 20 20  20 20 20 20 5c ed 20 76  |            \. v|
00004a80  25 0d 1c 52 10 43 4d 50  20 72 76 2c 72 6d 61 78  |%..R.CMP rv,rmax|
00004a90  76 0d 1c 5c 19 42 4c 45  20 66 69 6e 64 5f 62 6f  |v..\.BLE find_bo|
00004aa0  75 6e 64 73 5f 6c 6f 6f  70 31 0d 1c 66 36 4d 4f  |unds_loop1..f6MO|
00004ab0  56 20 72 30 2c 23 30 20  20 20 20 20 20 20 20 20  |V r0,#0         |
00004ac0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004ad0  20 20 20 5c 21 73 6b 69  70 5f 70 6f 6c 79 3d 30  |   \!skip_poly=0|
00004ae0  0d 1c 70 14 53 54 52 20  72 30 2c 73 6b 69 70 5f  |..p.STR r0,skip_|
00004af0  70 6f 6c 79 0d 1c 7a 0d  4d 4f 56 20 72 30 2c 23  |poly..z.MOV r0,#|
00004b00  31 0d 1c 84 3a 43 4d 50  20 72 62 74 6d 5f 73 79  |1...:CMP rbtm_sy|
00004b10  2c 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#0             |
00004b20  20 20 20 20 20 20 20 20  20 20 5c e7 20 62 74 6d  |          \. btm|
00004b30  5f 73 79 25 3c 30 20 8c  2e 2e 2e 0d 1c 8e 3d 53  |_sy%<0 .......=S|
00004b40  54 52 4c 54 20 72 30 2c  73 6b 69 70 5f 70 6f 6c  |TRLT r0,skip_pol|
00004b50  79 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |y               |
00004b60  20 20 20 20 5c 2e 2e 2e  21 73 6b 69 70 5f 70 6f  |    \...!skip_po|
00004b70  6c 79 3d 31 3a 5c 20 e1  0d 1c 98 12 4d 4f 56 4c  |ly=1:\ .....MOVL|
00004b80  54 20 50 43 2c 72 6c 69  6e 6b 0d 1c a2 3c 43 4d  |T PC,rlink...<CM|
00004b90  50 20 72 74 6f 70 5f 73  79 2c 23 34 38 30 20 20  |P rtop_sy,#480  |
00004ba0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004bb0  20 20 20 5c e7 20 74 6f  70 5f 73 79 25 3e 34 37  |   \. top_sy%>47|
00004bc0  39 20 8c 2e 2e 2e 0d 1c  ac 3d 53 54 52 47 45 20  |9 .......=STRGE |
00004bd0  72 30 2c 73 6b 69 70 5f  70 6f 6c 79 20 20 20 20  |r0,skip_poly    |
00004be0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00004bf0  2e 2e 2e 21 73 6b 69 70  5f 70 6f 6c 79 3d 31 3a  |...!skip_poly=1:|
00004c00  5c 20 e1 0d 1c b6 12 4d  4f 56 47 54 20 50 43 2c  |\ .....MOVGT PC,|
00004c10  72 6c 69 6e 6b 0d 1c c0  3c 43 4d 50 20 72 72 69  |rlink...<CMP rri|
00004c20  67 68 74 5f 73 78 2c 23  30 20 20 20 20 20 20 20  |ght_sx,#0       |
00004c30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c e7  |              \.|
00004c40  20 72 69 67 68 74 5f 73  78 25 3c 30 20 8c 2e 2e  | right_sx%<0 ...|
00004c50  2e 0d 1c ca 3d 53 54 52  4c 54 20 72 30 2c 73 6b  |....=STRLT r0,sk|
00004c60  69 70 5f 70 6f 6c 79 20  20 20 20 20 20 20 20 20  |ip_poly         |
00004c70  20 20 20 20 20 20 20 20  20 20 5c 2e 2e 2e 21 73  |          \...!s|
00004c80  6b 69 70 5f 70 6f 6c 79  3d 31 3a 5c 20 e1 0d 1c  |kip_poly=1:\ ...|
00004c90  d4 12 4d 4f 56 4c 54 20  50 43 2c 72 6c 69 6e 6b  |..MOVLT PC,rlink|
00004ca0  0d 1c de 3e 43 4d 50 20  72 6c 65 66 74 5f 73 78  |...>CMP rleft_sx|
00004cb0  2c 23 36 34 30 20 20 20  20 20 20 20 20 20 20 20  |,#640           |
00004cc0  20 20 20 20 20 20 20 20  20 5c e7 20 6c 65 66 74  |         \. left|
00004cd0  5f 73 78 25 3e 3d 36 34  30 20 8c 2e 2e 2e 0d 1c  |_sx%>=640 ......|
00004ce0  e8 3d 53 54 52 47 45 20  72 30 2c 73 6b 69 70 5f  |.=STRGE r0,skip_|
00004cf0  70 6f 6c 79 20 20 20 20  20 20 20 20 20 20 20 20  |poly            |
00004d00  20 20 20 20 20 20 20 5c  2e 2e 2e 21 73 6b 69 70  |       \...!skip|
00004d10  5f 70 6f 6c 79 3d 31 3a  5c 20 e1 0d 1c f2 12 4d  |_poly=1:\ .....M|
00004d20  4f 56 47 45 20 50 43 2c  72 6c 69 6e 6b 0d 1c fc  |OVGE PC,rlink...|
00004d30  3a 53 54 52 20 72 74 6f  70 5f 76 2c 74 6f 70 5f  |:STR rtop_v,top_|
00004d40  76 65 72 74 20 20 20 20  20 20 20 20 20 20 20 20  |vert            |
00004d50  20 20 20 20 20 20 5c 21  74 6f 70 5f 76 65 72 74  |      \!top_vert|
00004d60  3d 74 6f 70 5f 76 25 0d  1d 06 3a 53 54 52 20 72  |=top_v%...:STR r|
00004d70  62 74 6d 5f 76 2c 62 74  6d 5f 76 65 72 74 20 20  |btm_v,btm_vert  |
00004d80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004d90  5c 21 62 74 6d 5f 76 65  72 74 3d 62 74 6d 5f 76  |\!btm_vert=btm_v|
00004da0  25 0d 1d 10 3c 53 54 52  20 72 6c 65 66 74 5f 76  |%...<STR rleft_v|
00004db0  2c 6c 65 66 74 5f 76 65  72 74 20 20 20 20 20 20  |,left_vert      |
00004dc0  20 20 20 20 20 20 20 20  20 20 5c 21 6c 65 66 74  |          \!left|
00004dd0  5f 76 65 72 74 3d 6c 65  66 74 5f 76 25 0d 1d 1a  |_vert=left_v%...|
00004de0  3e 53 54 52 20 72 72 69  67 68 74 5f 76 2c 72 69  |>STR rright_v,ri|
00004df0  67 68 74 5f 76 65 72 74  20 20 20 20 20 20 20 20  |ght_vert        |
00004e00  20 20 20 20 20 20 5c 21  72 69 67 68 74 5f 76 65  |      \!right_ve|
00004e10  72 74 3d 72 69 67 68 74  5f 76 25 0d 1d 24 3c 43  |rt=right_v%..$<C|
00004e20  4d 50 20 72 62 74 6d 5f  73 79 2c 23 34 38 30 20  |MP rbtm_sy,#480 |
00004e30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004e40  20 20 20 20 5c e7 20 62  74 6d 5f 73 79 25 3e 34  |    \. btm_sy%>4|
00004e50  37 39 20 8c 2e 2e 2e 0d  1d 2e 38 4d 4f 56 47 45  |79 .......8MOVGE|
00004e60  20 72 62 74 6d 5f 73 79  2c 23 34 38 30 20 20 20  | rbtm_sy,#480   |
00004e70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004e80  5c 2e 2e 2e 62 74 6d 5f  73 79 25 3d 34 37 39 0d  |\...btm_sy%=479.|
00004e90  1d 38 1c 53 55 42 47 45  20 72 62 74 6d 5f 73 79  |.8.SUBGE rbtm_sy|
00004ea0  2c 72 62 74 6d 5f 73 79  2c 23 31 0d 1d 42 3a 43  |,rbtm_sy,#1..B:C|
00004eb0  4d 50 20 72 74 6f 70 5f  73 79 2c 23 30 20 20 20  |MP rtop_sy,#0   |
00004ec0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004ed0  20 20 20 20 5c e7 20 74  6f 70 5f 73 79 25 3c 30  |    \. top_sy%<0|
00004ee0  20 8c 2e 2e 2e 0d 1d 4c  36 4d 4f 56 4c 54 20 72  | ......L6MOVLT r|
00004ef0  74 6f 70 5f 73 79 2c 23  30 20 20 20 20 20 20 20  |top_sy,#0       |
00004f00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 2e  |              \.|
00004f10  2e 2e 74 6f 70 5f 73 79  25 3d 30 0d 1d 56 39 53  |..top_sy%=0..V9S|
00004f20  54 52 20 72 74 6f 70 5f  73 79 2c 74 6f 70 5f 73  |TR rtop_sy,top_s|
00004f30  79 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |y               |
00004f40  20 20 20 20 5c 21 74 6f  70 5f 73 79 3d 74 6f 70  |    \!top_sy=top|
00004f50  5f 73 79 25 0d 1d 60 39  53 54 52 20 72 62 74 6d  |_sy%..`9STR rbtm|
00004f60  5f 73 79 2c 62 74 6d 5f  73 79 20 20 20 20 20 20  |_sy,btm_sy      |
00004f70  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 21 62  |             \!b|
00004f80  74 6d 5f 73 79 3d 62 74  6d 5f 73 79 25 0d 1d 6a  |tm_sy=btm_sy%..j|
00004f90  3b 53 54 52 20 72 6c 65  66 74 5f 73 78 2c 6c 65  |;STR rleft_sx,le|
00004fa0  66 74 5f 73 78 20 20 20  20 20 20 20 20 20 20 20  |ft_sx           |
00004fb0  20 20 20 20 20 20 5c 21  6c 65 66 74 5f 73 78 3d  |      \!left_sx=|
00004fc0  6c 65 66 74 5f 73 78 25  0d 1d 74 3d 53 54 52 20  |left_sx%..t=STR |
00004fd0  72 72 69 67 68 74 5f 73  78 2c 72 69 67 68 74 5f  |rright_sx,right_|
00004fe0  73 78 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |sx              |
00004ff0  20 5c 21 72 69 67 68 74  5f 73 78 3d 72 69 67 68  | \!right_sx=righ|
00005000  74 5f 73 78 25 0d 1d 7e  2b 4d 4f 56 20 50 43 2c  |t_sx%..~+MOV PC,|
00005010  72 6c 69 6e 6b 20 20 20  20 20 20 20 20 20 20 20  |rlink           |
00005020  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c e1  |              \.|
00005030  0d 1d 88 05 5d 0d 1d 92  04 0d 1d 9c 2a f4 20 2d  |....].......*. -|
00005040  20 42 72 65 73 65 6e 68  61 6d 20 75 73 65 73 20  | Bresenham uses |
00005050  6f 6e 6c 79 20 72 30 20  61 6e 64 20 72 6c 69 6e  |only r0 and rlin|
00005060  6b 20 2d 0d 1d a6 04 0d  1d b0 0e 5b 4f 50 54 20  |k -........[OPT |
00005070  70 61 73 73 25 0d 1d ba  0e 2e 62 72 65 73 65 6e  |pass%.....bresen|
00005080  68 61 6d 0d 1d c4 37 4c  44 52 20 72 30 2c 62 74  |ham...7LDR r0,bt|
00005090  6d 5f 73 79 20 20 20 20  20 20 20 20 20 20 20 20  |m_sy            |
000050a0  20 20 20 20 20 20 20 20  20 20 20 20 5c e7 20 21  |            \. !|
000050b0  62 74 6d 5f 73 79 3c 34  38 30 0d 1d ce 0f 43 4d  |btm_sy<480....CM|
000050c0  50 20 72 30 2c 23 34 38  30 0d 1d d8 18 42 47 45  |P r0,#480....BGE|
000050d0  20 62 72 65 73 65 6e 68  61 6d 5f 65 6c 73 69 66  | bresenham_elsif|
000050e0  31 0d 1d e2 38 4d 4f 56  20 72 30 2c 23 75 70 25  |1...8MOV r0,#up%|
000050f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005100  20 20 20 20 20 20 20 20  20 20 5c 20 21 62 72 65  |          \ !bre|
00005110  73 5f 64 69 72 3d 75 70  25 0d 1d ec 13 53 54 52  |s_dir=up%....STR|
00005120  20 72 30 2c 62 72 65 73  5f 64 69 72 0d 1d f6 3c  | r0,bres_dir...<|
00005130  4d 4f 56 20 72 30 2c 23  63 77 25 20 20 20 20 20  |MOV r0,#cw%     |
00005140  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005150  20 20 20 20 20 5c 20 21  62 72 65 73 5f 61 6e 67  |     \ !bres_ang|
00005160  5f 64 69 72 3d 63 77 25  0d 1e 00 17 53 54 52 20  |_dir=cw%....STR |
00005170  72 30 2c 62 72 65 73 5f  61 6e 67 5f 64 69 72 0d  |r0,bres_ang_dir.|
00005180  1e 0a 39 4d 4f 56 20 72  30 2c 23 6c 65 66 74 25  |..9MOV r0,#left%|
00005190  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000051a0  20 20 20 20 20 20 20 20  5c 20 21 65 64 67 65 5f  |        \ !edge_|
000051b0  6e 6f 3d 6c 65 66 74 25  0d 1e 14 12 53 54 52 20  |no=left%....STR |
000051c0  72 30 2c 65 64 67 65 5f  6e 6f 0d 1e 1e 31 53 54  |r0,edge_no...1ST|
000051d0  4d 46 44 20 72 31 33 20  21 2c 7b 72 6c 69 6e 6b  |MFD r13 !,{rlink|
000051e0  7d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |}               |
000051f0  20 20 20 5c 20 d6 20 62  72 65 73 0d 1e 28 0b 42  |   \ . bres..(.B|
00005200  4c 20 62 72 65 73 0d 1e  32 17 4c 44 4d 46 44 20  |L bres..2.LDMFD |
00005210  72 31 33 20 21 2c 7b 72  6c 69 6e 6b 7d 0d 1e 3c  |r13 !,{rlink}..<|
00005220  38 4d 4f 56 20 72 30 2c  23 75 70 25 20 20 20 20  |8MOV r0,#up%    |
00005230  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005240  20 20 20 20 20 20 5c 20  21 62 72 65 73 5f 64 69  |      \ !bres_di|
00005250  72 3d 75 70 25 0d 1e 46  13 53 54 52 20 72 30 2c  |r=up%..F.STR r0,|
00005260  62 72 65 73 5f 64 69 72  0d 1e 50 3d 4d 4f 56 20  |bres_dir..P=MOV |
00005270  72 30 2c 23 61 63 77 25  20 20 20 20 20 20 20 20  |r0,#acw%        |
00005280  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005290  20 5c 20 21 62 72 65 73  5f 61 6e 67 5f 64 69 72  | \ !bres_ang_dir|
000052a0  3d 61 63 77 25 0d 1e 5a  17 53 54 52 20 72 30 2c  |=acw%..Z.STR r0,|
000052b0  62 72 65 73 5f 61 6e 67  5f 64 69 72 0d 1e 64 3a  |bres_ang_dir..d:|
000052c0  4d 4f 56 20 72 30 2c 23  72 69 67 68 74 25 20 20  |MOV r0,#right%  |
000052d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000052e0  20 20 20 20 20 5c 20 21  65 64 67 65 5f 6e 6f 3d  |     \ !edge_no=|
000052f0  72 69 67 68 74 25 0d 1e  6e 12 53 54 52 20 72 30  |right%..n.STR r0|
00005300  2c 65 64 67 65 5f 6e 6f  0d 1e 78 31 53 54 4d 46  |,edge_no..x1STMF|
00005310  44 20 72 31 33 20 21 2c  7b 72 6c 69 6e 6b 7d 20  |D r13 !,{rlink} |
00005320  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005330  20 5c 20 d6 20 62 72 65  73 0d 1e 82 0b 42 4c 20  | \ . bres....BL |
00005340  62 72 65 73 0d 1e 8c 17  4c 44 4d 46 44 20 72 31  |bres....LDMFD r1|
00005350  33 20 21 2c 7b 72 6c 69  6e 6b 7d 0d 1e 96 10 4d  |3 !,{rlink}....M|
00005360  4f 56 20 50 43 2c 72 6c  69 6e 6b 0d 1e a0 2b 2e  |OV PC,rlink...+.|
00005370  62 72 65 73 65 6e 68 61  6d 5f 65 6c 73 69 66 31  |bresenham_elsif1|
00005380  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005390  20 20 20 20 5c 8b 0d 1e  aa 38 4d 4f 56 20 72 30  |    \....8MOV r0|
000053a0  2c 23 75 70 25 20 20 20  20 20 20 20 20 20 20 20  |,#up%           |
000053b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
000053c0  20 21 62 72 65 73 5f 64  69 72 3d 75 70 25 0d 1e  | !bres_dir=up%..|
000053d0  b4 13 53 54 52 20 72 30  2c 62 72 65 73 5f 64 69  |..STR r0,bres_di|
000053e0  72 0d 1e be 3c 4d 4f 56  20 72 30 2c 23 63 77 25  |r...<MOV r0,#cw%|
000053f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005400  20 20 20 20 20 20 20 20  20 20 5c 20 21 62 72 65  |          \ !bre|
00005410  73 5f 61 6e 67 5f 64 69  72 3d 63 77 25 0d 1e c8  |s_ang_dir=cw%...|
00005420  17 53 54 52 20 72 30 2c  62 72 65 73 5f 61 6e 67  |.STR r0,bres_ang|
00005430  5f 64 69 72 0d 1e d2 39  4d 4f 56 20 72 30 2c 23  |_dir...9MOV r0,#|
00005440  6c 65 66 74 25 20 20 20  20 20 20 20 20 20 20 20  |left%           |
00005450  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 21  |             \ !|
00005460  65 64 67 65 5f 6e 6f 3d  6c 65 66 74 25 0d 1e dc  |edge_no=left%...|
00005470  12 53 54 52 20 72 30 2c  65 64 67 65 5f 6e 6f 0d  |.STR r0,edge_no.|
00005480  1e e6 31 53 54 52 20 72  6c 69 6e 6b 2c 62 72 65  |..1STR rlink,bre|
00005490  73 5f 6c 69 6e 6b 20 20  20 20 20 20 20 20 20 20  |s_link          |
000054a0  20 20 20 20 20 20 20 20  5c 20 d6 20 62 72 65 73  |        \ . bres|
000054b0  0d 1e f0 0b 42 4c 20 62  72 65 73 0d 1e fa 17 4c  |....BL bres....L|
000054c0  44 52 20 72 6c 69 6e 6b  2c 62 72 65 73 5f 6c 69  |DR rlink,bres_li|
000054d0  6e 6b 0d 1f 04 38 4d 4f  56 20 72 30 2c 23 75 70  |nk...8MOV r0,#up|
000054e0  25 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |%               |
000054f0  20 20 20 20 20 20 20 20  20 20 20 5c 20 21 62 72  |           \ !br|
00005500  65 73 5f 64 69 72 3d 75  70 25 0d 1f 0e 13 53 54  |es_dir=up%....ST|
00005510  52 20 72 30 2c 62 72 65  73 5f 64 69 72 0d 1f 18  |R r0,bres_dir...|
00005520  3d 4d 4f 56 20 72 30 2c  23 61 63 77 25 20 20 20  |=MOV r0,#acw%   |
00005530  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005540  20 20 20 20 20 20 5c 20  21 62 72 65 73 5f 61 6e  |      \ !bres_an|
00005550  67 5f 64 69 72 3d 61 63  77 25 0d 1f 22 17 53 54  |g_dir=acw%..".ST|
00005560  52 20 72 30 2c 62 72 65  73 5f 61 6e 67 5f 64 69  |R r0,bres_ang_di|
00005570  72 0d 1f 2c 3a 4d 4f 56  20 72 30 2c 23 72 69 67  |r..,:MOV r0,#rig|
00005580  68 74 25 20 20 20 20 20  20 20 20 20 20 20 20 20  |ht%             |
00005590  20 20 20 20 20 20 20 20  20 20 5c 20 21 65 64 67  |          \ !edg|
000055a0  65 5f 6e 6f 3d 72 69 67  68 74 25 0d 1f 36 12 53  |e_no=right%..6.S|
000055b0  54 52 20 72 30 2c 65 64  67 65 5f 6e 6f 0d 1f 40  |TR r0,edge_no..@|
000055c0  31 53 54 52 20 72 6c 69  6e 6b 2c 62 72 65 73 5f  |1STR rlink,bres_|
000055d0  6c 69 6e 6b 20 20 20 20  20 20 20 20 20 20 20 20  |link            |
000055e0  20 20 20 20 20 20 5c 20  d6 20 62 72 65 73 0d 1f  |      \ . bres..|
000055f0  4a 0b 42 4c 20 62 72 65  73 0d 1f 54 2b 4c 44 52  |J.BL bres..T+LDR|
00005600  20 50 43 2c 62 72 65 73  5f 6c 69 6e 6b 20 20 20  | PC,bres_link   |
00005610  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005620  20 20 5c cd 0d 1f 5e 2b  20 20 20 20 20 20 20 20  |  \...^+        |
00005630  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005640  20 20 20 20 20 20 20 20  20 20 20 20 20 5c e1 0d  |             \..|
00005650  1f 68 19 2e 62 72 65 73  5f 6c 69 6e 6b 20 20 20  |.h..bres_link   |
00005660  20 20 45 51 55 44 20 30  0d 1f 72 05 5d 0d 1f 7c  |  EQUD 0..r.]..||
00005670  04 0d 1f 86 1c f4 20 2d  20 52 65 67 69 73 74 65  |...... - Registe|
00005680  72 73 20 66 6f 72 20 62  72 65 73 20 2d 0d 1f 90  |rs for bres -...|
00005690  04 0d 1f 9a 0b 72 76 65  72 74 3d 33 0d 1f a4 10  |.....rvert=3....|
000056a0  72 6e 65 78 74 5f 76 65  72 74 3d 34 0d 1f ae 0c  |rnext_vert=4....|
000056b0  72 78 5f 62 75 66 3d 35  0d 1f b8 09 72 64 78 3d  |rx_buf=5....rdx=|
000056c0  36 0d 1f c2 09 72 64 79  3d 37 0d 1f cc 09 72 73  |6....rdy=7....rs|
000056d0  78 3d 38 0d 1f d6 09 72  73 79 3d 39 0d 1f e0 0a  |x=8....rsy=9....|
000056e0  72 78 31 3d 31 30 0d 1f  ea 0a 72 79 31 3d 31 31  |rx1=10....ry1=11|
000056f0  0d 1f f4 09 72 65 3d 31  32 0d 1f fe 04 0d 20 08  |....re=12..... .|
00005700  0e 5b 4f 50 54 20 70 61  73 73 25 0d 20 12 09 2e  |.[OPT pass%. ...|
00005710  62 72 65 73 0d 20 1c 3b  4c 44 52 20 72 30 2c 62  |bres. .;LDR r0,b|
00005720  72 65 73 5f 64 69 72 20  20 20 20 20 20 20 20 20  |res_dir         |
00005730  20 20 20 20 20 20 20 20  20 20 20 20 20 5c e7 20  |             \. |
00005740  21 62 72 65 73 5f 64 69  72 3d 75 70 25 20 8c 0d  |!bres_dir=up% ..|
00005750  20 26 0f 43 4d 50 20 72  30 2c 23 75 70 25 0d 20  | &.CMP r0,#up%. |
00005760  30 3a 4c 44 52 45 51 20  72 76 65 72 74 2c 62 74  |0:LDREQ rvert,bt|
00005770  6d 5f 76 65 72 74 20 20  20 20 20 20 20 20 20 20  |m_vert          |
00005780  20 20 20 20 20 20 20 5c  20 76 65 72 74 25 3d 21  |       \ vert%=!|
00005790  62 74 6d 5f 76 65 72 74  0d 20 3a 2b 20 20 20 20  |btm_vert. :+    |
000057a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000057c0  20 5c 8b 0d 20 44 3a 4c  44 52 4e 45 20 72 76 65  | \.. D:LDRNE rve|
000057d0  72 74 2c 74 6f 70 5f 76  65 72 74 20 20 20 20 20  |rt,top_vert     |
000057e0  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 76 65  |            \ ve|
000057f0  72 74 25 3d 21 74 6f 70  5f 76 65 72 74 0d 20 4e  |rt%=!top_vert. N|
00005800  2b 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |+               |
00005810  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005820  20 20 20 20 20 20 5c cd  0d 20 58 3c 4c 44 52 20  |      \.. X<LDR |
00005830  72 30 2c 65 64 67 65 5f  6e 6f 20 20 20 20 20 20  |r0,edge_no      |
00005840  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005850  20 5c e7 20 21 65 64 67  65 5f 6e 6f 3d 6c 65 66  | \. !edge_no=lef|
00005860  74 25 20 8c 0d 20 62 11  43 4d 50 20 72 30 2c 23  |t% .. b.CMP r0,#|
00005870  6c 65 66 74 25 0d 20 6c  3d 4c 44 52 45 51 20 72  |left%. l=LDREQ r|
00005880  78 5f 62 75 66 2c 6c 65  66 74 5f 73 78 62 75 66  |x_buf,left_sxbuf|
00005890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
000058a0  78 5f 62 75 66 25 3d 21  6c 65 66 74 5f 73 78 62  |x_buf%=!left_sxb|
000058b0  75 66 0d 20 76 2b 20 20  20 20 20 20 20 20 20 20  |uf. v+          |
000058c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000058d0  20 20 20 20 20 20 20 20  20 20 20 5c 8b 0d 20 80  |           \.. .|
000058e0  3e 4c 44 52 4e 45 20 72  78 5f 62 75 66 2c 72 69  |>LDRNE rx_buf,ri|
000058f0  67 68 74 5f 73 78 62 75  66 20 20 20 20 20 20 20  |ght_sxbuf       |
00005900  20 20 20 20 20 20 5c 20  78 5f 62 75 66 25 3d 21  |      \ x_buf%=!|
00005910  72 69 67 68 74 5f 73 78  62 75 66 0d 20 8a 2b 20  |right_sxbuf. .+ |
00005920  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00005940  20 20 20 20 5c cd 0d 20  94 2b 2e 62 72 65 73 5f  |    \.. .+.bres_|
00005950  72 65 70 65 61 74 31 20  20 20 20 20 20 20 20 20  |repeat1         |
00005960  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00005970  f5 0d 20 9e 37 4c 44 52  20 72 30 2c 6e 5f 76 65  |.. .7LDR r0,n_ve|
00005980  72 74 73 20 20 20 20 20  20 20 20 20 20 20 20 20  |rts             |
00005990  20 20 20 20 20 20 20 20  20 20 5c 20 72 30 25 3d  |          \ r0%=|
000059a0  21 6e 5f 76 65 72 74 73  0d 20 a8 40 4c 44 52 20  |!n_verts. .@LDR |
000059b0  72 31 2c 62 72 65 73 5f  61 6e 67 5f 64 69 72 20  |r1,bres_ang_dir |
000059c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000059d0  20 5c 20 e7 20 21 62 72  65 73 5f 61 6e 67 5f 64  | \ . !bres_ang_d|
000059e0  69 72 3d 63 77 25 20 8c  0d 20 b2 0f 43 4d 50 20  |ir=cw% .. ..CMP |
000059f0  72 31 2c 23 63 77 25 0d  20 bc 3e 41 44 44 45 51  |r1,#cw%. .>ADDEQ|
00005a00  20 72 6e 65 78 74 5f 76  65 72 74 2c 72 76 65 72  | rnext_vert,rver|
00005a10  74 2c 23 31 20 20 20 20  20 20 20 20 20 20 20 20  |t,#1            |
00005a20  5c 20 20 6e 65 78 74 5f  76 65 72 74 25 3d 76 65  |\  next_vert%=ve|
00005a30  72 74 25 2b 31 0d 20 c6  2c 20 20 20 20 20 20 20  |rt%+1. .,       |
00005a40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005a50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00005a60  8b 0d 20 d0 3e 53 55 42  4e 45 20 72 6e 65 78 74  |.. .>SUBNE rnext|
00005a70  5f 76 65 72 74 2c 72 76  65 72 74 2c 23 31 20 20  |_vert,rvert,#1  |
00005a80  20 20 20 20 20 20 20 20  20 20 5c 20 20 6e 65 78  |          \  nex|
00005a90  74 5f 76 65 72 74 25 3d  76 65 72 74 25 2d 31 0d  |t_vert%=vert%-1.|
00005aa0  20 da 2c 20 20 20 20 20  20 20 20 20 20 20 20 20  | .,             |
00005ab0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005ac0  20 20 20 20 20 20 20 20  5c 20 cd 0d 20 e4 3e 43  |        \ .. .>C|
00005ad0  4d 50 20 72 6e 65 78 74  5f 76 65 72 74 2c 23 30  |MP rnext_vert,#0|
00005ae0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005af0  20 20 20 20 5c 20 e7 20  6e 65 78 74 5f 76 65 72  |    \ . next_ver|
00005b00  74 25 3c 30 20 8c 2e 2e  2e 0d 20 ee 3d 53 55 42  |t%<0 ..... .=SUB|
00005b10  4c 54 20 72 6e 65 78 74  5f 76 65 72 74 2c 72 30  |LT rnext_vert,r0|
00005b20  2c 23 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#1             |
00005b30  20 20 5c 2e 2e 2e 6e 65  78 74 5f 76 65 72 74 25  |  \...next_vert%|
00005b40  3d 72 30 25 2d 31 0d 20  f8 3f 43 4d 50 20 72 6e  |=r0%-1. .?CMP rn|
00005b50  65 78 74 5f 76 65 72 74  2c 72 30 20 20 20 20 20  |ext_vert,r0     |
00005b60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00005b70  20 e7 20 6e 65 78 74 5f  76 65 72 74 25 3e 3d 72  | . next_vert%>=r|
00005b80  30 25 2e 2e 2e 0d 21 02  3b 4d 4f 56 47 45 20 72  |0%....!.;MOVGE r|
00005b90  6e 65 78 74 5f 76 65 72  74 2c 23 30 20 20 20 20  |next_vert,#0    |
00005ba0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 2e  |              \.|
00005bb0  2e 2e 8c 20 6e 65 78 74  5f 76 65 72 74 25 3d 30  |... next_vert%=0|
00005bc0  0d 21 0c 37 4c 44 52 20  72 30 2c 70 6f 6c 79 5f  |.!.7LDR r0,poly_|
00005bd0  73 78 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |sx              |
00005be0  20 20 20 20 20 20 20 20  20 5c 20 72 30 25 3d 21  |         \ r0%=!|
00005bf0  70 6f 6c 79 5f 73 78 0d  21 16 3d 4c 44 52 20 72  |poly_sx.!.=LDR r|
00005c00  78 31 2c 5b 72 30 2c 72  76 65 72 74 2c 4c 53 4c  |x1,[r0,rvert,LSL|
00005c10  23 32 5d 20 20 20 20 20  20 20 20 20 20 20 20 20  |#2]             |
00005c20  5c 20 78 31 25 3d 72 30  25 21 28 76 65 72 74 25  |\ x1%=r0%!(vert%|
00005c30  3c 3c 32 29 0d 21 20 37  4c 44 52 20 72 30 2c 70  |<<2).! 7LDR r0,p|
00005c40  6f 6c 79 5f 73 79 20 20  20 20 20 20 20 20 20 20  |oly_sy          |
00005c50  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 72  |             \ r|
00005c60  30 25 3d 21 70 6f 6c 79  5f 73 79 0d 21 2a 3d 4c  |0%=!poly_sy.!*=L|
00005c70  44 52 20 72 79 31 2c 5b  72 30 2c 72 76 65 72 74  |DR ry1,[r0,rvert|
00005c80  2c 4c 53 4c 23 32 5d 20  20 20 20 20 20 20 20 20  |,LSL#2]         |
00005c90  20 20 20 20 5c 20 79 31  25 3d 72 30 25 21 28 76  |    \ y1%=r0%!(v|
00005ca0  65 72 74 25 3c 3c 32 29  0d 21 34 37 4c 44 52 20  |ert%<<2).!47LDR |
00005cb0  72 30 2c 70 6f 6c 79 5f  73 78 20 20 20 20 20 20  |r0,poly_sx      |
00005cc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005cd0  20 5c 20 72 30 25 3d 21  70 6f 6c 79 5f 73 78 0d  | \ r0%=!poly_sx.|
00005ce0  21 3e 4e 4c 44 52 20 72  31 2c 5b 72 30 2c 72 6e  |!>NLDR r1,[r0,rn|
00005cf0  65 78 74 5f 76 65 72 74  2c 4c 53 4c 23 32 5d 20  |ext_vert,LSL#2] |
00005d00  20 20 20 20 20 20 20 20  5c 20 78 32 25 3d 72 30  |        \ x2%=r0|
00005d10  25 21 28 6e 65 78 74 5f  76 65 72 74 25 3c 3c 32  |%!(next_vert%<<2|
00005d20  29 20 20 28 72 31 20 69  73 20 78 32 29 0d 21 48  |)  (r1 is x2).!H|
00005d30  12 53 54 52 20 72 31 2c  62 72 65 73 5f 78 32 0d  |.STR r1,bres_x2.|
00005d40  21 52 37 4c 44 52 20 72  30 2c 70 6f 6c 79 5f 73  |!R7LDR r0,poly_s|
00005d50  79 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |y               |
00005d60  20 20 20 20 20 20 20 20  5c 20 72 30 25 3d 21 70  |        \ r0%=!p|
00005d70  6f 6c 79 5f 73 79 0d 21  5c 4e 4c 44 52 20 72 32  |oly_sy.!\NLDR r2|
00005d80  2c 5b 72 30 2c 72 6e 65  78 74 5f 76 65 72 74 2c  |,[r0,rnext_vert,|
00005d90  4c 53 4c 23 32 5d 20 20  20 20 20 20 20 20 20 5c  |LSL#2]         \|
00005da0  20 79 32 25 3d 72 30 25  21 28 6e 65 78 74 5f 76  | y2%=r0%!(next_v|
00005db0  65 72 74 25 3c 3c 32 29  20 20 28 72 32 20 69 73  |ert%<<2)  (r2 is|
00005dc0  20 79 32 29 0d 21 66 12  53 54 52 20 72 32 2c 62  | y2).!f.STR r2,b|
00005dd0  72 65 73 5f 79 32 0d 21  70 39 53 55 42 20 72 64  |res_y2.!p9SUB rd|
00005de0  78 2c 72 31 2c 72 78 31  20 20 20 20 20 20 20 20  |x,r1,rx1        |
00005df0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00005e00  20 64 78 25 3d 94 28 78  32 25 2d 78 31 25 29 0d  | dx%=.(x2%-x1%).|
00005e10  21 7a 0e 43 4d 50 20 72  64 78 2c 23 30 0d 21 84  |!z.CMP rdx,#0.!.|
00005e20  14 52 53 42 4c 54 20 72  64 78 2c 72 64 78 2c 23  |.RSBLT rdx,rdx,#|
00005e30  30 0d 21 8e 39 53 55 42  20 72 64 79 2c 72 32 2c  |0.!.9SUB rdy,r2,|
00005e40  72 79 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |ry1             |
00005e50  20 20 20 20 20 20 20 20  20 20 5c 20 64 79 25 3d  |          \ dy%=|
00005e60  94 28 79 32 25 2d 79 31  25 29 0d 21 98 0e 43 4d  |.(y2%-y1%).!..CM|
00005e70  50 20 72 64 79 2c 23 30  0d 21 a2 14 52 53 42 4c  |P rdy,#0.!..RSBL|
00005e80  54 20 72 64 79 2c 72 64  79 2c 23 30 0d 21 ac 39  |T rdy,rdy,#0.!.9|
00005e90  43 4d 50 20 72 31 2c 72  78 31 20 20 20 20 20 20  |CMP r1,rx1      |
00005ea0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005eb0  20 20 20 20 20 5c 20 73  78 25 3d b4 28 78 32 25  |     \ sx%=.(x2%|
00005ec0  2d 78 31 25 29 0d 21 b6  10 4d 4f 56 47 54 20 72  |-x1%).!..MOVGT r|
00005ed0  73 78 2c 23 31 0d 21 c0  0d ec 51 20 72 73 78 2c  |sx,#1.!...Q rsx,|
00005ee0  23 30 0d 21 ca 10 4d 56  4e 4c 54 20 72 73 78 2c  |#0.!..MVNLT rsx,|
00005ef0  23 30 0d 21 d4 39 43 4d  50 20 72 32 2c 72 79 31  |#0.!.9CMP r2,ry1|
00005f00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005f10  20 20 20 20 20 20 20 20  20 20 20 5c 20 73 79 25  |           \ sy%|
00005f20  3d b4 28 79 32 25 2d 79  31 25 29 0d 21 de 10 4d  |=.(y2%-y1%).!..M|
00005f30  4f 56 47 54 20 72 73 79  2c 23 31 0d 21 e8 0d ec  |OVGT rsy,#1.!...|
00005f40  51 20 72 73 79 2c 23 30  0d 21 f2 10 4d 56 4e 4c  |Q rsy,#0.!..MVNL|
00005f50  54 20 72 73 79 2c 23 30  0d 21 fc 36 43 4d 50 20  |T rsy,#0.!.6CMP |
00005f60  72 64 78 2c 72 64 79 20  20 20 20 20 20 20 20 20  |rdx,rdy         |
00005f70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005f80  20 5c 20 e7 20 64 78 25  3e 64 79 25 20 8c 0d 22  | \ . dx%>dy% .."|
00005f90  06 12 42 4c 45 20 62 72  65 73 5f 65 6c 73 65 31  |..BLE bres_else1|
00005fa0  0d 22 10 38 4d 4f 56 20  72 65 2c 72 64 79 2c 41  |.".8MOV re,rdy,A|
00005fb0  53 4c 23 31 20 20 20 20  20 20 20 20 20 20 20 20  |SL#1            |
00005fc0  20 20 20 20 20 20 20 20  20 5c 20 20 65 25 3d 64  |         \  e%=d|
00005fd0  79 25 2a 32 2d 64 78 25  0d 22 1a 11 53 55 42 20  |y%*2-dx%."..SUB |
00005fe0  72 65 2c 72 65 2c 72 64  78 0d 22 24 2d 2e 62 72  |re,re,rdx."$-.br|
00005ff0  65 73 5f 72 65 70 65 61  74 32 20 20 20 20 20 20  |es_repeat2      |
00006000  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006010  20 20 5c 20 20 f5 0d 22  2e 35 43 4d 50 20 72 65  |  \  ..".5CMP re|
00006020  2c 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#0             |
00006030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00006040  20 20 20 e7 20 65 25 3e  30 20 8c 0d 22 38 12 42  |   . e%>0 .."8.B|
00006050  4c 45 20 62 72 65 73 5f  65 6c 73 65 32 0d 22 42  |LE bres_else2."B|
00006060  3b 43 4d 50 20 72 79 31  2c 23 30 20 20 20 20 20  |;CMP ry1,#0     |
00006070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006080  20 20 20 20 20 20 5c 20  20 20 20 e7 20 79 31 25  |      \    . y1%|
00006090  3e 3d 30 20 80 2e 2e 2e  0d 22 4c 13 42 4c 54 20  |>=0 ....."L.BLT |
000060a0  62 72 65 73 5f 65 6e 64  69 66 33 0d 22 56 3a 43  |bres_endif3."V:C|
000060b0  4d 50 20 72 79 31 2c 23  34 38 30 20 20 20 20 20  |MP ry1,#480     |
000060c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000060d0  20 20 20 20 5c 20 20 20  20 2e 2e 2e 79 31 25 3c  |    \    ...y1%<|
000060e0  34 38 30 20 8c 0d 22 60  42 53 54 52 4c 54 20 72  |480 .."`BSTRLT r|
000060f0  78 31 2c 5b 72 78 5f 62  75 66 2c 72 79 31 2c 4c  |x1,[rx_buf,ry1,L|
00006100  53 4c 23 32 5d 20 20 20  20 20 20 20 20 20 5c 20  |SL#2]         \ |
00006110  20 20 20 20 78 5f 62 75  66 25 21 28 79 31 25 3c  |    x_buf%!(y1%<|
00006120  3c 32 29 3d 78 31 25 0d  22 6a 2f 2e 62 72 65 73  |<2)=x1%."j/.bres|
00006130  5f 65 6e 64 69 66 33 20  20 20 20 20 20 20 20 20  |_endif3         |
00006140  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006150  5c 20 20 20 20 cd 0d 22  74 36 41 44 44 20 72 79  |\    .."t6ADD ry|
00006160  31 2c 72 79 31 2c 72 73  79 20 20 20 20 20 20 20  |1,ry1,rsy       |
00006170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00006180  20 20 20 20 79 31 25 2b  3d 73 79 25 0d 22 7e 3d  |    y1%+=sy%."~=|
00006190  53 55 42 20 72 30 2c 72  64 79 2c 72 64 78 20 20  |SUB r0,rdy,rdx  |
000061a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000061b0  20 20 20 20 20 5c 20 20  20 20 65 25 2b 3d 28 64  |     \    e%+=(d|
000061c0  79 25 2d 64 78 25 29 2a  32 0d 22 88 16 41 44 44  |y%-dx%)*2."..ADD|
000061d0  20 72 65 2c 72 65 2c 72  30 2c 41 53 4c 23 31 0d  | re,re,r0,ASL#1.|
000061e0  22 92 11 42 20 62 72 65  73 5f 65 6e 64 69 66 32  |"..B bres_endif2|
000061f0  0d 22 9c 2e 2e 62 72 65  73 5f 65 6c 73 65 32 20  |."...bres_else2 |
00006200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006210  20 20 20 20 20 20 20 20  20 5c 20 20 20 8b 0d 22  |         \   .."|
00006220  a6 37 41 44 44 20 72 65  2c 72 65 2c 72 64 79 2c  |.7ADD re,re,rdy,|
00006230  41 53 4c 23 31 20 20 20  20 20 20 20 20 20 20 20  |ASL#1           |
00006240  20 20 20 20 20 20 20 5c  20 20 20 20 65 25 2b 3d  |       \    e%+=|
00006250  64 79 25 2a 32 0d 22 b0  2e 2e 62 72 65 73 5f 65  |dy%*2."...bres_e|
00006260  6e 64 69 66 32 20 20 20  20 20 20 20 20 20 20 20  |ndif2           |
00006270  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00006280  20 20 cd 0d 22 ba 35 41  44 44 20 72 78 31 2c 72  |  ..".5ADD rx1,r|
00006290  78 31 2c 72 73 78 20 20  20 20 20 20 20 20 20 20  |x1,rsx          |
000062a0  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 20 20  |            \   |
000062b0  78 31 25 2b 3d 73 78 25  0d 22 c4 35 4c 44 52 20  |x1%+=sx%.".5LDR |
000062c0  72 30 2c 62 72 65 73 5f  78 32 20 20 20 20 20 20  |r0,bres_x2      |
000062d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000062e0  20 5c 20 20 fd 20 78 31  25 3d 78 32 25 0d 22 ce  | \  . x1%=x2%.".|
000062f0  0e 43 4d 50 20 72 78 31  2c 72 30 0d 22 d8 14 42  |.CMP rx1,r0."..B|
00006300  4e 45 20 62 72 65 73 5f  72 65 70 65 61 74 32 0d  |NE bres_repeat2.|
00006310  22 e2 11 42 20 62 72 65  73 5f 65 6e 64 69 66 31  |"..B bres_endif1|
00006320  0d 22 ec 2c 2e 62 72 65  73 5f 65 6c 73 65 31 20  |.".,.bres_else1 |
00006330  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006340  20 20 20 20 20 20 20 20  20 5c 20 8b 0d 22 f6 38  |         \ ..".8|
00006350  4d 4f 56 20 72 65 2c 72  64 78 2c 41 53 4c 23 31  |MOV re,rdx,ASL#1|
00006360  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006370  20 20 20 20 20 5c 20 20  65 25 3d 64 78 25 2a 32  |     \  e%=dx%*2|
00006380  2d 64 79 25 0d 23 00 11  53 55 42 20 72 65 2c 72  |-dy%.#..SUB re,r|
00006390  65 2c 72 64 79 0d 23 0a  2d 2e 62 72 65 73 5f 72  |e,rdy.#.-.bres_r|
000063a0  65 70 65 61 74 33 20 20  20 20 20 20 20 20 20 20  |epeat3          |
000063b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
000063c0  20 f5 0d 23 14 38 43 4d  50 20 72 79 31 2c 23 30  | ..#.8CMP ry1,#0|
000063d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000063e0  20 20 20 20 20 20 20 20  20 20 20 5c 20 20 20 e7  |           \   .|
000063f0  20 79 31 25 3e 3d 30 2e  2e 2e 0d 23 1e 13 42 4c  | y1%>=0....#..BL|
00006400  54 20 62 72 65 73 5f 65  6e 64 69 66 34 0d 23 28  |T bres_endif4.#(|
00006410  3b 43 4d 50 20 72 79 31  2c 23 34 38 30 20 20 20  |;CMP ry1,#480   |
00006420  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006430  20 20 20 20 20 20 5c 20  20 20 2e 2e 2e 80 20 79  |      \   .... y|
00006440  31 25 3c 34 38 30 20 8c  0d 23 32 41 53 54 52 4c  |1%<480 ..#2ASTRL|
00006450  54 20 72 78 31 2c 5b 72  78 5f 62 75 66 2c 72 79  |T rx1,[rx_buf,ry|
00006460  31 2c 4c 53 4c 23 32 5d  20 20 20 20 20 20 20 20  |1,LSL#2]        |
00006470  20 5c 20 20 20 20 78 5f  62 75 66 25 21 28 79 31  | \    x_buf%!(y1|
00006480  25 3c 3c 32 29 3d 78 31  25 0d 23 3c 2e 2e 62 72  |%<<2)=x1%.#<..br|
00006490  65 73 5f 65 6e 64 69 66  34 20 20 20 20 20 20 20  |es_endif4       |
000064a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000064b0  20 20 5c 20 20 20 cd 0d  23 46 35 43 4d 50 20 72  |  \   ..#F5CMP r|
000064c0  65 2c 23 30 20 20 20 20  20 20 20 20 20 20 20 20  |e,#0            |
000064d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000064e0  5c 20 20 20 e7 20 65 25  3e 30 20 8c 0d 23 50 36  |\   . e%>0 ..#P6|
000064f0  41 44 44 47 54 20 72 78  31 2c 72 78 31 2c 72 73  |ADDGT rx1,rx1,rs|
00006500  78 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |x               |
00006510  20 20 20 20 20 5c 20 20  20 20 78 31 25 2b 3d 73  |     \    x1%+=s|
00006520  78 25 0d 23 5a 3d 53 55  42 47 54 20 72 30 2c 72  |x%.#Z=SUBGT r0,r|
00006530  64 78 2c 72 64 79 20 20  20 20 20 20 20 20 20 20  |dx,rdy          |
00006540  20 20 20 20 20 20 20 20  20 20 20 5c 20 20 20 20  |           \    |
00006550  65 25 2b 3d 28 64 78 25  2d 64 79 25 29 2a 32 0d  |e%+=(dx%-dy%)*2.|
00006560  23 64 18 41 44 44 47 54  20 72 65 2c 72 65 2c 72  |#d.ADDGT re,re,r|
00006570  30 2c 4c 53 4c 23 31 0d  23 6e 2e 20 20 20 20 20  |0,LSL#1.#n.     |
00006580  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000065a0  5c 20 20 20 8b 0d 23 78  37 41 44 44 4c 45 20 72  |\   ..#x7ADDLE r|
000065b0  65 2c 72 65 2c 72 64 78  2c 4c 53 4c 23 31 20 20  |e,re,rdx,LSL#1  |
000065c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
000065d0  20 20 20 65 25 2b 3d 64  78 25 2a 32 0d 23 82 2e  |   e%+=dx%*2.#..|
000065e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00006600  20 20 20 20 20 5c 20 20  20 cd 0d 23 8c 35 41 44  |     \   ..#.5AD|
00006610  44 20 72 79 31 2c 72 79  31 2c 72 73 79 20 20 20  |D ry1,ry1,rsy   |
00006620  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006630  20 20 20 5c 20 20 20 79  31 25 2b 3d 73 79 25 0d  |   \   y1%+=sy%.|
00006640  23 96 35 4c 44 52 20 72  30 2c 62 72 65 73 5f 79  |#.5LDR r0,bres_y|
00006650  32 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |2               |
00006660  20 20 20 20 20 20 20 20  5c 20 20 fd 20 79 31 25  |        \  . y1%|
00006670  3d 79 32 25 0d 23 a0 0e  43 4d 50 20 72 79 31 2c  |=y2%.#..CMP ry1,|
00006680  72 30 0d 23 aa 14 42 4e  45 20 62 72 65 73 5f 72  |r0.#..BNE bres_r|
00006690  65 70 65 61 74 33 0d 23  b4 2c 2e 62 72 65 73 5f  |epeat3.#.,.bres_|
000066a0  65 6e 64 69 66 31 20 20  20 20 20 20 20 20 20 20  |endif1          |
000066b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
000066c0  20 cd 0d 23 be 36 43 4d  50 20 72 79 31 2c 23 30  | ..#.6CMP ry1,#0|
000066d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000066e0  20 20 20 20 20 20 20 20  20 20 20 5c 20 e7 20 79  |           \ . y|
000066f0  31 25 3e 3d 30 2e 2e 2e  0d 23 c8 13 42 4c 54 20  |1%>=0....#..BLT |
00006700  62 72 65 73 5f 65 6e 64  69 66 35 0d 23 d2 39 43  |bres_endif5.#.9C|
00006710  4d 50 20 72 79 31 2c 23  34 38 30 20 20 20 20 20  |MP ry1,#480     |
00006720  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006730  20 20 20 20 5c 20 2e 2e  2e 80 20 79 31 25 3c 34  |    \ .... y1%<4|
00006740  38 30 20 8c 0d 23 dc 3f  53 54 52 4c 54 20 72 78  |80 ..#.?STRLT rx|
00006750  31 2c 5b 72 78 5f 62 75  66 2c 72 79 31 2c 4c 53  |1,[rx_buf,ry1,LS|
00006760  4c 23 32 5d 20 20 20 20  20 20 20 20 20 5c 20 20  |L#2]         \  |
00006770  78 5f 62 75 66 25 21 28  79 31 25 3c 3c 32 29 3d  |x_buf%!(y1%<<2)=|
00006780  78 31 25 0d 23 e6 2c 2e  62 72 65 73 5f 65 6e 64  |x1%.#.,.bres_end|
00006790  69 66 35 20 20 20 20 20  20 20 20 20 20 20 20 20  |if5             |
000067a0  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 cd 0d  |            \ ..|
000067b0  23 f0 3b 4d 4f 56 20 72  76 65 72 74 2c 72 6e 65  |#.;MOV rvert,rne|
000067c0  78 74 5f 76 65 72 74 20  20 20 20 20 20 20 20 20  |xt_vert         |
000067d0  20 20 20 20 20 20 20 20  5c 20 76 65 72 74 25 3d  |        \ vert%=|
000067e0  6e 65 78 74 5f 76 65 72  74 25 0d 23 fa 30 4d 4f  |next_vert%.#.0MO|
000067f0  56 20 72 30 2c 23 30 20  20 20 20 20 20 20 20 20  |V r0,#0         |
00006800  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006810  20 20 20 5c 20 72 30 25  3d 30 0d 24 04 3c 4c 44  |   \ r0%=0.$.<LD|
00006820  52 20 72 31 2c 62 72 65  73 5f 64 69 72 20 20 20  |R r1,bres_dir   |
00006830  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006840  20 20 20 5c 20 e7 20 21  62 72 65 73 5f 64 69 72  |   \ . !bres_dir|
00006850  3d 75 70 25 20 8c 0d 24  0e 0f 43 4d 50 20 72 31  |=up% ..$..CMP r1|
00006860  2c 23 75 70 25 0d 24 18  13 42 4e 45 20 62 72 65  |,#up%.$..BNE bre|
00006870  73 5f 65 6e 64 69 66 36  0d 24 22 3c 43 4d 50 20  |s_endif6.$"<CMP |
00006880  72 79 31 2c 23 30 20 20  20 20 20 20 20 20 20 20  |ry1,#0          |
00006890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000068a0  20 5c 20 20 e7 20 79 31  25 3c 3d 30 20 8c 20 72  | \  . y1%<=0 . r|
000068b0  30 25 3d 31 0d 24 2c 0f  4d 4f 56 4c 45 20 72 30  |0%=1.$,.MOVLE r0|
000068c0  2c 23 31 0d 24 36 45 4c  44 52 20 72 32 2c 74 6f  |,#1.$6ELDR r2,to|
000068d0  70 5f 76 65 72 74 20 20  20 20 20 20 20 20 20 20  |p_vert          |
000068e0  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 20 e7  |            \  .|
000068f0  20 76 65 72 74 25 3d 21  74 6f 70 5f 76 65 72 74  | vert%=!top_vert|
00006900  20 8c 20 72 30 25 3d 31  0d 24 40 10 43 4d 50 20  | . r0%=1.$@.CMP |
00006910  72 76 65 72 74 2c 72 32  0d 24 4a 0c ec 51 20 72  |rvert,r2.$J..Q r|
00006920  30 2c 23 31 0d 24 54 2c  2e 62 72 65 73 5f 65 6e  |0,#1.$T,.bres_en|
00006930  64 69 66 36 20 20 20 20  20 20 20 20 20 20 20 20  |dif6            |
00006940  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 cd  |             \ .|
00006950  0d 24 5e 49 43 4d 50 20  72 31 2c 23 64 6f 77 6e  |.$^ICMP r1,#down|
00006960  25 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |%               |
00006970  20 20 20 20 20 20 20 20  20 5c 20 e7 20 21 62 72  |         \ . !br|
00006980  65 73 5f 64 69 72 3d 64  6f 77 6e 25 20 8c 20 28  |es_dir=down% . (|
00006990  73 74 69 6c 6c 20 72 31  29 0d 24 68 13 42 4e 45  |still r1).$h.BNE|
000069a0  20 62 72 65 73 5f 65 6e  64 69 66 37 0d 24 72 3e  | bres_endif7.$r>|
000069b0  43 4d 50 20 72 79 31 2c  23 34 38 30 20 20 20 20  |CMP ry1,#480    |
000069c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000069d0  20 20 20 20 20 5c 20 20  e7 20 79 31 25 3e 3d 34  |     \  . y1%>=4|
000069e0  38 30 20 8c 20 72 30 25  3d 31 0d 24 7c 0f 4d 4f  |80 . r0%=1.$|.MO|
000069f0  56 47 45 20 72 30 2c 23  31 0d 24 86 45 4c 44 52  |VGE r0,#1.$.ELDR|
00006a00  20 72 32 2c 62 74 6d 5f  76 65 72 74 20 20 20 20  | r2,btm_vert    |
00006a10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006a20  20 20 5c 20 20 e7 20 76  65 72 74 25 3d 21 62 74  |  \  . vert%=!bt|
00006a30  6d 5f 76 65 72 74 20 8c  20 72 30 25 3d 31 0d 24  |m_vert . r0%=1.$|
00006a40  90 10 43 4d 50 20 72 76  65 72 74 2c 72 32 0d 24  |..CMP rvert,r2.$|
00006a50  9a 0c ec 51 20 72 30 2c  23 31 0d 24 a4 2c 2e 62  |...Q r0,#1.$.,.b|
00006a60  72 65 73 5f 65 6e 64 69  66 37 20 20 20 20 20 20  |res_endif7      |
00006a70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006a80  20 20 20 5c 20 cd 0d 24  ae 31 43 4d 50 20 72 30  |   \ ..$.1CMP r0|
00006a90  2c 23 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#1             |
00006aa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00006ab0  fd 20 72 30 25 3d 31 0d  24 b8 14 42 4e 45 20 62  |. r0%=1.$..BNE b|
00006ac0  72 65 73 5f 72 65 70 65  61 74 31 0d 24 c2 2b 4d  |res_repeat1.$.+M|
00006ad0  4f 56 20 50 43 2c 72 6c  69 6e 6b 20 20 20 20 20  |OV PC,rlink     |
00006ae0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006af0  20 20 20 20 5c e1 0d 24  cc 05 5d 0d 24 d6 04 0d  |    \..$..].$...|
00006b00  24 e0 21 f4 20 2d 20 52  65 67 69 73 74 65 72 73  |$.!. - Registers|
00006b10  20 66 6f 72 20 66 69 6c  6c 5f 70 6f 6c 79 20 2d  | for fill_poly -|
00006b20  0d 24 ea 04 0d 24 f4 1a  f4 20 2d 20 50 61 72 61  |.$...$... - Para|
00006b30  6d 73 20 66 6f 72 20 68  6c 69 6e 65 20 2d 0d 24  |ms for hline -.$|
00006b40  fe 09 72 78 31 3d 31 0d  25 08 09 72 78 32 3d 32  |..rx1=1.%..rx2=2|
00006b50  0d 25 12 08 72 79 3d 33  0d 25 1c 0d 72 63 6f 6c  |.%..ry=3.%..rcol|
00006b60  6f 75 72 3d 34 0d 25 26  0e f4 20 2d 20 56 61 72  |our=4.%&.. - Var|
00006b70  73 20 2d 0d 25 30 09 72  79 31 3d 35 0d 25 3a 09  |s -.%0.ry1=5.%:.|
00006b80  72 79 32 3d 36 0d 25 44  11 72 6c 65 66 74 5f 73  |ry2=6.%D.rleft_s|
00006b90  78 62 75 66 3d 37 0d 25  4e 12 72 72 69 67 68 74  |xbuf=7.%N.rright|
00006ba0  5f 73 78 62 75 66 3d 38  0d 25 58 0c 72 6c 69 6e  |_sxbuf=8.%X.rlin|
00006bb0  6b 3d 31 34 0d 25 62 04  0d 25 6c 0e 5b 4f 50 54  |k=14.%b..%l.[OPT|
00006bc0  20 70 61 73 73 25 0d 25  76 0e 2e 66 69 6c 6c 5f  | pass%.%v..fill_|
00006bd0  70 6f 6c 79 0d 25 80 41  4c 44 52 20 72 6c 65 66  |poly.%.ALDR rlef|
00006be0  74 5f 73 78 62 75 66 2c  6c 65 66 74 5f 73 78 62  |t_sxbuf,left_sxb|
00006bf0  75 66 20 20 20 20 20 20  20 20 20 20 20 5c 6c 65  |uf           \le|
00006c00  66 74 5f 73 78 62 75 66  25 3d 21 6c 65 66 74 5f  |ft_sxbuf%=!left_|
00006c10  73 78 62 75 66 0d 25 8a  43 4c 44 52 20 72 72 69  |sxbuf.%.CLDR rri|
00006c20  67 68 74 5f 73 78 62 75  66 2c 72 69 67 68 74 5f  |ght_sxbuf,right_|
00006c30  73 78 62 75 66 20 20 20  20 20 20 20 20 20 5c 72  |sxbuf         \r|
00006c40  69 67 68 74 5f 73 78 62  75 66 25 3d 21 72 69 67  |ight_sxbuf%=!rig|
00006c50  68 74 5f 73 78 62 75 66  0d 25 94 38 4c 44 52 20  |ht_sxbuf.%.8LDR |
00006c60  72 63 6f 6c 6f 75 72 2c  70 6f 6c 79 5f 63 6f 6c  |rcolour,poly_col|
00006c70  6f 75 72 20 20 20 20 20  20 20 20 20 20 20 20 20  |our             |
00006c80  20 5c e6 20 21 70 6f 6c  79 5f 63 6f 6c 6f 75 72  | \. !poly_colour|
00006c90  0d 25 9e 35 4c 44 52 20  72 79 31 2c 74 6f 70 5f  |.%.5LDR ry1,top_|
00006ca0  73 79 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |sy              |
00006cb0  20 20 20 20 20 20 20 20  20 5c 79 31 25 3d 21 74  |         \y1%=!t|
00006cc0  6f 70 5f 73 79 0d 25 a8  35 4c 44 52 20 72 79 32  |op_sy.%.5LDR ry2|
00006cd0  2c 62 74 6d 5f 73 79 20  20 20 20 20 20 20 20 20  |,btm_sy         |
00006ce0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 79  |              \y|
00006cf0  32 25 3d 21 62 74 6d 5f  73 79 0d 25 b2 38 4d 4f  |2%=!btm_sy.%.8MO|
00006d00  56 20 72 79 2c 72 79 31  20 20 20 20 20 20 20 20  |V ry,ry1        |
00006d10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006d20  20 20 20 5c e3 20 79 25  3d 79 31 25 20 b8 20 79  |   \. y%=y1% . y|
00006d30  32 25 0d 25 bc 14 2e 66  69 6c 6c 5f 70 6f 6c 79  |2%.%...fill_poly|
00006d40  5f 6c 6f 6f 70 31 0d 25  c6 45 20 20 20 20 20 20  |_loop1.%.E      |
00006d50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006d60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00006d70  20 2d 20 47 65 74 20 61  6e 64 20 63 6c 69 70 20  | - Get and clip |
00006d80  6c 69 6e 65 20 65 6e 64  73 20 2d 0d 25 d0 42 4c  |line ends -.%.BL|
00006d90  44 52 20 72 78 31 2c 5b  72 6c 65 66 74 5f 73 78  |DR rx1,[rleft_sx|
00006da0  62 75 66 2c 72 79 2c 4c  53 4c 23 32 5d 20 20 20  |buf,ry,LSL#2]   |
00006db0  20 20 20 20 5c 20 78 31  25 3d 6c 65 66 74 5f 73  |    \ x1%=left_s|
00006dc0  78 62 75 66 25 21 28 79  25 3c 3c 32 29 0d 25 da  |xbuf%!(y%<<2).%.|
00006dd0  41 43 4d 50 20 72 78 31  2c 23 36 34 30 20 20 20  |ACMP rx1,#640   |
00006de0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006df0  20 20 20 20 20 20 5c 20  e7 20 78 31 25 3e 3d 36  |      \ . x1%>=6|
00006e00  34 30 20 8c 20 67 6f 20  6e 65 78 74 20 79 0d 25  |40 . go next y.%|
00006e10  e4 17 42 47 45 20 66 69  6c 6c 5f 70 6f 6c 79 5f  |..BGE fill_poly_|
00006e20  6e 65 78 74 31 0d 25 ee  3a 43 4d 50 20 72 78 31  |next1.%.:CMP rx1|
00006e30  2c 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  |,#0             |
00006e40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00006e50  e7 20 78 31 25 3c 30 20  8c 20 78 31 25 3d 30 0d  |. x1%<0 . x1%=0.|
00006e60  25 f8 10 4d 4f 56 4c 54  20 72 78 31 2c 23 30 0d  |%..MOVLT rx1,#0.|
00006e70  26 02 43 4c 44 52 20 72  78 32 2c 5b 72 72 69 67  |&.CLDR rx2,[rrig|
00006e80  68 74 5f 73 78 62 75 66  2c 72 79 2c 4c 53 4c 23  |ht_sxbuf,ry,LSL#|
00006e90  32 5d 20 20 20 20 20 20  5c 20 78 32 25 3d 72 69  |2]      \ x2%=ri|
00006ea0  67 68 74 5f 73 78 62 75  66 25 21 28 79 25 3c 3c  |ght_sxbuf%!(y%<<|
00006eb0  32 29 0d 26 0c 3e 43 4d  50 20 72 78 32 2c 23 30  |2).&.>CMP rx2,#0|
00006ec0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006ed0  20 20 20 20 20 20 20 20  20 20 20 5c 20 e7 20 78  |           \ . x|
00006ee0  32 25 3c 30 20 8c 20 67  6f 20 6e 65 78 74 20 79  |2%<0 . go next y|
00006ef0  0d 26 16 17 42 4c 54 20  66 69 6c 6c 5f 70 6f 6c  |.&..BLT fill_pol|
00006f00  79 5f 6e 65 78 74 31 0d  26 20 3f 43 4d 50 20 72  |y_next1.& ?CMP r|
00006f10  78 32 2c 23 36 34 30 20  20 20 20 20 20 20 20 20  |x2,#640         |
00006f20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006f30  5c 20 e7 20 78 32 25 3e  3d 36 34 30 20 8c 20 78  |\ . x2%>=640 . x|
00006f40  32 25 3d 36 33 39 0d 26  2a 12 4d 4f 56 47 45 20  |2%=639.&*.MOVGE |
00006f50  72 78 32 2c 23 36 34 30  0d 26 34 14 53 55 42 47  |rx2,#640.&4.SUBG|
00006f60  45 20 72 78 32 2c 72 78  32 2c 23 31 0d 26 3e 38  |E rx2,rx2,#1.&>8|
00006f70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00006f90  20 20 20 20 20 5c 20 2d  20 44 72 61 77 20 6c 69  |     \ - Draw li|
00006fa0  6e 65 20 2d 0d 26 48 3d  53 54 4d 46 44 20 72 31  |ne -.&H=STMFD r1|
00006fb0  33 20 21 2c 7b 72 33 2d  72 38 2c 72 6c 69 6e 6b  |3 !,{r3-r8,rlink|
00006fc0  7d 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 f2  |}            \ .|
00006fd0  68 6c 69 6e 65 28 78 31  25 2c 78 32 25 2c 79 25  |hline(x1%,x2%,y%|
00006fe0  29 0d 26 52 0d 20 42 4c  20 68 6c 69 6e 65 0d 26  |).&R. BL hline.&|
00006ff0  5c 1d 4c 44 4d 46 44 20  72 31 33 20 21 2c 7b 72  |\.LDMFD r13 !,{r|
00007000  33 2d 72 38 2c 72 6c 69  6e 6b 7d 0d 26 66 2e 2e  |3-r8,rlink}.&f..|
00007010  66 69 6c 6c 5f 70 6f 6c  79 5f 6e 65 78 74 31 20  |fill_poly_next1 |
00007020  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007030  20 20 20 20 5c ed 20 79  25 0d 26 70 10 41 44 44  |    \. y%.&p.ADD|
00007040  20 72 79 2c 72 79 2c 23  31 0d 26 7a 0e 43 4d 50  | ry,ry,#1.&z.CMP|
00007050  20 72 79 2c 72 79 32 0d  26 84 17 42 4c 45 20 66  | ry,ry2.&..BLE f|
00007060  69 6c 6c 5f 70 6f 6c 79  5f 6c 6f 6f 70 31 0d 26  |ill_poly_loop1.&|
00007070  8e 2b 4d 4f 56 20 50 43  2c 72 6c 69 6e 6b 20 20  |.+MOV PC,rlink  |
00007080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007090  20 20 20 20 20 20 20 5c  e1 0d 26 98 05 5d 0d 26  |       \..&..].&|
000070a0  a2 04 0d 26 ac 1d f4 20  2d 20 52 65 67 69 73 74  |...&... - Regist|
000070b0  65 72 73 20 66 6f 72 20  68 6c 69 6e 65 20 2d 0d  |ers for hline -.|
000070c0  26 b6 04 0d 26 c0 16 f4  20 2d 20 49 6e 70 75 74  |&...&... - Input|
000070d0  20 70 61 72 61 6d 73 20  2d 0d 26 ca 2e 72 78 31  | params -.&..rx1|
000070e0  3d 31 20 20 20 20 20 20  20 20 20 3a f4 20 6c 65  |=1         :. le|
000070f0  66 74 20 65 6e 64 20 6f  66 20 6c 69 6e 65 20 28  |ft end of line (|
00007100  70 69 78 65 6c 73 29 0d  26 d4 1e 72 78 32 3d 32  |pixels).&..rx2=2|
00007110  20 20 20 20 20 20 20 20  20 3a f4 20 72 69 67 68  |         :. righ|
00007120  74 20 64 6f 2e 0d 26 de  35 72 79 3d 33 20 20 20  |t do..&.5ry=3   |
00007130  20 20 20 20 20 20 20 3a  f4 20 79 20 28 70 69 78  |       :. y (pix|
00007140  65 6c 73 29 20 66 6f 72  6d 20 62 6f 74 74 6f 6d  |els) form bottom|
00007150  20 6f 66 20 73 63 72 65  65 6e 0d 26 e8 1a 72 63  | of screen.&..rc|
00007160  6f 6c 6f 75 72 3d 34 20  20 20 20 20 3a f4 20 30  |olour=4     :. 0|
00007170  2e 2e 31 35 0d 26 f2 04  0d 26 fc 0e f4 20 2d 20  |..15.&...&... - |
00007180  56 61 72 73 20 2d 0d 27  06 3b 72 62 61 73 65 3d  |Vars -.'.;rbase=|
00007190  35 20 20 20 20 20 20 20  3a f4 20 62 61 73 65 20  |5       :. base |
000071a0  61 64 64 72 20 28 74 6f  70 2d 6c 65 66 74 29 20  |addr (top-left) |
000071b0  6f 66 20 63 75 72 72 65  6e 74 20 73 63 72 65 65  |of current scree|
000071c0  6e 0d 27 10 42 72 77 6f  72 64 31 3d 36 20 20 20  |n.'.Brword1=6   |
000071d0  20 20 20 3a f4 20 61 64  64 72 20 6f 66 20 77 6f  |   :. addr of wo|
000071e0  72 64 20 63 6f 6e 74 61  69 6e 69 6e 67 20 78 31  |rd containing x1|
000071f0  20 28 72 65 6c 61 74 69  76 65 20 74 6f 20 62 61  | (relative to ba|
00007200  73 65 29 0d 27 1a 1b 72  77 6f 72 64 32 3d 37 20  |se).'..rword2=7 |
00007210  20 20 20 20 20 3a f4 20  64 6f 2e 20 78 32 0d 27  |     :. do. x2.'|
00007220  24 27 72 77 6f 72 64 63  6f 6e 74 3d 38 20 20 20  |$'rwordcont=8   |
00007230  3a f4 20 63 6f 6e 74 65  6e 74 73 20 6f 66 20 61  |:. contents of a|
00007240  20 77 6f 72 64 0d 27 2e  37 72 6d 61 73 6b 31 3d  | word.'.7rmask1=|
00007250  39 20 20 20 20 20 20 3a  f4 20 6d 61 73 6b 20 66  |9      :. mask f|
00007260  6f 72 20 70 6f 69 6e 74  20 6f 72 20 6c 65 66 74  |or point or left|
00007270  20 65 6e 64 20 6f 66 20  6c 69 6e 65 0d 27 38 2f  | end of line.'8/|
00007280  72 6d 61 73 6b 32 3d 31  30 20 20 20 20 20 3a f4  |rmask2=10     :.|
00007290  20 6d 61 73 6b 20 66 6f  72 20 72 69 67 68 74 20  | mask for right |
000072a0  65 6e 64 20 6f 66 20 6c  69 6e 65 0d 27 42 34 72  |end of line.'B4r|
000072b0  69 6e 76 6d 61 73 6b 3d  31 31 20 20 20 3a f4 20  |invmask=11   :. |
000072c0  6c 6f 67 69 63 61 6c 20  69 6e 76 65 72 73 65 20  |logical inverse |
000072d0  6f 66 20 63 75 72 72 65  6e 74 20 6d 61 73 6b 0d  |of current mask.|
000072e0  27 4c 04 0d 27 56 0e 5b  4f 50 54 20 70 61 73 73  |'L..'V.[OPT pass|
000072f0  25 0d 27 60 32 2e 68 6c  69 6e 65 20 20 5c 20 44  |%.'`2.hline  \ D|
00007300  72 61 77 20 61 20 68 6f  72 69 7a 6f 6e 74 61 6c  |raw a horizontal|
00007310  20 6c 69 6e 65 20 28 7a  61 70 73 20 72 31 2d 72  | line (zaps r1-r|
00007320  31 31 29 0d 27 6a 34 5c  20 4d 6f 64 65 20 32 37  |11).'j4\ Mode 27|
00007330  20 2d 20 38 30 20 77 6f  72 64 73 20 70 65 72 20  | - 80 words per |
00007340  6c 69 6e 65 2c 20 38 20  70 69 78 65 6c 73 20 70  |line, 8 pixels p|
00007350  65 72 20 77 6f 72 64 0d  27 74 36 5c 20 78 31 20  |er word.'t6\ x1 |
00007360  69 6e 20 72 31 2c 20 78  32 20 69 6e 20 72 32 2c  |in r1, x2 in r2,|
00007370  20 79 20 69 6e 20 72 33  2c 20 63 6f 6c 6f 75 72  | y in r3, colour|
00007380  20 28 30 2d 31 35 29 20  69 6e 20 72 34 0d 27 7e  | (0-15) in r4.'~|
00007390  20 5c 20 34 20 63 61 73  65 73 20 2d 20 31 2c 20  | \ 4 cases - 1, |
000073a0  78 31 3d 78 32 20 28 70  6f 69 6e 74 29 0d 27 88  |x1=x2 (point).'.|
000073b0  25 5c 20 20 20 20 20 20  20 20 20 20 20 32 2c 20  |%\           2, |
000073c0  78 31 2c 78 32 20 69 6e  20 73 61 6d 65 20 77 6f  |x1,x2 in same wo|
000073d0  72 64 0d 27 92 2a 5c 20  20 20 20 20 20 20 20 20  |rd.'.*\         |
000073e0  20 20 33 2c 20 78 31 2c  78 32 20 69 6e 20 61 64  |  3, x1,x2 in ad|
000073f0  6a 61 63 65 6e 74 20 77  6f 72 64 73 0d 27 9c 2e  |jacent words.'..|
00007400  5c 20 20 20 20 20 20 20  20 20 20 20 34 2c 20 78  |\           4, x|
00007410  31 2c 78 32 20 69 6e 20  6e 6f 6e 5f 61 64 6a 61  |1,x2 in non_adja|
00007420  63 65 6e 74 20 77 6f 72  64 73 0d 27 a6 04 0d 27  |cent words.'...'|
00007430  b0 3f 41 44 52 20 72 30  2c 63 6f 6c 6f 75 72 5f  |.?ADR r0,colour_|
00007440  74 61 62 6c 65 20 20 20  20 20 20 20 20 20 20 20  |table           |
00007450  20 20 20 20 20 20 20 5c  73 74 61 72 74 20 6f 66  |       \start of|
00007460  20 63 6f 6c 6f 75 72 20  74 61 62 6c 65 0d 27 ba  | colour table.'.|
00007470  3b 4c 44 52 20 72 63 6f  6c 6f 75 72 2c 5b 72 30  |;LDR rcolour,[r0|
00007480  2c 72 63 6f 6c 6f 75 72  2c 4c 53 4c 23 32 5d 20  |,rcolour,LSL#2] |
00007490  20 20 20 20 20 20 5c 33  32 20 62 69 74 73 20 6f  |      \32 bits o|
000074a0  66 20 63 6f 6c 6f 75 72  0d 27 c4 04 0d 27 ce 0f  |f colour.'...'..|
000074b0  43 4d 50 20 72 78 31 2c  72 78 32 0d 27 d8 4c 42  |CMP rx1,rx2.'.LB|
000074c0  45 51 20 70 6f 69 6e 74  20 20 20 20 20 20 20 20  |EQ point        |
000074d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000074e0  20 20 20 20 5c 69 66 20  78 31 3d 78 32 20 74 68  |    \if x1=x2 th|
000074f0  65 6e 20 70 6c 6f 74 20  61 20 70 6f 69 6e 74 20  |en plot a point |
00007500  61 74 20 78 31 2c 79 0d  27 e2 04 0d 27 ec 4a 4c  |at x1,y.'...'.JL|
00007510  44 52 20 72 30 2c 73 63  72 5f 6e 6f 20 20 20 20  |DR r0,scr_no    |
00007520  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007530  20 20 20 20 5c 73 63 72  65 65 6e 20 31 20 6f 72  |    \screen 1 or|
00007540  20 73 63 72 65 65 6e 20  32 20 66 6f 72 20 64 69  | screen 2 for di|
00007550  73 70 6c 61 79 0d 27 f6  0d 43 4d 50 20 72 30 2c  |splay.'..CMP r0,|
00007560  23 31 0d 28 00 19 4c 44  52 45 51 20 72 62 61 73  |#1.(..LDREQ rbas|
00007570  65 2c 73 63 72 5f 62 61  73 65 31 0d 28 0a 45 4c  |e,scr_base1.(.EL|
00007580  44 52 4e 45 20 72 62 61  73 65 2c 73 63 72 5f 62  |DRNE rbase,scr_b|
00007590  61 73 65 32 20 20 20 20  20 20 20 20 20 20 20 20  |ase2            |
000075a0  20 20 20 20 5c 62 61 73  65 20 61 64 64 72 20 6f  |    \base addr o|
000075b0  66 20 63 75 72 72 65 6e  74 20 73 63 72 65 65 6e  |f current screen|
000075c0  0d 28 14 04 0d 28 1e 34  4d 4f 56 20 72 30 2c 72  |.(...(.4MOV r0,r|
000075d0  79 2c 4c 53 4c 23 36 20  20 20 20 20 20 20 20 20  |y,LSL#6         |
000075e0  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 79 20  |             \y |
000075f0  74 69 6d 65 73 20 36 34  0d 28 28 48 41 44 44 20  |times 64.((HADD |
00007600  72 30 2c 72 30 2c 72 79  2c 4c 53 4c 23 34 20 20  |r0,r0,ry,LSL#4  |
00007610  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007620  20 5c 70 6c 75 73 20 79  20 74 69 6d 65 73 20 31  | \plus y times 1|
00007630  36 20 28 3d 20 79 20 74  69 6d 65 73 20 38 30 29  |6 (= y times 80)|
00007640  0d 28 32 4b 41 44 44 20  72 77 6f 72 64 31 2c 72  |.(2KADD rword1,r|
00007650  30 2c 72 78 31 2c 4c 53  52 23 33 20 20 20 20 20  |0,rx1,LSR#3     |
00007660  20 20 20 20 20 20 20 20  20 5c 70 6c 75 73 20 78  |         \plus x|
00007670  20 64 69 76 20 38 20 2d  20 77 6f 72 64 20 63 6f  | div 8 - word co|
00007680  6e 74 61 69 6e 69 6e 67  20 78 31 0d 28 3c 30 41  |ntaining x1.(<0A|
00007690  44 44 20 72 77 6f 72 64  32 2c 72 30 2c 72 78 32  |DD rword2,r0,rx2|
000076a0  2c 4c 53 52 23 33 20 20  20 20 20 20 20 20 20 20  |,LSR#3          |
000076b0  20 20 20 20 5c 64 6f 2e  20 78 32 0d 28 46 04 0d  |    \do. x2.(F..|
000076c0  28 50 15 43 4d 50 20 72  77 6f 72 64 31 2c 72 77  |(P.CMP rword1,rw|
000076d0  6f 72 64 32 0d 28 5a 40  42 45 51 20 73 68 6f 72  |ord2.(Z@BEQ shor|
000076e0  74 6c 69 6e 65 20 20 20  20 20 20 20 20 20 20 20  |tline           |
000076f0  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 78 31  |             \x1|
00007700  20 61 6e 64 20 78 32 20  69 6e 20 73 61 6d 65 20  | and x2 in same |
00007710  77 6f 72 64 0d 28 64 04  0d 28 6e 29 5c 44 72 61  |word.(d..(n)\Dra|
00007720  77 20 6c 65 66 74 20 65  6e 64 20 28 70 61 72 74  |w left end (part|
00007730  2d 77 6f 72 64 29 20 6f  66 20 6c 69 6e 65 2e 2e  |-word) of line..|
00007740  2e 0d 28 78 04 0d 28 82  47 4c 44 52 20 72 77 6f  |..(x..(.GLDR rwo|
00007750  72 64 63 6f 6e 74 2c 5b  72 62 61 73 65 2c 72 77  |rdcont,[rbase,rw|
00007760  6f 72 64 31 2c 4c 53 4c  23 32 5d 20 20 20 5c 67  |ord1,LSL#2]   \g|
00007770  65 74 20 63 6f 6e 74 65  6e 74 73 20 6f 66 20 6c  |et contents of l|
00007780  65 66 74 20 65 6e 64 20  77 6f 72 64 0d 28 8c 3d  |eft end word.(.=|
00007790  80 20 72 30 2c 72 78 31  2c 23 25 31 31 31 20 20  |. r0,rx1,#%111  |
000077a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000077b0  20 20 20 5c 72 30 20 69  73 20 70 69 78 65 6c 20  |   \r0 is pixel |
000077c0  6e 6f 20 80 20 25 31 31  31 0d 28 96 42 41 44 52  |no . %111.(.BADR|
000077d0  20 72 6d 61 73 6b 31 2c  6c 65 66 74 5f 6d 61 73  | rmask1,left_mas|
000077e0  6b 73 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |ks              |
000077f0  20 20 5c 73 74 61 72 74  20 6f 66 20 6c 65 66 74  |  \start of left|
00007800  20 6d 61 73 6b 20 74 61  62 6c 65 0d 28 a0 35 4c  | mask table.(.5L|
00007810  44 52 20 72 6d 61 73 6b  31 2c 5b 72 6d 61 73 6b  |DR rmask1,[rmask|
00007820  31 2c 72 30 2c 4c 53 4c  23 32 5d 20 20 20 20 20  |1,r0,LSL#2]     |
00007830  20 20 20 20 5c 33 32 2d  62 69 74 20 6d 61 73 6b  |    \32-bit mask|
00007840  0d 28 aa 36 4d 56 4e 20  72 69 6e 76 6d 61 73 6b  |.(.6MVN rinvmask|
00007850  2c 72 6d 61 73 6b 31 20  20 20 20 20 20 20 20 20  |,rmask1         |
00007860  20 20 20 20 20 20 20 20  20 5c 69 6e 76 65 72 73  |         \invers|
00007870  65 20 6d 61 73 6b 0d 28  b4 33 80 20 72 30 2c 72  |e mask.(.3. r0,r|
00007880  63 6f 6c 6f 75 72 2c 72  69 6e 76 6d 61 73 6b 20  |colour,rinvmask |
00007890  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 63 6f  |             \co|
000078a0  6c 6f 75 72 20 6d 61 73  6b 0d 28 be 39 80 20 72  |lour mask.(.9. r|
000078b0  77 6f 72 64 63 6f 6e 74  2c 72 77 6f 72 64 63 6f  |wordcont,rwordco|
000078c0  6e 74 2c 72 6d 61 73 6b  31 20 20 20 20 20 20 20  |nt,rmask1       |
000078d0  5c 6d 61 73 6b 20 6f 75  74 20 6c 69 6e 65 20 73  |\mask out line s|
000078e0  65 67 0d 28 c8 45 84 52  20 72 77 6f 72 64 63 6f  |eg.(.E.R rwordco|
000078f0  6e 74 2c 72 77 6f 72 64  63 6f 6e 74 2c 72 30 20  |nt,rwordcont,r0 |
00007900  20 20 20 20 20 20 20 20  20 20 5c 72 65 70 6c 61  |          \repla|
00007910  63 65 20 6c 69 6e 65 20  73 65 67 20 77 69 74 68  |ce line seg with|
00007920  20 63 6f 6c 6f 75 72 0d  28 d2 3d 53 54 52 20 72  | colour.(.=STR r|
00007930  77 6f 72 64 63 6f 6e 74  2c 5b 72 62 61 73 65 2c  |wordcont,[rbase,|
00007940  72 77 6f 72 64 31 2c 4c  53 4c 23 32 5d 20 20 20  |rword1,LSL#2]   |
00007950  5c 73 74 6f 72 65 20 6d  6f 64 69 66 69 65 64 20  |\store modified |
00007960  77 6f 72 64 0d 28 dc 04  0d 28 e6 2a 5c 44 72 61  |word.(...(.*\Dra|
00007970  77 20 72 69 67 68 74 20  65 6e 64 20 28 70 61 72  |w right end (par|
00007980  74 2d 77 6f 72 64 29 20  6f 66 20 6c 69 6e 65 2e  |t-word) of line.|
00007990  2e 2e 0d 28 f0 04 0d 28  fa 48 4c 44 52 20 72 77  |...(...(.HLDR rw|
000079a0  6f 72 64 63 6f 6e 74 2c  5b 72 62 61 73 65 2c 72  |ordcont,[rbase,r|
000079b0  77 6f 72 64 32 2c 4c 53  4c 23 32 5d 20 20 20 5c  |word2,LSL#2]   \|
000079c0  67 65 74 20 63 6f 6e 74  65 6e 74 73 20 6f 66 20  |get contents of |
000079d0  72 69 67 68 74 20 65 6e  64 20 77 6f 72 64 0d 29  |right end word.)|
000079e0  04 3d 80 20 72 30 2c 72  78 32 2c 23 25 31 31 31  |.=. r0,rx2,#%111|
000079f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007a00  20 20 20 20 20 5c 72 30  20 69 73 20 70 69 78 65  |     \r0 is pixe|
00007a10  6c 20 6e 6f 20 80 20 25  31 31 31 0d 29 0e 43 41  |l no . %111.).CA|
00007a20  44 52 20 72 6d 61 73 6b  32 2c 72 69 67 68 74 5f  |DR rmask2,right_|
00007a30  6d 61 73 6b 73 20 20 20  20 20 20 20 20 20 20 20  |masks           |
00007a40  20 20 20 20 5c 73 74 61  72 74 20 6f 66 20 72 69  |    \start of ri|
00007a50  67 68 74 20 6d 61 73 6b  20 74 61 62 6c 65 0d 29  |ght mask table.)|
00007a60  18 35 4c 44 52 20 72 6d  61 73 6b 32 2c 5b 72 6d  |.5LDR rmask2,[rm|
00007a70  61 73 6b 32 2c 72 30 2c  4c 53 4c 23 32 5d 20 20  |ask2,r0,LSL#2]  |
00007a80  20 20 20 20 20 20 20 5c  33 32 2d 62 69 74 20 6d  |       \32-bit m|
00007a90  61 73 6b 0d 29 22 36 4d  56 4e 20 72 69 6e 76 6d  |ask.)"6MVN rinvm|
00007aa0  61 73 6b 2c 72 6d 61 73  6b 32 20 20 20 20 20 20  |ask,rmask2      |
00007ab0  20 20 20 20 20 20 20 20  20 20 20 20 5c 69 6e 76  |            \inv|
00007ac0  65 72 73 65 20 6d 61 73  6b 0d 29 2c 33 80 20 72  |erse mask.),3. r|
00007ad0  30 2c 72 63 6f 6c 6f 75  72 2c 72 69 6e 76 6d 61  |0,rcolour,rinvma|
00007ae0  73 6b 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |sk              |
00007af0  5c 63 6f 6c 6f 75 72 20  6d 61 73 6b 0d 29 36 39  |\colour mask.)69|
00007b00  80 20 72 77 6f 72 64 63  6f 6e 74 2c 72 77 6f 72  |. rwordcont,rwor|
00007b10  64 63 6f 6e 74 2c 72 6d  61 73 6b 32 20 20 20 20  |dcont,rmask2    |
00007b20  20 20 20 5c 6d 61 73 6b  20 6f 75 74 20 6c 69 6e  |   \mask out lin|
00007b30  65 20 73 65 67 0d 29 40  45 84 52 20 72 77 6f 72  |e seg.)@E.R rwor|
00007b40  64 63 6f 6e 74 2c 72 77  6f 72 64 63 6f 6e 74 2c  |dcont,rwordcont,|
00007b50  72 30 20 20 20 20 20 20  20 20 20 20 20 5c 72 65  |r0           \re|
00007b60  70 6c 61 63 65 20 6c 69  6e 65 20 73 65 67 20 77  |place line seg w|
00007b70  69 74 68 20 63 6f 6c 6f  75 72 0d 29 4a 3d 53 54  |ith colour.)J=ST|
00007b80  52 20 72 77 6f 72 64 63  6f 6e 74 2c 5b 72 62 61  |R rwordcont,[rba|
00007b90  73 65 2c 72 77 6f 72 64  32 2c 4c 53 4c 23 32 5d  |se,rword2,LSL#2]|
00007ba0  20 20 20 5c 73 74 6f 72  65 20 6d 6f 64 69 66 69  |   \store modifi|
00007bb0  65 64 20 77 6f 72 64 0d  29 54 04 0d 29 5e 1b 4d  |ed word.)T..)^.M|
00007bc0  4f 56 20 72 77 6f 72 64  31 2c 72 77 6f 72 64 31  |OV rword1,rword1|
00007bd0  2c 4c 53 4c 23 32 0d 29  68 43 41 44 44 20 72 77  |,LSL#2.)hCADD rw|
00007be0  6f 72 64 31 2c 72 77 6f  72 64 31 2c 72 62 61 73  |ord1,rword1,rbas|
00007bf0  65 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |e              \|
00007c00  6c 65 66 74 20 65 6e 64  20 61 62 73 6f 6c 75 74  |left end absolut|
00007c10  65 20 61 64 64 72 65 73  73 0d 29 72 1b 4d 4f 56  |e address.)r.MOV|
00007c20  20 72 77 6f 72 64 32 2c  72 77 6f 72 64 32 2c 4c  | rword2,rword2,L|
00007c30  53 4c 23 32 0d 29 7c 37  41 44 44 20 72 77 6f 72  |SL#2.)|7ADD rwor|
00007c40  64 32 2c 72 77 6f 72 64  32 2c 72 62 61 73 65 20  |d2,rword2,rbase |
00007c50  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 72 69  |             \ri|
00007c60  67 68 74 20 65 6e 64 20  64 6f 2e 0d 29 86 3d 53  |ght end do..).=S|
00007c70  55 42 20 72 30 2c 72 77  6f 72 64 32 2c 72 77 6f  |UB r0,rword2,rwo|
00007c80  72 64 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |rd1             |
00007c90  20 20 20 20 5c 6c 69 6e  65 20 6c 65 6e 67 74 68  |    \line length|
00007ca0  20 28 62 79 74 65 73 29  0d 29 90 04 0d 29 9a 0d  | (bytes).)...)..|
00007cb0  43 4d 50 20 72 30 2c 23  34 0d 29 a4 44 4d 4f 56  |CMP r0,#4.).DMOV|
00007cc0  4c 45 20 50 43 2c 72 6c  69 6e 6b 20 20 20 20 20  |LE PC,rlink     |
00007cd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007ce0  20 20 5c 71 75 69 74 20  69 66 20 65 6e 64 20 77  |  \quit if end w|
00007cf0  6f 72 64 73 20 61 64 6a  61 63 65 6e 74 0d 29 ae  |ords adjacent.).|
00007d00  04 0d 29 b8 29 5c 44 72  61 77 20 6d 69 64 64 6c  |..).)\Draw middl|
00007d10  65 20 28 77 68 6f 6c 65  20 77 6f 72 64 73 29 20  |e (whole words) |
00007d20  6f 66 20 6c 69 6e 65 2e  2e 2e 0d 29 c2 04 0d 29  |of line....)...)|
00007d30  cc 4d 52 53 42 20 72 30  2c 72 30 2c 23 33 32 30  |.MRSB r0,r0,#320|
00007d40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007d50  20 20 20 20 20 20 20 5c  73 69 7a 65 20 6f 66 20  |       \size of |
00007d60  53 54 52 20 62 6c 6f 63  6b 20 6d 69 6e 75 73 20  |STR block minus |
00007d70  6c 69 6e 65 20 6c 65 6e  67 74 68 0d 29 d6 4a 41  |line length.).JA|
00007d80  44 44 20 72 31 35 2c 72  31 35 2c 72 30 20 20 20  |DD r15,r15,r0   |
00007d90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007da0  20 20 20 20 5c 73 6b 69  70 20 61 70 70 72 6f 70  |    \skip approp|
00007db0  72 69 61 74 65 20 6e 75  6d 62 65 72 20 6f 66 20  |riate number of |
00007dc0  53 54 52 27 73 0d 29 e0  05 5d 0d 29 ea 04 0d 29  |STR's.)..].)...)|
00007dd0  f4 43 e3 20 49 25 3d 31  20 b8 20 38 30 20 20 20  |.C. I%=1 . 80   |
00007de0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007df0  20 20 20 20 3a f4 20 38  30 20 6f 66 20 74 68 65  |    :. 80 of the|
00007e00  73 65 20 28 33 32 30 20  62 79 74 65 73 29 2e 2e  |se (320 bytes)..|
00007e10  2e 0d 29 fe 44 5a 25 3d  a4 73 74 6f 72 65 28 70  |..).DZ%=.store(p|
00007e20  61 73 73 25 29 20 20 20  20 20 20 20 20 20 20 20  |ass%)           |
00007e30  20 20 20 20 20 20 20 20  20 3a f4 20 53 54 52 20  |         :. STR |
00007e40  72 63 6f 6c 6f 75 72 2c  5b 72 77 6f 72 64 31 2c  |rcolour,[rword1,|
00007e50  23 34 5d 20 21 0d 2a 08  42 ed 20 20 20 20 20 20  |#4] !.*.B.      |
00007e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007e70  20 20 20 20 20 20 20 20  20 20 20 3a f4 20 2e 2e  |           :. ..|
00007e80  2e 74 6f 20 61 76 6f 69  64 20 6c 6f 6f 70 20 6f  |.to avoid loop o|
00007e90  76 65 72 68 65 61 64 0d  2a 12 04 0d 2a 1c 0e 5b  |verhead.*...*..[|
00007ea0  4f 50 54 20 70 61 73 73  25 0d 2a 26 04 0d 2a 30  |OPT pass%.*&..*0|
00007eb0  3d 4d 4f 56 20 50 43 2c  72 6c 69 6e 6b 20 20 20  |=MOV PC,rlink   |
00007ec0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007ed0  20 20 20 20 20 20 5c 71  75 69 74 20 6c 6f 6e 67  |      \quit long|
00007ee0  20 6c 69 6e 65 20 63 61  73 65 0d 2a 3a 04 0d 2a  | line case.*:..*|
00007ef0  44 1f 2e 70 6f 69 6e 74  20 20 20 20 5c 20 50 6c  |D..point    \ Pl|
00007f00  6f 74 20 70 6f 69 6e 74  20 78 31 2c 79 0d 2a 4e  |ot point x1,y.*N|
00007f10  04 0d 2a 58 4a 4c 44 52  20 72 30 2c 73 63 72 5f  |..*XJLDR r0,scr_|
00007f20  6e 6f 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |no              |
00007f30  20 20 20 20 20 20 20 20  20 20 5c 73 63 72 65 65  |          \scree|
00007f40  6e 20 31 20 6f 72 20 73  63 72 65 65 6e 20 32 20  |n 1 or screen 2 |
00007f50  66 6f 72 20 64 69 73 70  6c 61 79 0d 2a 62 0d 43  |for display.*b.C|
00007f60  4d 50 20 72 30 2c 23 31  0d 2a 6c 19 4c 44 52 45  |MP r0,#1.*l.LDRE|
00007f70  51 20 72 62 61 73 65 2c  73 63 72 5f 62 61 73 65  |Q rbase,scr_base|
00007f80  31 0d 2a 76 45 4c 44 52  4e 45 20 72 62 61 73 65  |1.*vELDRNE rbase|
00007f90  2c 73 63 72 5f 62 61 73  65 32 20 20 20 20 20 20  |,scr_base2      |
00007fa0  20 20 20 20 20 20 20 20  20 20 5c 62 61 73 65 20  |          \base |
00007fb0  61 64 64 72 20 6f 66 20  63 75 72 72 65 6e 74 20  |addr of current |
00007fc0  73 63 72 65 65 6e 0d 2a  80 04 0d 2a 8a 34 4d 4f  |screen.*...*.4MO|
00007fd0  56 20 72 77 6f 72 64 31  2c 72 79 2c 4c 53 4c 23  |V rword1,ry,LSL#|
00007fe0  36 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |6               |
00007ff0  20 20 20 5c 79 20 74 69  6d 65 73 20 36 34 0d 2a  |   \y times 64.*|
00008000  94 39 41 44 44 20 72 77  6f 72 64 31 2c 72 77 6f  |.9ADD rword1,rwo|
00008010  72 64 31 2c 72 79 2c 4c  53 4c 23 34 20 20 20 20  |rd1,ry,LSL#4    |
00008020  20 20 20 20 20 20 20 5c  70 6c 75 73 20 79 20 74  |       \plus y t|
00008030  69 6d 65 73 20 31 36 0d  2a 9e 4b 41 44 44 20 72  |imes 16.*.KADD r|
00008040  77 6f 72 64 31 2c 72 77  6f 72 64 31 2c 72 78 31  |word1,rword1,rx1|
00008050  2c 4c 53 52 23 33 20 20  20 20 20 20 20 20 20 20  |,LSR#3          |
00008060  5c 70 6c 75 73 20 78 31  20 64 69 76 20 38 20 2d  |\plus x1 div 8 -|
00008070  20 77 6f 72 64 20 79 2a  38 30 2b 28 78 20 81 20  | word y*80+(x . |
00008080  38 29 0d 2a a8 04 0d 2a  b2 3e 4c 44 52 20 72 77  |8).*...*.>LDR rw|
00008090  6f 72 64 63 6f 6e 74 2c  5b 72 62 61 73 65 2c 72  |ordcont,[rbase,r|
000080a0  77 6f 72 64 31 2c 4c 53  4c 23 32 5d 20 20 20 5c  |word1,LSL#2]   \|
000080b0  67 65 74 20 63 6f 6e 74  65 6e 74 73 20 6f 66 20  |get contents of |
000080c0  77 6f 72 64 0d 2a bc 3d  80 20 72 30 2c 72 78 31  |word.*.=. r0,rx1|
000080d0  2c 23 25 31 31 31 20 20  20 20 20 20 20 20 20 20  |,#%111          |
000080e0  20 20 20 20 20 20 20 20  20 20 20 5c 72 30 20 69  |           \r0 i|
000080f0  73 20 70 69 78 65 6c 20  6e 6f 20 80 20 25 31 31  |s pixel no . %11|
00008100  31 0d 2a c6 3d 41 44 52  20 72 6d 61 73 6b 31 2c  |1.*.=ADR rmask1,|
00008110  70 6f 69 6e 74 5f 6d 61  73 6b 73 20 20 20 20 20  |point_masks     |
00008120  20 20 20 20 20 20 20 20  20 20 5c 73 74 61 72 74  |          \start|
00008130  20 6f 66 20 6d 61 73 6b  20 74 61 62 6c 65 0d 2a  | of mask table.*|
00008140  d0 4d 4c 44 52 20 72 6d  61 73 6b 31 2c 5b 72 6d  |.MLDR rmask1,[rm|
00008150  61 73 6b 31 2c 72 30 2c  4c 53 4c 23 32 5d 20 20  |ask1,r0,LSL#2]  |
00008160  20 20 20 20 20 20 20 5c  33 32 2d 62 69 74 20 6d  |       \32-bit m|
00008170  61 73 6b 20 20 2d 20 25  30 30 30 30 20 61 74 20  |ask  - %0000 at |
00008180  70 69 78 65 6c 20 70 6f  73 27 6e 0d 2a da 4d 4d  |pixel pos'n.*.MM|
00008190  56 4e 20 72 69 6e 76 6d  61 73 6b 2c 72 6d 61 73  |VN rinvmask,rmas|
000081a0  6b 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |k1              |
000081b0  20 20 20 20 5c 69 6e 76  65 72 73 65 20 6d 61 73  |    \inverse mas|
000081c0  6b 20 2d 20 25 31 31 31  31 20 61 74 20 70 69 78  |k - %1111 at pix|
000081d0  65 6c 20 70 6f 73 27 6e  0d 2a e4 4c 80 20 72 30  |el pos'n.*.L. r0|
000081e0  2c 72 63 6f 6c 6f 75 72  2c 72 69 6e 76 6d 61 73  |,rcolour,rinvmas|
000081f0  6b 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |k              \|
00008200  6d 61 73 6b 20 68 61 73  20 34 2d 62 69 74 20 63  |mask has 4-bit c|
00008210  6f 6c 6f 75 72 20 61 74  20 70 69 78 65 6c 20 70  |olour at pixel p|
00008220  6f 73 27 6e 0d 2a ee 36  80 20 72 77 6f 72 64 63  |os'n.*.6. rwordc|
00008230  6f 6e 74 2c 72 77 6f 72  64 63 6f 6e 74 2c 72 6d  |ont,rwordcont,rm|
00008240  61 73 6b 31 20 20 20 20  20 20 20 5c 6d 61 73 6b  |ask1       \mask|
00008250  20 6f 75 74 20 70 69 78  65 6c 0d 2a f8 42 84 52  | out pixel.*.B.R|
00008260  20 72 77 6f 72 64 63 6f  6e 74 2c 72 77 6f 72 64  | rwordcont,rword|
00008270  63 6f 6e 74 2c 72 30 20  20 20 20 20 20 20 20 20  |cont,r0         |
00008280  20 20 5c 72 65 70 6c 61  63 65 20 70 69 78 65 6c  |  \replace pixel|
00008290  20 77 69 74 68 20 63 6f  6c 6f 75 72 0d 2b 02 3d  | with colour.+.=|
000082a0  53 54 52 20 72 77 6f 72  64 63 6f 6e 74 2c 5b 72  |STR rwordcont,[r|
000082b0  62 61 73 65 2c 72 77 6f  72 64 31 2c 4c 53 4c 23  |base,rword1,LSL#|
000082c0  32 5d 20 20 20 5c 73 74  6f 72 65 20 6d 6f 64 69  |2]   \store modi|
000082d0  66 69 65 64 20 77 6f 72  64 0d 2b 0c 04 0d 2b 16  |fied word.+...+.|
000082e0  39 4d 4f 56 20 50 43 2c  72 6c 69 6e 6b 20 20 20  |9MOV PC,rlink   |
000082f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00008300  20 20 20 20 20 20 5c 71  75 69 74 20 70 6f 69 6e  |      \quit poin|
00008310  74 20 63 61 73 65 0d 2b  20 04 0d 2b 2a 3d 2e 73  |t case.+ ..+*=.s|
00008320  68 6f 72 74 6c 69 6e 65  20 5c 20 44 72 61 77 20  |hortline \ Draw |
00008330  61 20 6c 69 6e 65 20 77  68 65 72 65 20 78 31 20  |a line where x1 |
00008340  61 6e 64 20 78 32 20 61  72 65 20 69 6e 20 73 61  |and x2 are in sa|
00008350  6d 65 20 77 6f 72 64 0d  2b 34 04 0d 2b 3e 3e 4c  |me word.+4..+>>L|
00008360  44 52 20 72 77 6f 72 64  63 6f 6e 74 2c 5b 72 62  |DR rwordcont,[rb|
00008370  61 73 65 2c 72 77 6f 72  64 31 2c 4c 53 4c 23 32  |ase,rword1,LSL#2|
00008380  5d 20 20 20 5c 67 65 74  20 63 6f 6e 74 65 6e 74  |]   \get content|
00008390  73 20 6f 66 20 77 6f 72  64 0d 2b 48 3d 80 20 72  |s of word.+H=. r|
000083a0  30 2c 72 78 31 2c 23 25  31 31 31 20 20 20 20 20  |0,rx1,#%111     |
000083b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000083c0  5c 72 30 20 69 73 20 70  69 78 65 6c 20 6e 6f 20  |\r0 is pixel no |
000083d0  80 20 25 31 31 31 0d 2b  52 19 41 44 52 20 72 6d  |. %111.+R.ADR rm|
000083e0  61 73 6b 31 2c 6c 65 66  74 5f 6d 61 73 6b 73 0d  |ask1,left_masks.|
000083f0  2b 5c 40 4c 44 52 20 72  6d 61 73 6b 31 2c 5b 72  |+\@LDR rmask1,[r|
00008400  6d 61 73 6b 31 2c 72 30  2c 4c 53 4c 23 32 5d 20  |mask1,r0,LSL#2] |
00008410  20 20 20 20 20 20 20 20  5c 33 32 2d 62 69 74 20  |        \32-bit |
00008420  6d 61 73 6b 20 2d 20 6c  65 66 74 20 65 6e 64 0d  |mask - left end.|
00008430  2b 66 04 0d 2b 70 3d 80  20 72 30 2c 72 78 32 2c  |+f..+p=. r0,rx2,|
00008440  23 25 31 31 31 20 20 20  20 20 20 20 20 20 20 20  |#%111           |
00008450  20 20 20 20 20 20 20 20  20 20 5c 72 30 20 69 73  |          \r0 is|
00008460  20 70 69 78 65 6c 20 6e  6f 20 80 20 25 31 31 31  | pixel no . %111|
00008470  0d 2b 7a 1a 41 44 52 20  72 6d 61 73 6b 32 2c 72  |.+z.ADR rmask2,r|
00008480  69 67 68 74 5f 6d 61 73  6b 73 0d 2b 84 41 4c 44  |ight_masks.+.ALD|
00008490  52 20 72 6d 61 73 6b 32  2c 5b 72 6d 61 73 6b 32  |R rmask2,[rmask2|
000084a0  2c 72 30 2c 4c 53 4c 23  32 5d 20 20 20 20 20 20  |,r0,LSL#2]      |
000084b0  20 20 20 5c 33 32 2d 62  69 74 20 6d 61 73 6b 20  |   \32-bit mask |
000084c0  2d 20 72 69 67 68 74 20  65 6e 64 0d 2b 8e 04 0d  |- right end.+...|
000084d0  2b 98 36 84 52 20 72 6d  61 73 6b 31 2c 72 6d 61  |+.6.R rmask1,rma|
000084e0  73 6b 31 2c 72 6d 61 73  6b 32 20 20 20 20 20 20  |sk1,rmask2      |
000084f0  20 20 20 20 20 20 20 5c  63 6f 6d 62 69 6e 65 64  |       \combined|
00008500  20 6d 61 73 6b 0d 2b a2  04 0d 2b ac 36 4d 56 4e  | mask.+...+.6MVN|
00008510  20 72 69 6e 76 6d 61 73  6b 2c 72 6d 61 73 6b 31  | rinvmask,rmask1|
00008520  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00008530  20 20 5c 69 6e 76 65 72  73 65 20 6d 61 73 6b 0d  |  \inverse mask.|
00008540  2b b6 33 80 20 72 30 2c  72 63 6f 6c 6f 75 72 2c  |+.3. r0,rcolour,|
00008550  72 69 6e 76 6d 61 73 6b  20 20 20 20 20 20 20 20  |rinvmask        |
00008560  20 20 20 20 20 20 5c 63  6f 6c 6f 75 72 20 6d 61  |      \colour ma|
00008570  73 6b 0d 2b c0 39 80 20  72 77 6f 72 64 63 6f 6e  |sk.+.9. rwordcon|
00008580  74 2c 72 77 6f 72 64 63  6f 6e 74 2c 72 6d 61 73  |t,rwordcont,rmas|
00008590  6b 31 20 20 20 20 20 20  20 5c 6d 61 73 6b 20 6f  |k1       \mask o|
000085a0  75 74 20 6c 69 6e 65 20  73 65 67 0d 2b ca 45 84  |ut line seg.+.E.|
000085b0  52 20 72 77 6f 72 64 63  6f 6e 74 2c 72 77 6f 72  |R rwordcont,rwor|
000085c0  64 63 6f 6e 74 2c 72 30  20 20 20 20 20 20 20 20  |dcont,r0        |
000085d0  20 20 20 5c 72 65 70 6c  61 63 65 20 6c 69 6e 65  |   \replace line|
000085e0  20 73 65 67 20 77 69 74  68 20 63 6f 6c 6f 75 72  | seg with colour|
000085f0  0d 2b d4 3d 53 54 52 20  72 77 6f 72 64 63 6f 6e  |.+.=STR rwordcon|
00008600  74 2c 5b 72 62 61 73 65  2c 72 77 6f 72 64 31 2c  |t,[rbase,rword1,|
00008610  4c 53 4c 23 32 5d 20 20  20 5c 73 74 6f 72 65 20  |LSL#2]   \store |
00008620  6d 6f 64 69 66 69 65 64  20 77 6f 72 64 0d 2b de  |modified word.+.|
00008630  04 0d 2b e8 3e 4d 4f 56  20 50 43 2c 72 6c 69 6e  |..+.>MOV PC,rlin|
00008640  6b 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |k               |
00008650  20 20 20 20 20 20 20 20  20 20 5c 71 75 69 74 20  |          \quit |
00008660  73 68 6f 72 74 20 6c 69  6e 65 20 63 61 73 65 0d  |short line case.|
00008670  2b f2 04 0d 2b fc 46 2e  73 63 72 5f 6e 6f 20 20  |+...+.F.scr_no  |
00008680  20 20 20 20 20 20 45 51  55 44 20 31 20 20 20 20  |      EQUD 1    |
00008690  20 20 20 20 20 20 20 20  20 20 20 20 5c 63 75 72  |            \cur|
000086a0  72 65 6e 74 20 73 63 72  65 65 6e 20 62 61 6e 6b  |rent screen bank|
000086b0  20 28 31 20 6f 72 20 32  29 0d 2c 06 3a 2e 73 63  | (1 or 2).,.:.sc|
000086c0  72 5f 62 61 73 65 31 20  20 20 20 20 45 51 55 44  |r_base1     EQUD|
000086d0  20 a4 73 61 64 64 72 28  70 61 73 73 25 2c 31 29  | .saddr(pass%,1)|
000086e0  20 5c 61 64 64 72 65 73  73 20 6f 66 20 62 61 6e  | \address of ban|
000086f0  6b 20 31 0d 2c 10 3a 2e  73 63 72 5f 62 61 73 65  |k 1.,.:.scr_base|
00008700  32 20 20 20 20 20 45 51  55 44 20 a4 73 61 64 64  |2     EQUD .sadd|
00008710  72 28 70 61 73 73 25 2c  32 29 20 5c 61 64 64 72  |r(pass%,2) \addr|
00008720  65 73 73 20 6f 66 20 62  61 6e 6b 20 32 0d 2c 1a  |ess of bank 2.,.|
00008730  41 2e 73 63 72 5f 62 61  73 65 20 20 20 20 20 20  |A.scr_base      |
00008740  45 51 55 44 20 21 73 63  72 5f 62 61 73 65 31 20  |EQUD !scr_base1 |
00008750  20 20 20 20 20 20 5c 61  64 64 72 65 73 73 20 6f  |      \address o|
00008760  66 20 63 75 72 72 65 6e  74 20 62 61 6e 6b 0d 2c  |f current bank.,|
00008770  24 4c 2e 63 6f 6c 6f 75  72 5f 74 61 62 6c 65 20  |$L.colour_table |
00008780  20 45 51 55 44 20 26 30  30 30 30 30 30 30 30 20  | EQUD &00000000 |
00008790  20 20 20 20 20 20 20 5c  33 32 2d 62 69 74 20 76  |       \32-bit v|
000087a0  65 72 73 69 6f 6e 73 20  6f 66 20 6d 6f 64 65 20  |ersions of mode |
000087b0  32 37 20 63 6f 6c 6f 75  72 73 0d 2c 2e 21 20 20  |27 colours.,.!  |
000087c0  20 20 20 20 20 20 20 20  20 20 20 20 20 45 51 55  |             EQU|
000087d0  44 20 26 31 31 31 31 31  31 31 31 0d 2c 38 21 20  |D &11111111.,8! |
000087e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 45 51  |              EQ|
000087f0  55 44 20 26 32 32 32 32  32 32 32 32 0d 2c 42 21  |UD &22222222.,B!|
00008800  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 45  |               E|
00008810  51 55 44 20 26 33 33 33  33 33 33 33 33 0d 2c 4c  |QUD &33333333.,L|
00008820  21 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |!               |
00008830  45 51 55 44 20 26 34 34  34 34 34 34 34 34 0d 2c  |EQUD &44444444.,|
00008840  56 21 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |V!              |
00008850  20 45 51 55 44 20 26 35  35 35 35 35 35 35 35 0d  | EQUD &55555555.|
00008860  2c 60 21 20 20 20 20 20  20 20 20 20 20 20 20 20  |,`!             |
00008870  20 20 45 51 55 44 20 26  36 36 36 36 36 36 36 36  |  EQUD &66666666|
00008880  0d 2c 6a 21 20 20 20 20  20 20 20 20 20 20 20 20  |.,j!            |
00008890  20 20 20 45 51 55 44 20  26 37 37 37 37 37 37 37  |   EQUD &7777777|
000088a0  37 0d 2c 74 21 20 20 20  20 20 20 20 20 20 20 20  |7.,t!           |
000088b0  20 20 20 20 45 51 55 44  20 26 38 38 38 38 38 38  |    EQUD &888888|
000088c0  38 38 0d 2c 7e 21 20 20  20 20 20 20 20 20 20 20  |88.,~!          |
000088d0  20 20 20 20 20 45 51 55  44 20 26 39 39 39 39 39  |     EQUD &99999|
000088e0  39 39 39 0d 2c 88 21 20  20 20 20 20 20 20 20 20  |999.,.!         |
000088f0  20 20 20 20 20 20 45 51  55 44 20 26 41 41 41 41  |      EQUD &AAAA|
00008900  41 41 41 41 0d 2c 92 21  20 20 20 20 20 20 20 20  |AAAA.,.!        |
00008910  20 20 20 20 20 20 20 45  51 55 44 20 26 42 42 42  |       EQUD &BBB|
00008920  42 42 42 42 42 0d 2c 9c  21 20 20 20 20 20 20 20  |BBBBB.,.!       |
00008930  20 20 20 20 20 20 20 20  45 51 55 44 20 26 43 43  |        EQUD &CC|
00008940  43 43 43 43 43 43 0d 2c  a6 21 20 20 20 20 20 20  |CCCCCC.,.!      |
00008950  20 20 20 20 20 20 20 20  20 45 51 55 44 20 26 44  |         EQUD &D|
00008960  44 44 44 44 44 44 44 0d  2c b0 21 20 20 20 20 20  |DDDDDDD.,.!     |
00008970  20 20 20 20 20 20 20 20  20 20 45 51 55 44 20 26  |          EQUD &|
00008980  45 45 45 45 45 45 45 45  0d 2c ba 21 20 20 20 20  |EEEEEEEE.,.!    |
00008990  20 20 20 20 20 20 20 20  20 20 20 45 51 55 44 20  |           EQUD |
000089a0  26 46 46 46 46 46 46 46  46 0d 2c c4 40 2e 70 6f  |&FFFFFFFF.,.@.po|
000089b0  69 6e 74 5f 6d 61 73 6b  73 20 20 20 45 51 55 44  |int_masks   EQUD|
000089c0  20 26 46 46 46 46 46 46  46 30 20 20 20 20 20 20  | &FFFFFFF0      |
000089d0  20 20 5c 70 69 78 65 6c  20 70 6f 73 69 74 69 6f  |  \pixel positio|
000089e0  6e 20 69 6e 20 77 6f 72  64 0d 2c ce 21 20 20 20  |n in word.,.!   |
000089f0  20 20 20 20 20 20 20 20  20 20 20 20 45 51 55 44  |            EQUD|
00008a00  20 26 46 46 46 46 46 46  30 46 0d 2c d8 21 20 20  | &FFFFFF0F.,.!  |
00008a10  20 20 20 20 20 20 20 20  20 20 20 20 20 45 51 55  |             EQU|
00008a20  44 20 26 46 46 46 46 46  30 46 46 0d 2c e2 21 20  |D &FFFFF0FF.,.! |
00008a30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 45 51  |              EQ|
00008a40  55 44 20 26 46 46 46 46  30 46 46 46 0d 2c ec 21  |UD &FFFF0FFF.,.!|
00008a50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 45  |               E|
00008a60  51 55 44 20 26 46 46 46  30 46 46 46 46 0d 2c f6  |QUD &FFF0FFFF.,.|
00008a70  21 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |!               |
00008a80  45 51 55 44 20 26 46 46  30 46 46 46 46 46 0d 2d  |EQUD &FF0FFFFF.-|
00008a90  00 21 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.!              |
00008aa0  20 45 51 55 44 20 26 46  30 46 46 46 46 46 46 0d  | EQUD &F0FFFFFF.|
00008ab0  2d 0a 21 20 20 20 20 20  20 20 20 20 20 20 20 20  |-.!             |
00008ac0  20 20 45 51 55 44 20 26  30 46 46 46 46 46 46 46  |  EQUD &0FFFFFFF|
00008ad0  0d 2d 14 41 2e 6c 65 66  74 5f 6d 61 73 6b 73 20  |.-.A.left_masks |
00008ae0  20 20 20 45 51 55 44 20  26 30 30 30 30 30 30 30  |   EQUD &0000000|
00008af0  30 20 20 20 20 20 20 20  20 5c 6c 69 6e 65 20 73  |0        \line s|
00008b00  74 61 72 74 73 20 77 69  74 68 69 6e 20 77 6f 72  |tarts within wor|
00008b10  64 0d 2d 1e 21 20 20 20  20 20 20 20 20 20 20 20  |d.-.!           |
00008b20  20 20 20 20 45 51 55 44  20 26 30 30 30 30 30 30  |    EQUD &000000|
00008b30  30 46 0d 2d 28 21 20 20  20 20 20 20 20 20 20 20  |0F.-(!          |
00008b40  20 20 20 20 20 45 51 55  44 20 26 30 30 30 30 30  |     EQUD &00000|
00008b50  30 46 46 0d 2d 32 21 20  20 20 20 20 20 20 20 20  |0FF.-2!         |
00008b60  20 20 20 20 20 20 45 51  55 44 20 26 30 30 30 30  |      EQUD &0000|
00008b70  30 46 46 46 0d 2d 3c 21  20 20 20 20 20 20 20 20  |0FFF.-<!        |
00008b80  20 20 20 20 20 20 20 45  51 55 44 20 26 30 30 30  |       EQUD &000|
00008b90  30 46 46 46 46 0d 2d 46  21 20 20 20 20 20 20 20  |0FFFF.-F!       |
00008ba0  20 20 20 20 20 20 20 20  45 51 55 44 20 26 30 30  |        EQUD &00|
00008bb0  30 46 46 46 46 46 0d 2d  50 21 20 20 20 20 20 20  |0FFFFF.-P!      |
00008bc0  20 20 20 20 20 20 20 20  20 45 51 55 44 20 26 30  |         EQUD &0|
00008bd0  30 46 46 46 46 46 46 0d  2d 5a 21 20 20 20 20 20  |0FFFFFF.-Z!     |
00008be0  20 20 20 20 20 20 20 20  20 20 45 51 55 44 20 26  |          EQUD &|
00008bf0  30 46 46 46 46 46 46 46  0d 2d 64 3f 2e 72 69 67  |0FFFFFFF.-d?.rig|
00008c00  68 74 5f 6d 61 73 6b 73  20 20 20 45 51 55 44 20  |ht_masks   EQUD |
00008c10  26 46 46 46 46 46 46 46  30 20 20 20 20 20 20 20  |&FFFFFFF0       |
00008c20  20 5c 6c 69 6e 65 20 65  6e 64 73 20 77 69 74 68  | \line ends with|
00008c30  69 6e 20 77 6f 72 64 0d  2d 6e 21 20 20 20 20 20  |in word.-n!     |
00008c40  20 20 20 20 20 20 20 20  20 20 45 51 55 44 20 26  |          EQUD &|
00008c50  46 46 46 46 46 46 30 30  0d 2d 78 21 20 20 20 20  |FFFFFF00.-x!    |
00008c60  20 20 20 20 20 20 20 20  20 20 20 45 51 55 44 20  |           EQUD |
00008c70  26 46 46 46 46 46 30 30  30 0d 2d 82 21 20 20 20  |&FFFFF000.-.!   |
00008c80  20 20 20 20 20 20 20 20  20 20 20 20 45 51 55 44  |            EQUD|
00008c90  20 26 46 46 46 46 30 30  30 30 0d 2d 8c 21 20 20  | &FFFF0000.-.!  |
00008ca0  20 20 20 20 20 20 20 20  20 20 20 20 20 45 51 55  |             EQU|
00008cb0  44 20 26 46 46 46 30 30  30 30 30 0d 2d 96 21 20  |D &FFF00000.-.! |
00008cc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 45 51  |              EQ|
00008cd0  55 44 20 26 46 46 30 30  30 30 30 30 0d 2d a0 21  |UD &FF000000.-.!|
00008ce0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 45  |               E|
00008cf0  51 55 44 20 26 46 30 30  30 30 30 30 30 0d 2d aa  |QUD &F0000000.-.|
00008d00  21 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |!               |
00008d10  45 51 55 44 20 26 30 30  30 30 30 30 30 30 0d 2d  |EQUD &00000000.-|
00008d20  b4 16 5c 20 2d 20 54 72  61 63 6b 20 62 75 66 66  |..\ - Track buff|
00008d30  65 72 20 2d 0d 2d be 1f  2e 62 75 66 5f 77 78 20  |er -.-...buf_wx |
00008d40  20 20 20 20 20 20 20 45  51 55 44 20 62 75 66 5f  |       EQUD buf_|
00008d50  77 78 25 0d 2d c8 1f 2e  62 75 66 5f 77 79 20 20  |wx%.-...buf_wy  |
00008d60  20 20 20 20 20 20 45 51  55 44 20 62 75 66 5f 77  |      EQUD buf_w|
00008d70  79 25 0d 2d d2 1f 2e 62  75 66 5f 77 7a 20 20 20  |y%.-...buf_wz   |
00008d80  20 20 20 20 20 45 51 55  44 20 62 75 66 5f 77 7a  |     EQUD buf_wz|
00008d90  25 0d 2d dc 20 2e 62 75  66 5f 77 61 78 20 20 20  |%.-. .buf_wax   |
00008da0  20 20 20 20 45 51 55 44  20 62 75 66 5f 77 61 78  |    EQUD buf_wax|
00008db0  25 0d 2d e6 20 2e 62 75  66 5f 77 61 79 20 20 20  |%.-. .buf_way   |
00008dc0  20 20 20 20 45 51 55 44  20 62 75 66 5f 77 61 79  |    EQUD buf_way|
00008dd0  25 0d 2d f0 20 2e 62 75  66 5f 77 61 7a 20 20 20  |%.-. .buf_waz   |
00008de0  20 20 20 20 45 51 55 44  20 62 75 66 5f 77 61 7a  |    EQUD buf_waz|
00008df0  25 0d 2d fa 20 2e 62 75  66 5f 63 6f 6c 20 20 20  |%.-. .buf_col   |
00008e00  20 20 20 20 45 51 55 44  20 62 75 66 5f 63 6f 6c  |    EQUD buf_col|
00008e10  25 0d 2e 04 33 5c 20 2d  20 53 63 72 65 65 6e 20  |%...3\ - Screen |
00008e20  63 6f 2d 6f 72 64 20 61  72 72 61 79 73 20 66 6f  |co-ord arrays fo|
00008e30  72 20 70 6f 6c 79 67 6f  6e 20 76 65 72 74 69 63  |r polygon vertic|
00008e40  65 73 20 2d 0d 2e 0e 1c  2e 73 78 30 20 20 20 20  |es -.....sx0    |
00008e50  20 20 20 20 20 20 20 45  51 55 44 20 73 78 30 25  |       EQUD sx0%|
00008e60  0d 2e 18 1c 2e 73 78 31  20 20 20 20 20 20 20 20  |.....sx1        |
00008e70  20 20 20 45 51 55 44 20  73 78 31 25 0d 2e 22 1c  |   EQUD sx1%..".|
00008e80  2e 73 78 32 20 20 20 20  20 20 20 20 20 20 20 45  |.sx2           E|
00008e90  51 55 44 20 73 78 32 25  0d 2e 2c 1c 2e 73 78 33  |QUD sx2%..,..sx3|
00008ea0  20 20 20 20 20 20 20 20  20 20 20 45 51 55 44 20  |           EQUD |
00008eb0  73 78 33 25 0d 2e 36 1c  2e 73 79 30 20 20 20 20  |sx3%..6..sy0    |
00008ec0  20 20 20 20 20 20 20 45  51 55 44 20 73 79 30 25  |       EQUD sy0%|
00008ed0  0d 2e 40 1c 2e 73 79 31  20 20 20 20 20 20 20 20  |..@..sy1        |
00008ee0  20 20 20 45 51 55 44 20  73 79 31 25 0d 2e 4a 1c  |   EQUD sy1%..J.|
00008ef0  2e 73 79 32 20 20 20 20  20 20 20 20 20 20 20 45  |.sy2           E|
00008f00  51 55 44 20 73 79 32 25  0d 2e 54 1c 2e 73 79 33  |QUD sy2%..T..sy3|
00008f10  20 20 20 20 20 20 20 20  20 20 20 45 51 55 44 20  |           EQUD |
00008f20  73 79 33 25 0d 2e 5e 1c  2e 73 7a 30 20 20 20 20  |sy3%..^..sz0    |
00008f30  20 20 20 20 20 20 20 45  51 55 44 20 73 7a 30 25  |       EQUD sz0%|
00008f40  0d 2e 68 1c 2e 73 7a 31  20 20 20 20 20 20 20 20  |..h..sz1        |
00008f50  20 20 20 45 51 55 44 20  73 7a 31 25 0d 2e 72 1c  |   EQUD sz1%..r.|
00008f60  2e 73 7a 32 20 20 20 20  20 20 20 20 20 20 20 45  |.sz2           E|
00008f70  51 55 44 20 73 7a 32 25  0d 2e 7c 1c 2e 73 7a 33  |QUD sz2%..|..sz3|
00008f80  20 20 20 20 20 20 20 20  20 20 20 45 51 55 44 20  |           EQUD |
00008f90  73 7a 33 25 0d 2e 86 0f  5c 20 2d 20 54 72 61 63  |sz3%....\ - Trac|
00008fa0  6b 20 2d 0d 2e 90 1f 2e  74 72 6b 5f 77 78 20 20  |k -.....trk_wx  |
00008fb0  20 20 20 20 20 20 45 51  55 44 20 74 72 6b 5f 77  |      EQUD trk_w|
00008fc0  78 25 0d 2e 9a 1f 2e 74  72 6b 5f 77 79 20 20 20  |x%.....trk_wy   |
00008fd0  20 20 20 20 20 45 51 55  44 20 74 72 6b 5f 77 79  |     EQUD trk_wy|
00008fe0  25 0d 2e a4 1f 2e 74 72  6b 5f 77 7a 20 20 20 20  |%.....trk_wz    |
00008ff0  20 20 20 20 45 51 55 44  20 74 72 6b 5f 77 7a 25  |    EQUD trk_wz%|
00009000  0d 2e ae 20 2e 74 72 6b  5f 77 61 78 20 20 20 20  |... .trk_wax    |
00009010  20 20 20 45 51 55 44 20  74 72 6b 5f 77 61 78 25  |   EQUD trk_wax%|
00009020  0d 2e b8 20 2e 74 72 6b  5f 77 61 79 20 20 20 20  |... .trk_way    |
00009030  20 20 20 45 51 55 44 20  74 72 6b 5f 77 61 79 25  |   EQUD trk_way%|
00009040  0d 2e c2 20 2e 74 72 6b  5f 77 61 7a 20 20 20 20  |... .trk_waz    |
00009050  20 20 20 45 51 55 44 20  74 72 6b 5f 77 61 7a 25  |   EQUD trk_waz%|
00009060  0d 2e cc 20 2e 73 65 67  5f 72 61 64 20 20 20 20  |... .seg_rad    |
00009070  20 20 20 45 51 55 44 20  73 65 67 5f 72 61 64 25  |   EQUD seg_rad%|
00009080  0d 2e d6 12 5c 20 2d 20  4f 62 73 65 72 76 65 72  |....\ - Observer|
00009090  20 2d 0d 2e e0 1f 2e 6f  62 73 5f 77 78 20 20 20  | -.....obs_wx   |
000090a0  20 20 20 20 20 45 51 55  44 20 6f 62 73 5f 77 78  |     EQUD obs_wx|
000090b0  25 0d 2e ea 1f 2e 6f 62  73 5f 77 79 20 20 20 20  |%.....obs_wy    |
000090c0  20 20 20 20 45 51 55 44  20 6f 62 73 5f 77 79 25  |    EQUD obs_wy%|
000090d0  0d 2e f4 1f 2e 6f 62 73  5f 77 7a 20 20 20 20 20  |.....obs_wz     |
000090e0  20 20 20 45 51 55 44 20  6f 62 73 5f 77 7a 25 0d  |   EQUD obs_wz%.|
000090f0  2e fe 20 2e 6f 62 73 5f  77 61 78 20 20 20 20 20  |.. .obs_wax     |
00009100  20 20 45 51 55 44 20 6f  62 73 5f 77 61 78 25 0d  |  EQUD obs_wax%.|
00009110  2f 08 20 2e 6f 62 73 5f  77 61 79 20 20 20 20 20  |/. .obs_way     |
00009120  20 20 45 51 55 44 20 6f  62 73 5f 77 61 79 25 0d  |  EQUD obs_way%.|
00009130  2f 12 20 2e 6f 62 73 5f  77 61 7a 20 20 20 20 20  |/. .obs_waz     |
00009140  20 20 45 51 55 44 20 6f  62 73 5f 77 61 7a 25 0d  |  EQUD obs_waz%.|
00009150  2f 1c 1e 2e 73 63 61 6c  65 20 20 20 20 20 20 20  |/...scale       |
00009160  20 20 45 51 55 44 20 73  63 61 6c 65 25 0d 2f 26  |  EQUD scale%./&|
00009170  19 5c 20 2d 20 42 75 66  66 65 72 20 70 6f 69 6e  |.\ - Buffer poin|
00009180  74 65 72 73 20 2d 0d 2f  30 19 2e 6e 65 77 5f 70  |ters -./0..new_p|
00009190  74 72 20 20 20 20 20 20  20 45 51 55 44 20 30 0d  |tr       EQUD 0.|
000091a0  2f 3a 19 2e 76 69 65 77  5f 70 74 72 20 20 20 20  |/:..view_ptr    |
000091b0  20 20 45 51 55 44 20 30  0d 2f 44 19 2e 6f 62 73  |  EQUD 0./D..obs|
000091c0  5f 70 74 72 20 20 20 20  20 20 20 45 51 55 44 20  |_ptr       EQUD |
000091d0  30 0d 2f 4e 17 5c 20 2d  20 54 72 61 63 6b 20 64  |0./N.\ - Track d|
000091e0  65 74 61 69 6c 73 20 2d  0d 2f 58 19 2e 73 74 65  |etails -./X..ste|
000091f0  70 5f 63 6f 75 6e 74 20  20 20 20 45 51 55 44 20  |p_count    EQUD |
00009200  30 0d 2f 62 20 2e 73 65  67 5f 6c 65 6e 20 20 20  |0./b .seg_len   |
00009210  20 20 20 20 45 51 55 44  20 73 65 67 5f 6c 65 6e  |    EQUD seg_len|
00009220  25 0d 2f 6c 20 2e 74 72  6b 5f 64 69 72 20 20 20  |%./l .trk_dir   |
00009230  20 20 20 20 45 51 55 44  20 74 72 6b 5f 64 69 72  |    EQUD trk_dir|
00009240  25 0d 2f 76 19 2e 74 72  6b 5f 70 74 72 20 20 20  |%./v..trk_ptr   |
00009250  20 20 20 20 45 51 55 44  20 30 0d 2f 80 19 2e 73  |    EQUD 0./...s|
00009260  74 65 70 5f 64 69 72 20  20 20 20 20 20 45 51 55  |tep_dir      EQU|
00009270  44 20 30 0d 2f 8a 04 0d  2f 94 2f 5c 20 2d 20 53  |D 0./..././\ - S|
00009280  63 72 65 65 6e 20 64 65  73 63 72 69 70 74 69 6f  |creen descriptio|
00009290  6e 20 6f 66 20 63 75 72  72 65 6e 74 20 70 6f 6c  |n of current pol|
000092a0  79 67 6f 6e 20 2d 0d 2f  9e 3a 2e 6e 5f 76 65 72  |ygon -./.:.n_ver|
000092b0  74 73 20 20 20 20 20 20  20 45 51 55 44 20 30 20  |ts       EQUD 0 |
000092c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000092d0  20 5c 6e 6f 20 6f 66 20  76 65 72 74 69 63 65 73  | \no of vertices|
000092e0  0d 2f a8 3a 2e 70 6f 6c  79 5f 63 6f 6c 6f 75 72  |./.:.poly_colour|
000092f0  20 20 20 45 51 55 44 20  30 20 20 20 20 20 20 20  |   EQUD 0       |
00009300  20 20 20 20 20 20 20 20  20 20 20 5c 70 6f 6c 79  |           \poly|
00009310  67 6f 6e 20 63 6f 6c 6f  75 72 0d 2f b2 48 2e 70  |gon colour./.H.p|
00009320  6f 6c 79 5f 73 78 20 20  20 20 20 20 20 45 51 55  |oly_sx       EQU|
00009330  44 20 70 6f 6c 79 5f 73  78 25 20 20 20 20 20 20  |D poly_sx%      |
00009340  20 20 20 20 20 5c 73 63  72 65 65 6e 20 63 6f 2d  |     \screen co-|
00009350  6f 64 73 20 6f 66 20 76  65 72 74 69 63 65 73 2e  |ods of vertices.|
00009360  2e 2e 0d 2f bc 20 2e 70  6f 6c 79 5f 73 79 20 20  |.../. .poly_sy  |
00009370  20 20 20 20 20 45 51 55  44 20 70 6f 6c 79 5f 73  |     EQUD poly_s|
00009380  79 25 0d 2f c6 20 2e 70  6f 6c 79 5f 73 7a 20 20  |y%./. .poly_sz  |
00009390  20 20 20 20 20 45 51 55  44 20 70 6f 6c 79 5f 73  |     EQUD poly_s|
000093a0  7a 25 0d 2f d0 21 2e 73  6f 72 74 5f 6b 65 79 20  |z%./.!.sort_key |
000093b0  20 20 20 20 20 45 51 55  44 20 73 6f 72 74 5f 6b  |     EQUD sort_k|
000093c0  65 79 25 0d 2f da 1d 2e  73 69 6e 38 20 20 20 20  |ey%./...sin8    |
000093d0  20 20 20 20 20 20 45 51  55 44 20 73 69 6e 38 25  |      EQUD sin8%|
000093e0  0d 2f e4 1d 2e 63 6f 73  38 20 20 20 20 20 20 20  |./...cos8       |
000093f0  20 20 20 45 51 55 44 20  63 6f 73 38 25 0d 2f ee  |   EQUD cos8%./.|
00009400  40 2e 74 6f 70 5f 76 65  72 74 20 20 20 20 20 20  |@.top_vert      |
00009410  45 51 55 44 20 30 20 20  20 20 20 20 20 20 20 20  |EQUD 0          |
00009420  20 20 20 20 20 20 20 20  5c 62 6f 75 6e 64 69 6e  |        \boundin|
00009430  67 20 76 65 72 74 69 63  65 73 2e 2e 2e 0d 2f f8  |g vertices..../.|
00009440  19 2e 62 74 6d 5f 76 65  72 74 20 20 20 20 20 20  |..btm_vert      |
00009450  45 51 55 44 20 30 0d 30  02 19 2e 6c 65 66 74 5f  |EQUD 0.0...left_|
00009460  76 65 72 74 20 20 20 20  20 45 51 55 44 20 30 0d  |vert     EQUD 0.|
00009470  30 0c 19 2e 72 69 67 68  74 5f 76 65 72 74 20 20  |0...right_vert  |
00009480  20 20 45 51 55 44 20 30  0d 30 16 4e 2e 74 6f 70  |  EQUD 0.0.N.top|
00009490  5f 73 79 20 20 20 20 20  20 20 20 45 51 55 44 20  |_sy        EQUD |
000094a0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
000094b0  20 20 20 5c 73 63 72 65  65 6e 20 78 79 20 6f 66  |   \screen xy of|
000094c0  20 70 6f 6c 79 20 62 6f  75 6e 64 69 6e 67 20 72  | poly bounding r|
000094d0  65 63 74 2e 2e 2e 0d 30  20 19 2e 62 74 6d 5f 73  |ect....0 ..btm_s|
000094e0  79 20 20 20 20 20 20 20  20 45 51 55 44 20 30 0d  |y        EQUD 0.|
000094f0  30 2a 19 2e 6c 65 66 74  5f 73 78 20 20 20 20 20  |0*..left_sx     |
00009500  20 20 45 51 55 44 20 30  0d 30 34 19 2e 72 69 67  |  EQUD 0.04..rig|
00009510  68 74 5f 73 78 20 20 20  20 20 20 45 51 55 44 20  |ht_sx      EQUD |
00009520  30 0d 30 3e 49 2e 6c 65  66 74 5f 73 78 62 75 66  |0.0>I.left_sxbuf|
00009530  20 20 20 20 45 51 55 44  20 6c 65 66 74 5f 73 78  |    EQUD left_sx|
00009540  62 75 66 25 20 20 20 20  20 20 20 20 5c 78 20 63  |buf%        \x c|
00009550  6f 2d 6f 72 64 73 20 6f  66 20 6c 20 61 6e 64 20  |o-ords of l and |
00009560  72 20 73 69 64 65 73 2e  2e 2e 0d 30 48 24 2e 72  |r sides....0H$.r|
00009570  69 67 68 74 5f 73 78 62  75 66 20 20 20 45 51 55  |ight_sxbuf   EQU|
00009580  44 20 72 69 67 68 74 5f  73 78 62 75 66 25 0d 30  |D right_sxbuf%.0|
00009590  52 4d 2e 62 72 65 73 5f  64 69 72 20 20 20 20 20  |RM.bres_dir     |
000095a0  20 45 51 55 44 20 30 20  20 20 20 20 20 20 20 20  | EQUD 0         |
000095b0  20 20 20 20 20 20 20 20  20 5c 42 72 65 73 65 6e  |         \Bresen|
000095c0  68 61 6d 20 64 69 72 65  63 74 69 6f 6e 2c 20 30  |ham direction, 0|
000095d0  3d 75 70 2c 20 31 3d 64  6f 77 6e 0d 30 5c 48 2e  |=up, 1=down.0\H.|
000095e0  62 72 65 73 5f 61 6e 67  5f 64 69 72 20 20 45 51  |bres_ang_dir  EQ|
000095f0  55 44 20 30 20 20 20 20  20 20 20 20 20 20 20 20  |UD 0            |
00009600  20 20 20 20 20 20 5c 64  6f 2e 20 61 6e 67 75 6c  |      \do. angul|
00009610  61 72 20 64 69 72 2c 20  30 3d 63 77 2c 20 31 3d  |ar dir, 0=cw, 1=|
00009620  61 63 77 0d 30 66 4d 2e  65 64 67 65 5f 6e 6f 20  |acw.0fM.edge_no |
00009630  20 20 20 20 20 20 45 51  55 44 20 30 20 20 20 20  |      EQUD 0    |
00009640  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 64  |              \d|
00009650  6f 2e 20 70 6f 6c 79 67  6f 6e 20 65 64 67 65 2c  |o. polygon edge,|
00009660  20 30 3d 6c 65 66 74 2c  20 31 3d 72 69 67 68 74  | 0=left, 1=right|
00009670  0d 30 70 4d 2e 73 6b 69  70 5f 70 6f 6c 79 20 20  |.0pM.skip_poly  |
00009680  20 20 20 45 51 55 44 20  30 20 20 20 20 20 20 20  |   EQUD 0       |
00009690  20 20 20 20 20 20 20 20  20 20 20 5c 66 6c 61 67  |           \flag|
000096a0  20 2d 20 73 65 74 20 69  66 20 61 6c 6c 20 70 6f  | - set if all po|
000096b0  6c 79 20 6f 66 66 20 73  63 72 65 65 6e 0d 30 7a  |ly off screen.0z|
000096c0  10 5c 5c 5c 20 6d 69 73  63 20 5c 5c 5c 0d 30 84  |.\\\ misc \\\.0.|
000096d0  30 2e 62 72 65 73 5f 78  32 20 20 20 20 20 20 20  |0.bres_x2       |
000096e0  45 51 55 44 20 30 20 20  20 20 20 20 20 20 20 20  |EQUD 0          |
000096f0  20 20 20 20 20 20 20 20  5c 74 65 6d 70 0d 30 8e  |        \temp.0.|
00009700  30 2e 62 72 65 73 5f 79  32 20 20 20 20 20 20 20  |0.bres_y2       |
00009710  45 51 55 44 20 30 20 20  20 20 20 20 20 20 20 20  |EQUD 0          |
00009720  20 20 20 20 20 20 20 20  5c 74 65 6d 70 0d 30 98  |        \temp.0.|
00009730  05 5d 0d 30 a2 0b ed 20  70 61 73 73 25 0d 30 ac  |.].0... pass%.0.|
00009740  05 e1 0d 30 b6 04 0d 30  c0 13 dd 20 a4 73 74 6f  |...0...0... .sto|
00009750  72 65 28 70 61 73 73 25  29 0d 30 ca 0e 5b 4f 50  |re(pass%).0..[OP|
00009760  54 20 70 61 73 73 25 0d  30 d4 1e 20 53 54 52 20  |T pass%.0.. STR |
00009770  72 63 6f 6c 6f 75 72 2c  5b 72 77 6f 72 64 31 2c  |rcolour,[rword1,|
00009780  23 34 5d 20 21 0d 30 de  05 5d 0d 30 e8 06 3d 30  |#4] !.0..].0..=0|
00009790  0d 30 f2 04 0d 30 fc 1b  dd 20 a4 73 61 64 64 72  |.0...0... .saddr|
000097a0  28 70 61 73 73 25 2c 73  63 72 65 65 6e 25 29 0d  |(pass%,screen%).|
000097b0  31 06 08 ea 20 62 25 0d  31 10 0f e7 20 70 61 73  |1... b%.1... pas|
000097c0  73 25 3e 30 20 8c 0d 31  1a 0b 20 de 20 62 25 20  |s%>0 ..1.. . b% |
000097d0  38 0d 31 24 0c 20 21 62  25 3d 31 34 39 0d 31 2e  |8.1$. !b%=149.1.|
000097e0  0c 20 62 25 21 34 3d 2d  31 0d 31 38 11 20 c8 8e  |. b%!4=-1.18. ..|
000097f0  20 73 63 72 65 65 6e 25  20 ca 0d 31 42 09 20 20  | screen% ..1B.  |
00009800  c9 20 31 0d 31 4c 0f 20  20 20 2a 46 58 31 31 32  |. 1.1L.   *FX112|
00009810  2c 31 0d 31 56 0f 20 20  20 2a 46 58 31 31 33 2c  |,1.1V.   *FX113,|
00009820  31 0d 31 60 09 20 20 c9  20 32 0d 31 6a 0f 20 20  |1.1`.  . 2.1j.  |
00009830  20 2a 46 58 31 31 32 2c  32 0d 31 74 0f 20 20 20  | *FX112,2.1t.   |
00009840  2a 46 58 31 31 33 2c 32  0d 31 7e 06 20 cb 0d 31  |*FX113,2.1~. ..1|
00009850  88 23 20 c8 99 20 22 4f  53 5f 52 65 61 64 56 64  |.# .. "OS_ReadVd|
00009860  75 56 61 72 69 61 62 6c  65 73 22 2c 62 25 2c 62  |uVariables",b%,b|
00009870  25 0d 31 92 0d 20 2a 46  58 31 31 32 2c 31 0d 31  |%.1.. *FX112,1.1|
00009880  9c 0d 20 2a 46 58 31 31  33 2c 31 0d 31 a6 05 cd  |.. *FX113,1.1...|
00009890  0d 31 b0 08 3d 21 62 25  0d ff                    |.1..=!b%..|
0000989a