Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_22.ADF » F/M\Ctut1

F/M\Ctut1

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_22.ADF
Filename: F/M\Ctut1
Read OK:
File size: 1218 bytes
Load address: 4D204556
Exec address: 7574432F
File contents
USING THE ASSEMBLER 5
~~~~~~~~~~~~~~~~~~~~~
By Richard Dimond

I promised to discuss the making up of screens as I had in mind a program
from EU which I had converted to a completely M/code game and I hope to
publish this in the next issue together with some explanation of what I
have doe.

First, however, are some routines which I have not yet covered and which
can be used to make up screens for simple games.

In my first article I gave a simple routine (uline) for printing a line of
the same character.  If we use the 'tab' subroutine also given in that
article we can print horizontal or vertical lines of the same character
anywhere on the screen.  Add these two routines to those already entered -

   .horiz  JSRtab
           INX
           CPXlimit
           BNEhoriz
           RTS

   .vert   JSTtab
           INY
           CPYlimit
           BNEvert
           RTS

Add limit=&86 to the variables at line 40. Then to use the routines enter
in the main loop -

For a horizontal line -
       LDA# <end col> :STAlimit
       LDX# <start col>
       LDY# <line>
       LDA# <char>
       JSR horiz       )  or JMPhoriz
       RTS             )

For a vertical line -
      LDA# <end line> :STAlimit
      LDX# <column>
      LDY# <start line>
      LDA# char
      JMP vert

Blocks of characters can be printed as in BASIC by entering the data -

       EQUS CHR$224+CHR$225+CHR$8+CHR$8+CHR$10+CHR$226+CHR$227
and using the loop -

      .comms2  STX addr
               STY addr+1
               TAX
               LDY#0
      .clp     LDA (addr),Y
               JSR oswrch
               INY
               DEX
               BNE clp
               RTS

While the loop (cooms) is a little more economical in memory and perhaps
better programming, this loop is easier to use as it avoids the necessity
to reverse all the data.  It is used as before -

               LDA# <number of commands>
               LDX# <data> MOD256
               LDY# <data> DIV256
               JMP comms2

Windows can be made up using the data -

