Home » Archimedes archive » Acorn User » AU 1998-06 A.adf » Regulars » StarInfo/Ranke/ConnectSrc

StarInfo/Ranke/ConnectSrc

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-06 A.adf » Regulars
Filename: StarInfo/Ranke/ConnectSrc
Read OK:
File size: 1737 bytes
Load address: 0000
Exec address: 0000
File contents
   10ONERRORPRINTREPORT$ERL:END
   20PROCdir
   30DIM c 1024
   40FOR p%=4 TO 6 STEP 2
   50P%=&8000:O%=c
   60[OPTp%
   70.main
   80   mov 13,#&8800              ; need a stack
   90   swi "OS_WriteS"            ; print L:
  100   equs "L:"+CHR$13+CHR$0
  110   mov 3,#8                  ; max level-1, counter for prepare field
  120   bl getnum                  ; [0..8]=>r0
  130   movs 7,0,lsr#1             ; r7=r0 DIV 2;carry set if number was odd
  140   movcs 11,#0                ; computer beginns
  150   movcc 11,#32               ; player beginns
  160   add 7,7,#4                 ; search depth 4-7
  170   swi "OS_ReadMonotonicTime" ; get time for random numbers
  180   mov 8,0                    ; r8=seed
  190   mov 0,#ASC"�"              ; prepare field
  200   mov 2,#13                  ; (first, last line, right border=13;
  210   adr 4,field-8              ;  rest "�")
  220   mov 1,#63
  230.loop
  240   tst 1,#7
  250   subeq 3,3,#1
  260   cmpne 3,#8
  270   cmpne 3,#1
  280   streqb 2,[4],#1
  290   strneb 0,[4],#1
  300   subs 1,1,#1
  310   bge loop
  320   mov 10,#6*7                ; max number of moves
  330.loop
  340   bl draw                    ; draw board
  350   rsbs 11,11,#32             ; toggle player
  360   add 2,11,#111              ; r2=other player's piece
  370   beq player                 ; human move
  380   bl recurs                  ; computer move
  390.maincont
  400   rsb 2,2,#254               ; r2=player's piece
  410   strb 2,[0]                 ; put it
  420   bl check                   ; check if won
  430   movlt 0,#ASC")"+3          ; if won, ")" for computer "(" for player
  440   sublt 0,0,2,lsr#5
  450   subges 10,10,#1            ; if not won, decrease number of moves
  460   bgt loop                   ; if moves left, loop
  470   moveq 0,#ASC"|"            ; a draw
  480.mainend
  490   bl draw                    ; draw board
  500   swi 256+ASC":"             ; print smily
  510   swi "OS_WriteC"
  520   swi "OS_Exit"              ; exit
  530
  540.getnum                       ; enter number [1..r3+1] output [0..r3]
  550   swi "OS_ReadC"
  560   swics "OS_Exit"            ; exit if ESC
  570   subs 0,0,#49
  580   rsbges 1,0,3
  590   blt getnum
  600   movs pc,14
  610
  620.player                       ; get a players move
  630   mov 3,#6                   ; get number [1..7]
  640   bl getnum
  650   add 0,0,#field
  660   bl fall                    ; let piece fall down slot
  670   blt player                 ; if slot full, loop to player
  680   b maincont
  690
  700.draw                         ; draw board
  710   stmfd 13!,{0-3,14}
  720   mov 2,#field
  730   mov 3,#6*8
  740   swi 256+30
  750.loop
  760   ldrb 0,[2],#1
  770   swi "OS_WriteC"
  780   cmp 0,#13
  790   swieq 256+10
  800   subs 3,3,#1
  810   bne loop
  820   swi "OS_WriteS"
  830   equs "1234567"
  840   dcb 13:dcb 10:dcb 10
  850   dcb 0:dcb ASC"�"
  860   ldmfd 13!,{0-3,pc}^
  870
  880.fall                         ; let piece fall down slot
  890   ldrb 1,[0],#8
  900   cmp 1,#ASC"�"
  910   beq fall
  920   sub 0,0,#16
  930   cmp 0,#field               ; check if slot is full
  940   mov pc,14
  950
  960.recurs                       ; recursiv calculation of computer move
  970   stmfd 13!,{0,2-11,14}      ; note that r0 is put on the stack but r1 pulled
  980   rsb 2,2,#254               ; toggle player (piece)
  990   sub 7,7,#1                 ; decrease itaration counter
 1000   mvn 11,#&10000000          ; r11=move value
 1010   mov 9,#field               ; r9 start of field
 1020.loop2
 1030   mov 0,9                    ; let piece fall down slot
 1040   bl fall
 1050   blt cont
 1060   bl check                   ; value move
 1070   blt end                    ; if won, no need to go further
 1080   movs 7,7                   ; check itaration conter
 1090   strneb 2,[0]               ; put piece
 1100   blne recurs                ; calculate value for next move
 1110   movne 0,#ASC"�"            ; remove piece
 1120   strneb 0,[1]               ; (note r0=>r1)
 1130   subne 6,6,12               ; subtract move value of next player
 1140   cmp 11,6                   ; compare old and new value
 1150   addeqs 8,8,8,ror#13        ; if equal, 50% chance of taking new one
 1160   movlt 11,6                 ; new value and move
 1170   movlt 10,1
 1180.cont
 1190   ldrb 0,[9,#1]!             ; increase field pointer
 1200   cmp 0,#13                  ; reached end?
 1210   bne loop2                  ; if not, loop
 1220.end
 1230   cmn 11,#&10000000          ; if no possible move, initial value remained
 1240   moveq 12,#0                ; so set move value to zero
 1250   movne 12,11                ; r12=move value
 1260   mov 0,10                   ; r0=address of move
 1270   ldmfd 13!,{1-11,pc}^       ; r1 is pulled instead of r0
 1280
 1290.check                        ; value move and check if won
 1300   stmfd 13!,{14}
 1310   adr 4,dirtab
 1320   mov 6,#0
 1330.loop
 1340   ldrb 1,[4],#1              ; r1=direction for count
 1350   bl count                   ; count row of same pieces
 1360   mov 5,3
 1370   rsb 1,1,#0                 ; reverse direction
 1380   bl count                   ; count row of same pieces
 1390   add 3,3,5
 1400   rsbs 5,3,#2                ; check, 3 or more neighbours
 1410   movlt 11,#&10000           ; if yes, won, so return
 1420   movlt 10,0
 1430   ldmltfd 13!,{pc}
 1440   mov 5,#1                   ; values 0n=1 1n=2 2n=4 >2n=&10000 (won)
 1450   add 6,6,5,lsl 3
 1460   cmn 1,#1
 1470   bne loop
 1480   ldmfd 13!,{pc}
 1490
 1500.count                        ; count row of same pieces
 1510   stmfd 13!,{0,4,14}
 1520   mov 3,#0
 1530.loop
 1540   ldrb 4,[0,1]!
 1550   cmp 4,2
 1560   addeq 3,3,#1
 1570   beq loop
 1580   ldmfd 13!,{0,4,pc}^
 1590
 1600.dirtab
 1610   dcb 7:dcb 8:dcb 9:dcb 1
 1620]
 1630field=&8300
 1640NEXT
 1650SYS 8,10,"<Basic$Dir>.Connect4",&ff8,,c,O%
 1660END
 1670
 1680DEF PROCdir
 1690 LOCAL pnt%,s$,t$
 1700 SYS "XOS_Module",18,"BasicDir" TO ;pnt%
 1710 IF (pnt% AND 1)=0 ENDPROC
 1730 SYS &10 TO pnt%
 1740 pnt%+=6
 1750 WHILE ?pnt%<>32
 1760  pnt%+=1
 1770 ENDWHILE
 1780 s$=""
 1790 t$=""
 1800 pnt%+=1
 1810 WHILE ?pnt%>31
 1820  IF ?pnt%<>34 t$+=CHR$?pnt%
 1830  IF ?pnt%=46 THEN
 1840   s$+=t$
 1850   t$=""
 1860  ENDIF
 1870  pnt%+=1
 1880 ENDWHILE
 1890 SYS &24,"Basic$Dir",LEFT$(s$),LENs$-1
 1900ENDPROC

