Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_23.ADF » F/M\Ctut2

F/M\Ctut2

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 » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_23.ADF
Filename: F/M\Ctut2
Read OK:
File size: 1261 bytes
Load address: 4D206576
Exec address: 7574432F
File contents
 
lives (890-920) print the man at the top of the screen by tranferring the
data from &1E20 to the screen area at &5A38 and from &1E38 to &5B78.  This
is followed by printing the data dat (line 1940) using the dh routine.

lev (930-950) sets the level and prints Thinking.
 
load (960-1010) first checks the level, doubles it (ASL A) and subtracts
two (DEX:DEX) so the value in X register is 0, 2, 4, 6 or 8. This is used
as an index to select the data address from the data table in line 1950.
The data is then loaded from that address adding 159 each time to convert
to the character numbers.  Line 980 calls the subroutine to save the key
address.  Line 990 counts the number of diamonds, earth and mushrooms and
stores these in maxdi%, maxea% and maxsq%.  Line 1000 loads the level data
over the memory area &534B onwards as explained earlier.

set (1020) sets the variables MX% and MY% for the position of the man.

set2 (1030) sets x% and y% in the same way.

sc1 and sc2 (1040-1070) print the score.  sc (1060-1070) is the routine
for printing decimal from the hex value in the variable digits.  sc1 adds
3 each time for earth collected and sc2 adds 10 for diamonds.

prt (1100) together with the following routines to line 1150 print the
number of diamonds, earth and mushrooms remaining.  h, t and u calulate
the hundreds, tens and units of the value stored at &70.  di, ea and sq
set the values and print co-ordinates for each one.

ki (1160-1180) flashes the key by printing charater 232 or 233.  The
characters alternating to produce the flashing.

kyaddr (1190) uses routine cal to find the address of the key from its
co-ordinates and saves this in the variable kad.

eas(1200) and dis (1210) count the earth and diamonds collected and call
sc1 or sc1 to add to the score.

chk1 (1220,1230) checks whether you have lost a life or completed a level.
Also when all levels are completed.

ss% (1240) sets data to D% and addr to &6390.

ded (1250,1260) flashes the man. decreases li% and increases deadman, when
you lose a life.

move (1270-1330) reads the keys.  With A register loaded with 129, Y with
&FF and X with the negative INKEY value, after the call to osbyte Y=0 if
the key is not pressed and -1 when pressed.  If no keys are pressed, all
comparisons are equal and the routine ends.  If a key is pressed, the
routine for that key is called as the comparison is not equal.

Keys Q and S call the routines sdoff and sdon as explained.

The ESCAPE key calls the routine ded and replaces the data address with a
space.

The four movement routines (1340-1440) are somewhat complex.              
It is first necessary to check the address of the position to which
movement is to be made.  For left and right movement this is -1 and +1
relative to the position of the man and for up and down they are -24 and
+24.  I used the indexed addressing LDA(mp),Y to do this and to avoid the
negative values, which are not permissible, I set Y to 48 so that the
address in mp +48 points to the address of the man.  The address held in
mp is calculated as the address of the man minus 48.  With Y=47 will then
point to the position on the left and Y=49 that on the right.  Similarly,
Y=24 points to the one above and Y=72 to the one below.
Each routine first calculates the address to be held in mp with the
routine mpos and checks the relevant address as explained above.  Then the
following comparisons are made -

     CMP#231 (safe) - if equal, cannot move
     if greater (carry flag set) ie Key collected - jump chg to call T%
     CMP#224 (brick) - if equal, cannot move
     CMP#225 (rock) - if up or down and equal - cannot move
                    - if left or right, check next address
                      if not 229 (space), cannot move
                      else move rock
     CMP#227 (mushroom) - if equal, JMP ded
     CMP#226 (diamond) - if equal, JSRdis, move
     CMP#228 (earth) - if equal, JSReas, move
                       else move

When a move is made the character in memory is replaced with a space
character and the variables re-calculated and the dispay redrawn.

rep (1450) waits for space to be pressed.

gamend (1460-1480) prints the final message (DATA lines 1980-2010), starts
the tune with *FX14,4 and asks if you want another game.  Then waits for Y
or N to be pressed.

mload (1490-1570) first print a message asking for the suffix number
(1-5).  After pressing the number key, the number is inserted in the
loading message (DATA line 2080) and in the loading command (DATA line
2090) for the file to be loaded.

