Home » Archimedes archive » Acorn User » AU 1998-13 (Christmas).adf » Regulars » StarInfo/Madams/fogscape

StarInfo/Madams/fogscape

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 1998-13 (Christmas).adf » Regulars
Filename: StarInfo/Madams/fogscape
Read OK:
File size: 2146 bytes
Load address: 0000
Exec address: 0000
File contents
   10MODE 15
   20ONERROR REPORT:PRINT ERL:END
   30OFF
   40
   50ORIGIN 640,1024
   60roughness%=10
   70divisions%=7
   80
   90size%=2^divisions%
  100sizey%=2^(divisions%+1)
  110s%=(divisions%+1)
  120shift%=9-divisions%
  130
  140lx=(RND(256)-1)*SGNRND
  150ly=(RND(256)-1)*SGNRND
  160lz=-RND(256)-1  : REM must be front lit
  170lx=.5
  180ly=1
  190lz=-1
  200normal=SQR(lx*lx+ly*ly+lz*lz)
  210lx=lx/normal
  220ly=ly/normal
  230lz=lz/normal
  240
  250DIM oh%   (size%+1)*(sizey%)*4
  260DIM h%    (size%+1)*(sizey%)*4
  270DIM mask% (size%+1)*(sizey%)
  280DIM prog% 8192
  290DIM seed% 8
  300DIM px%(2),py%(2)
  310DIM x(2),y(2),z(2)
  320DIM r%(255),g%(255),b%(255)
  330
  340PROCpalette
  350PROCassemble
  360
  370REPEAT
  380GCOL 63 TINT 255
  390RECTANGLE FILL -640,-1024,1280,1024
  400!seed%=RND
  410seed%!4=0
  420PRINT "Landscape = &";~(!seed%)
  430CALL prog%
  440VDU 7
  450PROCdraw
  460ch$=GET$
  470IF ch$=" " OSCLI "screensave scape"
  480CLS
  490UNTIL 0
  500END
  510
  520
  530DEFPROCdraw
  540FOR z%=size% TO 1 STEP -1
  550FOR x%=1 TO size%
  560
  570x(0)=x%-1
  580x(1)=x%-1
  590x(2)=x%
  600y(0)=oh%!((x%-1+(z%<<s%))<<2)
  610y(1)=oh%!((x%-1+((z%-1)<<s%))<<2)
  620y(2)=oh%!((x%+(z%<<s%))<<2)
  630z(0)=z%
  640z(1)=z%-1
  650z(2)=z%
  660
  670FOR r%=0 TO 2
  680xx%=x(r%)-(size%>>1)
  690px%(r%)=xx%*1024 DIV (z(r%)+32)
  700py%(r%)=(y(r%)-1024)*32 DIV (z(r%)+32)
  710NEXT
  720
  730PROCnormal(2,1,0)
  740MOVE px%(0),py%(0)
  750MOVE px%(1),py%(1)
  760PLOT85,px%(2),py%(2)
  770
  780x(0)=x%
  790y(0)=oh%!((x%+((z%-1)<<s%))<<2)
  800z(0)=z%-1
  810
  820xx%=x(0)-(size%>>1)
  830px%(0)=xx%*1024 DIV (z(0)+32)
  840py%(0)=(y(0)-1024)*32 DIV (z(0)+32)
  850
  860PROCnormal(0,1,2)
  870MOVE px%(0),py%(0)
  880MOVE px%(1),py%(1)
  890PLOT85,px%(2),py%(2)
  900NEXT
  910NEXT
  920ENDPROC
  930
  940DEFPROCnormal(a%,b%,c%)
  950nz=((x(a%)-x(b%))*(y(a%)-y(c%)))-((y(a%)-y(b%))*(x(a%)-x(c%)))
  960nx=((y(a%)-y(b%))*(z(a%)-z(c%)))-((z(a%)-z(b%))*(y(a%)-y(c%)))
  970ny=((z(a%)-z(b%))*(x(a%)-x(c%)))-((x(a%)-x(b%))*(z(a%)-z(c%)))
  980normal=SQR(nx*nx+ny*ny+nz*nz)
  990nx=nx/normal
 1000ny=ny/normal
 1010nz=nz/normal
 1020col=(nx*lx+ny*ly+ABS(nz*lz))
 1030h%=(y(a%)+y(b%)+y(c%)) DIV 3
 1040col=col/2+.5
 1050h%=(h%+256)>>1
 1060IF h%<0 h%=0
 1070IF h%>255 h%=255
 1080re%=r%(h%)*col
 1090gr%=g%(h%)*col
 1100bl%=b%(h%)*col
 1110depth=1-(z%/size%)
 1120IF depth>0 depth=SQRdepth
 1130re%=(255-re%)*depth
 1140gr%=(255-gr%)*depth
 1150bl%=(255-bl%)*depth
 1160re%=255-re%
 1170gr%=255-gr%
 1180bl%=255-bl%
 1190
 1200colour%=(re%<<8)+(gr%<<16)+(bl%<<24)
 1210SYS "ColourTrans_SetGCOL",colour%,,,256
 1220ENDPROC
 1230
 1240DEFPROCpalette
 1250r%()=255
 1260g%()=255
 1270b%()=255
 1280FOR rep%=0 TO 31
 1290r%(rep%)=0
 1300g%(rep%)=rep%*4
 1310b%(rep%)=255
 1320NEXT
 1330FOR rep%=0 TO 31
 1340r%(rep%+32)=0
 1350g%(rep%+32)=128-rep%*2
 1360b%(rep%+32)=255
 1370NEXT
 1380
 1390FOR rep%=0 TO 31
 1400r%(rep%+64)=255
 1410g%(rep%+64)=255-rep%*3
 1420b%(rep%+64)=0
 1430NEXT
 1440
 1450FOR rep%=0 TO 63
 1460r%(rep%+96)=255-(rep%*4)
 1470g%(rep%+96)=161-rep%/2
 1480b%(rep%+96)=0
 1490NEXT
 1500
 1510
 1520FOR rep%=0 TO 31
 1530r%(rep%+160)=0
 1540g%(rep%+160)=128+rep%*4
 1550b%(rep%+160)=0
 1560NEXT
 1570
 1580FOR rep%=0 TO 31
 1590r%(rep%+192)=rep%*8
 1600g%(rep%+192)=255
 1610b%(rep%+192)=rep%*8
 1620NEXT
 1630ENDPROC
 1640DEFPROCassemble
 1650r=0
 1660ohadr=1
 1670hadr=2
 1680maskadr=3
 1690a=4
 1700b=5
 1710c=6
 1720d=7
 1730x=8
 1740y=9
 1750step=10
 1760height=11
 1770size=12
 1780
 1790FOR pass%=0 TO 2 STEP 2
 1800P%=prog%
 1810[OPT pass%
 1820 STMFD R13!,{R14}
 1830
 1840 LDR r,sizeat
 1850 LDR maskadr,maskat
 1860 LDR hadr,hat
 1870 LDR ohadr,ohat
 1880 MOV size,#size%
 1890
 1900; clear all the arrays
 1910
 1920 MOV a,#0
 1930.clearloop
 1940 STRB a,[maskadr,r,LSR#2]
 1950 STR a,[ohadr,r]
 1960 STR a,[hadr,r]
 1970 SUBS r,r,#4
 1980BNE clearloop
 1990
 2000; initialise the four corners
 2010
 2020 MOV step,#1
 2030 FNrnd(b,c,a,16*roughness%)
 2040 STR a,[hadr]
 2050 STR a,[ohadr]
 2060 FNrnd(b,c,a,16*roughness%)
 2070 STR a,[hadr,size,LSL#2]
 2080 STR a,[ohadr,size,LSL#2]
 2090 FNrnd(b,c,a,16*roughness%)
 2100 STR a,[hadr,size,LSL#2+s%]
 2110 STR a,[ohadr,size,LSL#2+s%]
 2120 FNrnd(b,c,a,16*roughness%)
 2130 ADD d,size,size,LSL#s%
 2140 STR a,[hadr,d,LSL#2]
 2150 STR a,[ohadr,d,LSL#2]
 2160
 2170 MOV a,#2
 2180 STRB a,[maskadr]
 2190 STRB a,[maskadr,size]
 2200 STRB a,[maskadr,size,LSL#s%]
 2210 STRB a,[maskadr,d]
 2220
 2230; right, lets do it!
 2240 MOV step,#size%>>1
 2250.repeatloop
 2260 MOV y,step
 2270.yloop
 2280 MOV x,step
 2290.xloop
 2300
 2310; a,b,c,d are the heights corners of the square that
 2320; the landscaping routine is working on...
 2330;
 2340; b   a
 2350;
 2360;
 2370; d   c
 2380
 2390 ADD a,y,step
 2400 ADD a,x,a,LSL#s%
 2410 ADD a,a,step
 2420 LDR a,[ohadr,a,LSL#2]
 2430 
 2440 ADD b,y,step
 2450 ADD b,x,b,LSL#s%
 2460 SUB b,b,step
 2470 LDR b,[ohadr,b,LSL#2]
 2480 
 2490 SUB c,y,step
 2500 ADD c,x,c,LSL#s%
 2510 ADD c,c,step
 2520 LDR c,[ohadr,c,LSL#2]
 2530 
 2540 SUB d,y,step
 2550 ADD d,x,d,LSL#s%
 2560 SUB d,d,step
 2570 LDR d,[ohadr,d,LSL#2]
 2580
 2590; now we difine these points...
 2600;
 2610; b x a
 2620; x y x
 2630; d x c
 2640;
 2650; the y is moved twice as much as the x's
 2660
 2670 ADD R14,x,y,LSL#s%
 2680 LDRB r,[maskadr,R14]
 2690 CMP r,#0
 2700BNE skipcentre
 2710
 2720 ADD height,a,b
 2730 ADD height,height,c
 2740 ADD height,height,d
 2750 MOV height,height,ASR#2
 2760 FNrnd(a,b,r,2*roughness%)
 2770 ADD height,height,r
 2780 STR height,[hadr,R14,LSL#2]
 2790 MOV r,#1
 2800 STRB r,[maskadr,R14]
 2810.skipcentre
 2820 
 2830 ADD R14,x,y,LSL#s%
 2840 SUB R14,R14,step,LSL#s%
 2850 LDRB r,[maskadr,R14]
 2860 CMP r,#0
 2870BNE skipbottom
 2880
 2890 ADD height,c,d
 2900 MOV height,height,ASR#1
 2910 FNrnd(a,b,r,roughness%)
 2920 ADD height,height,r
 2930 STR height,[hadr,R14,LSL#2]
 2940 MOV r,#1
 2950 STRB r,[maskadr,R14]
 2960.skipbottom
 2970 
 2980 ADD R14,x,y,LSL#s%
 2990 SUB R14,R14,step
 3000 LDRB r,[maskadr,R14]
 3010 CMP r,#0
 3020BNE skipleft
 3030
 3040 ADD height,d,b
 3050 MOV height,height,ASR#1
 3060 FNrnd(a,b,r,roughness%)
 3070 ADD height,height,r
 3080 STR height,[hadr,R14,LSL#2]
 3090 MOV r,#1
 3100 STRB r,[maskadr,R14]
 3110.skipleft
 3120 
 3130 
 3140 ADD R14,x,y,LSL#s%
 3150 ADD R14,R14,step
 3160 ADD R14,R14,step,LSL#s%
 3170 LDRB r,[maskadr,R14]
 3180 CMP r,#0
 3190BEQ skiptop
 3200 SUB R14,R14,step,LSL#1
 3210 LDRB r,[maskadr,R14]
 3220 CMP r,#0
 3230BEQ skiptop
 3240
 3250 ADD R14,x,y,LSL#s%
 3260 ADD R14,R14,step,LSL#s%
 3270 
 3280 ADD height,b,a
 3290 MOV height,height,ASR#1
 3300 FNrnd(a,b,r,roughness%)
 3310 ADD height,height,r
 3320 STR height,[hadr,R14,LSL#2]
 3330 MOV r,#1
 3340 STRB r,[maskadr,R14]
 3350.skiptop
 3360
 3370 ADD R14,x,y,LSL#s%
 3380 ADD R14,R14,step
 3390 SUB R14,R14,step,LSL#s%
 3400 LDRB r,[maskadr,R14]
 3410 CMP r,#0
 3420BEQ skipright
 3430 ADD R14,R14,step,LSL#1+s%
 3440 LDRB r,[maskadr,R14]
 3450 CMP r,#0
 3460BEQ skipright
 3470
 3480 ADD R14,x,y,LSL#s%
 3490 ADD R14,R14,step
 3500 
 3510 ADD height,c,a
 3520 MOV height,height,ASR#1
 3530 FNrnd(a,b,r,roughness%)
 3540 ADD height,height,r
 3550 STR height,[hadr,R14,LSL#2]
 3560 MOV r,#1
 3570 STRB r,[maskadr,R14]
 3580.skipright
 3590
 3600 ADD x,x,step
 3610 MOV a,#size%
 3620 SUB a,a,step
 3630 CMP x,a
 3640BLE xloop
 3650 ADD y,y,step
 3660 CMP y,a
 3670BLE yloop
 3680
 3690; now we update the values in oh() to those in h()
 3700
 3710 LDR r,sizeat
 3720.update
 3730 LDR a,[hadr,r]
 3740 STR a,[ohadr,r]
 3750 SUBS r,r,#4
 3760BNE update
 3770
 3780 MOV step,step,ASR#1
 3790 CMP step,#0
 3800BGT repeatloop
 3810
 3820 LDR R12,hat
 3830 LDR R11,ohat
 3840 MOV R1,#0
 3850.smoothy
 3860 MOV R0,#0
 3870.smoothx
 3880 ADD R3,R0,R1,LSL#divisions%+1
 3890 LDR R4,[R12,R3]
 3900 
 3910 CMP R0,#0
 3920 MOVEQ R5,R4
 3930BEQ sleft
 3940 SUB R3,R3,#4
 3950 LDR R5,[R12,R3]
 3960 ADD R3,R3,#4
 3970.sleft
 3980 CMP R0,#size%<<2
 3990 MOVEQ R6,R4
 4000BEQ sright
 4010 ADD R3,R3,#4
 4020 LDR R6,[R12,R3]
 4030 SUB R3,R3,#4
 4040.sright
 4050
 4060 CMP R1,#0
 4070 MOVEQ R5,R4
 4080BEQ sbottom
 4090 SUB R3,R3,#sizey%<<2
 4100 LDR R7,[R12,R3]
 4110 ADD R3,R3,#sizey%<<2
 4120.sbottom
 4130 CMP R1,#size%<<2
 4140 MOVEQ R6,R4
 4150BEQ stop
 4160 ADD R3,R3,#sizey%<<2
 4170 LDR R8,[R12,R3]
 4180 SUB R3,R3,#sizey%<<2
 4190.stop
 4200
 4210 ADD R4,R5,R4,LSL#2
 4220 ADD R4,R4,R6
 4230 ADD R4,R4,R7
 4240 ADD R4,R4,R8
 4250 MOV R4,R4,ASR#4
 4260 
 4270 STR R4,[R11,R3]
 4280 
 4290 ADD R0,R0,#4
 4300 CMP R0,#size%<<2
 4301BLE smoothx
 4302 ADD R1,R1,#4
 4303 CMP R1,#size%<<2
 4304BLE smoothy
 4310 
 4320 
 4330 LDR r,sizeat
 4331 LDR ohadr,ohat
 4340.dowater
 4350 LDR a,[ohadr,r]
 4360 CMN a,#97
 4370BGE notwater
 4380 ADD a,a,#98
 4390 MOV a,a,ASR#2
 4400 SUB a,a,#98 
 4410 STR a,[ohadr,r]
 4420.notwater
 4430 SUBS r,r,#4
 4440BNE dowater
 4450
 4460 LDMFD R13!,{PC}
 4470
 4480.seedat EQUD seed%
 4490.sizeat EQUD (size%+1)*(sizey%)*4
 4500.maskat EQUD mask%
 4510.ohat   EQUD oh%
 4520.hat    EQUD h%
 4530]
 4540NEXT
 4550ENDPROC
 4560
 4570DEFFNrnd(reg1,reg2,out,and)
 4580REM and is a constant
 4590REM uses registers reg1,reg2,out,R14
 4600REM reg1 /= reg2 /= out /= 14
 4610REM reg1 < reg2 < out < 14
 4620REM out = (RND(and)-1) * SGNRND
 4630
 4640[OPT pass%
 4650 STMFD R13!,{reg1,reg2,R14}
 4660
 4670 LDR out,seedat
 4680 LDMIA out,{reg1,reg2}
 4690 MOVS reg2,reg2,LSR#1
 4700 MOVS R14,reg1,RRX
 4710 ADC reg2,reg2,reg2
 4720 EOR reg1,R14,reg1,LSL#12
 4730 EOR reg1,reg1,reg1,LSR#20
 4740 STMIA out,{reg1,reg2}
 4750 MOVS R14,R14,ROR#1
 4760 MOV out,#and
 4770 MUL out,step,out
 4780 SUB out,out,#1
 4790 AND out,R14,out
 4800 RSBCS out,out,#0
 4810
 4820 LDMFD R13!,{reg1,reg2,R14}
 4830]
 4840=""

� 15
� �:� �:�
�
(
2ȑ 640,1024
<roughness%=10
Fdivisions%=7
P
Zsize%=2^divisions%
dsizey%=2^(divisions%+1)
ns%=(divisions%+1)
xshift%=9-divisions%
�
�lx=(�(256)-1)*��
�ly=(�(256)-1)*��
�'lz=-�(256)-1  : � must be front lit
�	lx=.5
�ly=1
�	lz=-1
�normal=�(lx*lx+ly*ly+lz*lz)
�lx=lx/normal
�ly=ly/normal
�lz=lz/normal
�
� � oh%   (size%+1)*(sizey%)*4
 � h%    (size%+1)*(sizey%)*4
� mask% (size%+1)*(sizey%)
� prog% 8192
"
� seed% 8
,� px%(2),py%(2)
6� x(2),y(2),z(2)
@� r%(255),g%(255),b%(255)
J
T�palette
^
�assemble
h
r�
|� 63 Ȝ 255
�ȓ Ȑ -640,-1024,1280,1024
�!seed%=�
�
seed%!4=0
�� "Landscape = &";~(!seed%)
�� prog%
�� 7
�	�draw
�	ch$=�
�"� ch$=" " � "screensave scape"
��
�� 0
��
�


��draw
� z%=size% � 1 � -1
&� x%=1 � size%
0
:
x(0)=x%-1
D
x(1)=x%-1
Nx(2)=x%
X!y(0)=oh%!((x%-1+(z%<<s%))<<2)
b%y(1)=oh%!((x%-1+((z%-1)<<s%))<<2)
ly(2)=oh%!((x%+(z%<<s%))<<2)
vz(0)=z%
�
z(1)=z%-1
�z(2)=z%
�
�� r%=0 � 2
�xx%=x(r%)-(size%>>1)
�!px%(r%)=xx%*1024 � (z(r%)+32)
�(py%(r%)=(y(r%)-1024)*32 � (z(r%)+32)
��
�
��normal(2,1,0)
�� px%(0),py%(0)
�� px%(1),py%(1)
��85,px%(2),py%(2)

x(0)=x%
#y(0)=oh%!((x%+((z%-1)<<s%))<<2)
 
z(0)=z%-1
*
4xx%=x(0)-(size%>>1)
>px%(0)=xx%*1024 � (z(0)+32)
H%py%(0)=(y(0)-1024)*32 � (z(0)+32)
R
\�normal(0,1,2)
f� px%(0),py%(0)
p� px%(1),py%(1)
z�85,px%(2),py%(2)
��
��
��
�
���normal(a%,b%,c%)
�Bnz=((x(a%)-x(b%))*(y(a%)-y(c%)))-((y(a%)-y(b%))*(x(a%)-x(c%)))
�Bnx=((y(a%)-y(b%))*(z(a%)-z(c%)))-((z(a%)-z(b%))*(y(a%)-y(c%)))
�Bny=((z(a%)-z(b%))*(x(a%)-x(c%)))-((x(a%)-x(b%))*(z(a%)-z(c%)))
�normal=�(nx*nx+ny*ny+nz*nz)
�nx=nx/normal
�ny=ny/normal
�nz=nz/normal
�col=(nx*lx+ny*ly+�(nz*lz))
h%=(y(a%)+y(b%)+y(c%)) � 3
col=col/2+.5
h%=(h%+256)>>1
$� h%<0 h%=0
.� h%>255 h%=255
8re%=r%(h%)*col
Bgr%=g%(h%)*col
Lbl%=b%(h%)*col
Vdepth=1-(z%/size%)
`� depth>0 depth=�depth
jre%=(255-re%)*depth
tgr%=(255-gr%)*depth
~bl%=(255-bl%)*depth
�re%=255-re%
�gr%=255-gr%
�bl%=255-bl%
�
�(colour%=(re%<<8)+(gr%<<16)+(bl%<<24)
�*ș "ColourTrans_SetGCOL",colour%,,,256
��
�
�
��palette
�r%()=255
�g%()=255
�b%()=255
� rep%=0 � 31

r%(rep%)=0
g%(rep%)=rep%*4
b%(rep%)=255
(�
2� rep%=0 � 31
<r%(rep%+32)=0
Fg%(rep%+32)=128-rep%*2
Pb%(rep%+32)=255
Z�
d
n� rep%=0 � 31
xr%(rep%+64)=255
�g%(rep%+64)=255-rep%*3
�b%(rep%+64)=0
��
�
�� rep%=0 � 63
�r%(rep%+96)=255-(rep%*4)
�g%(rep%+96)=161-rep%/2
�b%(rep%+96)=0
��
�
�
�� rep%=0 � 31
�r%(rep%+160)=0
g%(rep%+160)=128+rep%*4
b%(rep%+160)=0
�
"
,� rep%=0 � 31
6r%(rep%+192)=rep%*8
@g%(rep%+192)=255
Jb%(rep%+192)=rep%*8
T�
^�
h��assemble
rr=0
|ohadr=1
�
hadr=2
�
maskadr=3
�a=4
�b=5
�c=6
�d=7
�x=8
�y=9
�step=10
�
height=11
�size=12
�
�� pass%=0 � 2 � 2
P%=prog%
[OPT pass%
 STMFD R13!,{R14}
&
0 LDR r,sizeat
: LDR maskadr,maskat
D LDR hadr,hat
N LDR ohadr,ohat
X MOV size,#size%
b
l; clear all the arrays
v
�
 MOV a,#0
�.clearloop
� STRB a,[maskadr,r,LSR#2]
� STR a,[ohadr,r]
� STR a,[hadr,r]
� SUBS r,r,#4
�BNE clearloop
�
�!; initialise the four corners
�
� MOV step,#1
� �rnd(b,c,a,16*roughness%)
� STR a,[hadr]
 STR a,[ohadr]
 �rnd(b,c,a,16*roughness%)
 STR a,[hadr,size,LSL#2]
  STR a,[ohadr,size,LSL#2]
* �rnd(b,c,a,16*roughness%)
4 STR a,[hadr,size,LSL#2+s%]
>  STR a,[ohadr,size,LSL#2+s%]
H �rnd(b,c,a,16*roughness%)
R ADD d,size,size,LSL#s%
\ STR a,[hadr,d,LSL#2]
f STR a,[ohadr,d,LSL#2]
p
z
 MOV a,#2
� STRB a,[maskadr]
� STRB a,[maskadr,size]
�! STRB a,[maskadr,size,LSL#s%]
� STRB a,[maskadr,d]
�
�; right, lets do it!
� MOV step,#size%>>1
�.repeatloop
� MOV y,step
�
.yloop
� MOV x,step
�
.xloop
�
	8; a,b,c,d are the heights corners of the square that
	.; the landscaping routine is working on...
	;
	$; b   a
	.;
	8;
	B; d   c
	L
	V ADD a,y,step
	` ADD a,x,a,LSL#s%
	j ADD a,a,step
	t LDR a,[ohadr,a,LSL#2]
	~ 
	� ADD b,y,step
	� ADD b,x,b,LSL#s%
	� SUB b,b,step
	� LDR b,[ohadr,b,LSL#2]
	� 
	� SUB c,y,step
	� ADD c,x,c,LSL#s%
	� ADD c,c,step
	� LDR c,[ohadr,c,LSL#2]
	� 
	� SUB d,y,step
	� ADD d,x,d,LSL#s%
 SUB d,d,step

 LDR d,[ohadr,d,LSL#2]

#; now we difine these points...
(;
2; b x a
<; x y x
F; d x c
P;
Z-; the y is moved twice as much as the x's
d
n ADD R14,x,y,LSL#s%
x LDRB r,[maskadr,R14]
�
 CMP r,#0
�BNE skipcentre
�
� ADD height,a,b
� ADD height,height,c
� ADD height,height,d
� MOV height,height,ASR#2
� �rnd(a,b,r,2*roughness%)
� ADD height,height,r
�  STR height,[hadr,R14,LSL#2]
�
 MOV r,#1
� STRB r,[maskadr,R14]
�.skipcentre
 
 ADD R14,x,y,LSL#s%
 SUB R14,R14,step,LSL#s%
" LDRB r,[maskadr,R14]
,
 CMP r,#0
6BNE skipbottom
@
J ADD height,c,d
T MOV height,height,ASR#1
^ �rnd(a,b,r,roughness%)
h ADD height,height,r
r  STR height,[hadr,R14,LSL#2]
|
 MOV r,#1
� STRB r,[maskadr,R14]
�.skipbottom
� 
� ADD R14,x,y,LSL#s%
� SUB R14,R14,step
� LDRB r,[maskadr,R14]
�
 CMP r,#0
�BNE skipleft
�
� ADD height,d,b
� MOV height,height,ASR#1
� �rnd(a,b,r,roughness%)
� ADD height,height,r
  STR height,[hadr,R14,LSL#2]

 MOV r,#1
 STRB r,[maskadr,R14]
&
.skipleft
0 
: 
D ADD R14,x,y,LSL#s%
N ADD R14,R14,step
X ADD R14,R14,step,LSL#s%
b LDRB r,[maskadr,R14]
l
 CMP r,#0
vBEQ skiptop
� SUB R14,R14,step,LSL#1
� LDRB r,[maskadr,R14]
�
 CMP r,#0
�BEQ skiptop
�
� ADD R14,x,y,LSL#s%
� ADD R14,R14,step,LSL#s%
� 
� ADD height,b,a
� MOV height,height,ASR#1
� �rnd(a,b,r,roughness%)
� ADD height,height,r
�  STR height,[hadr,R14,LSL#2]


 MOV r,#1

 STRB r,[maskadr,R14]

.skiptop

 

* ADD R14,x,y,LSL#s%

4 ADD R14,R14,step

> SUB R14,R14,step,LSL#s%

H LDRB r,[maskadr,R14]

R
 CMP r,#0

\BEQ skipright

f ADD R14,R14,step,LSL#1+s%

p LDRB r,[maskadr,R14]

z
 CMP r,#0

�BEQ skipright

�

� ADD R14,x,y,LSL#s%

� ADD R14,R14,step

� 

� ADD height,c,a

� MOV height,height,ASR#1

� �rnd(a,b,r,roughness%)

� ADD height,height,r

�  STR height,[hadr,R14,LSL#2]

�
 MOV r,#1

� STRB r,[maskadr,R14]

�.skipright

 ADD x,x,step
 MOV a,#size%
$ SUB a,a,step
. CMP x,a
8
BLE xloop
B ADD y,y,step
L CMP y,a
V
BLE yloop
`
j6; now we update the values in oh() to those in h()
t
~ LDR r,sizeat
�.update
� LDR a,[hadr,r]
� STR a,[ohadr,r]
� SUBS r,r,#4
�BNE update
�
� MOV step,step,ASR#1
� CMP step,#0
�BGT repeatloop
�
� LDR R12,hat
� LDR R11,ohat
 MOV R1,#0

.smoothy
 MOV R0,#0
.smoothx
(" ADD R3,R0,R1,LSL#divisions%+1
2 LDR R4,[R12,R3]
< 
F CMP R0,#0
P
 �Q R5,R4
Z
BEQ sleft
d SUB R3,R3,#4
n LDR R5,[R12,R3]
x ADD R3,R3,#4
�
.sleft
� CMP R0,#size%<<2
�
 �Q R6,R4
�BEQ sright
� ADD R3,R3,#4
� LDR R6,[R12,R3]
� SUB R3,R3,#4
�.sright
�
� CMP R1,#0
�
 �Q R5,R4
�BEQ sbottom
� SUB R3,R3,#sizey%<<2
 LDR R7,[R12,R3]
 ADD R3,R3,#sizey%<<2
.sbottom
" CMP R1,#size%<<2
,
 �Q R6,R4
6BEQ stop
@ ADD R3,R3,#sizey%<<2
J LDR R8,[R12,R3]
T SUB R3,R3,#sizey%<<2
^	.stop
h
r ADD R4,R5,R4,LSL#2
| ADD R4,R4,R6
� ADD R4,R4,R7
� ADD R4,R4,R8
� MOV R4,R4,ASR#4
� 
� STR R4,[R11,R3]
� 
� ADD R0,R0,#4
� CMP R0,#size%<<2
�BLE smoothx
� ADD R1,R1,#4
� CMP R1,#size%<<2
�BLE smoothy
� 
� 
� LDR r,sizeat
� LDR ohadr,ohat
�.dowater
� LDR a,[ohadr,r]
 CMN a,#97
BGE notwater
 ADD a,a,#98
& MOV a,a,ASR#2
0 SUB a,a,#98 
: STR a,[ohadr,r]
D
.notwater
N SUBS r,r,#4
XBNE dowater
b
l LDMFD R13!,{PC}
v
�.seedat EQUD seed%
�%.sizeat EQUD (size%+1)*(sizey%)*4
�.maskat EQUD mask%
�.ohat   EQUD oh%
�.hat    EQUD h%
�]
��
��
�
�ݤrnd(reg1,reg2,out,and)
�� and is a constant
�&� uses registers reg1,reg2,out,R14
�� reg1 /= reg2 /= out /= 14
� reg1 < reg2 < out < 14
!� out = (RND(and)-1) * SGNRND

 [OPT pass%
* STMFD R13!,{reg1,reg2,R14}
4
> LDR out,seedat
H LDMIA out,{reg1,reg2}
R MOVS reg2,reg2,LSR#1
\ MOVS R14,reg1,RRX
f ADC reg2,reg2,reg2
p � reg1,R14,reg1,LSL#12
z � reg1,reg1,reg1,LSR#20
� STMIA out,{reg1,reg2}
� MOVS R14,R14,ROR#1
� MOV out,#and
� MUL out,step,out
� SUB out,out,#1
� � out,R14,out
� RSBCS out,out,#0
�
� LDMFD R13!,{reg1,reg2,R14}
�]
�=""
�
00000000  0d 00 0a 08 eb 20 31 35  0d 00 14 0e ee 85 20 f6  |..... 15...... .|
00000010  3a f1 20 9e 3a e0 0d 00  1e 05 87 0d 00 28 04 0d  |:. .:........(..|
00000020  00 32 0f c8 91 20 36 34  30 2c 31 30 32 34 0d 00  |.2... 640,1024..|
00000030  3c 11 72 6f 75 67 68 6e  65 73 73 25 3d 31 30 0d  |<.roughness%=10.|
00000040  00 46 10 64 69 76 69 73  69 6f 6e 73 25 3d 37 0d  |.F.divisions%=7.|
00000050  00 50 04 0d 00 5a 16 73  69 7a 65 25 3d 32 5e 64  |.P...Z.size%=2^d|
00000060  69 76 69 73 69 6f 6e 73  25 0d 00 64 1b 73 69 7a  |ivisions%..d.siz|
00000070  65 79 25 3d 32 5e 28 64  69 76 69 73 69 6f 6e 73  |ey%=2^(divisions|
00000080  25 2b 31 29 0d 00 6e 15  73 25 3d 28 64 69 76 69  |%+1)..n.s%=(divi|
00000090  73 69 6f 6e 73 25 2b 31  29 0d 00 78 17 73 68 69  |sions%+1)..x.shi|
000000a0  66 74 25 3d 39 2d 64 69  76 69 73 69 6f 6e 73 25  |ft%=9-divisions%|
000000b0  0d 00 82 04 0d 00 8c 14  6c 78 3d 28 b3 28 32 35  |........lx=(.(25|
000000c0  36 29 2d 31 29 2a b4 b3  0d 00 96 14 6c 79 3d 28  |6)-1)*......ly=(|
000000d0  b3 28 32 35 36 29 2d 31  29 2a b4 b3 0d 00 a0 27  |.(256)-1)*.....'|
000000e0  6c 7a 3d 2d b3 28 32 35  36 29 2d 31 20 20 3a 20  |lz=-.(256)-1  : |
000000f0  f4 20 6d 75 73 74 20 62  65 20 66 72 6f 6e 74 20  |. must be front |
00000100  6c 69 74 0d 00 aa 09 6c  78 3d 2e 35 0d 00 b4 08  |lit....lx=.5....|
00000110  6c 79 3d 31 0d 00 be 09  6c 7a 3d 2d 31 0d 00 c8  |ly=1....lz=-1...|
00000120  1f 6e 6f 72 6d 61 6c 3d  b6 28 6c 78 2a 6c 78 2b  |.normal=.(lx*lx+|
00000130  6c 79 2a 6c 79 2b 6c 7a  2a 6c 7a 29 0d 00 d2 10  |ly*ly+lz*lz)....|
00000140  6c 78 3d 6c 78 2f 6e 6f  72 6d 61 6c 0d 00 dc 10  |lx=lx/normal....|
00000150  6c 79 3d 6c 79 2f 6e 6f  72 6d 61 6c 0d 00 e6 10  |ly=ly/normal....|
00000160  6c 7a 3d 6c 7a 2f 6e 6f  72 6d 61 6c 0d 00 f0 04  |lz=lz/normal....|
00000170  0d 00 fa 20 de 20 6f 68  25 20 20 20 28 73 69 7a  |... . oh%   (siz|
00000180  65 25 2b 31 29 2a 28 73  69 7a 65 79 25 29 2a 34  |e%+1)*(sizey%)*4|
00000190  0d 01 04 20 de 20 68 25  20 20 20 20 28 73 69 7a  |... . h%    (siz|
000001a0  65 25 2b 31 29 2a 28 73  69 7a 65 79 25 29 2a 34  |e%+1)*(sizey%)*4|
000001b0  0d 01 0e 1e de 20 6d 61  73 6b 25 20 28 73 69 7a  |..... mask% (siz|
000001c0  65 25 2b 31 29 2a 28 73  69 7a 65 79 25 29 0d 01  |e%+1)*(sizey%)..|
000001d0  18 10 de 20 70 72 6f 67  25 20 38 31 39 32 0d 01  |... prog% 8192..|
000001e0  22 0d de 20 73 65 65 64  25 20 38 0d 01 2c 13 de  |".. seed% 8..,..|
000001f0  20 70 78 25 28 32 29 2c  70 79 25 28 32 29 0d 01  | px%(2),py%(2)..|
00000200  36 14 de 20 78 28 32 29  2c 79 28 32 29 2c 7a 28  |6.. x(2),y(2),z(|
00000210  32 29 0d 01 40 1d de 20  72 25 28 32 35 35 29 2c  |2)..@.. r%(255),|
00000220  67 25 28 32 35 35 29 2c  62 25 28 32 35 35 29 0d  |g%(255),b%(255).|
00000230  01 4a 04 0d 01 54 0c f2  70 61 6c 65 74 74 65 0d  |.J...T..palette.|
00000240  01 5e 0d f2 61 73 73 65  6d 62 6c 65 0d 01 68 04  |.^..assemble..h.|
00000250  0d 01 72 05 f5 0d 01 7c  0f e6 20 36 33 20 c8 9c  |..r....|.. 63 ..|
00000260  20 32 35 35 0d 01 86 1e  c8 93 20 c8 90 20 2d 36  | 255...... .. -6|
00000270  34 30 2c 2d 31 30 32 34  2c 31 32 38 30 2c 31 30  |40,-1024,1280,10|
00000280  32 34 0d 01 90 0c 21 73  65 65 64 25 3d b3 0d 01  |24....!seed%=...|
00000290  9a 0d 73 65 65 64 25 21  34 3d 30 0d 01 a4 1f f1  |..seed%!4=0.....|
000002a0  20 22 4c 61 6e 64 73 63  61 70 65 20 3d 20 26 22  | "Landscape = &"|
000002b0  3b 7e 28 21 73 65 65 64  25 29 0d 01 ae 0b d6 20  |;~(!seed%)..... |
000002c0  70 72 6f 67 25 0d 01 b8  07 ef 20 37 0d 01 c2 09  |prog%..... 7....|
000002d0  f2 64 72 61 77 0d 01 cc  09 63 68 24 3d be 0d 01  |.draw....ch$=...|
000002e0  d6 22 e7 20 63 68 24 3d  22 20 22 20 ff 20 22 73  |.". ch$=" " . "s|
000002f0  63 72 65 65 6e 73 61 76  65 20 73 63 61 70 65 22  |creensave scape"|
00000300  0d 01 e0 05 db 0d 01 ea  07 fd 20 30 0d 01 f4 05  |.......... 0....|
00000310  e0 0d 01 fe 04 0d 02 08  04 0d 02 12 0a dd f2 64  |...............d|
00000320  72 61 77 0d 02 1c 17 e3  20 7a 25 3d 73 69 7a 65  |raw..... z%=size|
00000330  25 20 b8 20 31 20 88 20  2d 31 0d 02 26 12 e3 20  |% . 1 . -1..&.. |
00000340  78 25 3d 31 20 b8 20 73  69 7a 65 25 0d 02 30 04  |x%=1 . size%..0.|
00000350  0d 02 3a 0d 78 28 30 29  3d 78 25 2d 31 0d 02 44  |..:.x(0)=x%-1..D|
00000360  0d 78 28 31 29 3d 78 25  2d 31 0d 02 4e 0b 78 28  |.x(1)=x%-1..N.x(|
00000370  32 29 3d 78 25 0d 02 58  21 79 28 30 29 3d 6f 68  |2)=x%..X!y(0)=oh|
00000380  25 21 28 28 78 25 2d 31  2b 28 7a 25 3c 3c 73 25  |%!((x%-1+(z%<<s%|
00000390  29 29 3c 3c 32 29 0d 02  62 25 79 28 31 29 3d 6f  |))<<2)..b%y(1)=o|
000003a0  68 25 21 28 28 78 25 2d  31 2b 28 28 7a 25 2d 31  |h%!((x%-1+((z%-1|
000003b0  29 3c 3c 73 25 29 29 3c  3c 32 29 0d 02 6c 1f 79  |)<<s%))<<2)..l.y|
000003c0  28 32 29 3d 6f 68 25 21  28 28 78 25 2b 28 7a 25  |(2)=oh%!((x%+(z%|
000003d0  3c 3c 73 25 29 29 3c 3c  32 29 0d 02 76 0b 7a 28  |<<s%))<<2)..v.z(|
000003e0  30 29 3d 7a 25 0d 02 80  0d 7a 28 31 29 3d 7a 25  |0)=z%....z(1)=z%|
000003f0  2d 31 0d 02 8a 0b 7a 28  32 29 3d 7a 25 0d 02 94  |-1....z(2)=z%...|
00000400  04 0d 02 9e 0e e3 20 72  25 3d 30 20 b8 20 32 0d  |...... r%=0 . 2.|
00000410  02 a8 18 78 78 25 3d 78  28 72 25 29 2d 28 73 69  |...xx%=x(r%)-(si|
00000420  7a 65 25 3e 3e 31 29 0d  02 b2 21 70 78 25 28 72  |ze%>>1)...!px%(r|
00000430  25 29 3d 78 78 25 2a 31  30 32 34 20 81 20 28 7a  |%)=xx%*1024 . (z|
00000440  28 72 25 29 2b 33 32 29  0d 02 bc 28 70 79 25 28  |(r%)+32)...(py%(|
00000450  72 25 29 3d 28 79 28 72  25 29 2d 31 30 32 34 29  |r%)=(y(r%)-1024)|
00000460  2a 33 32 20 81 20 28 7a  28 72 25 29 2b 33 32 29  |*32 . (z(r%)+32)|
00000470  0d 02 c6 05 ed 0d 02 d0  04 0d 02 da 12 f2 6e 6f  |..............no|
00000480  72 6d 61 6c 28 32 2c 31  2c 30 29 0d 02 e4 13 ec  |rmal(2,1,0).....|
00000490  20 70 78 25 28 30 29 2c  70 79 25 28 30 29 0d 02  | px%(0),py%(0)..|
000004a0  ee 13 ec 20 70 78 25 28  31 29 2c 70 79 25 28 31  |... px%(1),py%(1|
000004b0  29 0d 02 f8 15 f0 38 35  2c 70 78 25 28 32 29 2c  |).....85,px%(2),|
000004c0  70 79 25 28 32 29 0d 03  02 04 0d 03 0c 0b 78 28  |py%(2)........x(|
000004d0  30 29 3d 78 25 0d 03 16  23 79 28 30 29 3d 6f 68  |0)=x%...#y(0)=oh|
000004e0  25 21 28 28 78 25 2b 28  28 7a 25 2d 31 29 3c 3c  |%!((x%+((z%-1)<<|
000004f0  73 25 29 29 3c 3c 32 29  0d 03 20 0d 7a 28 30 29  |s%))<<2).. .z(0)|
00000500  3d 7a 25 2d 31 0d 03 2a  04 0d 03 34 17 78 78 25  |=z%-1..*...4.xx%|
00000510  3d 78 28 30 29 2d 28 73  69 7a 65 25 3e 3e 31 29  |=x(0)-(size%>>1)|
00000520  0d 03 3e 1f 70 78 25 28  30 29 3d 78 78 25 2a 31  |..>.px%(0)=xx%*1|
00000530  30 32 34 20 81 20 28 7a  28 30 29 2b 33 32 29 0d  |024 . (z(0)+32).|
00000540  03 48 25 70 79 25 28 30  29 3d 28 79 28 30 29 2d  |.H%py%(0)=(y(0)-|
00000550  31 30 32 34 29 2a 33 32  20 81 20 28 7a 28 30 29  |1024)*32 . (z(0)|
00000560  2b 33 32 29 0d 03 52 04  0d 03 5c 12 f2 6e 6f 72  |+32)..R...\..nor|
00000570  6d 61 6c 28 30 2c 31 2c  32 29 0d 03 66 13 ec 20  |mal(0,1,2)..f.. |
00000580  70 78 25 28 30 29 2c 70  79 25 28 30 29 0d 03 70  |px%(0),py%(0)..p|
00000590  13 ec 20 70 78 25 28 31  29 2c 70 79 25 28 31 29  |.. px%(1),py%(1)|
000005a0  0d 03 7a 15 f0 38 35 2c  70 78 25 28 32 29 2c 70  |..z..85,px%(2),p|
000005b0  79 25 28 32 29 0d 03 84  05 ed 0d 03 8e 05 ed 0d  |y%(2)...........|
000005c0  03 98 05 e1 0d 03 a2 04  0d 03 ac 16 dd f2 6e 6f  |..............no|
000005d0  72 6d 61 6c 28 61 25 2c  62 25 2c 63 25 29 0d 03  |rmal(a%,b%,c%)..|
000005e0  b6 42 6e 7a 3d 28 28 78  28 61 25 29 2d 78 28 62  |.Bnz=((x(a%)-x(b|
000005f0  25 29 29 2a 28 79 28 61  25 29 2d 79 28 63 25 29  |%))*(y(a%)-y(c%)|
00000600  29 29 2d 28 28 79 28 61  25 29 2d 79 28 62 25 29  |))-((y(a%)-y(b%)|
00000610  29 2a 28 78 28 61 25 29  2d 78 28 63 25 29 29 29  |)*(x(a%)-x(c%)))|
00000620  0d 03 c0 42 6e 78 3d 28  28 79 28 61 25 29 2d 79  |...Bnx=((y(a%)-y|
00000630  28 62 25 29 29 2a 28 7a  28 61 25 29 2d 7a 28 63  |(b%))*(z(a%)-z(c|
00000640  25 29 29 29 2d 28 28 7a  28 61 25 29 2d 7a 28 62  |%)))-((z(a%)-z(b|
00000650  25 29 29 2a 28 79 28 61  25 29 2d 79 28 63 25 29  |%))*(y(a%)-y(c%)|
00000660  29 29 0d 03 ca 42 6e 79  3d 28 28 7a 28 61 25 29  |))...Bny=((z(a%)|
00000670  2d 7a 28 62 25 29 29 2a  28 78 28 61 25 29 2d 78  |-z(b%))*(x(a%)-x|
00000680  28 63 25 29 29 29 2d 28  28 78 28 61 25 29 2d 78  |(c%)))-((x(a%)-x|
00000690  28 62 25 29 29 2a 28 7a  28 61 25 29 2d 7a 28 63  |(b%))*(z(a%)-z(c|
000006a0  25 29 29 29 0d 03 d4 1f  6e 6f 72 6d 61 6c 3d b6  |%)))....normal=.|
000006b0  28 6e 78 2a 6e 78 2b 6e  79 2a 6e 79 2b 6e 7a 2a  |(nx*nx+ny*ny+nz*|
000006c0  6e 7a 29 0d 03 de 10 6e  78 3d 6e 78 2f 6e 6f 72  |nz)....nx=nx/nor|
000006d0  6d 61 6c 0d 03 e8 10 6e  79 3d 6e 79 2f 6e 6f 72  |mal....ny=ny/nor|
000006e0  6d 61 6c 0d 03 f2 10 6e  7a 3d 6e 7a 2f 6e 6f 72  |mal....nz=nz/nor|
000006f0  6d 61 6c 0d 03 fc 1e 63  6f 6c 3d 28 6e 78 2a 6c  |mal....col=(nx*l|
00000700  78 2b 6e 79 2a 6c 79 2b  94 28 6e 7a 2a 6c 7a 29  |x+ny*ly+.(nz*lz)|
00000710  29 0d 04 06 1e 68 25 3d  28 79 28 61 25 29 2b 79  |)....h%=(y(a%)+y|
00000720  28 62 25 29 2b 79 28 63  25 29 29 20 81 20 33 0d  |(b%)+y(c%)) . 3.|
00000730  04 10 10 63 6f 6c 3d 63  6f 6c 2f 32 2b 2e 35 0d  |...col=col/2+.5.|
00000740  04 1a 12 68 25 3d 28 68  25 2b 32 35 36 29 3e 3e  |...h%=(h%+256)>>|
00000750  31 0d 04 24 0f e7 20 68  25 3c 30 20 68 25 3d 30  |1..$.. h%<0 h%=0|
00000760  0d 04 2e 13 e7 20 68 25  3e 32 35 35 20 68 25 3d  |..... h%>255 h%=|
00000770  32 35 35 0d 04 38 12 72  65 25 3d 72 25 28 68 25  |255..8.re%=r%(h%|
00000780  29 2a 63 6f 6c 0d 04 42  12 67 72 25 3d 67 25 28  |)*col..B.gr%=g%(|
00000790  68 25 29 2a 63 6f 6c 0d  04 4c 12 62 6c 25 3d 62  |h%)*col..L.bl%=b|
000007a0  25 28 68 25 29 2a 63 6f  6c 0d 04 56 16 64 65 70  |%(h%)*col..V.dep|
000007b0  74 68 3d 31 2d 28 7a 25  2f 73 69 7a 65 25 29 0d  |th=1-(z%/size%).|
000007c0  04 60 1a e7 20 64 65 70  74 68 3e 30 20 64 65 70  |.`.. depth>0 dep|
000007d0  74 68 3d b6 64 65 70 74  68 0d 04 6a 17 72 65 25  |th=.depth..j.re%|
000007e0  3d 28 32 35 35 2d 72 65  25 29 2a 64 65 70 74 68  |=(255-re%)*depth|
000007f0  0d 04 74 17 67 72 25 3d  28 32 35 35 2d 67 72 25  |..t.gr%=(255-gr%|
00000800  29 2a 64 65 70 74 68 0d  04 7e 17 62 6c 25 3d 28  |)*depth..~.bl%=(|
00000810  32 35 35 2d 62 6c 25 29  2a 64 65 70 74 68 0d 04  |255-bl%)*depth..|
00000820  88 0f 72 65 25 3d 32 35  35 2d 72 65 25 0d 04 92  |..re%=255-re%...|
00000830  0f 67 72 25 3d 32 35 35  2d 67 72 25 0d 04 9c 0f  |.gr%=255-gr%....|
00000840  62 6c 25 3d 32 35 35 2d  62 6c 25 0d 04 a6 04 0d  |bl%=255-bl%.....|
00000850  04 b0 28 63 6f 6c 6f 75  72 25 3d 28 72 65 25 3c  |..(colour%=(re%<|
00000860  3c 38 29 2b 28 67 72 25  3c 3c 31 36 29 2b 28 62  |<8)+(gr%<<16)+(b|
00000870  6c 25 3c 3c 32 34 29 0d  04 ba 2a c8 99 20 22 43  |l%<<24)...*.. "C|
00000880  6f 6c 6f 75 72 54 72 61  6e 73 5f 53 65 74 47 43  |olourTrans_SetGC|
00000890  4f 4c 22 2c 63 6f 6c 6f  75 72 25 2c 2c 2c 32 35  |OL",colour%,,,25|
000008a0  36 0d 04 c4 05 e1 0d 04  ce 04 0d 04 d8 0d dd f2  |6...............|
000008b0  70 61 6c 65 74 74 65 0d  04 e2 0c 72 25 28 29 3d  |palette....r%()=|
000008c0  32 35 35 0d 04 ec 0c 67  25 28 29 3d 32 35 35 0d  |255....g%()=255.|
000008d0  04 f6 0c 62 25 28 29 3d  32 35 35 0d 05 00 11 e3  |...b%()=255.....|
000008e0  20 72 65 70 25 3d 30 20  b8 20 33 31 0d 05 0a 0e  | rep%=0 . 31....|
000008f0  72 25 28 72 65 70 25 29  3d 30 0d 05 14 13 67 25  |r%(rep%)=0....g%|
00000900  28 72 65 70 25 29 3d 72  65 70 25 2a 34 0d 05 1e  |(rep%)=rep%*4...|
00000910  10 62 25 28 72 65 70 25  29 3d 32 35 35 0d 05 28  |.b%(rep%)=255..(|
00000920  05 ed 0d 05 32 11 e3 20  72 65 70 25 3d 30 20 b8  |....2.. rep%=0 .|
00000930  20 33 31 0d 05 3c 11 72  25 28 72 65 70 25 2b 33  | 31..<.r%(rep%+3|
00000940  32 29 3d 30 0d 05 46 1a  67 25 28 72 65 70 25 2b  |2)=0..F.g%(rep%+|
00000950  33 32 29 3d 31 32 38 2d  72 65 70 25 2a 32 0d 05  |32)=128-rep%*2..|
00000960  50 13 62 25 28 72 65 70  25 2b 33 32 29 3d 32 35  |P.b%(rep%+32)=25|
00000970  35 0d 05 5a 05 ed 0d 05  64 04 0d 05 6e 11 e3 20  |5..Z....d...n.. |
00000980  72 65 70 25 3d 30 20 b8  20 33 31 0d 05 78 13 72  |rep%=0 . 31..x.r|
00000990  25 28 72 65 70 25 2b 36  34 29 3d 32 35 35 0d 05  |%(rep%+64)=255..|
000009a0  82 1a 67 25 28 72 65 70  25 2b 36 34 29 3d 32 35  |..g%(rep%+64)=25|
000009b0  35 2d 72 65 70 25 2a 33  0d 05 8c 11 62 25 28 72  |5-rep%*3....b%(r|
000009c0  65 70 25 2b 36 34 29 3d  30 0d 05 96 05 ed 0d 05  |ep%+64)=0.......|
000009d0  a0 04 0d 05 aa 11 e3 20  72 65 70 25 3d 30 20 b8  |....... rep%=0 .|
000009e0  20 36 33 0d 05 b4 1c 72  25 28 72 65 70 25 2b 39  | 63....r%(rep%+9|
000009f0  36 29 3d 32 35 35 2d 28  72 65 70 25 2a 34 29 0d  |6)=255-(rep%*4).|
00000a00  05 be 1a 67 25 28 72 65  70 25 2b 39 36 29 3d 31  |...g%(rep%+96)=1|
00000a10  36 31 2d 72 65 70 25 2f  32 0d 05 c8 11 62 25 28  |61-rep%/2....b%(|
00000a20  72 65 70 25 2b 39 36 29  3d 30 0d 05 d2 05 ed 0d  |rep%+96)=0......|
00000a30  05 dc 04 0d 05 e6 04 0d  05 f0 11 e3 20 72 65 70  |............ rep|
00000a40  25 3d 30 20 b8 20 33 31  0d 05 fa 12 72 25 28 72  |%=0 . 31....r%(r|
00000a50  65 70 25 2b 31 36 30 29  3d 30 0d 06 04 1b 67 25  |ep%+160)=0....g%|
00000a60  28 72 65 70 25 2b 31 36  30 29 3d 31 32 38 2b 72  |(rep%+160)=128+r|
00000a70  65 70 25 2a 34 0d 06 0e  12 62 25 28 72 65 70 25  |ep%*4....b%(rep%|
00000a80  2b 31 36 30 29 3d 30 0d  06 18 05 ed 0d 06 22 04  |+160)=0.......".|
00000a90  0d 06 2c 11 e3 20 72 65  70 25 3d 30 20 b8 20 33  |..,.. rep%=0 . 3|
00000aa0  31 0d 06 36 17 72 25 28  72 65 70 25 2b 31 39 32  |1..6.r%(rep%+192|
00000ab0  29 3d 72 65 70 25 2a 38  0d 06 40 14 67 25 28 72  |)=rep%*8..@.g%(r|
00000ac0  65 70 25 2b 31 39 32 29  3d 32 35 35 0d 06 4a 17  |ep%+192)=255..J.|
00000ad0  62 25 28 72 65 70 25 2b  31 39 32 29 3d 72 65 70  |b%(rep%+192)=rep|
00000ae0  25 2a 38 0d 06 54 05 ed  0d 06 5e 05 e1 0d 06 68  |%*8..T....^....h|
00000af0  0e dd f2 61 73 73 65 6d  62 6c 65 0d 06 72 07 72  |...assemble..r.r|
00000b00  3d 30 0d 06 7c 0b 6f 68  61 64 72 3d 31 0d 06 86  |=0..|.ohadr=1...|
00000b10  0a 68 61 64 72 3d 32 0d  06 90 0d 6d 61 73 6b 61  |.hadr=2....maska|
00000b20  64 72 3d 33 0d 06 9a 07  61 3d 34 0d 06 a4 07 62  |dr=3....a=4....b|
00000b30  3d 35 0d 06 ae 07 63 3d  36 0d 06 b8 07 64 3d 37  |=5....c=6....d=7|
00000b40  0d 06 c2 07 78 3d 38 0d  06 cc 07 79 3d 39 0d 06  |....x=8....y=9..|
00000b50  d6 0b 73 74 65 70 3d 31  30 0d 06 e0 0d 68 65 69  |..step=10....hei|
00000b60  67 68 74 3d 31 31 0d 06  ea 0b 73 69 7a 65 3d 31  |ght=11....size=1|
00000b70  32 0d 06 f4 04 0d 06 fe  15 e3 20 70 61 73 73 25  |2......... pass%|
00000b80  3d 30 20 b8 20 32 20 88  20 32 0d 07 08 0c 50 25  |=0 . 2 . 2....P%|
00000b90  3d 70 72 6f 67 25 0d 07  12 0e 5b 4f 50 54 20 70  |=prog%....[OPT p|
00000ba0  61 73 73 25 0d 07 1c 15  20 53 54 4d 46 44 20 52  |ass%.... STMFD R|
00000bb0  31 33 21 2c 7b 52 31 34  7d 0d 07 26 04 0d 07 30  |13!,{R14}..&...0|
00000bc0  11 20 4c 44 52 20 72 2c  73 69 7a 65 61 74 0d 07  |. LDR r,sizeat..|
00000bd0  3a 17 20 4c 44 52 20 6d  61 73 6b 61 64 72 2c 6d  |:. LDR maskadr,m|
00000be0  61 73 6b 61 74 0d 07 44  11 20 4c 44 52 20 68 61  |askat..D. LDR ha|
00000bf0  64 72 2c 68 61 74 0d 07  4e 13 20 4c 44 52 20 6f  |dr,hat..N. LDR o|
00000c00  68 61 64 72 2c 6f 68 61  74 0d 07 58 14 20 4d 4f  |hadr,ohat..X. MO|
00000c10  56 20 73 69 7a 65 2c 23  73 69 7a 65 25 0d 07 62  |V size,#size%..b|
00000c20  04 0d 07 6c 1a 3b 20 63  6c 65 61 72 20 61 6c 6c  |...l.; clear all|
00000c30  20 74 68 65 20 61 72 72  61 79 73 0d 07 76 04 0d  | the arrays..v..|
00000c40  07 80 0d 20 4d 4f 56 20  61 2c 23 30 0d 07 8a 0e  |... MOV a,#0....|
00000c50  2e 63 6c 65 61 72 6c 6f  6f 70 0d 07 94 1d 20 53  |.clearloop.... S|
00000c60  54 52 42 20 61 2c 5b 6d  61 73 6b 61 64 72 2c 72  |TRB a,[maskadr,r|
00000c70  2c 4c 53 52 23 32 5d 0d  07 9e 14 20 53 54 52 20  |,LSR#2].... STR |
00000c80  61 2c 5b 6f 68 61 64 72  2c 72 5d 0d 07 a8 13 20  |a,[ohadr,r].... |
00000c90  53 54 52 20 61 2c 5b 68  61 64 72 2c 72 5d 0d 07  |STR a,[hadr,r]..|
00000ca0  b2 10 20 53 55 42 53 20  72 2c 72 2c 23 34 0d 07  |.. SUBS r,r,#4..|
00000cb0  bc 11 42 4e 45 20 63 6c  65 61 72 6c 6f 6f 70 0d  |..BNE clearloop.|
00000cc0  07 c6 04 0d 07 d0 21 3b  20 69 6e 69 74 69 61 6c  |......!; initial|
00000cd0  69 73 65 20 74 68 65 20  66 6f 75 72 20 63 6f 72  |ise the four cor|
00000ce0  6e 65 72 73 0d 07 da 04  0d 07 e4 10 20 4d 4f 56  |ners........ MOV|
00000cf0  20 73 74 65 70 2c 23 31  0d 07 ee 1e 20 a4 72 6e  | step,#1.... .rn|
00000d00  64 28 62 2c 63 2c 61 2c  31 36 2a 72 6f 75 67 68  |d(b,c,a,16*rough|
00000d10  6e 65 73 73 25 29 0d 07  f8 11 20 53 54 52 20 61  |ness%).... STR a|
00000d20  2c 5b 68 61 64 72 5d 0d  08 02 12 20 53 54 52 20  |,[hadr].... STR |
00000d30  61 2c 5b 6f 68 61 64 72  5d 0d 08 0c 1e 20 a4 72  |a,[ohadr].... .r|
00000d40  6e 64 28 62 2c 63 2c 61  2c 31 36 2a 72 6f 75 67  |nd(b,c,a,16*roug|
00000d50  68 6e 65 73 73 25 29 0d  08 16 1c 20 53 54 52 20  |hness%).... STR |
00000d60  61 2c 5b 68 61 64 72 2c  73 69 7a 65 2c 4c 53 4c  |a,[hadr,size,LSL|
00000d70  23 32 5d 0d 08 20 1d 20  53 54 52 20 61 2c 5b 6f  |#2].. . STR a,[o|
00000d80  68 61 64 72 2c 73 69 7a  65 2c 4c 53 4c 23 32 5d  |hadr,size,LSL#2]|
00000d90  0d 08 2a 1e 20 a4 72 6e  64 28 62 2c 63 2c 61 2c  |..*. .rnd(b,c,a,|
00000da0  31 36 2a 72 6f 75 67 68  6e 65 73 73 25 29 0d 08  |16*roughness%)..|
00000db0  34 1f 20 53 54 52 20 61  2c 5b 68 61 64 72 2c 73  |4. STR a,[hadr,s|
00000dc0  69 7a 65 2c 4c 53 4c 23  32 2b 73 25 5d 0d 08 3e  |ize,LSL#2+s%]..>|
00000dd0  20 20 53 54 52 20 61 2c  5b 6f 68 61 64 72 2c 73  |  STR a,[ohadr,s|
00000de0  69 7a 65 2c 4c 53 4c 23  32 2b 73 25 5d 0d 08 48  |ize,LSL#2+s%]..H|
00000df0  1e 20 a4 72 6e 64 28 62  2c 63 2c 61 2c 31 36 2a  |. .rnd(b,c,a,16*|
00000e00  72 6f 75 67 68 6e 65 73  73 25 29 0d 08 52 1b 20  |roughness%)..R. |
00000e10  41 44 44 20 64 2c 73 69  7a 65 2c 73 69 7a 65 2c  |ADD d,size,size,|
00000e20  4c 53 4c 23 73 25 0d 08  5c 19 20 53 54 52 20 61  |LSL#s%..\. STR a|
00000e30  2c 5b 68 61 64 72 2c 64  2c 4c 53 4c 23 32 5d 0d  |,[hadr,d,LSL#2].|
00000e40  08 66 1a 20 53 54 52 20  61 2c 5b 6f 68 61 64 72  |.f. STR a,[ohadr|
00000e50  2c 64 2c 4c 53 4c 23 32  5d 0d 08 70 04 0d 08 7a  |,d,LSL#2]..p...z|
00000e60  0d 20 4d 4f 56 20 61 2c  23 32 0d 08 84 15 20 53  |. MOV a,#2.... S|
00000e70  54 52 42 20 61 2c 5b 6d  61 73 6b 61 64 72 5d 0d  |TRB a,[maskadr].|
00000e80  08 8e 1a 20 53 54 52 42  20 61 2c 5b 6d 61 73 6b  |... STRB a,[mask|
00000e90  61 64 72 2c 73 69 7a 65  5d 0d 08 98 21 20 53 54  |adr,size]...! ST|
00000ea0  52 42 20 61 2c 5b 6d 61  73 6b 61 64 72 2c 73 69  |RB a,[maskadr,si|
00000eb0  7a 65 2c 4c 53 4c 23 73  25 5d 0d 08 a2 17 20 53  |ze,LSL#s%].... S|
00000ec0  54 52 42 20 61 2c 5b 6d  61 73 6b 61 64 72 2c 64  |TRB a,[maskadr,d|
00000ed0  5d 0d 08 ac 04 0d 08 b6  18 3b 20 72 69 67 68 74  |]........; right|
00000ee0  2c 20 6c 65 74 73 20 64  6f 20 69 74 21 0d 08 c0  |, lets do it!...|
00000ef0  17 20 4d 4f 56 20 73 74  65 70 2c 23 73 69 7a 65  |. MOV step,#size|
00000f00  25 3e 3e 31 0d 08 ca 0f  2e 72 65 70 65 61 74 6c  |%>>1.....repeatl|
00000f10  6f 6f 70 0d 08 d4 0f 20  4d 4f 56 20 79 2c 73 74  |oop.... MOV y,st|
00000f20  65 70 0d 08 de 0a 2e 79  6c 6f 6f 70 0d 08 e8 0f  |ep.....yloop....|
00000f30  20 4d 4f 56 20 78 2c 73  74 65 70 0d 08 f2 0a 2e  | MOV x,step.....|
00000f40  78 6c 6f 6f 70 0d 08 fc  04 0d 09 06 38 3b 20 61  |xloop.......8; a|
00000f50  2c 62 2c 63 2c 64 20 61  72 65 20 74 68 65 20 68  |,b,c,d are the h|
00000f60  65 69 67 68 74 73 20 63  6f 72 6e 65 72 73 20 6f  |eights corners o|
00000f70  66 20 74 68 65 20 73 71  75 61 72 65 20 74 68 61  |f the square tha|
00000f80  74 0d 09 10 2e 3b 20 74  68 65 20 6c 61 6e 64 73  |t....; the lands|
00000f90  63 61 70 69 6e 67 20 72  6f 75 74 69 6e 65 20 69  |caping routine i|
00000fa0  73 20 77 6f 72 6b 69 6e  67 20 6f 6e 2e 2e 2e 0d  |s working on....|
00000fb0  09 1a 05 3b 0d 09 24 0b  3b 20 62 20 20 20 61 0d  |...;..$.; b   a.|
00000fc0  09 2e 05 3b 0d 09 38 05  3b 0d 09 42 0b 3b 20 64  |...;..8.;..B.; d|
00000fd0  20 20 20 63 0d 09 4c 04  0d 09 56 11 20 41 44 44  |   c..L...V. ADD|
00000fe0  20 61 2c 79 2c 73 74 65  70 0d 09 60 15 20 41 44  | a,y,step..`. AD|
00000ff0  44 20 61 2c 78 2c 61 2c  4c 53 4c 23 73 25 0d 09  |D a,x,a,LSL#s%..|
00001000  6a 11 20 41 44 44 20 61  2c 61 2c 73 74 65 70 0d  |j. ADD a,a,step.|
00001010  09 74 1a 20 4c 44 52 20  61 2c 5b 6f 68 61 64 72  |.t. LDR a,[ohadr|
00001020  2c 61 2c 4c 53 4c 23 32  5d 0d 09 7e 05 20 0d 09  |,a,LSL#2]..~. ..|
00001030  88 11 20 41 44 44 20 62  2c 79 2c 73 74 65 70 0d  |.. ADD b,y,step.|
00001040  09 92 15 20 41 44 44 20  62 2c 78 2c 62 2c 4c 53  |... ADD b,x,b,LS|
00001050  4c 23 73 25 0d 09 9c 11  20 53 55 42 20 62 2c 62  |L#s%.... SUB b,b|
00001060  2c 73 74 65 70 0d 09 a6  1a 20 4c 44 52 20 62 2c  |,step.... LDR b,|
00001070  5b 6f 68 61 64 72 2c 62  2c 4c 53 4c 23 32 5d 0d  |[ohadr,b,LSL#2].|
00001080  09 b0 05 20 0d 09 ba 11  20 53 55 42 20 63 2c 79  |... .... SUB c,y|
00001090  2c 73 74 65 70 0d 09 c4  15 20 41 44 44 20 63 2c  |,step.... ADD c,|
000010a0  78 2c 63 2c 4c 53 4c 23  73 25 0d 09 ce 11 20 41  |x,c,LSL#s%.... A|
000010b0  44 44 20 63 2c 63 2c 73  74 65 70 0d 09 d8 1a 20  |DD c,c,step.... |
000010c0  4c 44 52 20 63 2c 5b 6f  68 61 64 72 2c 63 2c 4c  |LDR c,[ohadr,c,L|
000010d0  53 4c 23 32 5d 0d 09 e2  05 20 0d 09 ec 11 20 53  |SL#2].... .... S|
000010e0  55 42 20 64 2c 79 2c 73  74 65 70 0d 09 f6 15 20  |UB d,y,step.... |
000010f0  41 44 44 20 64 2c 78 2c  64 2c 4c 53 4c 23 73 25  |ADD d,x,d,LSL#s%|
00001100  0d 0a 00 11 20 53 55 42  20 64 2c 64 2c 73 74 65  |.... SUB d,d,ste|
00001110  70 0d 0a 0a 1a 20 4c 44  52 20 64 2c 5b 6f 68 61  |p.... LDR d,[oha|
00001120  64 72 2c 64 2c 4c 53 4c  23 32 5d 0d 0a 14 04 0d  |dr,d,LSL#2].....|
00001130  0a 1e 23 3b 20 6e 6f 77  20 77 65 20 64 69 66 69  |..#; now we difi|
00001140  6e 65 20 74 68 65 73 65  20 70 6f 69 6e 74 73 2e  |ne these points.|
00001150  2e 2e 0d 0a 28 05 3b 0d  0a 32 0b 3b 20 62 20 78  |....(.;..2.; b x|
00001160  20 61 0d 0a 3c 0b 3b 20  78 20 79 20 78 0d 0a 46  | a..<.; x y x..F|
00001170  0b 3b 20 64 20 78 20 63  0d 0a 50 05 3b 0d 0a 5a  |.; d x c..P.;..Z|
00001180  2d 3b 20 74 68 65 20 79  20 69 73 20 6d 6f 76 65  |-; the y is move|
00001190  64 20 74 77 69 63 65 20  61 73 20 6d 75 63 68 20  |d twice as much |
000011a0  61 73 20 74 68 65 20 78  27 73 0d 0a 64 04 0d 0a  |as the x's..d...|
000011b0  6e 17 20 41 44 44 20 52  31 34 2c 78 2c 79 2c 4c  |n. ADD R14,x,y,L|
000011c0  53 4c 23 73 25 0d 0a 78  19 20 4c 44 52 42 20 72  |SL#s%..x. LDRB r|
000011d0  2c 5b 6d 61 73 6b 61 64  72 2c 52 31 34 5d 0d 0a  |,[maskadr,R14]..|
000011e0  82 0d 20 43 4d 50 20 72  2c 23 30 0d 0a 8c 12 42  |.. CMP r,#0....B|
000011f0  4e 45 20 73 6b 69 70 63  65 6e 74 72 65 0d 0a 96  |NE skipcentre...|
00001200  04 0d 0a a0 13 20 41 44  44 20 68 65 69 67 68 74  |..... ADD height|
00001210  2c 61 2c 62 0d 0a aa 18  20 41 44 44 20 68 65 69  |,a,b.... ADD hei|
00001220  67 68 74 2c 68 65 69 67  68 74 2c 63 0d 0a b4 18  |ght,height,c....|
00001230  20 41 44 44 20 68 65 69  67 68 74 2c 68 65 69 67  | ADD height,heig|
00001240  68 74 2c 64 0d 0a be 1c  20 4d 4f 56 20 68 65 69  |ht,d.... MOV hei|
00001250  67 68 74 2c 68 65 69 67  68 74 2c 41 53 52 23 32  |ght,height,ASR#2|
00001260  0d 0a c8 1d 20 a4 72 6e  64 28 61 2c 62 2c 72 2c  |.... .rnd(a,b,r,|
00001270  32 2a 72 6f 75 67 68 6e  65 73 73 25 29 0d 0a d2  |2*roughness%)...|
00001280  18 20 41 44 44 20 68 65  69 67 68 74 2c 68 65 69  |. ADD height,hei|
00001290  67 68 74 2c 72 0d 0a dc  20 20 53 54 52 20 68 65  |ght,r...  STR he|
000012a0  69 67 68 74 2c 5b 68 61  64 72 2c 52 31 34 2c 4c  |ight,[hadr,R14,L|
000012b0  53 4c 23 32 5d 0d 0a e6  0d 20 4d 4f 56 20 72 2c  |SL#2].... MOV r,|
000012c0  23 31 0d 0a f0 19 20 53  54 52 42 20 72 2c 5b 6d  |#1.... STRB r,[m|
000012d0  61 73 6b 61 64 72 2c 52  31 34 5d 0d 0a fa 0f 2e  |askadr,R14].....|
000012e0  73 6b 69 70 63 65 6e 74  72 65 0d 0b 04 05 20 0d  |skipcentre.... .|
000012f0  0b 0e 17 20 41 44 44 20  52 31 34 2c 78 2c 79 2c  |... ADD R14,x,y,|
00001300  4c 53 4c 23 73 25 0d 0b  18 1c 20 53 55 42 20 52  |LSL#s%.... SUB R|
00001310  31 34 2c 52 31 34 2c 73  74 65 70 2c 4c 53 4c 23  |14,R14,step,LSL#|
00001320  73 25 0d 0b 22 19 20 4c  44 52 42 20 72 2c 5b 6d  |s%..". LDRB r,[m|
00001330  61 73 6b 61 64 72 2c 52  31 34 5d 0d 0b 2c 0d 20  |askadr,R14]..,. |
00001340  43 4d 50 20 72 2c 23 30  0d 0b 36 12 42 4e 45 20  |CMP r,#0..6.BNE |
00001350  73 6b 69 70 62 6f 74 74  6f 6d 0d 0b 40 04 0d 0b  |skipbottom..@...|
00001360  4a 13 20 41 44 44 20 68  65 69 67 68 74 2c 63 2c  |J. ADD height,c,|
00001370  64 0d 0b 54 1c 20 4d 4f  56 20 68 65 69 67 68 74  |d..T. MOV height|
00001380  2c 68 65 69 67 68 74 2c  41 53 52 23 31 0d 0b 5e  |,height,ASR#1..^|
00001390  1b 20 a4 72 6e 64 28 61  2c 62 2c 72 2c 72 6f 75  |. .rnd(a,b,r,rou|
000013a0  67 68 6e 65 73 73 25 29  0d 0b 68 18 20 41 44 44  |ghness%)..h. ADD|
000013b0  20 68 65 69 67 68 74 2c  68 65 69 67 68 74 2c 72  | height,height,r|
000013c0  0d 0b 72 20 20 53 54 52  20 68 65 69 67 68 74 2c  |..r  STR height,|
000013d0  5b 68 61 64 72 2c 52 31  34 2c 4c 53 4c 23 32 5d  |[hadr,R14,LSL#2]|
000013e0  0d 0b 7c 0d 20 4d 4f 56  20 72 2c 23 31 0d 0b 86  |..|. MOV r,#1...|
000013f0  19 20 53 54 52 42 20 72  2c 5b 6d 61 73 6b 61 64  |. STRB r,[maskad|
00001400  72 2c 52 31 34 5d 0d 0b  90 0f 2e 73 6b 69 70 62  |r,R14].....skipb|
00001410  6f 74 74 6f 6d 0d 0b 9a  05 20 0d 0b a4 17 20 41  |ottom.... .... A|
00001420  44 44 20 52 31 34 2c 78  2c 79 2c 4c 53 4c 23 73  |DD R14,x,y,LSL#s|
00001430  25 0d 0b ae 15 20 53 55  42 20 52 31 34 2c 52 31  |%.... SUB R14,R1|
00001440  34 2c 73 74 65 70 0d 0b  b8 19 20 4c 44 52 42 20  |4,step.... LDRB |
00001450  72 2c 5b 6d 61 73 6b 61  64 72 2c 52 31 34 5d 0d  |r,[maskadr,R14].|
00001460  0b c2 0d 20 43 4d 50 20  72 2c 23 30 0d 0b cc 10  |... CMP r,#0....|
00001470  42 4e 45 20 73 6b 69 70  6c 65 66 74 0d 0b d6 04  |BNE skipleft....|
00001480  0d 0b e0 13 20 41 44 44  20 68 65 69 67 68 74 2c  |.... ADD height,|
00001490  64 2c 62 0d 0b ea 1c 20  4d 4f 56 20 68 65 69 67  |d,b.... MOV heig|
000014a0  68 74 2c 68 65 69 67 68  74 2c 41 53 52 23 31 0d  |ht,height,ASR#1.|
000014b0  0b f4 1b 20 a4 72 6e 64  28 61 2c 62 2c 72 2c 72  |... .rnd(a,b,r,r|
000014c0  6f 75 67 68 6e 65 73 73  25 29 0d 0b fe 18 20 41  |oughness%).... A|
000014d0  44 44 20 68 65 69 67 68  74 2c 68 65 69 67 68 74  |DD height,height|
000014e0  2c 72 0d 0c 08 20 20 53  54 52 20 68 65 69 67 68  |,r...  STR heigh|
000014f0  74 2c 5b 68 61 64 72 2c  52 31 34 2c 4c 53 4c 23  |t,[hadr,R14,LSL#|
00001500  32 5d 0d 0c 12 0d 20 4d  4f 56 20 72 2c 23 31 0d  |2].... MOV r,#1.|
00001510  0c 1c 19 20 53 54 52 42  20 72 2c 5b 6d 61 73 6b  |... STRB r,[mask|
00001520  61 64 72 2c 52 31 34 5d  0d 0c 26 0d 2e 73 6b 69  |adr,R14]..&..ski|
00001530  70 6c 65 66 74 0d 0c 30  05 20 0d 0c 3a 05 20 0d  |pleft..0. ..:. .|
00001540  0c 44 17 20 41 44 44 20  52 31 34 2c 78 2c 79 2c  |.D. ADD R14,x,y,|
00001550  4c 53 4c 23 73 25 0d 0c  4e 15 20 41 44 44 20 52  |LSL#s%..N. ADD R|
00001560  31 34 2c 52 31 34 2c 73  74 65 70 0d 0c 58 1c 20  |14,R14,step..X. |
00001570  41 44 44 20 52 31 34 2c  52 31 34 2c 73 74 65 70  |ADD R14,R14,step|
00001580  2c 4c 53 4c 23 73 25 0d  0c 62 19 20 4c 44 52 42  |,LSL#s%..b. LDRB|
00001590  20 72 2c 5b 6d 61 73 6b  61 64 72 2c 52 31 34 5d  | r,[maskadr,R14]|
000015a0  0d 0c 6c 0d 20 43 4d 50  20 72 2c 23 30 0d 0c 76  |..l. CMP r,#0..v|
000015b0  0f 42 45 51 20 73 6b 69  70 74 6f 70 0d 0c 80 1b  |.BEQ skiptop....|
000015c0  20 53 55 42 20 52 31 34  2c 52 31 34 2c 73 74 65  | SUB R14,R14,ste|
000015d0  70 2c 4c 53 4c 23 31 0d  0c 8a 19 20 4c 44 52 42  |p,LSL#1.... LDRB|
000015e0  20 72 2c 5b 6d 61 73 6b  61 64 72 2c 52 31 34 5d  | r,[maskadr,R14]|
000015f0  0d 0c 94 0d 20 43 4d 50  20 72 2c 23 30 0d 0c 9e  |.... CMP r,#0...|
00001600  0f 42 45 51 20 73 6b 69  70 74 6f 70 0d 0c a8 04  |.BEQ skiptop....|
00001610  0d 0c b2 17 20 41 44 44  20 52 31 34 2c 78 2c 79  |.... ADD R14,x,y|
00001620  2c 4c 53 4c 23 73 25 0d  0c bc 1c 20 41 44 44 20  |,LSL#s%.... ADD |
00001630  52 31 34 2c 52 31 34 2c  73 74 65 70 2c 4c 53 4c  |R14,R14,step,LSL|
00001640  23 73 25 0d 0c c6 05 20  0d 0c d0 13 20 41 44 44  |#s%.... .... ADD|
00001650  20 68 65 69 67 68 74 2c  62 2c 61 0d 0c da 1c 20  | height,b,a.... |
00001660  4d 4f 56 20 68 65 69 67  68 74 2c 68 65 69 67 68  |MOV height,heigh|
00001670  74 2c 41 53 52 23 31 0d  0c e4 1b 20 a4 72 6e 64  |t,ASR#1.... .rnd|
00001680  28 61 2c 62 2c 72 2c 72  6f 75 67 68 6e 65 73 73  |(a,b,r,roughness|
00001690  25 29 0d 0c ee 18 20 41  44 44 20 68 65 69 67 68  |%).... ADD heigh|
000016a0  74 2c 68 65 69 67 68 74  2c 72 0d 0c f8 20 20 53  |t,height,r...  S|
000016b0  54 52 20 68 65 69 67 68  74 2c 5b 68 61 64 72 2c  |TR height,[hadr,|
000016c0  52 31 34 2c 4c 53 4c 23  32 5d 0d 0d 02 0d 20 4d  |R14,LSL#2].... M|
000016d0  4f 56 20 72 2c 23 31 0d  0d 0c 19 20 53 54 52 42  |OV r,#1.... STRB|
000016e0  20 72 2c 5b 6d 61 73 6b  61 64 72 2c 52 31 34 5d  | r,[maskadr,R14]|
000016f0  0d 0d 16 0c 2e 73 6b 69  70 74 6f 70 0d 0d 20 04  |.....skiptop.. .|
00001700  0d 0d 2a 17 20 41 44 44  20 52 31 34 2c 78 2c 79  |..*. ADD R14,x,y|
00001710  2c 4c 53 4c 23 73 25 0d  0d 34 15 20 41 44 44 20  |,LSL#s%..4. ADD |
00001720  52 31 34 2c 52 31 34 2c  73 74 65 70 0d 0d 3e 1c  |R14,R14,step..>.|
00001730  20 53 55 42 20 52 31 34  2c 52 31 34 2c 73 74 65  | SUB R14,R14,ste|
00001740  70 2c 4c 53 4c 23 73 25  0d 0d 48 19 20 4c 44 52  |p,LSL#s%..H. LDR|
00001750  42 20 72 2c 5b 6d 61 73  6b 61 64 72 2c 52 31 34  |B r,[maskadr,R14|
00001760  5d 0d 0d 52 0d 20 43 4d  50 20 72 2c 23 30 0d 0d  |]..R. CMP r,#0..|
00001770  5c 11 42 45 51 20 73 6b  69 70 72 69 67 68 74 0d  |\.BEQ skipright.|
00001780  0d 66 1e 20 41 44 44 20  52 31 34 2c 52 31 34 2c  |.f. ADD R14,R14,|
00001790  73 74 65 70 2c 4c 53 4c  23 31 2b 73 25 0d 0d 70  |step,LSL#1+s%..p|
000017a0  19 20 4c 44 52 42 20 72  2c 5b 6d 61 73 6b 61 64  |. LDRB r,[maskad|
000017b0  72 2c 52 31 34 5d 0d 0d  7a 0d 20 43 4d 50 20 72  |r,R14]..z. CMP r|
000017c0  2c 23 30 0d 0d 84 11 42  45 51 20 73 6b 69 70 72  |,#0....BEQ skipr|
000017d0  69 67 68 74 0d 0d 8e 04  0d 0d 98 17 20 41 44 44  |ight........ ADD|
000017e0  20 52 31 34 2c 78 2c 79  2c 4c 53 4c 23 73 25 0d  | R14,x,y,LSL#s%.|
000017f0  0d a2 15 20 41 44 44 20  52 31 34 2c 52 31 34 2c  |... ADD R14,R14,|
00001800  73 74 65 70 0d 0d ac 05  20 0d 0d b6 13 20 41 44  |step.... .... AD|
00001810  44 20 68 65 69 67 68 74  2c 63 2c 61 0d 0d c0 1c  |D height,c,a....|
00001820  20 4d 4f 56 20 68 65 69  67 68 74 2c 68 65 69 67  | MOV height,heig|
00001830  68 74 2c 41 53 52 23 31  0d 0d ca 1b 20 a4 72 6e  |ht,ASR#1.... .rn|
00001840  64 28 61 2c 62 2c 72 2c  72 6f 75 67 68 6e 65 73  |d(a,b,r,roughnes|
00001850  73 25 29 0d 0d d4 18 20  41 44 44 20 68 65 69 67  |s%).... ADD heig|
00001860  68 74 2c 68 65 69 67 68  74 2c 72 0d 0d de 20 20  |ht,height,r...  |
00001870  53 54 52 20 68 65 69 67  68 74 2c 5b 68 61 64 72  |STR height,[hadr|
00001880  2c 52 31 34 2c 4c 53 4c  23 32 5d 0d 0d e8 0d 20  |,R14,LSL#2].... |
00001890  4d 4f 56 20 72 2c 23 31  0d 0d f2 19 20 53 54 52  |MOV r,#1.... STR|
000018a0  42 20 72 2c 5b 6d 61 73  6b 61 64 72 2c 52 31 34  |B r,[maskadr,R14|
000018b0  5d 0d 0d fc 0e 2e 73 6b  69 70 72 69 67 68 74 0d  |].....skipright.|
000018c0  0e 06 04 0d 0e 10 11 20  41 44 44 20 78 2c 78 2c  |....... ADD x,x,|
000018d0  73 74 65 70 0d 0e 1a 11  20 4d 4f 56 20 61 2c 23  |step.... MOV a,#|
000018e0  73 69 7a 65 25 0d 0e 24  11 20 53 55 42 20 61 2c  |size%..$. SUB a,|
000018f0  61 2c 73 74 65 70 0d 0e  2e 0c 20 43 4d 50 20 78  |a,step.... CMP x|
00001900  2c 61 0d 0e 38 0d 42 4c  45 20 78 6c 6f 6f 70 0d  |,a..8.BLE xloop.|
00001910  0e 42 11 20 41 44 44 20  79 2c 79 2c 73 74 65 70  |.B. ADD y,y,step|
00001920  0d 0e 4c 0c 20 43 4d 50  20 79 2c 61 0d 0e 56 0d  |..L. CMP y,a..V.|
00001930  42 4c 45 20 79 6c 6f 6f  70 0d 0e 60 04 0d 0e 6a  |BLE yloop..`...j|
00001940  36 3b 20 6e 6f 77 20 77  65 20 75 70 64 61 74 65  |6; now we update|
00001950  20 74 68 65 20 76 61 6c  75 65 73 20 69 6e 20 6f  | the values in o|
00001960  68 28 29 20 74 6f 20 74  68 6f 73 65 20 69 6e 20  |h() to those in |
00001970  68 28 29 0d 0e 74 04 0d  0e 7e 11 20 4c 44 52 20  |h()..t...~. LDR |
00001980  72 2c 73 69 7a 65 61 74  0d 0e 88 0b 2e 75 70 64  |r,sizeat.....upd|
00001990  61 74 65 0d 0e 92 13 20  4c 44 52 20 61 2c 5b 68  |ate.... LDR a,[h|
000019a0  61 64 72 2c 72 5d 0d 0e  9c 14 20 53 54 52 20 61  |adr,r].... STR a|
000019b0  2c 5b 6f 68 61 64 72 2c  72 5d 0d 0e a6 10 20 53  |,[ohadr,r].... S|
000019c0  55 42 53 20 72 2c 72 2c  23 34 0d 0e b0 0e 42 4e  |UBS r,r,#4....BN|
000019d0  45 20 75 70 64 61 74 65  0d 0e ba 04 0d 0e c4 18  |E update........|
000019e0  20 4d 4f 56 20 73 74 65  70 2c 73 74 65 70 2c 41  | MOV step,step,A|
000019f0  53 52 23 31 0d 0e ce 10  20 43 4d 50 20 73 74 65  |SR#1.... CMP ste|
00001a00  70 2c 23 30 0d 0e d8 12  42 47 54 20 72 65 70 65  |p,#0....BGT repe|
00001a10  61 74 6c 6f 6f 70 0d 0e  e2 04 0d 0e ec 10 20 4c  |atloop........ L|
00001a20  44 52 20 52 31 32 2c 68  61 74 0d 0e f6 11 20 4c  |DR R12,hat.... L|
00001a30  44 52 20 52 31 31 2c 6f  68 61 74 0d 0f 00 0e 20  |DR R11,ohat.... |
00001a40  4d 4f 56 20 52 31 2c 23  30 0d 0f 0a 0c 2e 73 6d  |MOV R1,#0.....sm|
00001a50  6f 6f 74 68 79 0d 0f 14  0e 20 4d 4f 56 20 52 30  |oothy.... MOV R0|
00001a60  2c 23 30 0d 0f 1e 0c 2e  73 6d 6f 6f 74 68 78 0d  |,#0.....smoothx.|
00001a70  0f 28 22 20 41 44 44 20  52 33 2c 52 30 2c 52 31  |.(" ADD R3,R0,R1|
00001a80  2c 4c 53 4c 23 64 69 76  69 73 69 6f 6e 73 25 2b  |,LSL#divisions%+|
00001a90  31 0d 0f 32 14 20 4c 44  52 20 52 34 2c 5b 52 31  |1..2. LDR R4,[R1|
00001aa0  32 2c 52 33 5d 0d 0f 3c  05 20 0d 0f 46 0e 20 43  |2,R3]..<. ..F. C|
00001ab0  4d 50 20 52 30 2c 23 30  0d 0f 50 0d 20 ec 51 20  |MP R0,#0..P. .Q |
00001ac0  52 35 2c 52 34 0d 0f 5a  0d 42 45 51 20 73 6c 65  |R5,R4..Z.BEQ sle|
00001ad0  66 74 0d 0f 64 11 20 53  55 42 20 52 33 2c 52 33  |ft..d. SUB R3,R3|
00001ae0  2c 23 34 0d 0f 6e 14 20  4c 44 52 20 52 35 2c 5b  |,#4..n. LDR R5,[|
00001af0  52 31 32 2c 52 33 5d 0d  0f 78 11 20 41 44 44 20  |R12,R3]..x. ADD |
00001b00  52 33 2c 52 33 2c 23 34  0d 0f 82 0a 2e 73 6c 65  |R3,R3,#4.....sle|
00001b10  66 74 0d 0f 8c 15 20 43  4d 50 20 52 30 2c 23 73  |ft.... CMP R0,#s|
00001b20  69 7a 65 25 3c 3c 32 0d  0f 96 0d 20 ec 51 20 52  |ize%<<2.... .Q R|
00001b30  36 2c 52 34 0d 0f a0 0e  42 45 51 20 73 72 69 67  |6,R4....BEQ srig|
00001b40  68 74 0d 0f aa 11 20 41  44 44 20 52 33 2c 52 33  |ht.... ADD R3,R3|
00001b50  2c 23 34 0d 0f b4 14 20  4c 44 52 20 52 36 2c 5b  |,#4.... LDR R6,[|
00001b60  52 31 32 2c 52 33 5d 0d  0f be 11 20 53 55 42 20  |R12,R3].... SUB |
00001b70  52 33 2c 52 33 2c 23 34  0d 0f c8 0b 2e 73 72 69  |R3,R3,#4.....sri|
00001b80  67 68 74 0d 0f d2 04 0d  0f dc 0e 20 43 4d 50 20  |ght........ CMP |
00001b90  52 31 2c 23 30 0d 0f e6  0d 20 ec 51 20 52 35 2c  |R1,#0.... .Q R5,|
00001ba0  52 34 0d 0f f0 0f 42 45  51 20 73 62 6f 74 74 6f  |R4....BEQ sbotto|
00001bb0  6d 0d 0f fa 19 20 53 55  42 20 52 33 2c 52 33 2c  |m.... SUB R3,R3,|
00001bc0  23 73 69 7a 65 79 25 3c  3c 32 0d 10 04 14 20 4c  |#sizey%<<2.... L|
00001bd0  44 52 20 52 37 2c 5b 52  31 32 2c 52 33 5d 0d 10  |DR R7,[R12,R3]..|
00001be0  0e 19 20 41 44 44 20 52  33 2c 52 33 2c 23 73 69  |.. ADD R3,R3,#si|
00001bf0  7a 65 79 25 3c 3c 32 0d  10 18 0c 2e 73 62 6f 74  |zey%<<2.....sbot|
00001c00  74 6f 6d 0d 10 22 15 20  43 4d 50 20 52 31 2c 23  |tom..". CMP R1,#|
00001c10  73 69 7a 65 25 3c 3c 32  0d 10 2c 0d 20 ec 51 20  |size%<<2..,. .Q |
00001c20  52 36 2c 52 34 0d 10 36  0c 42 45 51 20 73 74 6f  |R6,R4..6.BEQ sto|
00001c30  70 0d 10 40 19 20 41 44  44 20 52 33 2c 52 33 2c  |p..@. ADD R3,R3,|
00001c40  23 73 69 7a 65 79 25 3c  3c 32 0d 10 4a 14 20 4c  |#sizey%<<2..J. L|
00001c50  44 52 20 52 38 2c 5b 52  31 32 2c 52 33 5d 0d 10  |DR R8,[R12,R3]..|
00001c60  54 19 20 53 55 42 20 52  33 2c 52 33 2c 23 73 69  |T. SUB R3,R3,#si|
00001c70  7a 65 79 25 3c 3c 32 0d  10 5e 09 2e 73 74 6f 70  |zey%<<2..^..stop|
00001c80  0d 10 68 04 0d 10 72 17  20 41 44 44 20 52 34 2c  |..h...r. ADD R4,|
00001c90  52 35 2c 52 34 2c 4c 53  4c 23 32 0d 10 7c 11 20  |R5,R4,LSL#2..|. |
00001ca0  41 44 44 20 52 34 2c 52  34 2c 52 36 0d 10 86 11  |ADD R4,R4,R6....|
00001cb0  20 41 44 44 20 52 34 2c  52 34 2c 52 37 0d 10 90  | ADD R4,R4,R7...|
00001cc0  11 20 41 44 44 20 52 34  2c 52 34 2c 52 38 0d 10  |. ADD R4,R4,R8..|
00001cd0  9a 14 20 4d 4f 56 20 52  34 2c 52 34 2c 41 53 52  |.. MOV R4,R4,ASR|
00001ce0  23 34 0d 10 a4 05 20 0d  10 ae 14 20 53 54 52 20  |#4.... .... STR |
00001cf0  52 34 2c 5b 52 31 31 2c  52 33 5d 0d 10 b8 05 20  |R4,[R11,R3].... |
00001d00  0d 10 c2 11 20 41 44 44  20 52 30 2c 52 30 2c 23  |.... ADD R0,R0,#|
00001d10  34 0d 10 cc 15 20 43 4d  50 20 52 30 2c 23 73 69  |4.... CMP R0,#si|
00001d20  7a 65 25 3c 3c 32 0d 10  cd 0f 42 4c 45 20 73 6d  |ze%<<2....BLE sm|
00001d30  6f 6f 74 68 78 0d 10 ce  11 20 41 44 44 20 52 31  |oothx.... ADD R1|
00001d40  2c 52 31 2c 23 34 0d 10  cf 15 20 43 4d 50 20 52  |,R1,#4.... CMP R|
00001d50  31 2c 23 73 69 7a 65 25  3c 3c 32 0d 10 d0 0f 42  |1,#size%<<2....B|
00001d60  4c 45 20 73 6d 6f 6f 74  68 79 0d 10 d6 05 20 0d  |LE smoothy.... .|
00001d70  10 e0 05 20 0d 10 ea 11  20 4c 44 52 20 72 2c 73  |... .... LDR r,s|
00001d80  69 7a 65 61 74 0d 10 eb  13 20 4c 44 52 20 6f 68  |izeat.... LDR oh|
00001d90  61 64 72 2c 6f 68 61 74  0d 10 f4 0c 2e 64 6f 77  |adr,ohat.....dow|
00001da0  61 74 65 72 0d 10 fe 14  20 4c 44 52 20 61 2c 5b  |ater.... LDR a,[|
00001db0  6f 68 61 64 72 2c 72 5d  0d 11 08 0e 20 43 4d 4e  |ohadr,r].... CMN|
00001dc0  20 61 2c 23 39 37 0d 11  12 10 42 47 45 20 6e 6f  | a,#97....BGE no|
00001dd0  74 77 61 74 65 72 0d 11  1c 10 20 41 44 44 20 61  |twater.... ADD a|
00001de0  2c 61 2c 23 39 38 0d 11  26 12 20 4d 4f 56 20 61  |,a,#98..&. MOV a|
00001df0  2c 61 2c 41 53 52 23 32  0d 11 30 11 20 53 55 42  |,a,ASR#2..0. SUB|
00001e00  20 61 2c 61 2c 23 39 38  20 0d 11 3a 14 20 53 54  | a,a,#98 ..:. ST|
00001e10  52 20 61 2c 5b 6f 68 61  64 72 2c 72 5d 0d 11 44  |R a,[ohadr,r]..D|
00001e20  0d 2e 6e 6f 74 77 61 74  65 72 0d 11 4e 10 20 53  |..notwater..N. S|
00001e30  55 42 53 20 72 2c 72 2c  23 34 0d 11 58 0f 42 4e  |UBS r,r,#4..X.BN|
00001e40  45 20 64 6f 77 61 74 65  72 0d 11 62 04 0d 11 6c  |E dowater..b...l|
00001e50  14 20 4c 44 4d 46 44 20  52 31 33 21 2c 7b 50 43  |. LDMFD R13!,{PC|
00001e60  7d 0d 11 76 04 0d 11 80  16 2e 73 65 65 64 61 74  |}..v......seedat|
00001e70  20 45 51 55 44 20 73 65  65 64 25 0d 11 8a 25 2e  | EQUD seed%...%.|
00001e80  73 69 7a 65 61 74 20 45  51 55 44 20 28 73 69 7a  |sizeat EQUD (siz|
00001e90  65 25 2b 31 29 2a 28 73  69 7a 65 79 25 29 2a 34  |e%+1)*(sizey%)*4|
00001ea0  0d 11 94 16 2e 6d 61 73  6b 61 74 20 45 51 55 44  |.....maskat EQUD|
00001eb0  20 6d 61 73 6b 25 0d 11  9e 14 2e 6f 68 61 74 20  | mask%.....ohat |
00001ec0  20 20 45 51 55 44 20 6f  68 25 0d 11 a8 13 2e 68  |  EQUD oh%.....h|
00001ed0  61 74 20 20 20 20 45 51  55 44 20 68 25 0d 11 b2  |at    EQUD h%...|
00001ee0  05 5d 0d 11 bc 05 ed 0d  11 c6 05 e1 0d 11 d0 04  |.]..............|
00001ef0  0d 11 da 1c dd a4 72 6e  64 28 72 65 67 31 2c 72  |......rnd(reg1,r|
00001f00  65 67 32 2c 6f 75 74 2c  61 6e 64 29 0d 11 e4 17  |eg2,out,and)....|
00001f10  f4 20 61 6e 64 20 69 73  20 61 20 63 6f 6e 73 74  |. and is a const|
00001f20  61 6e 74 0d 11 ee 26 f4  20 75 73 65 73 20 72 65  |ant...&. uses re|
00001f30  67 69 73 74 65 72 73 20  72 65 67 31 2c 72 65 67  |gisters reg1,reg|
00001f40  32 2c 6f 75 74 2c 52 31  34 0d 11 f8 1f f4 20 72  |2,out,R14..... r|
00001f50  65 67 31 20 2f 3d 20 72  65 67 32 20 2f 3d 20 6f  |eg1 /= reg2 /= o|
00001f60  75 74 20 2f 3d 20 31 34  0d 12 02 1c f4 20 72 65  |ut /= 14..... re|
00001f70  67 31 20 3c 20 72 65 67  32 20 3c 20 6f 75 74 20  |g1 < reg2 < out |
00001f80  3c 20 31 34 0d 12 0c 21  f4 20 6f 75 74 20 3d 20  |< 14...!. out = |
00001f90  28 52 4e 44 28 61 6e 64  29 2d 31 29 20 2a 20 53  |(RND(and)-1) * S|
00001fa0  47 4e 52 4e 44 0d 12 16  04 0d 12 20 0e 5b 4f 50  |GNRND...... .[OP|
00001fb0  54 20 70 61 73 73 25 0d  12 2a 1f 20 53 54 4d 46  |T pass%..*. STMF|
00001fc0  44 20 52 31 33 21 2c 7b  72 65 67 31 2c 72 65 67  |D R13!,{reg1,reg|
00001fd0  32 2c 52 31 34 7d 0d 12  34 04 0d 12 3e 13 20 4c  |2,R14}..4...>. L|
00001fe0  44 52 20 6f 75 74 2c 73  65 65 64 61 74 0d 12 48  |DR out,seedat..H|
00001ff0  1a 20 4c 44 4d 49 41 20  6f 75 74 2c 7b 72 65 67  |. LDMIA out,{reg|
00002000  31 2c 72 65 67 32 7d 0d  12 52 19 20 4d 4f 56 53  |1,reg2}..R. MOVS|
00002010  20 72 65 67 32 2c 72 65  67 32 2c 4c 53 52 23 31  | reg2,reg2,LSR#1|
00002020  0d 12 5c 16 20 4d 4f 56  53 20 52 31 34 2c 72 65  |..\. MOVS R14,re|
00002030  67 31 2c 52 52 58 0d 12  66 17 20 41 44 43 20 72  |g1,RRX..f. ADC r|
00002040  65 67 32 2c 72 65 67 32  2c 72 65 67 32 0d 12 70  |eg2,reg2,reg2..p|
00002050  1b 20 82 20 72 65 67 31  2c 52 31 34 2c 72 65 67  |. . reg1,R14,reg|
00002060  31 2c 4c 53 4c 23 31 32  0d 12 7a 1c 20 82 20 72  |1,LSL#12..z. . r|
00002070  65 67 31 2c 72 65 67 31  2c 72 65 67 31 2c 4c 53  |eg1,reg1,reg1,LS|
00002080  52 23 32 30 0d 12 84 1a  20 53 54 4d 49 41 20 6f  |R#20.... STMIA o|
00002090  75 74 2c 7b 72 65 67 31  2c 72 65 67 32 7d 0d 12  |ut,{reg1,reg2}..|
000020a0  8e 17 20 4d 4f 56 53 20  52 31 34 2c 52 31 34 2c  |.. MOVS R14,R14,|
000020b0  52 4f 52 23 31 0d 12 98  11 20 4d 4f 56 20 6f 75  |ROR#1.... MOV ou|
000020c0  74 2c 23 61 6e 64 0d 12  a2 15 20 4d 55 4c 20 6f  |t,#and.... MUL o|
000020d0  75 74 2c 73 74 65 70 2c  6f 75 74 0d 12 ac 13 20  |ut,step,out.... |
000020e0  53 55 42 20 6f 75 74 2c  6f 75 74 2c 23 31 0d 12  |SUB out,out,#1..|
000020f0  b6 12 20 80 20 6f 75 74  2c 52 31 34 2c 6f 75 74  |.. . out,R14,out|
00002100  0d 12 c0 15 20 52 53 42  43 53 20 6f 75 74 2c 6f  |.... RSBCS out,o|
00002110  75 74 2c 23 30 0d 12 ca  04 0d 12 d4 1f 20 4c 44  |ut,#0........ LD|
00002120  4d 46 44 20 52 31 33 21  2c 7b 72 65 67 31 2c 72  |MFD R13!,{reg1,r|
00002130  65 67 32 2c 52 31 34 7d  0d 12 de 05 5d 0d 12 e8  |eg2,R14}....]...|
00002140  07 3d 22 22 0d ff                                 |.=""..|
00002146