Text window -

   EQUB28:EQUB <left>:EQUB (bottom>:EQUB <right>:EQUB <top>

Graphics window  -

    EQUB24:EQUW  <left>:EQUW <bottom>:EQUW <riht>:EQUW <top>

Double height lettering can be printed with this routine -

        .dh    STX db: STY db+1
               LDA#0:STA &70
        .b1    LDY &70:LDA (db),Y
               CMP #13:BEQ b3
               STA &71:INY:STY &70
               LDX #&71:LDY #0
               LDA #10:JSR &fff1
               LDX #1:LDY #0
        .b2    LDA &71,X:STA &CF0,Y
               INY:STA &CF0,Y
               INY:INX
               CPX #9:BNE b2
               LDA #254:JSR oswrch
               LDA #8:JSR oswrch:LDA #10:JSR oswrch
               LDA #255:JSR oswrch
               LDA #11:JSR oswrch
               JMP b1
         .b3   RTS

The variable  db=&80  must be added to the variables in line 40.  This
will hold the address of the STRING to be printed which must have the CR
character &0D at the end.  The routine is used in the same way as the
print routine by -

               LDX # <label> MOD256
               LDY # <label> DIV256
               JMP dh

Note - &70 holds the position in the string of the character being printed
and &71 holds the character.  The character codes are then split to &72 to
&79. These are doubled loaded to &CF0 to &CFF for characters 254 and 255.

The routines given so far should enable you to make up screens for simple
games where a clash may be detected by comparing co-ordinates where these
are held at say &74 (x,y) and &76 (x1,y1) -

               LDAx:CMPx1:BNE no_clash
               LDAx+1:CMPx12+1:BNE no_clash
               .clash
               <clash routine>
               .no_clash RTS

For arcade games of the Reptonm type a map is needed as in BASIC and this
should be entered to a suitabla address for the M/code.  The data can be
saved separately with other similar files so they can be looded into the
game.  

To load these we use the OS routine OSCLI (&FFF7).  This is used for all 
* commands.  It needs the X and Y registers to be loaded with the address
of the command data as for other routines before being called -

                 LDX# comm MOD256
                 LDY# comm DIV256
                 JMP &FFF7
        .comm    EQUS "LOAD map <address>"

While it may not be necessary to add the address if it is saved to the
correct address, it can be put in.

I shall be explaining more about maps and other routines next time.

**************************************************************************

00000000  0d 55 53 49 4e 47 20 54  48 45 20 41 53 53 45 4d  |.USING THE ASSEM|
00000010  42 4c 45 52 20 35 0d 7e  7e 7e 7e 7e 7e 7e 7e 7e  |BLER 5.~~~~~~~~~|
00000020  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 0d 42 79 20  |~~~~~~~~~~~~.By |
00000030  52 69 63 68 61 72 64 20  44 69 6d 6f 6e 64 0d 0d  |Richard Dimond..|
00000040  49 1a 20 70 72 6f 6d 69  73 65 64 20 74 6f 20 64  |I. promised to d|
00000050  69 73 63 75 73 73 20 74  68 65 20 6d 61 6b 69 6e  |iscuss the makin|
00000060  67 20 75 70 20 6f 66 20  73 63 72 65 65 6e 73 20  |g up of screens |
00000070  61 73 20 49 20 68 61 64  20 69 6e 20 6d 69 6e 64  |as I had in mind|
00000080  20 61 20 70 72 6f 67 72  61 6d 0d 66 72 6f 6d 20  | a program.from |
00000090  45 55 1a 20 77 68 69 63  68 1a 20 49 1a 20 68 61  |EU. which. I. ha|
000000a0  64 20 63 6f 6e 76 65 72  74 65 64 20 74 6f 20 61  |d converted to a|
000000b0  20 63 6f 6d 70 6c 65 74  65 6c 79 20 4d 2f 63 6f  | completely M/co|
000000c0  64 65 20 67 61 6d 65 20  61 6e 64 20 49 20 68 6f  |de game and I ho|
000000d0  70 65 20 74 6f 0d 70 75  62 6c 69 73 68 20 74 68  |pe to.publish th|
000000e0  69 73 20 69 6e 20 74 68  65 20 6e 65 78 74 1a 20  |is in the next. |
000000f0  69 73 73 75 65 1a 20 74  6f 67 65 74 68 65 72 1a  |issue. together.|
00000100  20 77 69 74 68 20 73 6f  6d 65 20 65 78 70 6c 61  | with some expla|
00000110  6e 61 74 69 6f 6e 20 6f  66 20 77 68 61 74 20 49  |nation of what I|
00000120  0d 68 61 76 65 20 64 6f  65 2e 0d 0d 46 69 72 73  |.have doe...Firs|
00000130  74 2c 20 68 6f 77 65 76  65 72 2c 20 61 72 65 20  |t, however, are |
00000140  73 6f 6d 65 20 72 6f 75  74 69 6e 65 73 20 77 68  |some routines wh|
00000150  69 63 68 20 49 20 68 61  76 65 1a 20 6e 6f 74 1a  |ich I have. not.|
00000160  20 79 65 74 20 63 6f 76  65 72 65 64 20 61 6e 64  | yet covered and|
00000170  20 77 68 69 63 68 0d 63  61 6e 20 62 65 20 75 73  | which.can be us|
00000180  65 64 20 74 6f 20 6d 61  6b 65 20 75 70 20 73 63  |ed to make up sc|
00000190  72 65 65 6e 73 20 66 6f  72 20 73 69 6d 70 6c 65  |reens for simple|
000001a0  20 67 61 6d 65 73 2e 0d  0d 49 6e 20 6d 79 20 66  | games...In my f|
000001b0  69 72 73 74 20 61 72 74  69 63 6c 65 20 49 20 67  |irst article I g|
000001c0  61 76 65 20 61 20 73 69  6d 70 6c 65 20 72 6f 75  |ave a simple rou|
000001d0  74 69 6e 65 20 28 75 6c  69 6e 65 29 20 66 6f 72  |tine (uline) for|
000001e0  20 70 72 69 6e 74 69 6e  67 20 61 20 6c 69 6e 65  | printing a line|
000001f0  20 6f 66 0d 74 68 65 1a  20 73 61 6d 65 20 63 68  | of.the. same ch|
00000200  61 72 61 63 74 65 72 2e  20 20 49 66 20 77 65 20  |aracter.  If we |
00000210  75 73 65 20 74 68 65 20  27 74 61 62 27 20 73 75  |use the 'tab' su|
00000220  62 72 6f 75 74 69 6e 65  20 61 6c 73 6f 1a 20 67  |broutine also. g|
00000230  69 76 65 6e 1a 20 69 6e  1a 20 74 68 61 74 0d 61  |iven. in. that.a|
00000240  72 74 69 63 6c 65 20 77  65 1a 20 63 61 6e 1a 20  |rticle we. can. |
00000250  70 72 69 6e 74 1a 20 68  6f 72 69 7a 6f 6e 74 61  |print. horizonta|
00000260  6c 20 6f 72 20 76 65 72  74 69 63 61 6c 20 6c 69  |l or vertical li|
00000270  6e 65 73 20 6f 66 20 74  68 65 20 73 61 6d 65 20  |nes of the same |
00000280  63 68 61 72 61 63 74 65  72 0d 61 6e 79 77 68 65  |character.anywhe|
00000290  72 65 20 6f 6e 20 74 68  65 20 73 63 72 65 65 6e  |re on the screen|
000002a0  2e 20 20 41 64 64 20 74  68 65 73 65 20 74 77 6f  |.  Add these two|
000002b0  20 72 6f 75 74 69 6e 65  73 20 74 6f 20 74 68 6f  | routines to tho|
000002c0  73 65 20 61 6c 72 65 61  64 79 20 65 6e 74 65 72  |se already enter|
000002d0  65 64 20 2d 0d 0d 20 20  20 2e 68 6f 72 69 7a 20  |ed -..   .horiz |
000002e0  20 4a 53 52 74 61 62 0d  20 20 20 20 20 20 20 20  | JSRtab.        |
000002f0  20 20 20 49 4e 58 0d 20  20 20 20 20 20 20 20 20  |   INX.         |
00000300  20 20 43 50 58 6c 69 6d  69 74 0d 20 20 20 20 20  |  CPXlimit.     |
00000310  20 20 20 20 20 20 42 4e  45 68 6f 72 69 7a 0d 20  |      BNEhoriz. |
00000320  20 20 20 20 20 20 20 20  20 20 52 54 53 0d 0d 20  |          RTS.. |
00000330  20 20 2e 76 65 72 74 20  20 20 4a 53 54 74 61 62  |  .vert   JSTtab|
00000340  0d 20 20 20 20 20 20 20  20 20 20 20 49 4e 59 0d  |.           INY.|
00000350  20 20 20 20 20 20 20 20  20 20 20 43 50 59 6c 69  |           CPYli|
00000360  6d 69 74 0d 20 20 20 20  20 20 20 20 20 20 20 42  |mit.           B|
00000370  4e 45 76 65 72 74 0d 20  20 20 20 20 20 20 20 20  |NEvert.         |
00000380  20 20 52 54 53 0d 0d 41  64 64 20 6c 69 6d 69 74  |  RTS..Add limit|
00000390  3d 26 38 36 20 74 6f 20  74 68 65 20 76 61 72 69  |=&86 to the vari|
000003a0  61 62 6c 65 73 20 61 74  1a 20 6c 69 6e 65 20 34  |ables at. line 4|
000003b0  30 2e 20 54 68 65 6e 20  74 6f 20 75 73 65 20 74  |0. Then to use t|
000003c0  68 65 20 72 6f 75 74 69  6e 65 73 20 65 6e 74 65  |he routines ente|
000003d0  72 0d 69 6e 20 74 68 65  20 6d 61 69 6e 20 6c 6f  |r.in the main lo|
000003e0  6f 70 20 2d 0d 0d 46 6f  72 20 61 20 68 6f 72 69  |op -..For a hori|
000003f0  7a 6f 6e 74 61 6c 20 6c  69 6e 65 20 2d 0d 20 20  |zontal line -.  |
00000400  20 20 20 20 20 4c 44 41  23 20 3c 65 6e 64 20 63  |     LDA# <end c|
00000410  6f 6c 3e 20 3a 53 54 41  6c 69 6d 69 74 0d 20 20  |ol> :STAlimit.  |
00000420  20 20 20 20 20 4c 44 58  23 20 3c 73 74 61 72 74  |     LDX# <start|
00000430  20 63 6f 6c 3e 0d 20 20  20 20 20 20 20 4c 44 59  | col>.       LDY|
00000440  23 20 3c 6c 69 6e 65 3e  0d 20 20 20 20 20 20 20  |# <line>.       |
00000450  4c 44 41 23 20 3c 63 68  61 72 3e 0d 20 20 20 20  |LDA# <char>.    |
00000460  20 20 20 4a 53 52 20 68  6f 72 69 7a 20 20 20 20  |   JSR horiz    |
00000470  20 20 20 29 20 20 6f 72  20 4a 4d 50 68 6f 72 69  |   )  or JMPhori|
00000480  7a 0d 20 20 20 20 20 20  20 52 54 53 20 20 20 20  |z.       RTS    |
00000490  20 20 20 20 20 20 20 20  20 29 0d 0d 46 6f 72 20  |         )..For |
000004a0  61 20 76 65 72 74 69 63  61 6c 20 6c 69 6e 65 20  |a vertical line |
000004b0  2d 0d 20 20 20 20 20 20  4c 44 41 23 20 3c 65 6e  |-.      LDA# <en|
000004c0  64 20 6c 69 6e 65 3e 20  3a 53 54 41 6c 69 6d 69  |d line> :STAlimi|
000004d0  74 0d 20 20 20 20 20 20  4c 44 58 23 20 3c 63 6f  |t.      LDX# <co|
000004e0  6c 75 6d 6e 3e 0d 20 20  20 20 20 20 4c 44 59 23  |lumn>.      LDY#|
000004f0  20 3c 73 74 61 72 74 20  6c 69 6e 65 3e 0d 20 20  | <start line>.  |
00000500  20 20 20 20 4c 44 41 23  20 63 68 61 72 0d 20 20  |    LDA# char.  |
00000510  20 20 20 20 4a 4d 50 20  76 65 72 74 0d 0d 42 6c  |    JMP vert..Bl|
00000520  6f 63 6b 73 20 6f 66 20  63 68 61 72 61 63 74 65  |ocks of characte|
00000530  72 73 20 63 61 6e 20 62  65 20 70 72 69 6e 74 65  |rs can be printe|
00000540  64 20 61 73 20 69 6e 20  42 41 53 49 43 20 62 79  |d as in BASIC by|
00000550  20 65 6e 74 65 72 69 6e  67 20 74 68 65 20 64 61  | entering the da|
00000560  74 61 20 2d 0d 0d 20 20  20 20 20 20 20 45 51 55  |ta -..       EQU|
00000570  53 20 43 48 52 24 32 32  34 2b 43 48 52 24 32 32  |S CHR$224+CHR$22|
00000580  35 2b 43 48 52 24 38 2b  43 48 52 24 38 2b 43 48  |5+CHR$8+CHR$8+CH|
00000590  52 24 31 30 2b 43 48 52  24 32 32 36 2b 43 48 52  |R$10+CHR$226+CHR|
000005a0  24 32 32 37 0d 61 6e 64  20 75 73 69 6e 67 20 74  |$227.and using t|
000005b0  68 65 20 6c 6f 6f 70 20  2d 0d 0d 20 20 20 20 20  |he loop -..     |
000005c0  20 2e 63 6f 6d 6d 73 32  20 20 53 54 58 20 61 64  | .comms2  STX ad|
000005d0  64 72 0d 20 20 20 20 20  20 20 20 20 20 20 20 20  |dr.             |
000005e0  20 20 53 54 59 20 61 64  64 72 2b 31 0d 20 20 20  |  STY addr+1.   |
000005f0  20 20 20 20 20 20 20 20  20 20 20 20 54 41 58 0d  |            TAX.|
00000600  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 4c  |               L|
00000610  44 59 23 30 0d 20 20 20  20 20 20 2e 63 6c 70 20  |DY#0.      .clp |
00000620  20 20 20 20 4c 44 41 20  28 61 64 64 72 29 2c 59  |    LDA (addr),Y|
00000630  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000640  4a 53 52 20 6f 73 77 72  63 68 0d 20 20 20 20 20  |JSR oswrch.     |
00000650  20 20 20 20 20 20 20 20  20 20 49 4e 59 0d 20 20  |          INY.  |
00000660  20 20 20 20 20 20 20 20  20 20 20 20 20 44 45 58  |             DEX|
00000670  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000680  42 4e 45 20 63 6c 70 0d  20 20 20 20 20 20 20 20  |BNE clp.        |
00000690  20 20 20 20 20 20 20 52  54 53 0d 0d 57 68 69 6c  |       RTS..Whil|
000006a0  65 20 74 68 65 20 6c 6f  6f 70 20 28 63 6f 6f 6d  |e the loop (coom|
000006b0  73 29 20 69 73 1a 20 61  1a 20 6c 69 74 74 6c 65  |s) is. a. little|
000006c0  20 6d 6f 72 65 20 65 63  6f 6e 6f 6d 69 63 61 6c  | more economical|
000006d0  20 69 6e 20 6d 65 6d 6f  72 79 20 61 6e 64 20 70  | in memory and p|
000006e0  65 72 68 61 70 73 0d 62  65 74 74 65 72 20 70 72  |erhaps.better pr|
000006f0  6f 67 72 61 6d 6d 69 6e  67 2c 20 74 68 69 73 20  |ogramming, this |
00000700  6c 6f 6f 70 20 69 73 20  65 61 73 69 65 72 20 74  |loop is easier t|
00000710  6f 1a 20 75 73 65 20 61  73 20 69 74 20 61 76 6f  |o. use as it avo|
00000720  69 64 73 20 74 68 65 20  6e 65 63 65 73 73 69 74  |ids the necessit|
00000730  79 0d 74 6f 20 72 65 76  65 72 73 65 20 61 6c 6c  |y.to reverse all|
00000740  20 74 68 65 20 64 61 74  61 2e 20 20 49 74 20 69  | the data.  It i|
00000750  73 20 75 73 65 64 20 61  73 20 62 65 66 6f 72 65  |s used as before|
00000760  20 2d 0d 0d 20 20 20 20  20 20 20 20 20 20 20 20  | -..            |
00000770  20 20 20 4c 44 41 23 20  3c 6e 75 6d 62 65 72 20  |   LDA# <number |
00000780  6f 66 20 63 6f 6d 6d 61  6e 64 73 3e 0d 20 20 20  |of commands>.   |
00000790  20 20 20 20 20 20 20 20  20 20 20 20 4c 44 58 23  |            LDX#|
000007a0  20 3c 64 61 74 61 3e 20  4d 4f 44 32 35 36 0d 20  | <data> MOD256. |
000007b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 4c 44  |              LD|
000007c0  59 23 20 3c 64 61 74 61  3e 20 44 49 56 32 35 36  |Y# <data> DIV256|
000007d0  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000007e0  4a 4d 50 20 63 6f 6d 6d  73 32 0d 0d 57 69 6e 64  |JMP comms2..Wind|
000007f0  6f 77 73 20 63 61 6e 20  62 65 20 6d 61 64 65 20  |ows can be made |
00000800  75 70 20 75 73 69 6e 67  20 74 68 65 20 64 61 74  |up using the dat|
00000810  61 20 2d 0d 0d 54 65 78  74 1a 20 77 69 6e 64 6f  |a -..Text. windo|
00000820  77 1a 20 2d 0d 0d 1a 20  20 20 45 51 55 42 32 38  |w. -...   EQUB28|
00000830  3a 45 51 55 42 1a 20 3c  6c 65 66 74 3e 3a 45 51  |:EQUB. <left>:EQ|
00000840  55 42 1a 20 28 62 6f 74  74 6f 6d 3e 3a 45 51 55  |UB. (bottom>:EQU|
00000850  42 20 3c 72 69 67 68 74  3e 3a 45 51 55 42 20 3c  |B <right>:EQUB <|
00000860  74 6f 70 3e 0d 0d 47 72  61 70 68 69 63 73 20 77  |top>..Graphics w|
00000870  69 6e 64 6f 77 20 20 2d  0d 0d 20 20 20 20 45 51  |indow  -..    EQ|
00000880  55 42 32 34 3a 45 51 55  57 20 20 3c 6c 65 66 74  |UB24:EQUW  <left|
00000890  3e 3a 45 51 55 57 20 3c  62 6f 74 74 6f 6d 3e 3a  |>:EQUW <bottom>:|
000008a0  45 51 55 57 20 3c 72 69  68 74 3e 3a 45 51 55 57  |EQUW <riht>:EQUW|
000008b0  20 3c 74 6f 70 3e 0d 0d  44 6f 75 62 6c 65 20 68  | <top>..Double h|
000008c0  65 69 67 68 74 20 6c 65  74 74 65 72 69 6e 67 20  |eight lettering |
000008d0  63 61 6e 20 62 65 20 70  72 69 6e 74 65 64 20 77  |can be printed w|
000008e0  69 74 68 20 74 68 69 73  20 72 6f 75 74 69 6e 65  |ith this routine|
000008f0  20 2d 0d 0d 20 20 20 20  20 20 20 20 2e 64 68 20  | -..        .dh |
00000900  20 20 20 53 54 58 20 64  62 3a 20 53 54 59 20 64  |   STX db: STY d|
00000910  62 2b 31 0d 20 20 20 20  20 20 20 20 20 20 20 20  |b+1.            |
00000920  20 20 20 4c 44 41 23 30  3a 53 54 41 20 26 37 30  |   LDA#0:STA &70|
00000930  0d 20 20 20 20 20 20 20  20 2e 62 31 20 20 20 20  |.        .b1    |
00000940  4c 44 59 20 26 37 30 3a  4c 44 41 20 28 64 62 29  |LDY &70:LDA (db)|
00000950  2c 59 0d 20 20 20 20 20  20 20 20 20 20 20 20 20  |,Y.             |
00000960  20 20 43 4d 50 20 23 31  33 3a 42 45 51 20 62 33  |  CMP #13:BEQ b3|
00000970  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000980  53 54 41 20 26 37 31 3a  49 4e 59 3a 53 54 59 20  |STA &71:INY:STY |
00000990  26 37 30 0d 20 20 20 20  20 20 20 20 20 20 20 20  |&70.            |
000009a0  20 20 20 4c 44 58 20 23  26 37 31 3a 4c 44 59 20  |   LDX #&71:LDY |
000009b0  23 30 0d 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0.             |
000009c0  20 20 4c 44 41 20 23 31  30 3a 4a 53 52 20 26 66  |  LDA #10:JSR &f|
000009d0  66 66 31 0d 20 20 20 20  20 20 20 20 20 20 20 20  |ff1.            |
000009e0  20 20 20 4c 44 58 20 23  31 3a 4c 44 59 20 23 30  |   LDX #1:LDY #0|
000009f0  0d 20 20 20 20 20 20 20  20 2e 62 32 20 20 20 20  |.        .b2    |
00000a00  4c 44 41 20 26 37 31 2c  58 3a 53 54 41 20 26 43  |LDA &71,X:STA &C|
00000a10  46 30 2c 59 0d 20 20 20  20 20 20 20 20 20 20 20  |F0,Y.           |
00000a20  20 20 20 20 49 4e 59 3a  53 54 41 20 26 43 46 30  |    INY:STA &CF0|
00000a30  2c 59 0d 20 20 20 20 20  20 20 20 20 20 20 20 20  |,Y.             |
00000a40  20 20 49 4e 59 3a 49 4e  58 0d 20 20 20 20 20 20  |  INY:INX.      |
00000a50  20 20 20 20 20 20 20 20  20 43 50 58 20 23 39 3a  |         CPX #9:|
00000a60  42 4e 45 20 62 32 0d 20  20 20 20 20 20 20 20 20  |BNE b2.         |
00000a70  20 20 20 20 20 20 4c 44  41 20 23 32 35 34 3a 4a  |      LDA #254:J|
00000a80  53 52 20 6f 73 77 72 63  68 0d 20 20 20 20 20 20  |SR oswrch.      |
00000a90  20 20 20 20 20 20 20 20  20 4c 44 41 20 23 38 3a  |         LDA #8:|
00000aa0  4a 53 52 20 6f 73 77 72  63 68 3a 4c 44 41 20 23  |JSR oswrch:LDA #|
00000ab0  31 30 3a 4a 53 52 20 6f  73 77 72 63 68 0d 20 20  |10:JSR oswrch.  |
00000ac0  20 20 20 20 20 20 20 20  20 20 20 20 20 4c 44 41  |             LDA|
00000ad0  20 23 32 35 35 3a 4a 53  52 20 6f 73 77 72 63 68  | #255:JSR oswrch|
00000ae0  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000af0  4c 44 41 20 23 31 31 3a  4a 53 52 20 6f 73 77 72  |LDA #11:JSR oswr|
00000b00  63 68 0d 20 20 20 20 20  20 20 20 20 20 20 20 20  |ch.             |
00000b10  20 20 4a 4d 50 20 62 31  0d 20 20 20 20 20 20 20  |  JMP b1.       |
00000b20  20 20 2e 62 33 20 20 20  52 54 53 0d 0d 54 68 65  |  .b3   RTS..The|
00000b30  1a 20 76 61 72 69 61 62  6c 65 1a 20 20 64 62 3d  |. variable.  db=|
00000b40  26 38 30 1a 20 20 6d 75  73 74 1a 20 62 65 20 61  |&80.  must. be a|
00000b50  64 64 65 64 20 74 6f 20  74 68 65 20 76 61 72 69  |dded to the vari|
00000b60  61 62 6c 65 73 20 69 6e  20 6c 69 6e 65 20 34 30  |ables in line 40|
00000b70  2e 20 20 54 68 69 73 0d  77 69 6c 6c 20 68 6f 6c  |.  This.will hol|
00000b80  64 20 74 68 65 20 61 64  64 72 65 73 73 20 6f 66  |d the address of|
00000b90  1a 20 74 68 65 1a 20 53  54 52 49 4e 47 20 74 6f  |. the. STRING to|
00000ba0  20 62 65 20 70 72 69 6e  74 65 64 20 77 68 69 63  | be printed whic|
00000bb0  68 20 6d 75 73 74 20 68  61 76 65 20 74 68 65 20  |h must have the |
00000bc0  43 52 0d 63 68 61 72 61  63 74 65 72 20 26 30 44  |CR.character &0D|
00000bd0  20 61 74 20 74 68 65 20  65 6e 64 2e 20 20 54 68  | at the end.  Th|
00000be0  65 20 72 6f 75 74 69 6e  65 1a 20 69 73 1a 20 75  |e routine. is. u|
00000bf0  73 65 64 1a 20 69 6e 1a  20 74 68 65 1a 20 73 61  |sed. in. the. sa|
00000c00  6d 65 20 77 61 79 20 61  73 20 74 68 65 0d 70 72  |me way as the.pr|
00000c10  69 6e 74 20 72 6f 75 74  69 6e 65 20 62 79 20 2d  |int routine by -|
00000c20  0d 0d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
00000c30  20 4c 44 58 20 23 20 3c  6c 61 62 65 6c 3e 20 4d  | LDX # <label> M|
00000c40  4f 44 32 35 36 0d 20 20  20 20 20 20 20 20 20 20  |OD256.          |
00000c50  20 20 20 20 20 4c 44 59  20 23 20 3c 6c 61 62 65  |     LDY # <labe|
00000c60  6c 3e 20 44 49 56 32 35  36 0d 20 20 20 20 20 20  |l> DIV256.      |
00000c70  20 20 20 20 20 20 20 20  20 4a 4d 50 20 64 68 0d  |         JMP dh.|
00000c80  0d 4e 6f 74 65 20 2d 20  26 37 30 20 68 6f 6c 64  |.Note - &70 hold|
00000c90  73 20 74 68 65 20 70 6f  73 69 74 69 6f 6e 20 69  |s the position i|
00000ca0  6e 20 74 68 65 20 73 74  72 69 6e 67 20 6f 66 20  |n the string of |
00000cb0  74 68 65 20 63 68 61 72  61 63 74 65 72 20 62 65  |the character be|
00000cc0  69 6e 67 20 70 72 69 6e  74 65 64 0d 61 6e 64 20  |ing printed.and |
00000cd0  26 37 31 20 68 6f 6c 64  73 20 74 68 65 20 63 68  |&71 holds the ch|
00000ce0  61 72 61 63 74 65 72 2e  20 20 54 68 65 20 63 68  |aracter.  The ch|
00000cf0  61 72 61 63 74 65 72 20  63 6f 64 65 73 20 61 72  |aracter codes ar|
00000d00  65 20 74 68 65 6e 20 73  70 6c 69 74 20 74 6f 20  |e then split to |
00000d10  26 37 32 20 74 6f 0d 26  37 39 2e 20 54 68 65 73  |&72 to.&79. Thes|
00000d20  65 20 61 72 65 20 64 6f  75 62 6c 65 64 20 6c 6f  |e are doubled lo|
00000d30  61 64 65 64 20 74 6f 20  26 43 46 30 20 74 6f 20  |aded to &CF0 to |
00000d40  26 43 46 46 20 66 6f 72  20 63 68 61 72 61 63 74  |&CFF for charact|
00000d50  65 72 73 20 32 35 34 20  61 6e 64 20 32 35 35 2e  |ers 254 and 255.|
00000d60  0d 0d 54 68 65 20 72 6f  75 74 69 6e 65 73 20 67  |..The routines g|
00000d70  69 76 65 6e 20 73 6f 20  66 61 72 1a 20 73 68 6f  |iven so far. sho|
00000d80  75 6c 64 20 65 6e 61 62  6c 65 20 79 6f 75 20 74  |uld enable you t|
00000d90  6f 20 6d 61 6b 65 20 75  70 20 73 63 72 65 65 6e  |o make up screen|
00000da0  73 20 66 6f 72 20 73 69  6d 70 6c 65 0d 67 61 6d  |s for simple.gam|
00000db0  65 73 20 77 68 65 72 65  20 61 20 63 6c 61 73 68  |es where a clash|
00000dc0  20 6d 61 79 20 62 65 1a  20 64 65 74 65 63 74 65  | may be. detecte|
00000dd0  64 20 62 79 20 63 6f 6d  70 61 72 69 6e 67 20 63  |d by comparing c|
00000de0  6f 2d 6f 72 64 69 6e 61  74 65 73 20 77 68 65 72  |o-ordinates wher|
00000df0  65 20 74 68 65 73 65 0d  61 72 65 20 68 65 6c 64  |e these.are held|
00000e00  20 61 74 20 73 61 79 20  26 37 34 20 28 78 2c 79  | at say &74 (x,y|
00000e10  29 20 61 6e 64 20 26 37  36 20 28 78 31 2c 79 31  |) and &76 (x1,y1|
00000e20  29 20 2d 0d 0d 20 20 20  20 20 20 20 20 20 20 20  |) -..           |
00000e30  20 20 20 20 4c 44 41 78  3a 43 4d 50 78 31 3a 42  |    LDAx:CMPx1:B|
00000e40  4e 45 20 6e 6f 5f 63 6c  61 73 68 0d 20 20 20 20  |NE no_clash.    |
00000e50  20 20 20 20 20 20 20 20  20 20 20 4c 44 41 78 2b  |           LDAx+|
00000e60  31 3a 43 4d 50 78 31 32  2b 31 3a 42 4e 45 20 6e  |1:CMPx12+1:BNE n|
00000e70  6f 5f 63 6c 61 73 68 0d  20 20 20 20 20 20 20 20  |o_clash.        |
00000e80  20 20 20 20 20 20 20 2e  63 6c 61 73 68 0d 20 20  |       .clash.  |
00000e90  20 20 20 20 20 20 20 20  20 20 20 20 20 3c 63 6c  |             <cl|
00000ea0  61 73 68 20 72 6f 75 74  69 6e 65 3e 0d 20 20 20  |ash routine>.   |
00000eb0  20 20 20 20 20 20 20 20  20 20 20 20 2e 6e 6f 5f  |            .no_|
00000ec0  63 6c 61 73 68 20 52 54  53 0d 0d 46 6f 72 20 61  |clash RTS..For a|
00000ed0  72 63 61 64 65 20 67 61  6d 65 73 1a 20 6f 66 20  |rcade games. of |
00000ee0  74 68 65 20 52 65 70 74  6f 6e 6d 20 74 79 70 65  |the Reptonm type|
00000ef0  20 61 20 6d 61 70 20 69  73 20 6e 65 65 64 65 64  | a map is needed|
00000f00  20 61 73 20 69 6e 20 42  41 53 49 43 20 61 6e 64  | as in BASIC and|
00000f10  20 74 68 69 73 0d 73 68  6f 75 6c 64 20 62 65 20  | this.should be |
00000f20  65 6e 74 65 72 65 64 20  74 6f 1a 20 61 1a 20 73  |entered to. a. s|
00000f30  75 69 74 61 62 6c 61 20  61 64 64 72 65 73 73 20  |uitabla address |
00000f40  66 6f 72 20 74 68 65 20  4d 2f 63 6f 64 65 2e 20  |for the M/code. |
00000f50  20 54 68 65 20 64 61 74  61 20 63 61 6e 20 62 65  | The data can be|
00000f60  0d 73 61 76 65 64 20 73  65 70 61 72 61 74 65 6c  |.saved separatel|
00000f70  79 20 77 69 74 68 20 6f  74 68 65 72 20 73 69 6d  |y with other sim|
00000f80  69 6c 61 72 20 66 69 6c  65 73 1a 20 73 6f 1a 20  |ilar files. so. |
00000f90  74 68 65 79 20 63 61 6e  20 62 65 20 6c 6f 6f 64  |they can be lood|
00000fa0  65 64 20 69 6e 74 6f 20  74 68 65 0d 67 61 6d 65  |ed into the.game|
00000fb0  2e 20 20 0d 0d 54 6f 20  6c 6f 61 64 20 74 68 65  |.  ..To load the|
00000fc0  73 65 20 77 65 20 75 73  65 20 74 68 65 20 4f 53  |se we use the OS|
00000fd0  20 72 6f 75 74 69 6e 65  1a 20 4f 53 43 4c 49 1a  | routine. OSCLI.|
00000fe0  20 28 26 46 46 46 37 29  2e 20 20 54 68 69 73 20  | (&FFF7).  This |
00000ff0  69 73 20 75 73 65 64 20  66 6f 72 20 61 6c 6c 20  |is used for all |
00001000  0d 2a 20 63 6f 6d 6d 61  6e 64 73 2e 20 20 49 74  |.* commands.  It|
00001010  20 6e 65 65 64 73 20 74  68 65 20 58 20 61 6e 64  | needs the X and|
00001020  20 59 20 72 65 67 69 73  74 65 72 73 20 74 6f 1a  | Y registers to.|
00001030  20 62 65 20 6c 6f 61 64  65 64 20 77 69 74 68 20  | be loaded with |
00001040  74 68 65 20 61 64 64 72  65 73 73 0d 6f 66 20 74  |the address.of t|
00001050  68 65 20 63 6f 6d 6d 61  6e 64 20 64 61 74 61 20  |he command data |
00001060  61 73 20 66 6f 72 20 6f  74 68 65 72 20 72 6f 75  |as for other rou|
00001070  74 69 6e 65 73 20 62 65  66 6f 72 65 20 62 65 69  |tines before bei|
00001080  6e 67 20 63 61 6c 6c 65  64 20 2d 0d 0d 20 20 20  |ng called -..   |
00001090  20 20 20 20 20 20 20 20  20 20 20 20 20 20 4c 44  |              LD|
000010a0  58 23 20 63 6f 6d 6d 20  4d 4f 44 32 35 36 0d 20  |X# comm MOD256. |
000010b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000010c0  4c 44 59 23 20 63 6f 6d  6d 20 44 49 56 32 35 36  |LDY# comm DIV256|
000010d0  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000010e0  20 20 4a 4d 50 20 26 46  46 46 37 0d 20 20 20 20  |  JMP &FFF7.    |
000010f0  20 20 20 20 2e 63 6f 6d  6d 20 20 20 20 45 51 55  |    .comm    EQU|
00001100  53 20 22 4c 4f 41 44 20  6d 61 70 20 3c 61 64 64  |S "LOAD map <add|
00001110  72 65 73 73 3e 22 0d 0d  57 68 69 6c 65 20 69 74  |ress>"..While it|
00001120  20 6d 61 79 20 6e 6f 74  20 62 65 20 6e 65 63 65  | may not be nece|
00001130  73 73 61 72 79 20 74 6f  20 61 64 64 20 74 68 65  |ssary to add the|
00001140  20 61 64 64 72 65 73 73  20 69 66 1a 20 69 74 1a  | address if. it.|
00001150  20 69 73 1a 20 73 61 76  65 64 1a 20 74 6f 20 74  | is. saved. to t|
00001160  68 65 0d 63 6f 72 72 65  63 74 20 61 64 64 72 65  |he.correct addre|
00001170  73 73 2c 20 69 74 20 63  61 6e 20 62 65 20 70 75  |ss, it can be pu|
00001180  74 20 69 6e 2e 0d 0d 49  20 73 68 61 6c 6c 20 62  |t in...I shall b|
00001190  65 20 65 78 70 6c 61 69  6e 69 6e 67 20 6d 6f 72  |e explaining mor|
000011a0  65 20 61 62 6f 75 74 20  6d 61 70 73 20 61 6e 64  |e about maps and|
000011b0  20 6f 74 68 65 72 20 72  6f 75 74 69 6e 65 73 20  | other routines |
000011c0  6e 65 78 74 20 74 69 6d  65 2e 0d 0d 2a 2a 2a 2a  |next time...****|
000011d0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00001210  2a 2a 2a 2a 2a 2a 0d 0d                           |******..|
00001218
F/M\Ctut1.m0
F/M\Ctut1.m1
F/M\Ctut1.m2
F/M\Ctut1.m4
F/M\Ctut1.m5