Lines 1580 - 1610 make space for the variables.
00000000  20 0d 6c 69 76 65 73 20  28 38 39 30 2d 39 32 30  | .lives (890-920|
00000010  29 20 70 72 69 6e 74 1a  20 74 68 65 20 6d 61 6e  |) print. the man|
00000020  20 61 74 20 74 68 65 20  74 6f 70 20 6f 66 20 74  | at the top of t|
00000030  68 65 20 73 63 72 65 65  6e 20 62 79 20 74 72 61  |he screen by tra|
00000040  6e 66 65 72 72 69 6e 67  20 74 68 65 0d 64 61 74  |nferring the.dat|
00000050  61 20 66 72 6f 6d 20 26  31 45 32 30 20 74 6f 20  |a from &1E20 to |
00000060  74 68 65 20 73 63 72 65  65 6e 20 61 72 65 61 20  |the screen area |
00000070  61 74 20 26 35 41 33 38  20 61 6e 64 20 66 72 6f  |at &5A38 and fro|
00000080  6d 20 26 31 45 33 38 20  74 6f 20 26 35 42 37 38  |m &1E38 to &5B78|
00000090  2e 20 20 54 68 69 73 0d  69 73 20 66 6f 6c 6c 6f  |.  This.is follo|
000000a0  77 65 64 20 62 79 20 70  72 69 6e 74 69 6e 67 20  |wed by printing |
000000b0  74 68 65 20 64 61 74 61  20 64 61 74 20 28 6c 69  |the data dat (li|
000000c0  6e 65 20 31 39 34 30 29  20 75 73 69 6e 67 20 74  |ne 1940) using t|
000000d0  68 65 20 64 68 20 72 6f  75 74 69 6e 65 2e 0d 0d  |he dh routine...|
000000e0  6c 65 76 20 28 39 33 30  2d 39 35 30 29 20 73 65  |lev (930-950) se|
000000f0  74 73 20 74 68 65 20 6c  65 76 65 6c 20 61 6e 64  |ts the level and|
00000100  20 70 72 69 6e 74 73 20  54 68 69 6e 6b 69 6e 67  | prints Thinking|
00000110  2e 0d 20 0d 6c 6f 61 64  1a 20 28 39 36 30 2d 31  |.. .load. (960-1|
00000120  30 31 30 29 1a 20 66 69  72 73 74 20 63 68 65 63  |010). first chec|
00000130  6b 73 20 74 68 65 20 6c  65 76 65 6c 2c 20 64 6f  |ks the level, do|
00000140  75 62 6c 65 73 20 69 74  20 28 41 53 4c 20 41 29  |ubles it (ASL A)|
00000150  20 61 6e 64 20 73 75 62  74 72 61 63 74 73 0d 74  | and subtracts.t|
00000160  77 6f 20 28 44 45 58 3a  44 45 58 29 20 73 6f 20  |wo (DEX:DEX) so |
00000170  74 68 65 20 76 61 6c 75  65 1a 20 69 6e 20 58 20  |the value. in X |
00000180  72 65 67 69 73 74 65 72  20 69 73 20 30 2c 20 32  |register is 0, 2|
00000190  2c 20 34 2c 20 36 20 6f  72 20 38 2e 20 54 68 69  |, 4, 6 or 8. Thi|
000001a0  73 20 69 73 20 75 73 65  64 0d 61 73 20 61 6e 20  |s is used.as an |
000001b0  69 6e 64 65 78 20 74 6f  20 73 65 6c 65 63 74 20  |index to select |
000001c0  74 68 65 1a 20 64 61 74  61 1a 20 61 64 64 72 65  |the. data. addre|
000001d0  73 73 20 66 72 6f 6d 20  74 68 65 20 64 61 74 61  |ss from the data|
000001e0  20 74 61 62 6c 65 20 69  6e 20 6c 69 6e 65 20 31  | table in line 1|
000001f0  39 35 30 2e 0d 54 68 65  20 64 61 74 61 20 69 73  |950..The data is|
00000200  20 74 68 65 6e 20 6c 6f  61 64 65 64 20 66 72 6f  | then loaded fro|
00000210  6d 20 74 68 61 74 20 61  64 64 72 65 73 73 1a 20  |m that address. |
00000220  61 64 64 69 6e 67 20 31  35 39 20 65 61 63 68 20  |adding 159 each |
00000230  74 69 6d 65 20 74 6f 20  63 6f 6e 76 65 72 74 0d  |time to convert.|
00000240  74 6f 20 74 68 65 20 63  68 61 72 61 63 74 65 72  |to the character|
00000250  20 6e 75 6d 62 65 72 73  2e 20 20 4c 69 6e 65 20  | numbers.  Line |
00000260  39 38 30 20 63 61 6c 6c  73 20 74 68 65 20 73 75  |980 calls the su|
00000270  62 72 6f 75 74 69 6e 65  1a 20 74 6f 1a 20 73 61  |broutine. to. sa|
00000280  76 65 20 74 68 65 20 6b  65 79 0d 61 64 64 72 65  |ve the key.addre|
00000290  73 73 2e 1a 20 20 4c 69  6e 65 20 39 39 30 20 63  |ss..  Line 990 c|
000002a0  6f 75 6e 74 73 20 74 68  65 20 6e 75 6d 62 65 72  |ounts the number|
000002b0  20 6f 66 20 64 69 61 6d  6f 6e 64 73 2c 20 65 61  | of diamonds, ea|
000002c0  72 74 68 20 61 6e 64 20  6d 75 73 68 72 6f 6f 6d  |rth and mushroom|
000002d0  73 20 61 6e 64 0d 73 74  6f 72 65 73 20 74 68 65  |s and.stores the|
000002e0  73 65 20 69 6e 20 6d 61  78 64 69 25 2c 20 6d 61  |se in maxdi%, ma|
000002f0  78 65 61 25 20 61 6e 64  20 6d 61 78 73 71 25 2e  |xea% and maxsq%.|
00000300  20 20 4c 69 6e 65 20 31  30 30 30 20 6c 6f 61 64  |  Line 1000 load|
00000310  73 20 74 68 65 20 6c 65  76 65 6c 20 64 61 74 61  |s the level data|
00000320  0d 6f 76 65 72 20 74 68  65 20 6d 65 6d 6f 72 79  |.over the memory|
00000330  20 61 72 65 61 20 26 35  33 34 42 20 6f 6e 77 61  | area &534B onwa|
00000340  72 64 73 20 61 73 20 65  78 70 6c 61 69 6e 65 64  |rds as explained|
00000350  20 65 61 72 6c 69 65 72  2e 0d 0d 73 65 74 20 28  | earlier...set (|
00000360  31 30 32 30 29 20 73 65  74 73 20 74 68 65 20 76  |1020) sets the v|
00000370  61 72 69 61 62 6c 65 73  20 4d 58 25 20 61 6e 64  |ariables MX% and|
00000380  20 4d 59 25 20 66 6f 72  20 74 68 65 20 70 6f 73  | MY% for the pos|
00000390  69 74 69 6f 6e 20 6f 66  20 74 68 65 20 6d 61 6e  |ition of the man|
000003a0  2e 0d 0d 73 65 74 32 20  28 31 30 33 30 29 20 73  |...set2 (1030) s|
000003b0  65 74 73 20 78 25 20 61  6e 64 20 79 25 20 69 6e  |ets x% and y% in|
000003c0  20 74 68 65 20 73 61 6d  65 20 77 61 79 2e 0d 0d  | the same way...|
000003d0  73 63 31 1a 20 61 6e 64  1a 20 73 63 32 1a 20 28  |sc1. and. sc2. (|
000003e0  31 30 34 30 2d 31 30 37  30 29 20 70 72 69 6e 74  |1040-1070) print|
000003f0  20 74 68 65 20 73 63 6f  72 65 2e 20 20 73 63 20  | the score.  sc |
00000400  28 31 30 36 30 2d 31 30  37 30 29 20 69 73 20 74  |(1060-1070) is t|
00000410  68 65 20 72 6f 75 74 69  6e 65 0d 66 6f 72 20 70  |he routine.for p|
00000420  72 69 6e 74 69 6e 67 20  64 65 63 69 6d 61 6c 20  |rinting decimal |
00000430  66 72 6f 6d 1a 20 74 68  65 20 68 65 78 20 76 61  |from. the hex va|
00000440  6c 75 65 20 69 6e 20 74  68 65 20 76 61 72 69 61  |lue in the varia|
00000450  62 6c 65 20 64 69 67 69  74 73 2e 20 20 73 63 31  |ble digits.  sc1|
00000460  20 61 64 64 73 0d 33 20  65 61 63 68 20 74 69 6d  | adds.3 each tim|
00000470  65 20 66 6f 72 20 65 61  72 74 68 20 63 6f 6c 6c  |e for earth coll|
00000480  65 63 74 65 64 20 61 6e  64 20 73 63 32 20 61 64  |ected and sc2 ad|
00000490  64 73 20 31 30 20 66 6f  72 20 64 69 61 6d 6f 6e  |ds 10 for diamon|
000004a0  64 73 2e 0d 0d 70 72 74  20 28 31 31 30 30 29 20  |ds...prt (1100) |
000004b0  74 6f 67 65 74 68 65 72  20 77 69 74 68 20 74 68  |together with th|
000004c0  65 1a 20 66 6f 6c 6c 6f  77 69 6e 67 1a 20 72 6f  |e. following. ro|
000004d0  75 74 69 6e 65 73 1a 20  74 6f 1a 20 6c 69 6e 65  |utines. to. line|
000004e0  20 31 31 35 30 20 70 72  69 6e 74 20 74 68 65 0d  | 1150 print the.|
000004f0  6e 75 6d 62 65 72 20 6f  66 20 64 69 61 6d 6f 6e  |number of diamon|
00000500  64 73 2c 20 65 61 72 74  68 20 61 6e 64 20 6d 75  |ds, earth and mu|
00000510  73 68 72 6f 6f 6d 73 20  72 65 6d 61 69 6e 69 6e  |shrooms remainin|
00000520  67 2e 20 20 68 2c 20 74  1a 20 61 6e 64 1a 20 75  |g.  h, t. and. u|
00000530  1a 20 63 61 6c 75 6c 61  74 65 0d 74 68 65 1a 20  |. calulate.the. |
00000540  68 75 6e 64 72 65 64 73  2c 1a 20 74 65 6e 73 1a  |hundreds,. tens.|
00000550  20 61 6e 64 20 75 6e 69  74 73 20 6f 66 20 74 68  | and units of th|
00000560  65 20 76 61 6c 75 65 20  73 74 6f 72 65 64 20 61  |e value stored a|
00000570  74 20 26 37 30 2e 20 20  64 69 2c 20 65 61 20 61  |t &70.  di, ea a|
00000580  6e 64 20 73 71 0d 73 65  74 20 74 68 65 20 76 61  |nd sq.set the va|
00000590  6c 75 65 73 20 61 6e 64  20 70 72 69 6e 74 20 63  |lues and print c|
000005a0  6f 2d 6f 72 64 69 6e 61  74 65 73 20 66 6f 72 20  |o-ordinates for |
000005b0  65 61 63 68 20 6f 6e 65  2e 0d 0d 6b 69 20 28 31  |each one...ki (1|
000005c0  31 36 30 2d 31 31 38 30  29 20 66 6c 61 73 68 65  |160-1180) flashe|
000005d0  73 1a 20 74 68 65 1a 20  6b 65 79 1a 20 62 79 1a  |s. the. key. by.|
000005e0  20 70 72 69 6e 74 69 6e  67 1a 20 63 68 61 72 61  | printing. chara|
000005f0  74 65 72 1a 20 32 33 32  20 6f 72 20 32 33 33 2e  |ter. 232 or 233.|
00000600  20 20 54 68 65 0d 63 68  61 72 61 63 74 65 72 73  |  The.characters|
00000610  20 61 6c 74 65 72 6e 61  74 69 6e 67 20 74 6f 20  | alternating to |
00000620  70 72 6f 64 75 63 65 20  74 68 65 20 66 6c 61 73  |produce the flas|
00000630  68 69 6e 67 2e 0d 0d 6b  79 61 64 64 72 20 28 31  |hing...kyaddr (1|
00000640  31 39 30 29 20 75 73 65  73 20 72 6f 75 74 69 6e  |190) uses routin|
00000650  65 20 63 61 6c 20 74 6f  20 66 69 6e 64 20 74 68  |e cal to find th|
00000660  65 20 61 64 64 72 65 73  73 20 6f 66 1a 20 74 68  |e address of. th|
00000670  65 1a 20 6b 65 79 1a 20  66 72 6f 6d 1a 20 69 74  |e. key. from. it|
00000680  73 0d 63 6f 2d 6f 72 64  69 6e 61 74 65 73 20 61  |s.co-ordinates a|
00000690  6e 64 20 73 61 76 65 73  20 74 68 69 73 20 69 6e  |nd saves this in|
000006a0  20 74 68 65 20 76 61 72  69 61 62 6c 65 20 6b 61  | the variable ka|
000006b0  64 2e 0d 0d 65 61 73 1a  28 31 32 30 30 29 20 61  |d...eas.(1200) a|
000006c0  6e 64 20 64 69 73 20 28  31 32 31 30 29 20 63 6f  |nd dis (1210) co|
000006d0  75 6e 74 20 74 68 65 20  65 61 72 74 68 1a 20 61  |unt the earth. a|
000006e0  6e 64 20 64 69 61 6d 6f  6e 64 73 20 63 6f 6c 6c  |nd diamonds coll|
000006f0  65 63 74 65 64 20 61 6e  64 20 63 61 6c 6c 0d 73  |ected and call.s|
00000700  63 31 20 6f 72 20 73 63  31 20 74 6f 20 61 64 64  |c1 or sc1 to add|
00000710  20 74 6f 20 74 68 65 20  73 63 6f 72 65 2e 0d 0d  | to the score...|
00000720  63 68 6b 31 20 28 31 32  32 30 2c 31 32 33 30 29  |chk1 (1220,1230)|
00000730  20 63 68 65 63 6b 73 20  77 68 65 74 68 65 72 20  | checks whether |
00000740  79 6f 75 20 68 61 76 65  20 6c 6f 73 74 20 61 20  |you have lost a |
00000750  6c 69 66 65 20 6f 72 20  63 6f 6d 70 6c 65 74 65  |life or complete|
00000760  64 20 61 20 6c 65 76 65  6c 2e 0d 41 6c 73 6f 20  |d a level..Also |
00000770  77 68 65 6e 20 61 6c 6c  20 6c 65 76 65 6c 73 20  |when all levels |
00000780  61 72 65 20 63 6f 6d 70  6c 65 74 65 64 2e 0d 0d  |are completed...|
00000790  73 73 25 20 28 31 32 34  30 29 20 73 65 74 73 20  |ss% (1240) sets |
000007a0  64 61 74 61 20 74 6f 20  44 25 20 61 6e 64 20 61  |data to D% and a|
000007b0  64 64 72 20 74 6f 20 26  36 33 39 30 2e 0d 0d 64  |ddr to &6390...d|
000007c0  65 64 20 28 31 32 35 30  2c 31 32 36 30 29 20 66  |ed (1250,1260) f|
000007d0  6c 61 73 68 65 73 20 74  68 65 20 6d 61 6e 2e 20  |lashes the man. |
000007e0  64 65 63 72 65 61 73 65  73 20 6c 69 25 20 61 6e  |decreases li% an|
000007f0  64 20 69 6e 63 72 65 61  73 65 73 20 64 65 61 64  |d increases dead|
00000800  6d 61 6e 2c 20 77 68 65  6e 0d 79 6f 75 20 6c 6f  |man, when.you lo|
00000810  73 65 20 61 20 6c 69 66  65 2e 0d 0d 6d 6f 76 65  |se a life...move|
00000820  20 28 31 32 37 30 2d 31  33 33 30 29 20 72 65 61  | (1270-1330) rea|
00000830  64 73 20 74 68 65 20 6b  65 79 73 2e 20 20 57 69  |ds the keys.  Wi|
00000840  74 68 20 41 20 72 65 67  69 73 74 65 72 20 6c 6f  |th A register lo|
00000850  61 64 65 64 1a 20 77 69  74 68 20 31 32 39 2c 20  |aded. with 129, |
00000860  59 20 77 69 74 68 0d 26  46 46 20 61 6e 64 20 58  |Y with.&FF and X|
00000870  20 77 69 74 68 20 74 68  65 20 6e 65 67 61 74 69  | with the negati|
00000880  76 65 20 49 4e 4b 45 59  20 76 61 6c 75 65 2c 20  |ve INKEY value, |
00000890  61 66 74 65 72 20 74 68  65 1a 20 63 61 6c 6c 1a  |after the. call.|
000008a0  20 74 6f 20 6f 73 62 79  74 65 20 59 3d 30 20 69  | to osbyte Y=0 i|
000008b0  66 0d 74 68 65 20 6b 65  79 20 69 73 20 6e 6f 74  |f.the key is not|
000008c0  20 70 72 65 73 73 65 64  20 61 6e 64 20 2d 31 20  | pressed and -1 |
000008d0  77 68 65 6e 20 70 72 65  73 73 65 64 2e 20 20 49  |when pressed.  I|
000008e0  66 20 6e 6f 20 6b 65 79  73 1a 20 61 72 65 1a 20  |f no keys. are. |
000008f0  70 72 65 73 73 65 64 2c  20 61 6c 6c 0d 63 6f 6d  |pressed, all.com|
00000900  70 61 72 69 73 6f 6e 73  20 61 72 65 20 65 71 75  |parisons are equ|
00000910  61 6c 20 61 6e 64 20 74  68 65 1a 20 72 6f 75 74  |al and the. rout|
00000920  69 6e 65 1a 20 65 6e 64  73 2e 1a 20 20 49 66 1a  |ine. ends..  If.|
00000930  20 61 1a 20 6b 65 79 20  69 73 20 70 72 65 73 73  | a. key is press|
00000940  65 64 2c 20 74 68 65 0d  72 6f 75 74 69 6e 65 20  |ed, the.routine |
00000950  66 6f 72 20 74 68 61 74  20 6b 65 79 20 69 73 20  |for that key is |
00000960  63 61 6c 6c 65 64 20 61  73 20 74 68 65 20 63 6f  |called as the co|
00000970  6d 70 61 72 69 73 6f 6e  20 69 73 20 6e 6f 74 20  |mparison is not |
00000980  65 71 75 61 6c 2e 0d 0d  4b 65 79 73 20 51 20 61  |equal...Keys Q a|
00000990  6e 64 20 53 20 63 61 6c  6c 20 74 68 65 20 72 6f  |nd S call the ro|
000009a0  75 74 69 6e 65 73 20 73  64 6f 66 66 20 61 6e 64  |utines sdoff and|
000009b0  20 73 64 6f 6e 20 61 73  20 65 78 70 6c 61 69 6e  | sdon as explain|
000009c0  65 64 2e 0d 0d 54 68 65  20 45 53 43 41 50 45 1a  |ed...The ESCAPE.|
000009d0  20 6b 65 79 20 63 61 6c  6c 73 20 74 68 65 20 72  | key calls the r|
000009e0  6f 75 74 69 6e 65 20 64  65 64 20 61 6e 64 20 72  |outine ded and r|
000009f0  65 70 6c 61 63 65 73 20  74 68 65 20 64 61 74 61  |eplaces the data|
00000a00  20 61 64 64 72 65 73 73  20 77 69 74 68 20 61 0d  | address with a.|
00000a10  73 70 61 63 65 2e 0d 0d  54 68 65 20 66 6f 75 72  |space...The four|
00000a20  20 6d 6f 76 65 6d 65 6e  74 20 72 6f 75 74 69 6e  | movement routin|
00000a30  65 73 20 28 31 33 34 30  2d 31 34 34 30 29 20 61  |es (1340-1440) a|
00000a40  72 65 20 73 6f 6d 65 77  68 61 74 20 63 6f 6d 70  |re somewhat comp|
00000a50  6c 65 78 2e 20 20 20 20  20 20 20 20 20 20 20 20  |lex.            |
00000a60  20 20 0d 49 74 1a 20 69  73 1a 20 66 69 72 73 74  |  .It. is. first|
00000a70  1a 20 6e 65 63 65 73 73  61 72 79 1a 20 74 6f 1a  |. necessary. to.|
00000a80  20 63 68 65 63 6b 1a 20  74 68 65 1a 20 61 64 64  | check. the. add|
00000a90  72 65 73 73 20 6f 66 20  74 68 65 20 70 6f 73 69  |ress of the posi|
00000aa0  74 69 6f 6e 20 74 6f 20  77 68 69 63 68 0d 6d 6f  |tion to which.mo|
00000ab0  76 65 6d 65 6e 74 20 69  73 20 74 6f 20 62 65 20  |vement is to be |
00000ac0  6d 61 64 65 2e 20 20 46  6f 72 20 6c 65 66 74 20  |made.  For left |
00000ad0  61 6e 64 1a 20 72 69 67  68 74 1a 20 6d 6f 76 65  |and. right. move|
00000ae0  6d 65 6e 74 1a 20 74 68  69 73 1a 20 69 73 20 2d  |ment. this. is -|
00000af0  31 20 61 6e 64 20 2b 31  0d 72 65 6c 61 74 69 76  |1 and +1.relativ|
00000b00  65 20 74 6f 20 74 68 65  20 70 6f 73 69 74 69 6f  |e to the positio|
00000b10  6e 20 6f 66 20 74 68 65  20 6d 61 6e 20 61 6e 64  |n of the man and|
00000b20  20 66 6f 72 20 75 70 20  61 6e 64 20 64 6f 77 6e  | for up and down|
00000b30  1a 20 74 68 65 79 1a 20  61 72 65 20 2d 32 34 20  |. they. are -24 |
00000b40  61 6e 64 0d 2b 32 34 2e  1a 20 20 49 20 75 73 65  |and.+24..  I use|
00000b50  64 20 74 68 65 20 69 6e  64 65 78 65 64 20 61 64  |d the indexed ad|
00000b60  64 72 65 73 73 69 6e 67  20 4c 44 41 28 6d 70 29  |dressing LDA(mp)|
00000b70  2c 59 20 74 6f 20 64 6f  20 74 68 69 73 20 61 6e  |,Y to do this an|
00000b80  64 20 74 6f 20 61 76 6f  69 64 20 74 68 65 0d 6e  |d to avoid the.n|
00000b90  65 67 61 74 69 76 65 20  76 61 6c 75 65 73 2c 20  |egative values, |
00000ba0  77 68 69 63 68 20 61 72  65 20 6e 6f 74 1a 20 70  |which are not. p|
00000bb0  65 72 6d 69 73 73 69 62  6c 65 2c 1a 20 49 1a 20  |ermissible,. I. |
00000bc0  73 65 74 1a 20 59 1a 20  74 6f 20 34 38 20 73 6f  |set. Y. to 48 so|
00000bd0  20 74 68 61 74 20 74 68  65 0d 61 64 64 72 65 73  | that the.addres|
00000be0  73 20 69 6e 20 6d 70 20  2b 34 38 20 70 6f 69 6e  |s in mp +48 poin|
00000bf0  74 73 20 74 6f 20 74 68  65 20 61 64 64 72 65 73  |ts to the addres|
00000c00  73 20 6f 66 20 74 68 65  1a 20 6d 61 6e 2e 1a 20  |s of the. man.. |
00000c10  20 54 68 65 20 61 64 64  72 65 73 73 20 68 65 6c  | The address hel|
00000c20  64 20 69 6e 0d 6d 70 20  69 73 20 63 61 6c 63 75  |d in.mp is calcu|
00000c30  6c 61 74 65 64 20 61 73  20 74 68 65 20 61 64 64  |lated as the add|
00000c40  72 65 73 73 20 6f 66 20  74 68 65 20 6d 61 6e 20  |ress of the man |
00000c50  6d 69 6e 75 73 20 34 38  2e 20 20 57 69 74 68 1a  |minus 48.  With.|
00000c60  20 59 3d 34 37 20 77 69  6c 6c 20 74 68 65 6e 0d  | Y=47 will then.|
00000c70  70 6f 69 6e 74 1a 20 74  6f 20 74 68 65 20 70 6f  |point. to the po|
00000c80  73 69 74 69 6f 6e 20 6f  6e 20 74 68 65 20 6c 65  |sition on the le|
00000c90  66 74 20 61 6e 64 20 59  3d 34 39 20 74 68 61 74  |ft and Y=49 that|
00000ca0  20 6f 6e 20 74 68 65 20  72 69 67 68 74 2e 20 20  | on the right.  |
00000cb0  53 69 6d 69 6c 61 72 6c  79 2c 0d 59 3d 32 34 20  |Similarly,.Y=24 |
00000cc0  70 6f 69 6e 74 73 20 74  6f 20 74 68 65 20 6f 6e  |points to the on|
00000cd0  65 20 61 62 6f 76 65 20  61 6e 64 20 59 3d 37 32  |e above and Y=72|
00000ce0  20 74 6f 20 74 68 65 20  6f 6e 65 20 62 65 6c 6f  | to the one belo|
00000cf0  77 2e 0d 45 61 63 68 20  72 6f 75 74 69 6e 65 1a  |w..Each routine.|
00000d00  20 66 69 72 73 74 1a 20  63 61 6c 63 75 6c 61 74  | first. calculat|
00000d10  65 73 1a 20 74 68 65 1a  20 61 64 64 72 65 73 73  |es. the. address|
00000d20  1a 20 74 6f 1a 20 62 65  1a 20 68 65 6c 64 20 69  |. to. be. held i|
00000d30  6e 20 6d 70 20 77 69 74  68 20 74 68 65 0d 72 6f  |n mp with the.ro|
00000d40  75 74 69 6e 65 20 6d 70  6f 73 20 61 6e 64 20 63  |utine mpos and c|
00000d50  68 65 63 6b 73 20 74 68  65 20 72 65 6c 65 76 61  |hecks the releva|
00000d60  6e 74 20 61 64 64 72 65  73 73 20 61 73 20 65 78  |nt address as ex|
00000d70  70 6c 61 69 6e 65 64 20  61 62 6f 76 65 2e 20 20  |plained above.  |
00000d80  54 68 65 6e 20 74 68 65  0d 66 6f 6c 6c 6f 77 69  |Then the.followi|
00000d90  6e 67 20 63 6f 6d 70 61  72 69 73 6f 6e 73 20 61  |ng comparisons a|
00000da0  72 65 20 6d 61 64 65 20  2d 0d 0d 20 20 20 20 20  |re made -..     |
00000db0  43 4d 50 23 32 33 31 20  28 73 61 66 65 29 20 2d  |CMP#231 (safe) -|
00000dc0  20 69 66 20 65 71 75 61  6c 2c 20 63 61 6e 6e 6f  | if equal, canno|
00000dd0  74 20 6d 6f 76 65 0d 20  20 20 20 20 69 66 20 67  |t move.     if g|
00000de0  72 65 61 74 65 72 20 28  63 61 72 72 79 20 66 6c  |reater (carry fl|
00000df0  61 67 20 73 65 74 29 20  69 65 20 4b 65 79 20 63  |ag set) ie Key c|
00000e00  6f 6c 6c 65 63 74 65 64  20 2d 20 6a 75 6d 70 20  |ollected - jump |
00000e10  63 68 67 20 74 6f 20 63  61 6c 6c 20 54 25 0d 20  |chg to call T%. |
00000e20  20 20 20 20 43 4d 50 23  32 32 34 20 28 62 72 69  |    CMP#224 (bri|
00000e30  63 6b 29 20 2d 20 69 66  20 65 71 75 61 6c 2c 20  |ck) - if equal, |
00000e40  63 61 6e 6e 6f 74 20 6d  6f 76 65 0d 20 20 20 20  |cannot move.    |
00000e50  20 43 4d 50 23 32 32 35  20 28 72 6f 63 6b 29 20  | CMP#225 (rock) |
00000e60  2d 20 69 66 20 75 70 20  6f 72 20 64 6f 77 6e 20  |- if up or down |
00000e70  61 6e 64 20 65 71 75 61  6c 20 2d 20 63 61 6e 6e  |and equal - cann|
00000e80  6f 74 20 6d 6f 76 65 0d  20 20 20 20 20 20 20 20  |ot move.        |
00000e90  20 20 20 20 20 20 20 20  20 20 20 20 2d 20 69 66  |            - if|
00000ea0  20 6c 65 66 74 20 6f 72  20 72 69 67 68 74 2c 20  | left or right, |
00000eb0  63 68 65 63 6b 20 6e 65  78 74 20 61 64 64 72 65  |check next addre|
00000ec0  73 73 0d 20 20 20 20 20  20 20 20 20 20 20 20 20  |ss.             |
00000ed0  20 20 20 20 20 20 20 20  20 69 66 20 6e 6f 74 20  |         if not |
00000ee0  32 32 39 20 28 73 70 61  63 65 29 2c 20 63 61 6e  |229 (space), can|
00000ef0  6e 6f 74 20 6d 6f 76 65  0d 20 20 20 20 20 20 20  |not move.       |
00000f00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 65  |               e|
00000f10  6c 73 65 20 6d 6f 76 65  20 72 6f 63 6b 0d 20 20  |lse move rock.  |
00000f20  20 20 20 43 4d 50 23 32  32 37 20 28 6d 75 73 68  |   CMP#227 (mush|
00000f30  72 6f 6f 6d 29 20 2d 20  69 66 20 65 71 75 61 6c  |room) - if equal|
00000f40  2c 20 4a 4d 50 20 64 65  64 0d 20 20 20 20 20 43  |, JMP ded.     C|
00000f50  4d 50 23 32 32 36 20 28  64 69 61 6d 6f 6e 64 29  |MP#226 (diamond)|
00000f60  20 2d 20 69 66 20 65 71  75 61 6c 2c 20 4a 53 52  | - if equal, JSR|
00000f70  64 69 73 2c 20 6d 6f 76  65 0d 20 20 20 20 20 43  |dis, move.     C|
00000f80  4d 50 23 32 32 38 20 28  65 61 72 74 68 29 20 2d  |MP#228 (earth) -|
00000f90  20 69 66 20 65 71 75 61  6c 2c 20 4a 53 52 65 61  | if equal, JSRea|
00000fa0  73 2c 20 6d 6f 76 65 0d  20 20 20 20 20 20 20 20  |s, move.        |
00000fb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 65  |               e|
00000fc0  6c 73 65 20 6d 6f 76 65  0d 0d 57 68 65 6e 1a 20  |lse move..When. |
00000fd0  61 20 6d 6f 76 65 20 69  73 20 6d 61 64 65 20 74  |a move is made t|
00000fe0  68 65 20 63 68 61 72 61  63 74 65 72 20 69 6e 20  |he character in |
00000ff0  6d 65 6d 6f 72 79 1a 20  69 73 1a 20 72 65 70 6c  |memory. is. repl|
00001000  61 63 65 64 1a 20 77 69  74 68 1a 20 61 1a 20 73  |aced. with. a. s|
00001010  70 61 63 65 0d 63 68 61  72 61 63 74 65 72 20 61  |pace.character a|
00001020  6e 64 20 74 68 65 20 76  61 72 69 61 62 6c 65 73  |nd the variables|
00001030  20 72 65 2d 63 61 6c 63  75 6c 61 74 65 64 20 61  | re-calculated a|
00001040  6e 64 20 74 68 65 20 64  69 73 70 61 79 20 72 65  |nd the dispay re|
00001050  64 72 61 77 6e 2e 0d 0d  72 65 70 20 28 31 34 35  |drawn...rep (145|
00001060  30 29 20 77 61 69 74 73  20 66 6f 72 20 73 70 61  |0) waits for spa|
00001070  63 65 20 74 6f 20 62 65  20 70 72 65 73 73 65 64  |ce to be pressed|
00001080  2e 0d 0d 67 61 6d 65 6e  64 20 28 31 34 36 30 2d  |...gamend (1460-|
00001090  31 34 38 30 29 20 70 72  69 6e 74 73 20 74 68 65  |1480) prints the|
000010a0  20 66 69 6e 61 6c 20 6d  65 73 73 61 67 65 20 28  | final message (|
000010b0  44 41 54 41 20 6c 69 6e  65 73 20 31 39 38 30 2d  |DATA lines 1980-|
000010c0  32 30 31 30 29 2c 20 73  74 61 72 74 73 0d 74 68  |2010), starts.th|
000010d0  65 20 74 75 6e 65 20 77  69 74 68 20 2a 46 58 31  |e tune with *FX1|
000010e0  34 2c 34 20 61 6e 64 20  61 73 6b 73 20 69 66 20  |4,4 and asks if |
000010f0  79 6f 75 20 77 61 6e 74  20 61 6e 6f 74 68 65 72  |you want another|
00001100  20 67 61 6d 65 2e 20 20  54 68 65 6e 20 77 61 69  | game.  Then wai|
00001110  74 73 20 66 6f 72 20 59  0d 6f 72 20 4e 20 74 6f  |ts for Y.or N to|
00001120  20 62 65 20 70 72 65 73  73 65 64 2e 0d 0d 6d 6c  | be pressed...ml|
00001130  6f 61 64 20 28 31 34 39  30 2d 31 35 37 30 29 20  |oad (1490-1570) |
00001140  66 69 72 73 74 1a 20 70  72 69 6e 74 1a 20 61 1a  |first. print. a.|
00001150  20 6d 65 73 73 61 67 65  1a 20 61 73 6b 69 6e 67  | message. asking|
00001160  1a 20 66 6f 72 1a 20 74  68 65 20 73 75 66 66 69  |. for. the suffi|
00001170  78 20 6e 75 6d 62 65 72  0d 28 31 2d 35 29 2e 1a  |x number.(1-5)..|
00001180  20 20 41 66 74 65 72 1a  20 70 72 65 73 73 69 6e  |  After. pressin|
00001190  67 1a 20 74 68 65 20 6e  75 6d 62 65 72 20 6b 65  |g. the number ke|
000011a0  79 2c 20 74 68 65 20 6e  75 6d 62 65 72 20 69 73  |y, the number is|
000011b0  1a 20 69 6e 73 65 72 74  65 64 1a 20 69 6e 1a 20  |. inserted. in. |
000011c0  74 68 65 0d 6c 6f 61 64  69 6e 67 20 6d 65 73 73  |the.loading mess|
000011d0  61 67 65 20 28 44 41 54  41 20 6c 69 6e 65 20 32  |age (DATA line 2|
000011e0  30 38 30 29 1a 20 61 6e  64 1a 20 69 6e 1a 20 74  |080). and. in. t|
000011f0  68 65 1a 20 6c 6f 61 64  69 6e 67 20 63 6f 6d 6d  |he. loading comm|
00001200  61 6e 64 20 28 44 41 54  41 20 6c 69 6e 65 0d 32  |and (DATA line.2|
00001210  30 39 30 29 20 66 6f 72  20 74 68 65 20 66 69 6c  |090) for the fil|
00001220  65 20 74 6f 20 62 65 20  6c 6f 61 64 65 64 2e 0d  |e to be loaded..|
00001230  0d 4c 69 6e 65 73 20 31  35 38 30 20 2d 20 31 36  |.Lines 1580 - 16|
00001240  31 30 20 6d 61 6b 65 20  73 70 61 63 65 20 66 6f  |10 make space fo|
00001250  72 20 74 68 65 20 76 61  72 69 61 62 6c 65 73 2e  |r the variables.|
00001260  0d                                                |.|
00001261
F/M\Ctut2.m0
F/M\Ctut2.m1
F/M\Ctut2.m2
F/M\Ctut2.m4
F/M\Ctut2.m5