��$�:�
�dir
� c 1024
(� p%=4 � 6 � 2
2P%=&8000:O%=c
<
[OPTp%
F	.main
P0   mov 13,#&8800              ; need a stack
Z,   swi "OS_WriteS"            ; print L:
d   equs "L:"+�13+�0
nI   mov 3,#8                  ; max level-1, counter for prepare field
x.   bl getnum                  ; [0..8]=>r0
�I   movs 7,0,lsr#1             ; r7=r0 � 2;carry set if number was odd
�4   movcs 11,#0                ; computer beginns
�2   movcc 11,#32               ; player beginns
�4   add 7,7,#4                 ; search depth 4-7
�?   swi "OS_ReadMonotonicTime" ; get time for random numbers
�+   mov 8,0                    ; r8=seed
�/   mov 0,#�"�"              ; prepare field
�G   mov 2,#13                  ; (first, last line, right border=13;
�.   adr 4,field-8              ;  rest "�")
�   mov 1,#63
�	.loop
�   tst 1,#7
�   subeq 3,3,#1
   cmpne 3,#8
   cmpne 3,#1
   streqb 2,[4],#1
"   strneb 0,[4],#1
,   subs 1,1,#1
6   bge loop
@7   mov 10,#6*7                ; max number of moves
J	.loop
T.   bl draw                    ; draw board
^1   rsbs 11,11,#32             ; toggle player
h;   add 2,11,#111              ; r2=other player's piece
r.   beq player                 ; human move
|1   bl recurs                  ; computer move
�
.maincont
�5   rsb 2,2,#254               ; r2=player's piece
�*   strb 2,[0]                 ; put it
�0   bl check                   ; check if won
�I   movlt 0,#�")"+3          ; if won, ")" for computer "(" for player
�   sublt 0,0,2,lsr#5
�H   subges 10,10,#1            ; if not won, decrease number of moves
�7   bgt loop                   ; if moves left, loop
�(   moveq 0,#�"|"            ; a draw
�.mainend
�.   bl draw                    ; draw board
�-   swi 256+�":"             ; print smily
�   swi "OS_WriteC"
(   swi "OS_Exit"              ; exit

I.getnum                       ; enter number [1..r3+1] output [0..r3]
&   swi "OS_ReadC"
0/   swics "OS_Exit"            ; exit if ESC
:   subs 0,0,#49
D   rsbges 1,0,3
N   blt getnum
X   movs pc,14
b
l6.player                       ; get a players move
v5   mov 3,#6                   ; get number [1..7]
�   bl getnum
�   add 0,0,#field
�<   bl fall                    ; let piece fall down slot
�@   blt player                 ; if slot full, loop to player
�   b maincont
�
�..draw                         ; draw board
�   stmfd 13!,{0-3,14}
�   mov 2,#field
�   mov 3,#6*8
�   swi 256+30
�	.loop
�   ldrb 0,[2],#1
   swi "OS_WriteC"
   cmp 0,#13
   swieq 256+10
    subs 3,3,#1
*   bne loop
4   swi "OS_WriteS"
>   equs "1234567"
H   dcb 13:dcb 10:dcb 10
R   dcb 0:dcb �"�"
\   ldmfd 13!,{0-3,pc}^
f
p<.fall                         ; let piece fall down slot
z   ldrb 1,[0],#8
�   cmp 1,#�"�"
�   beq fall
�   sub 0,0,#16
�9   cmp 0,#field               ; check if slot is full
�   mov pc,14
�
�I.recurs                       ; recursiv calculation of computer move
�R   stmfd 13!,{0,2-11,14}      ; note that r0 is put on the stack but r1 pulled
�9   rsb 2,2,#254               ; toggle player (piece)
�>   sub 7,7,#1                 ; decrease itaration counter
�2   mvn 11,#&10000000          ; r11=move value
�5   mov 9,#field               ; r9 start of field
�
.loop2
<   mov 0,9                    ; let piece fall down slot
   bl fall
   blt cont
$.   bl check                   ; value move
.A   blt end                    ; if won, no need to go further
8:   movs 7,7                   ; check itaration conter
B-   strneb 2,[0]               ; put piece
LA   blne recurs                ; calculate value for next move
V.   movne 0,#�"�"            ; remove piece
`1   strneb 0,[1]               ; (note r0=>r1)
jF   subne 6,6,12               ; subtract move value of next player
t=   cmp 11,6                   ; compare old and new value
~J   addeqs 8,8,8,ror#13        ; if equal, 50% chance of taking new one
�6   movlt 11,6                 ; new value and move
�   movlt 10,1
�	.cont
�:   ldrb 0,[9,#1]!             ; increase field pointer
�0   cmp 0,#13                  ; reached end?
�0   bne loop2                  ; if not, loop
�.end
�O   cmn 11,#&10000000          ; if no possible move, initial value remained
�=   moveq 12,#0                ; so set move value to zero
�2   movne 12,11                ; r12=move value
�6   mov 0,10                   ; r0=address of move
�>   ldmfd 13!,{1-11,pc}^       ; r1 is pulled instead of r0


?.check                        ; value move and check if won
   stmfd 13!,{14}
   adr 4,dirtab
(   mov 6,#0
2	.loop
<:   ldrb 1,[4],#1              ; r1=direction for count
F<   bl count                   ; count row of same pieces
P   mov 5,3
Z5   rsb 1,1,#0                 ; reverse direction
d<   bl count                   ; count row of same pieces
n   add 3,3,5
x?   rsbs 5,3,#2                ; check, 3 or more neighbours
�:   movlt 11,#&10000           ; if yes, won, so return
�   movlt 10,0
�   ldmltfd 13!,{pc}
�J   mov 5,#1                   ; values 0n=1 1n=2 2n=4 >2n=&10000 (won)
�   add 6,6,5,lsl 3
�   cmn 1,#1
�   bne loop
�   ldmfd 13!,{pc}
�
�<.count                        ; count row of same pieces
�   stmfd 13!,{0,4,14}
�   mov 3,#0
�	.loop
   ldrb 4,[0,1]!
   cmp 4,2
   addeq 3,3,#1
"   beq loop
,   ldmfd 13!,{0,4,pc}^
6
@.dirtab
J   dcb 7:dcb 8:dcb 9:dcb 1
T]
^field=&8300
h�
r-ș 8,10,"<Basic$Dir>.Connect4",&ff8,,c,O%
|�
�
�
� �dir
� � pnt%,s$,t$
�* ș "XOS_Module",18,"BasicDir" � ;pnt%
� � (pnt% � 1)=0 �
� ș &10 � pnt%
� pnt%+=6
� ȕ ?pnt%<>32
�
  pnt%+=1
� �
�
 s$=""
�
 t$=""
 pnt%+=1
 ȕ ?pnt%>31
  � ?pnt%<>34 t$+=�?pnt%
&  � ?pnt%=46 �
0
   s$+=t$
:   t$=""
D  �
N
  pnt%+=1
X �
b" ș &24,"Basic$Dir",�s$),�s$-1
l�
�
00000000  0d 00 0a 0c ee 85 f1 f6  24 9e 3a e0 0d 00 14 08  |........$.:.....|
00000010  f2 64 69 72 0d 00 1e 0c  de 20 63 20 31 30 32 34  |.dir..... c 1024|
00000020  0d 00 28 12 e3 20 70 25  3d 34 20 b8 20 36 20 88  |..(.. p%=4 . 6 .|
00000030  20 32 0d 00 32 11 50 25  3d 26 38 30 30 30 3a 4f  | 2..2.P%=&8000:O|
00000040  25 3d 63 0d 00 3c 0a 5b  4f 50 54 70 25 0d 00 46  |%=c..<.[OPTp%..F|
00000050  09 2e 6d 61 69 6e 0d 00  50 30 20 20 20 6d 6f 76  |..main..P0   mov|
00000060  20 31 33 2c 23 26 38 38  30 30 20 20 20 20 20 20  | 13,#&8800      |
00000070  20 20 20 20 20 20 20 20  3b 20 6e 65 65 64 20 61  |        ; need a|
00000080  20 73 74 61 63 6b 0d 00  5a 2c 20 20 20 73 77 69  | stack..Z,   swi|
00000090  20 22 4f 53 5f 57 72 69  74 65 53 22 20 20 20 20  | "OS_WriteS"    |
000000a0  20 20 20 20 20 20 20 20  3b 20 70 72 69 6e 74 20  |        ; print |
000000b0  4c 3a 0d 00 64 17 20 20  20 65 71 75 73 20 22 4c  |L:..d.   equs "L|
000000c0  3a 22 2b bd 31 33 2b bd  30 0d 00 6e 49 20 20 20  |:"+.13+.0..nI   |
000000d0  6d 6f 76 20 33 2c 23 38  20 20 20 20 20 20 20 20  |mov 3,#8        |
000000e0  20 20 20 20 20 20 20 20  20 20 3b 20 6d 61 78 20  |          ; max |
000000f0  6c 65 76 65 6c 2d 31 2c  20 63 6f 75 6e 74 65 72  |level-1, counter|
00000100  20 66 6f 72 20 70 72 65  70 61 72 65 20 66 69 65  | for prepare fie|
00000110  6c 64 0d 00 78 2e 20 20  20 62 6c 20 67 65 74 6e  |ld..x.   bl getn|
00000120  75 6d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |um              |
00000130  20 20 20 20 3b 20 5b 30  2e 2e 38 5d 3d 3e 72 30  |    ; [0..8]=>r0|
00000140  0d 00 82 49 20 20 20 6d  6f 76 73 20 37 2c 30 2c  |...I   movs 7,0,|
00000150  6c 73 72 23 31 20 20 20  20 20 20 20 20 20 20 20  |lsr#1           |
00000160  20 20 3b 20 72 37 3d 72  30 20 81 20 32 3b 63 61  |  ; r7=r0 . 2;ca|
00000170  72 72 79 20 73 65 74 20  69 66 20 6e 75 6d 62 65  |rry set if numbe|
00000180  72 20 77 61 73 20 6f 64  64 0d 00 8c 34 20 20 20  |r was odd...4   |
00000190  6d 6f 76 63 73 20 31 31  2c 23 30 20 20 20 20 20  |movcs 11,#0     |
000001a0  20 20 20 20 20 20 20 20  20 20 20 3b 20 63 6f 6d  |           ; com|
000001b0  70 75 74 65 72 20 62 65  67 69 6e 6e 73 0d 00 96  |puter beginns...|
000001c0  32 20 20 20 6d 6f 76 63  63 20 31 31 2c 23 33 32  |2   movcc 11,#32|
000001d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000001e0  20 70 6c 61 79 65 72 20  62 65 67 69 6e 6e 73 0d  | player beginns.|
000001f0  00 a0 34 20 20 20 61 64  64 20 37 2c 37 2c 23 34  |..4   add 7,7,#4|
00000200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000210  20 3b 20 73 65 61 72 63  68 20 64 65 70 74 68 20  | ; search depth |
00000220  34 2d 37 0d 00 aa 3f 20  20 20 73 77 69 20 22 4f  |4-7...?   swi "O|
00000230  53 5f 52 65 61 64 4d 6f  6e 6f 74 6f 6e 69 63 54  |S_ReadMonotonicT|
00000240  69 6d 65 22 20 3b 20 67  65 74 20 74 69 6d 65 20  |ime" ; get time |
00000250  66 6f 72 20 72 61 6e 64  6f 6d 20 6e 75 6d 62 65  |for random numbe|
00000260  72 73 0d 00 b4 2b 20 20  20 6d 6f 76 20 38 2c 30  |rs...+   mov 8,0|
00000270  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000280  20 20 20 20 3b 20 72 38  3d 73 65 65 64 0d 00 be  |    ; r8=seed...|
00000290  2f 20 20 20 6d 6f 76 20  30 2c 23 97 22 b7 22 20  |/   mov 0,#."." |
000002a0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 70  |             ; p|
000002b0  72 65 70 61 72 65 20 66  69 65 6c 64 0d 00 c8 47  |repare field...G|
000002c0  20 20 20 6d 6f 76 20 32  2c 23 31 33 20 20 20 20  |   mov 2,#13    |
000002d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000002e0  28 66 69 72 73 74 2c 20  6c 61 73 74 20 6c 69 6e  |(first, last lin|
000002f0  65 2c 20 72 69 67 68 74  20 62 6f 72 64 65 72 3d  |e, right border=|
00000300  31 33 3b 0d 00 d2 2e 20  20 20 61 64 72 20 34 2c  |13;....   adr 4,|
00000310  66 69 65 6c 64 2d 38 20  20 20 20 20 20 20 20 20  |field-8         |
00000320  20 20 20 20 20 3b 20 20  72 65 73 74 20 22 b7 22  |     ;  rest "."|
00000330  29 0d 00 dc 10 20 20 20  6d 6f 76 20 31 2c 23 36  |)....   mov 1,#6|
00000340  33 0d 00 e6 09 2e 6c 6f  6f 70 0d 00 f0 0f 20 20  |3.....loop....  |
00000350  20 74 73 74 20 31 2c 23  37 0d 00 fa 13 20 20 20  | tst 1,#7....   |
00000360  73 75 62 65 71 20 33 2c  33 2c 23 31 0d 01 04 11  |subeq 3,3,#1....|
00000370  20 20 20 63 6d 70 6e 65  20 33 2c 23 38 0d 01 0e  |   cmpne 3,#8...|
00000380  11 20 20 20 63 6d 70 6e  65 20 33 2c 23 31 0d 01  |.   cmpne 3,#1..|
00000390  18 16 20 20 20 73 74 72  65 71 62 20 32 2c 5b 34  |..   streqb 2,[4|
000003a0  5d 2c 23 31 0d 01 22 16  20 20 20 73 74 72 6e 65  |],#1..".   strne|
000003b0  62 20 30 2c 5b 34 5d 2c  23 31 0d 01 2c 12 20 20  |b 0,[4],#1..,.  |
000003c0  20 73 75 62 73 20 31 2c  31 2c 23 31 0d 01 36 0f  | subs 1,1,#1..6.|
000003d0  20 20 20 62 67 65 20 6c  6f 6f 70 0d 01 40 37 20  |   bge loop..@7 |
000003e0  20 20 6d 6f 76 20 31 30  2c 23 36 2a 37 20 20 20  |  mov 10,#6*7   |
000003f0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 6d  |             ; m|
00000400  61 78 20 6e 75 6d 62 65  72 20 6f 66 20 6d 6f 76  |ax number of mov|
00000410  65 73 0d 01 4a 09 2e 6c  6f 6f 70 0d 01 54 2e 20  |es..J..loop..T. |
00000420  20 20 62 6c 20 64 72 61  77 20 20 20 20 20 20 20  |  bl draw       |
00000430  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
00000440  72 61 77 20 62 6f 61 72  64 0d 01 5e 31 20 20 20  |raw board..^1   |
00000450  72 73 62 73 20 31 31 2c  31 31 2c 23 33 32 20 20  |rsbs 11,11,#32  |
00000460  20 20 20 20 20 20 20 20  20 20 20 3b 20 74 6f 67  |           ; tog|
00000470  67 6c 65 20 70 6c 61 79  65 72 0d 01 68 3b 20 20  |gle player..h;  |
00000480  20 61 64 64 20 32 2c 31  31 2c 23 31 31 31 20 20  | add 2,11,#111  |
00000490  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 72 32  |            ; r2|
000004a0  3d 6f 74 68 65 72 20 70  6c 61 79 65 72 27 73 20  |=other player's |
000004b0  70 69 65 63 65 0d 01 72  2e 20 20 20 62 65 71 20  |piece..r.   beq |
000004c0  70 6c 61 79 65 72 20 20  20 20 20 20 20 20 20 20  |player          |
000004d0  20 20 20 20 20 20 20 3b  20 68 75 6d 61 6e 20 6d  |       ; human m|
000004e0  6f 76 65 0d 01 7c 31 20  20 20 62 6c 20 72 65 63  |ove..|1   bl rec|
000004f0  75 72 73 20 20 20 20 20  20 20 20 20 20 20 20 20  |urs             |
00000500  20 20 20 20 20 3b 20 63  6f 6d 70 75 74 65 72 20  |     ; computer |
00000510  6d 6f 76 65 0d 01 86 0d  2e 6d 61 69 6e 63 6f 6e  |move.....maincon|
00000520  74 0d 01 90 35 20 20 20  72 73 62 20 32 2c 32 2c  |t...5   rsb 2,2,|
00000530  23 32 35 34 20 20 20 20  20 20 20 20 20 20 20 20  |#254            |
00000540  20 20 20 3b 20 72 32 3d  70 6c 61 79 65 72 27 73  |   ; r2=player's|
00000550  20 70 69 65 63 65 0d 01  9a 2a 20 20 20 73 74 72  | piece...*   str|
00000560  62 20 32 2c 5b 30 5d 20  20 20 20 20 20 20 20 20  |b 2,[0]         |
00000570  20 20 20 20 20 20 20 20  3b 20 70 75 74 20 69 74  |        ; put it|
00000580  0d 01 a4 30 20 20 20 62  6c 20 63 68 65 63 6b 20  |...0   bl check |
00000590  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000005a0  20 20 3b 20 63 68 65 63  6b 20 69 66 20 77 6f 6e  |  ; check if won|
000005b0  0d 01 ae 49 20 20 20 6d  6f 76 6c 74 20 30 2c 23  |...I   movlt 0,#|
000005c0  97 22 29 22 2b 33 20 20  20 20 20 20 20 20 20 20  |.")"+3          |
000005d0  3b 20 69 66 20 77 6f 6e  2c 20 22 29 22 20 66 6f  |; if won, ")" fo|
000005e0  72 20 63 6f 6d 70 75 74  65 72 20 22 28 22 20 66  |r computer "(" f|
000005f0  6f 72 20 70 6c 61 79 65  72 0d 01 b8 18 20 20 20  |or player....   |
00000600  73 75 62 6c 74 20 30 2c  30 2c 32 2c 6c 73 72 23  |sublt 0,0,2,lsr#|
00000610  35 0d 01 c2 48 20 20 20  73 75 62 67 65 73 20 31  |5...H   subges 1|
00000620  30 2c 31 30 2c 23 31 20  20 20 20 20 20 20 20 20  |0,10,#1         |
00000630  20 20 20 3b 20 69 66 20  6e 6f 74 20 77 6f 6e 2c  |   ; if not won,|
00000640  20 64 65 63 72 65 61 73  65 20 6e 75 6d 62 65 72  | decrease number|
00000650  20 6f 66 20 6d 6f 76 65  73 0d 01 cc 37 20 20 20  | of moves...7   |
00000660  62 67 74 20 6c 6f 6f 70  20 20 20 20 20 20 20 20  |bgt loop        |
00000670  20 20 20 20 20 20 20 20  20 20 20 3b 20 69 66 20  |           ; if |
00000680  6d 6f 76 65 73 20 6c 65  66 74 2c 20 6c 6f 6f 70  |moves left, loop|
00000690  0d 01 d6 28 20 20 20 6d  6f 76 65 71 20 30 2c 23  |...(   moveq 0,#|
000006a0  97 22 7c 22 20 20 20 20  20 20 20 20 20 20 20 20  |."|"            |
000006b0  3b 20 61 20 64 72 61 77  0d 01 e0 0c 2e 6d 61 69  |; a draw.....mai|
000006c0  6e 65 6e 64 0d 01 ea 2e  20 20 20 62 6c 20 64 72  |nend....   bl dr|
000006d0  61 77 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |aw              |
000006e0  20 20 20 20 20 20 3b 20  64 72 61 77 20 62 6f 61  |      ; draw boa|
000006f0  72 64 0d 01 f4 2d 20 20  20 73 77 69 20 32 35 36  |rd...-   swi 256|
00000700  2b 97 22 3a 22 20 20 20  20 20 20 20 20 20 20 20  |+.":"           |
00000710  20 20 3b 20 70 72 69 6e  74 20 73 6d 69 6c 79 0d  |  ; print smily.|
00000720  01 fe 16 20 20 20 73 77  69 20 22 4f 53 5f 57 72  |...   swi "OS_Wr|
00000730  69 74 65 43 22 0d 02 08  28 20 20 20 73 77 69 20  |iteC"...(   swi |
00000740  22 4f 53 5f 45 78 69 74  22 20 20 20 20 20 20 20  |"OS_Exit"       |
00000750  20 20 20 20 20 20 20 3b  20 65 78 69 74 0d 02 12  |       ; exit...|
00000760  04 0d 02 1c 49 2e 67 65  74 6e 75 6d 20 20 20 20  |....I.getnum    |
00000770  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000780  20 20 20 3b 20 65 6e 74  65 72 20 6e 75 6d 62 65  |   ; enter numbe|
00000790  72 20 5b 31 2e 2e 72 33  2b 31 5d 20 6f 75 74 70  |r [1..r3+1] outp|
000007a0  75 74 20 5b 30 2e 2e 72  33 5d 0d 02 26 15 20 20  |ut [0..r3]..&.  |
000007b0  20 73 77 69 20 22 4f 53  5f 52 65 61 64 43 22 0d  | swi "OS_ReadC".|
000007c0  02 30 2f 20 20 20 73 77  69 63 73 20 22 4f 53 5f  |.0/   swics "OS_|
000007d0  45 78 69 74 22 20 20 20  20 20 20 20 20 20 20 20  |Exit"           |
000007e0  20 3b 20 65 78 69 74 20  69 66 20 45 53 43 0d 02  | ; exit if ESC..|
000007f0  3a 13 20 20 20 73 75 62  73 20 30 2c 30 2c 23 34  |:.   subs 0,0,#4|
00000800  39 0d 02 44 13 20 20 20  72 73 62 67 65 73 20 31  |9..D.   rsbges 1|
00000810  2c 30 2c 33 0d 02 4e 11  20 20 20 62 6c 74 20 67  |,0,3..N.   blt g|
00000820  65 74 6e 75 6d 0d 02 58  11 20 20 20 6d 6f 76 73  |etnum..X.   movs|
00000830  20 70 63 2c 31 34 0d 02  62 04 0d 02 6c 36 2e 70  | pc,14..b...l6.p|
00000840  6c 61 79 65 72 20 20 20  20 20 20 20 20 20 20 20  |layer           |
00000850  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 67 65  |            ; ge|
00000860  74 20 61 20 70 6c 61 79  65 72 73 20 6d 6f 76 65  |t a players move|
00000870  0d 02 76 35 20 20 20 6d  6f 76 20 33 2c 23 36 20  |..v5   mov 3,#6 |
00000880  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000890  20 20 3b 20 67 65 74 20  6e 75 6d 62 65 72 20 5b  |  ; get number [|
000008a0  31 2e 2e 37 5d 0d 02 80  10 20 20 20 62 6c 20 67  |1..7]....   bl g|
000008b0  65 74 6e 75 6d 0d 02 8a  15 20 20 20 61 64 64 20  |etnum....   add |
000008c0  30 2c 30 2c 23 66 69 65  6c 64 0d 02 94 3c 20 20  |0,0,#field...<  |
000008d0  20 62 6c 20 66 61 6c 6c  20 20 20 20 20 20 20 20  | bl fall        |
000008e0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 6c 65  |            ; le|
000008f0  74 20 70 69 65 63 65 20  66 61 6c 6c 20 64 6f 77  |t piece fall dow|
00000900  6e 20 73 6c 6f 74 0d 02  9e 40 20 20 20 62 6c 74  |n slot...@   blt|
00000910  20 70 6c 61 79 65 72 20  20 20 20 20 20 20 20 20  | player         |
00000920  20 20 20 20 20 20 20 20  3b 20 69 66 20 73 6c 6f  |        ; if slo|
00000930  74 20 66 75 6c 6c 2c 20  6c 6f 6f 70 20 74 6f 20  |t full, loop to |
00000940  70 6c 61 79 65 72 0d 02  a8 11 20 20 20 62 20 6d  |player....   b m|
00000950  61 69 6e 63 6f 6e 74 0d  02 b2 04 0d 02 bc 2e 2e  |aincont.........|
00000960  64 72 61 77 20 20 20 20  20 20 20 20 20 20 20 20  |draw            |
00000970  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
00000980  72 61 77 20 62 6f 61 72  64 0d 02 c6 19 20 20 20  |raw board....   |
00000990  73 74 6d 66 64 20 31 33  21 2c 7b 30 2d 33 2c 31  |stmfd 13!,{0-3,1|
000009a0  34 7d 0d 02 d0 13 20 20  20 6d 6f 76 20 32 2c 23  |4}....   mov 2,#|
000009b0  66 69 65 6c 64 0d 02 da  11 20 20 20 6d 6f 76 20  |field....   mov |
000009c0  33 2c 23 36 2a 38 0d 02  e4 11 20 20 20 73 77 69  |3,#6*8....   swi|
000009d0  20 32 35 36 2b 33 30 0d  02 ee 09 2e 6c 6f 6f 70  | 256+30.....loop|
000009e0  0d 02 f8 14 20 20 20 6c  64 72 62 20 30 2c 5b 32  |....   ldrb 0,[2|
000009f0  5d 2c 23 31 0d 03 02 16  20 20 20 73 77 69 20 22  |],#1....   swi "|
00000a00  4f 53 5f 57 72 69 74 65  43 22 0d 03 0c 10 20 20  |OS_WriteC"....  |
00000a10  20 63 6d 70 20 30 2c 23  31 33 0d 03 16 13 20 20  | cmp 0,#13....  |
00000a20  20 73 77 69 65 71 20 32  35 36 2b 31 30 0d 03 20  | swieq 256+10.. |
00000a30  12 20 20 20 73 75 62 73  20 33 2c 33 2c 23 31 0d  |.   subs 3,3,#1.|
00000a40  03 2a 0f 20 20 20 62 6e  65 20 6c 6f 6f 70 0d 03  |.*.   bne loop..|
00000a50  34 16 20 20 20 73 77 69  20 22 4f 53 5f 57 72 69  |4.   swi "OS_Wri|
00000a60  74 65 53 22 0d 03 3e 15  20 20 20 65 71 75 73 20  |teS"..>.   equs |
00000a70  22 31 32 33 34 35 36 37  22 0d 03 48 1b 20 20 20  |"1234567"..H.   |
00000a80  64 63 62 20 31 33 3a 64  63 62 20 31 30 3a 64 63  |dcb 13:dcb 10:dc|
00000a90  62 20 31 30 0d 03 52 15  20 20 20 64 63 62 20 30  |b 10..R.   dcb 0|
00000aa0  3a 64 63 62 20 97 22 b6  22 0d 03 5c 1a 20 20 20  |:dcb ."."..\.   |
00000ab0  6c 64 6d 66 64 20 31 33  21 2c 7b 30 2d 33 2c 70  |ldmfd 13!,{0-3,p|
00000ac0  63 7d 5e 0d 03 66 04 0d  03 70 3c 2e 66 61 6c 6c  |c}^..f...p<.fall|
00000ad0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ae0  20 20 20 20 20 20 20 20  20 3b 20 6c 65 74 20 70  |         ; let p|
00000af0  69 65 63 65 20 66 61 6c  6c 20 64 6f 77 6e 20 73  |iece fall down s|
00000b00  6c 6f 74 0d 03 7a 14 20  20 20 6c 64 72 62 20 31  |lot..z.   ldrb 1|
00000b10  2c 5b 30 5d 2c 23 38 0d  03 84 12 20 20 20 63 6d  |,[0],#8....   cm|
00000b20  70 20 31 2c 23 97 22 b7  22 0d 03 8e 0f 20 20 20  |p 1,#."."....   |
00000b30  62 65 71 20 66 61 6c 6c  0d 03 98 12 20 20 20 73  |beq fall....   s|
00000b40  75 62 20 30 2c 30 2c 23  31 36 0d 03 a2 39 20 20  |ub 0,0,#16...9  |
00000b50  20 63 6d 70 20 30 2c 23  66 69 65 6c 64 20 20 20  | cmp 0,#field   |
00000b60  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 63 68  |            ; ch|
00000b70  65 63 6b 20 69 66 20 73  6c 6f 74 20 69 73 20 66  |eck if slot is f|
00000b80  75 6c 6c 0d 03 ac 10 20  20 20 6d 6f 76 20 70 63  |ull....   mov pc|
00000b90  2c 31 34 0d 03 b6 04 0d  03 c0 49 2e 72 65 63 75  |,14.......I.recu|
00000ba0  72 73 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |rs              |
00000bb0  20 20 20 20 20 20 20 20  20 3b 20 72 65 63 75 72  |         ; recur|
00000bc0  73 69 76 20 63 61 6c 63  75 6c 61 74 69 6f 6e 20  |siv calculation |
00000bd0  6f 66 20 63 6f 6d 70 75  74 65 72 20 6d 6f 76 65  |of computer move|
00000be0  0d 03 ca 52 20 20 20 73  74 6d 66 64 20 31 33 21  |...R   stmfd 13!|
00000bf0  2c 7b 30 2c 32 2d 31 31  2c 31 34 7d 20 20 20 20  |,{0,2-11,14}    |
00000c00  20 20 3b 20 6e 6f 74 65  20 74 68 61 74 20 72 30  |  ; note that r0|
00000c10  20 69 73 20 70 75 74 20  6f 6e 20 74 68 65 20 73  | is put on the s|
00000c20  74 61 63 6b 20 62 75 74  20 72 31 20 70 75 6c 6c  |tack but r1 pull|
00000c30  65 64 0d 03 d4 39 20 20  20 72 73 62 20 32 2c 32  |ed...9   rsb 2,2|
00000c40  2c 23 32 35 34 20 20 20  20 20 20 20 20 20 20 20  |,#254           |
00000c50  20 20 20 20 3b 20 74 6f  67 67 6c 65 20 70 6c 61  |    ; toggle pla|
00000c60  79 65 72 20 28 70 69 65  63 65 29 0d 03 de 3e 20  |yer (piece)...> |
00000c70  20 20 73 75 62 20 37 2c  37 2c 23 31 20 20 20 20  |  sub 7,7,#1    |
00000c80  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 64  |             ; d|
00000c90  65 63 72 65 61 73 65 20  69 74 61 72 61 74 69 6f  |ecrease itaratio|
00000ca0  6e 20 63 6f 75 6e 74 65  72 0d 03 e8 32 20 20 20  |n counter...2   |
00000cb0  6d 76 6e 20 31 31 2c 23  26 31 30 30 30 30 30 30  |mvn 11,#&1000000|
00000cc0  30 20 20 20 20 20 20 20  20 20 20 3b 20 72 31 31  |0          ; r11|
00000cd0  3d 6d 6f 76 65 20 76 61  6c 75 65 0d 03 f2 35 20  |=move value...5 |
00000ce0  20 20 6d 6f 76 20 39 2c  23 66 69 65 6c 64 20 20  |  mov 9,#field  |
00000cf0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 72  |             ; r|
00000d00  39 20 73 74 61 72 74 20  6f 66 20 66 69 65 6c 64  |9 start of field|
00000d10  0d 03 fc 0a 2e 6c 6f 6f  70 32 0d 04 06 3c 20 20  |.....loop2...<  |
00000d20  20 6d 6f 76 20 30 2c 39  20 20 20 20 20 20 20 20  | mov 0,9        |
00000d30  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 6c 65  |            ; le|
00000d40  74 20 70 69 65 63 65 20  66 61 6c 6c 20 64 6f 77  |t piece fall dow|
00000d50  6e 20 73 6c 6f 74 0d 04  10 0e 20 20 20 62 6c 20  |n slot....   bl |
00000d60  66 61 6c 6c 0d 04 1a 0f  20 20 20 62 6c 74 20 63  |fall....   blt c|
00000d70  6f 6e 74 0d 04 24 2e 20  20 20 62 6c 20 63 68 65  |ont..$.   bl che|
00000d80  63 6b 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |ck              |
00000d90  20 20 20 20 20 3b 20 76  61 6c 75 65 20 6d 6f 76  |     ; value mov|
00000da0  65 0d 04 2e 41 20 20 20  62 6c 74 20 65 6e 64 20  |e...A   blt end |
00000db0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000dc0  20 20 20 3b 20 69 66 20  77 6f 6e 2c 20 6e 6f 20  |   ; if won, no |
00000dd0  6e 65 65 64 20 74 6f 20  67 6f 20 66 75 72 74 68  |need to go furth|
00000de0  65 72 0d 04 38 3a 20 20  20 6d 6f 76 73 20 37 2c  |er..8:   movs 7,|
00000df0  37 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |7               |
00000e00  20 20 20 20 3b 20 63 68  65 63 6b 20 69 74 61 72  |    ; check itar|
00000e10  61 74 69 6f 6e 20 63 6f  6e 74 65 72 0d 04 42 2d  |ation conter..B-|
00000e20  20 20 20 73 74 72 6e 65  62 20 32 2c 5b 30 5d 20  |   strneb 2,[0] |
00000e30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000e40  70 75 74 20 70 69 65 63  65 0d 04 4c 41 20 20 20  |put piece..LA   |
00000e50  62 6c 6e 65 20 72 65 63  75 72 73 20 20 20 20 20  |blne recurs     |
00000e60  20 20 20 20 20 20 20 20  20 20 20 3b 20 63 61 6c  |           ; cal|
00000e70  63 75 6c 61 74 65 20 76  61 6c 75 65 20 66 6f 72  |culate value for|
00000e80  20 6e 65 78 74 20 6d 6f  76 65 0d 04 56 2e 20 20  | next move..V.  |
00000e90  20 6d 6f 76 6e 65 20 30  2c 23 97 22 b7 22 20 20  | movne 0,#."."  |
00000ea0  20 20 20 20 20 20 20 20  20 20 3b 20 72 65 6d 6f  |          ; remo|
00000eb0  76 65 20 70 69 65 63 65  0d 04 60 31 20 20 20 73  |ve piece..`1   s|
00000ec0  74 72 6e 65 62 20 30 2c  5b 31 5d 20 20 20 20 20  |trneb 0,[1]     |
00000ed0  20 20 20 20 20 20 20 20  20 20 3b 20 28 6e 6f 74  |          ; (not|
00000ee0  65 20 72 30 3d 3e 72 31  29 0d 04 6a 46 20 20 20  |e r0=>r1)..jF   |
00000ef0  73 75 62 6e 65 20 36 2c  36 2c 31 32 20 20 20 20  |subne 6,6,12    |
00000f00  20 20 20 20 20 20 20 20  20 20 20 3b 20 73 75 62  |           ; sub|
00000f10  74 72 61 63 74 20 6d 6f  76 65 20 76 61 6c 75 65  |tract move value|
00000f20  20 6f 66 20 6e 65 78 74  20 70 6c 61 79 65 72 0d  | of next player.|
00000f30  04 74 3d 20 20 20 63 6d  70 20 31 31 2c 36 20 20  |.t=   cmp 11,6  |
00000f40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000f50  20 3b 20 63 6f 6d 70 61  72 65 20 6f 6c 64 20 61  | ; compare old a|
00000f60  6e 64 20 6e 65 77 20 76  61 6c 75 65 0d 04 7e 4a  |nd new value..~J|
00000f70  20 20 20 61 64 64 65 71  73 20 38 2c 38 2c 38 2c  |   addeqs 8,8,8,|
00000f80  72 6f 72 23 31 33 20 20  20 20 20 20 20 20 3b 20  |ror#13        ; |
00000f90  69 66 20 65 71 75 61 6c  2c 20 35 30 25 20 63 68  |if equal, 50% ch|
00000fa0  61 6e 63 65 20 6f 66 20  74 61 6b 69 6e 67 20 6e  |ance of taking n|
00000fb0  65 77 20 6f 6e 65 0d 04  88 36 20 20 20 6d 6f 76  |ew one...6   mov|
00000fc0  6c 74 20 31 31 2c 36 20  20 20 20 20 20 20 20 20  |lt 11,6         |
00000fd0  20 20 20 20 20 20 20 20  3b 20 6e 65 77 20 76 61  |        ; new va|
00000fe0  6c 75 65 20 61 6e 64 20  6d 6f 76 65 0d 04 92 11  |lue and move....|
00000ff0  20 20 20 6d 6f 76 6c 74  20 31 30 2c 31 0d 04 9c  |   movlt 10,1...|
00001000  09 2e 63 6f 6e 74 0d 04  a6 3a 20 20 20 6c 64 72  |..cont...:   ldr|
00001010  62 20 30 2c 5b 39 2c 23  31 5d 21 20 20 20 20 20  |b 0,[9,#1]!     |
00001020  20 20 20 20 20 20 20 20  3b 20 69 6e 63 72 65 61  |        ; increa|
00001030  73 65 20 66 69 65 6c 64  20 70 6f 69 6e 74 65 72  |se field pointer|
00001040  0d 04 b0 30 20 20 20 63  6d 70 20 30 2c 23 31 33  |...0   cmp 0,#13|
00001050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001060  20 20 3b 20 72 65 61 63  68 65 64 20 65 6e 64 3f  |  ; reached end?|
00001070  0d 04 ba 30 20 20 20 62  6e 65 20 6c 6f 6f 70 32  |...0   bne loop2|
00001080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001090  20 20 3b 20 69 66 20 6e  6f 74 2c 20 6c 6f 6f 70  |  ; if not, loop|
000010a0  0d 04 c4 08 2e 65 6e 64  0d 04 ce 4f 20 20 20 63  |.....end...O   c|
000010b0  6d 6e 20 31 31 2c 23 26  31 30 30 30 30 30 30 30  |mn 11,#&10000000|
000010c0  20 20 20 20 20 20 20 20  20 20 3b 20 69 66 20 6e  |          ; if n|
000010d0  6f 20 70 6f 73 73 69 62  6c 65 20 6d 6f 76 65 2c  |o possible move,|
000010e0  20 69 6e 69 74 69 61 6c  20 76 61 6c 75 65 20 72  | initial value r|
000010f0  65 6d 61 69 6e 65 64 0d  04 d8 3d 20 20 20 6d 6f  |emained...=   mo|
00001100  76 65 71 20 31 32 2c 23  30 20 20 20 20 20 20 20  |veq 12,#0       |
00001110  20 20 20 20 20 20 20 20  20 3b 20 73 6f 20 73 65  |         ; so se|
00001120  74 20 6d 6f 76 65 20 76  61 6c 75 65 20 74 6f 20  |t move value to |
00001130  7a 65 72 6f 0d 04 e2 32  20 20 20 6d 6f 76 6e 65  |zero...2   movne|
00001140  20 31 32 2c 31 31 20 20  20 20 20 20 20 20 20 20  | 12,11          |
00001150  20 20 20 20 20 20 3b 20  72 31 32 3d 6d 6f 76 65  |      ; r12=move|
00001160  20 76 61 6c 75 65 0d 04  ec 36 20 20 20 6d 6f 76  | value...6   mov|
00001170  20 30 2c 31 30 20 20 20  20 20 20 20 20 20 20 20  | 0,10           |
00001180  20 20 20 20 20 20 20 20  3b 20 72 30 3d 61 64 64  |        ; r0=add|
00001190  72 65 73 73 20 6f 66 20  6d 6f 76 65 0d 04 f6 3e  |ress of move...>|
000011a0  20 20 20 6c 64 6d 66 64  20 31 33 21 2c 7b 31 2d  |   ldmfd 13!,{1-|
000011b0  31 31 2c 70 63 7d 5e 20  20 20 20 20 20 20 3b 20  |11,pc}^       ; |
000011c0  72 31 20 69 73 20 70 75  6c 6c 65 64 20 69 6e 73  |r1 is pulled ins|
000011d0  74 65 61 64 20 6f 66 20  72 30 0d 05 00 04 0d 05  |tead of r0......|
000011e0  0a 3f 2e 63 68 65 63 6b  20 20 20 20 20 20 20 20  |.?.check        |
000011f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001200  3b 20 76 61 6c 75 65 20  6d 6f 76 65 20 61 6e 64  |; value move and|
00001210  20 63 68 65 63 6b 20 69  66 20 77 6f 6e 0d 05 14  | check if won...|
00001220  15 20 20 20 73 74 6d 66  64 20 31 33 21 2c 7b 31  |.   stmfd 13!,{1|
00001230  34 7d 0d 05 1e 13 20 20  20 61 64 72 20 34 2c 64  |4}....   adr 4,d|
00001240  69 72 74 61 62 0d 05 28  0f 20 20 20 6d 6f 76 20  |irtab..(.   mov |
00001250  36 2c 23 30 0d 05 32 09  2e 6c 6f 6f 70 0d 05 3c  |6,#0..2..loop..<|
00001260  3a 20 20 20 6c 64 72 62  20 31 2c 5b 34 5d 2c 23  |:   ldrb 1,[4],#|
00001270  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |1              ;|
00001280  20 72 31 3d 64 69 72 65  63 74 69 6f 6e 20 66 6f  | r1=direction fo|
00001290  72 20 63 6f 75 6e 74 0d  05 46 3c 20 20 20 62 6c  |r count..F<   bl|
000012a0  20 63 6f 75 6e 74 20 20  20 20 20 20 20 20 20 20  | count          |
000012b0  20 20 20 20 20 20 20 20  20 3b 20 63 6f 75 6e 74  |         ; count|
000012c0  20 72 6f 77 20 6f 66 20  73 61 6d 65 20 70 69 65  | row of same pie|
000012d0  63 65 73 0d 05 50 0e 20  20 20 6d 6f 76 20 35 2c  |ces..P.   mov 5,|
000012e0  33 0d 05 5a 35 20 20 20  72 73 62 20 31 2c 31 2c  |3..Z5   rsb 1,1,|
000012f0  23 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0              |
00001300  20 20 20 3b 20 72 65 76  65 72 73 65 20 64 69 72  |   ; reverse dir|
00001310  65 63 74 69 6f 6e 0d 05  64 3c 20 20 20 62 6c 20  |ection..d<   bl |
00001320  63 6f 75 6e 74 20 20 20  20 20 20 20 20 20 20 20  |count           |
00001330  20 20 20 20 20 20 20 20  3b 20 63 6f 75 6e 74 20  |        ; count |
00001340  72 6f 77 20 6f 66 20 73  61 6d 65 20 70 69 65 63  |row of same piec|
00001350  65 73 0d 05 6e 10 20 20  20 61 64 64 20 33 2c 33  |es..n.   add 3,3|
00001360  2c 35 0d 05 78 3f 20 20  20 72 73 62 73 20 35 2c  |,5..x?   rsbs 5,|
00001370  33 2c 23 32 20 20 20 20  20 20 20 20 20 20 20 20  |3,#2            |
00001380  20 20 20 20 3b 20 63 68  65 63 6b 2c 20 33 20 6f  |    ; check, 3 o|
00001390  72 20 6d 6f 72 65 20 6e  65 69 67 68 62 6f 75 72  |r more neighbour|
000013a0  73 0d 05 82 3a 20 20 20  6d 6f 76 6c 74 20 31 31  |s...:   movlt 11|
000013b0  2c 23 26 31 30 30 30 30  20 20 20 20 20 20 20 20  |,#&10000        |
000013c0  20 20 20 3b 20 69 66 20  79 65 73 2c 20 77 6f 6e  |   ; if yes, won|
000013d0  2c 20 73 6f 20 72 65 74  75 72 6e 0d 05 8c 11 20  |, so return.... |
000013e0  20 20 6d 6f 76 6c 74 20  31 30 2c 30 0d 05 96 17  |  movlt 10,0....|
000013f0  20 20 20 6c 64 6d 6c 74  66 64 20 31 33 21 2c 7b  |   ldmltfd 13!,{|
00001400  70 63 7d 0d 05 a0 4a 20  20 20 6d 6f 76 20 35 2c  |pc}...J   mov 5,|
00001410  23 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#1              |
00001420  20 20 20 20 20 3b 20 76  61 6c 75 65 73 20 30 6e  |     ; values 0n|
00001430  3d 31 20 31 6e 3d 32 20  32 6e 3d 34 20 3e 32 6e  |=1 1n=2 2n=4 >2n|
00001440  3d 26 31 30 30 30 30 20  28 77 6f 6e 29 0d 05 aa  |=&10000 (won)...|
00001450  16 20 20 20 61 64 64 20  36 2c 36 2c 35 2c 6c 73  |.   add 6,6,5,ls|
00001460  6c 20 33 0d 05 b4 0f 20  20 20 63 6d 6e 20 31 2c  |l 3....   cmn 1,|
00001470  23 31 0d 05 be 0f 20 20  20 62 6e 65 20 6c 6f 6f  |#1....   bne loo|
00001480  70 0d 05 c8 15 20 20 20  6c 64 6d 66 64 20 31 33  |p....   ldmfd 13|
00001490  21 2c 7b 70 63 7d 0d 05  d2 04 0d 05 dc 3c 2e 63  |!,{pc}.......<.c|
000014a0  6f 75 6e 74 20 20 20 20  20 20 20 20 20 20 20 20  |ount            |
000014b0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 63 6f  |            ; co|
000014c0  75 6e 74 20 72 6f 77 20  6f 66 20 73 61 6d 65 20  |unt row of same |
000014d0  70 69 65 63 65 73 0d 05  e6 19 20 20 20 73 74 6d  |pieces....   stm|
000014e0  66 64 20 31 33 21 2c 7b  30 2c 34 2c 31 34 7d 0d  |fd 13!,{0,4,14}.|
000014f0  05 f0 0f 20 20 20 6d 6f  76 20 33 2c 23 30 0d 05  |...   mov 3,#0..|
00001500  fa 09 2e 6c 6f 6f 70 0d  06 04 14 20 20 20 6c 64  |...loop....   ld|
00001510  72 62 20 34 2c 5b 30 2c  31 5d 21 0d 06 0e 0e 20  |rb 4,[0,1]!.... |
00001520  20 20 63 6d 70 20 34 2c  32 0d 06 18 13 20 20 20  |  cmp 4,2....   |
00001530  61 64 64 65 71 20 33 2c  33 2c 23 31 0d 06 22 0f  |addeq 3,3,#1..".|
00001540  20 20 20 62 65 71 20 6c  6f 6f 70 0d 06 2c 1a 20  |   beq loop..,. |
00001550  20 20 6c 64 6d 66 64 20  31 33 21 2c 7b 30 2c 34  |  ldmfd 13!,{0,4|
00001560  2c 70 63 7d 5e 0d 06 36  04 0d 06 40 0b 2e 64 69  |,pc}^..6...@..di|
00001570  72 74 61 62 0d 06 4a 1e  20 20 20 64 63 62 20 37  |rtab..J.   dcb 7|
00001580  3a 64 63 62 20 38 3a 64  63 62 20 39 3a 64 63 62  |:dcb 8:dcb 9:dcb|
00001590  20 31 0d 06 54 05 5d 0d  06 5e 0f 66 69 65 6c 64  | 1..T.]..^.field|
000015a0  3d 26 38 33 30 30 0d 06  68 05 ed 0d 06 72 2d c8  |=&8300..h....r-.|
000015b0  99 20 38 2c 31 30 2c 22  3c 42 61 73 69 63 24 44  |. 8,10,"<Basic$D|
000015c0  69 72 3e 2e 43 6f 6e 6e  65 63 74 34 22 2c 26 66  |ir>.Connect4",&f|
000015d0  66 38 2c 2c 63 2c 4f 25  0d 06 7c 05 e0 0d 06 86  |f8,,c,O%..|.....|
000015e0  04 0d 06 90 0a dd 20 f2  64 69 72 0d 06 9a 11 20  |...... .dir.... |
000015f0  ea 20 70 6e 74 25 2c 73  24 2c 74 24 0d 06 a4 2a  |. pnt%,s$,t$...*|
00001600  20 c8 99 20 22 58 4f 53  5f 4d 6f 64 75 6c 65 22  | .. "XOS_Module"|
00001610  2c 31 38 2c 22 42 61 73  69 63 44 69 72 22 20 b8  |,18,"BasicDir" .|
00001620  20 3b 70 6e 74 25 0d 06  ae 15 20 e7 20 28 70 6e  | ;pnt%.... . (pn|
00001630  74 25 20 80 20 31 29 3d  30 20 e1 0d 06 c2 12 20  |t% . 1)=0 ..... |
00001640  c8 99 20 26 31 30 20 b8  20 70 6e 74 25 0d 06 cc  |.. &10 . pnt%...|
00001650  0c 20 70 6e 74 25 2b 3d  36 0d 06 d6 11 20 c8 95  |. pnt%+=6.... ..|
00001660  20 3f 70 6e 74 25 3c 3e  33 32 0d 06 e0 0d 20 20  | ?pnt%<>32....  |
00001670  70 6e 74 25 2b 3d 31 0d  06 ea 06 20 ce 0d 06 f4  |pnt%+=1.... ....|
00001680  0a 20 73 24 3d 22 22 0d  06 fe 0a 20 74 24 3d 22  |. s$="".... t$="|
00001690  22 0d 07 08 0c 20 70 6e  74 25 2b 3d 31 0d 07 12  |".... pnt%+=1...|
000016a0  10 20 c8 95 20 3f 70 6e  74 25 3e 33 31 0d 07 1c  |. .. ?pnt%>31...|
000016b0  1c 20 20 e7 20 3f 70 6e  74 25 3c 3e 33 34 20 74  |.  . ?pnt%<>34 t|
000016c0  24 2b 3d bd 3f 70 6e 74  25 0d 07 26 12 20 20 e7  |$+=.?pnt%..&.  .|
000016d0  20 3f 70 6e 74 25 3d 34  36 20 8c 0d 07 30 0d 20  | ?pnt%=46 ...0. |
000016e0  20 20 73 24 2b 3d 74 24  0d 07 3a 0c 20 20 20 74  |  s$+=t$..:.   t|
000016f0  24 3d 22 22 0d 07 44 07  20 20 cd 0d 07 4e 0d 20  |$=""..D.  ...N. |
00001700  20 70 6e 74 25 2b 3d 31  0d 07 58 06 20 ce 0d 07  | pnt%+=1..X. ...|
00001710  62 22 20 c8 99 20 26 32  34 2c 22 42 61 73 69 63  |b" .. &24,"Basic|
00001720  24 44 69 72 22 2c c0 73  24 29 2c a9 73 24 2d 31  |$Dir",.s$),.s$-1|
00001730  0d 07 6c 05 e1 0d ff                              |..l....|
00001737