Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_20.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_20.ADF
Filename: F/m\ctut1
Read OK:
File size: 137C bytes
Load address: 24204556
Exec address: 632F6D2E
File contents
�PBoff
USING THE ASSEMBLER 3
~~~~~~~~~~~~~~~~~~~~~
I hope that you have been following me all right so far and enjoying some
experimenting with the assembler - it is through trying things out that we
learn.....

Hopefully I shall lead up to providing routines for simple arcade games
and also possibly adventure games too.

Having given the routines for printing to screen etc., you should be able
to make up instructions for a simple game or a menu or even location data
for an advenure game.  How about some ideas......

In the meantime, I want to progress to some more interesting routines as
promised last time.

PLOTTING AND DRAWING
~~~~~~~~~~~~~~~~~~~~
These are performed by using VDU25 and PLOT becomes -

         VDU25,p,x,y

where p is the PLOT number and x,y are the co-ordinates.

For MOVE use PLOT 4 and for DRAW  use PLOT 5.  Other PLOT numbers nan be
used, just as in BASIC, eg PLOT85 for filling triangles.

If you are setting up a series of PLOTs to draw a diagram, I have made up
a subroutine which read data in the form -

         EQUB p:EQUW x:EQUW y

This needs the number of PLOTs loaded in A register and the address of
the data loaded in X and Y registers, as explained for previous routines,
before the routine is called.

   .plot STXaddr:STYaddr+1:STAlen:LDY#0  
   .ploop LDA#25:JSR&FFEE                     \ VDU 25
   LDX#5  
   .ploop2 LDA(addr),Y:JSR&FFEE               \ enter data byte
   INY:BNEnotover:INC addr+1  
   .notover DEX:BNEploop2
   DEClen:BNE ploop  
   RTS  

Note.
There are two variables in this listing which should be allocated before
the assembly loop so add -

      15 addr=&70:len=80

You may also add the address of OSWRCH as a variable since it is easier to
write and saves remembering the address.  Add  - :oswrch=&FFEE to line 15.
This could even be shortened further (eg -  os) provided it does not clash
with other variables.

It is usually good practice to allocate any variables in this way at the
beginning of the program.


The subroutine first enters the value 25 before calling OSWRCH then enters
the loop 'ploop2' which repeats 5 times to enter the 5 data bytes.  The
variable 'len' is then decremented and if not zero then the routine
branches back to 'ploop1' for the next plot.  If the data is longer than
255 bytes, Y register will return to zero and the branch to 'notover' will
not occur so that the high byte of 'addr' is incremented.

The Print routine could be modified in a similar way to enable it to print
longer text as it will only print up to 255 characters at present.


USER DEFINED CHARACTERS
~~~~~~~~~~~~~~~~~~~~~~~
These are defined by VDU23,char,a,b,c,d,e,f,g,h as in BASIC and this
routine will set up any number of characters from number 224 in sequnce.

Itwill read a series of data lines in the same way as the above routine.
The data can be entered, following the label '.chardata', as -
      
      EQUB a:EQUB b:EQUB c:...........EQUB h

This can be simplified by using EQUD:EQUD but the numbers must be in hex
and each four digits must entered in reverse order as EQUD enters them in
reverse order. This then becomes -

       EQUD &dcba:EQUD &hgfe

This routine needs the variables, temp=&81 and oswrch=&FFEE, entering in
line 15 as mentioned above.

   .chars LDY#0:LDX#224 
   .chloop1 STXtemp 
   LDA#23:JSRoswrch           \ VDU 23
   TXA:JSRoswrch              \ character no.
   LDX#8 
   .chloop2 LDAchdata,Y       \ read data byte
   JSRoswrch
   INY 
   DEX 
   BNEchloop2
   LDXtemp                     \ reload char no.
   INX                         \ increment char no.
   CPX#242                     \ last char no. +1
   BNEchloop1
   RTS 

X register is loaded with 224, the first character value, and this is
stored in 'temp' within loop 'chloop1' since X register is used in the
second loop to count the 8 data bytes.  A register is first loaded with 23
then the value in X to give the first two parts of the command.  The loop
'chloop2' then loads the 8 data bytes.  Register X is then loaded from
'temp' and incremented before repeating the process for the next
character.  When the final character definition is completed, the routine
does not branch back as the comparison is met.  The value of this must be
entered according to the number of characters to be defined.

This routine uses the Indexed Addressing mode and as written can only be
used once in the program.  If some characters need to be redefined during
the running of a program, it should be possible to re-write the code in a
similar way to the print routine so that some could be re-defined from a
second set of data.  How about trying this?  You would need to do the
characters in reverse order - say from 250 down to 224 and from say 230 to
224 to re-define these.  I will cover this later if needed.

I hope to cover key entry routines for making menu choices and moving
characters about the screen next time.
00000000  80 50 42 6f 66 66 0d 55  53 49 4e 47 20 54 48 45  |.PBoff.USING THE|
00000010  20 41 53 53 45 4d 42 4c  45 52 20 33 0d 7e 7e 7e  | ASSEMBLER 3.~~~|
00000020  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |~~~~~~~~~~~~~~~~|
00000030  7e 7e 0d 49 1a 20 68 6f  70 65 20 74 68 61 74 20  |~~.I. hope that |
00000040  79 6f 75 20 68 61 76 65  20 62 65 65 6e 20 66 6f  |you have been fo|
00000050  6c 6c 6f 77 69 6e 67 20  6d 65 20 61 6c 6c 20 72  |llowing me all r|
00000060  69 67 68 74 20 73 6f 20  66 61 72 20 61 6e 64 20  |ight so far and |
00000070  65 6e 6a 6f 79 69 6e 67  20 73 6f 6d 65 0d 65 78  |enjoying some.ex|
00000080  70 65 72 69 6d 65 6e 74  69 6e 67 20 77 69 74 68  |perimenting with|
00000090  20 74 68 65 20 61 73 73  65 6d 62 6c 65 72 20 2d  | the assembler -|
000000a0  20 69 74 20 69 73 20 74  68 72 6f 75 67 68 20 74  | it is through t|
000000b0  72 79 69 6e 67 20 74 68  69 6e 67 73 20 6f 75 74  |rying things out|
000000c0  20 74 68 61 74 20 77 65  0d 6c 65 61 72 6e 2e 2e  | that we.learn..|
000000d0  2e 2e 2e 0d 0d 48 6f 70  65 66 75 6c 6c 79 20 49  |.....Hopefully I|
000000e0  20 73 68 61 6c 6c 20 6c  65 61 64 20 75 70 1a 20  | shall lead up. |
000000f0  74 6f 1a 20 70 72 6f 76  69 64 69 6e 67 1a 20 72  |to. providing. r|
00000100  6f 75 74 69 6e 65 73 20  66 6f 72 20 73 69 6d 70  |outines for simp|
00000110  6c 65 20 61 72 63 61 64  65 20 67 61 6d 65 73 0d  |le arcade games.|
00000120  61 6e 64 20 61 6c 73 6f  20 70 6f 73 73 69 62 6c  |and also possibl|
00000130  79 20 61 64 76 65 6e 74  75 72 65 20 67 61 6d 65  |y adventure game|
00000140  73 20 74 6f 6f 2e 0d 0d  48 61 76 69 6e 67 20 67  |s too...Having g|
00000150  69 76 65 6e 20 74 68 65  20 72 6f 75 74 69 6e 65  |iven the routine|
00000160  73 20 66 6f 72 20 70 72  69 6e 74 69 6e 67 1a 20  |s for printing. |
00000170  74 6f 20 73 63 72 65 65  6e 20 65 74 63 2e 2c 20  |to screen etc., |
00000180  79 6f 75 20 73 68 6f 75  6c 64 20 62 65 20 61 62  |you should be ab|
00000190  6c 65 0d 74 6f 20 6d 61  6b 65 20 75 70 20 69 6e  |le.to make up in|
000001a0  73 74 72 75 63 74 69 6f  6e 73 20 66 6f 72 20 61  |structions for a|
000001b0  20 73 69 6d 70 6c 65 1a  20 67 61 6d 65 20 6f 72  | simple. game or|
000001c0  20 61 20 6d 65 6e 75 20  6f 72 20 65 76 65 6e 20  | a menu or even |
000001d0  6c 6f 63 61 74 69 6f 6e  20 64 61 74 61 0d 66 6f  |location data.fo|
000001e0  72 20 61 6e 20 61 64 76  65 6e 75 72 65 20 67 61  |r an advenure ga|
000001f0  6d 65 2e 20 20 48 6f 77  20 61 62 6f 75 74 20 73  |me.  How about s|
00000200  6f 6d 65 20 69 64 65 61  73 2e 2e 2e 2e 2e 2e 0d  |ome ideas.......|
00000210  0d 49 6e 20 74 68 65 20  6d 65 61 6e 74 69 6d 65  |.In the meantime|
00000220  2c 20 49 20 77 61 6e 74  20 74 6f 20 70 72 6f 67  |, I want to prog|
00000230  72 65 73 73 20 74 6f 1a  20 73 6f 6d 65 1a 20 6d  |ress to. some. m|
00000240  6f 72 65 20 69 6e 74 65  72 65 73 74 69 6e 67 20  |ore interesting |
00000250  72 6f 75 74 69 6e 65 73  20 61 73 0d 70 72 6f 6d  |routines as.prom|
00000260  69 73 65 64 20 6c 61 73  74 20 74 69 6d 65 2e 0d  |ised last time..|
00000270  0d 50 4c 4f 54 54 49 4e  47 20 41 4e 44 20 44 52  |.PLOTTING AND DR|
00000280  41 57 49 4e 47 0d 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |AWING.~~~~~~~~~~|
00000290  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 0d 54 68 65 73 65  |~~~~~~~~~~.These|
000002a0  20 61 72 65 20 70 65 72  66 6f 72 6d 65 64 20 62  | are performed b|
000002b0  79 20 75 73 69 6e 67 20  56 44 55 32 35 20 61 6e  |y using VDU25 an|
000002c0  64 20 50 4c 4f 54 20 62  65 63 6f 6d 65 73 20 2d  |d PLOT becomes -|
000002d0  0d 0d 20 20 20 20 20 20  20 20 20 56 44 55 32 35  |..         VDU25|
000002e0  2c 70 2c 78 2c 79 0d 0d  77 68 65 72 65 20 70 20  |,p,x,y..where p |
000002f0  69 73 20 74 68 65 20 50  4c 4f 54 20 6e 75 6d 62  |is the PLOT numb|
00000300  65 72 20 61 6e 64 20 78  2c 79 20 61 72 65 20 74  |er and x,y are t|
00000310  68 65 20 63 6f 2d 6f 72  64 69 6e 61 74 65 73 2e  |he co-ordinates.|
00000320  0d 0d 46 6f 72 20 4d 4f  56 45 20 75 73 65 20 50  |..For MOVE use P|
00000330  4c 4f 54 20 34 20 61 6e  64 20 66 6f 72 20 44 52  |LOT 4 and for DR|
00000340  41 57 1a 20 20 75 73 65  1a 20 50 4c 4f 54 20 35  |AW.  use. PLOT 5|
00000350  2e 20 20 4f 74 68 65 72  20 50 4c 4f 54 20 6e 75  |.  Other PLOT nu|
00000360  6d 62 65 72 73 20 6e 61  6e 20 62 65 0d 75 73 65  |mbers nan be.use|
00000370  64 2c 20 6a 75 73 74 20  61 73 20 69 6e 20 42 41  |d, just as in BA|
00000380  53 49 43 2c 20 65 67 20  50 4c 4f 54 38 35 20 66  |SIC, eg PLOT85 f|
00000390  6f 72 20 66 69 6c 6c 69  6e 67 20 74 72 69 61 6e  |or filling trian|
000003a0  67 6c 65 73 2e 0d 0d 49  66 20 79 6f 75 20 61 72  |gles...If you ar|
000003b0  65 20 73 65 74 74 69 6e  67 20 75 70 20 61 20 73  |e setting up a s|
000003c0  65 72 69 65 73 20 6f 66  20 50 4c 4f 54 73 20 74  |eries of PLOTs t|
000003d0  6f 1a 20 64 72 61 77 20  61 20 64 69 61 67 72 61  |o. draw a diagra|
000003e0  6d 2c 20 49 20 68 61 76  65 20 6d 61 64 65 20 75  |m, I have made u|
000003f0  70 0d 61 20 73 75 62 72  6f 75 74 69 6e 65 20 77  |p.a subroutine w|
00000400  68 69 63 68 20 72 65 61  64 20 64 61 74 61 20 69  |hich read data i|
00000410  6e 20 74 68 65 20 66 6f  72 6d 20 2d 0d 0d 20 20  |n the form -..  |
00000420  20 20 20 20 20 20 20 45  51 55 42 20 70 3a 45 51  |       EQUB p:EQ|
00000430  55 57 20 78 3a 45 51 55  57 20 79 0d 0d 54 68 69  |UW x:EQUW y..Thi|
00000440  73 20 6e 65 65 64 73 20  74 68 65 20 6e 75 6d 62  |s needs the numb|
00000450  65 72 20 6f 66 20 50 4c  4f 54 73 20 6c 6f 61 64  |er of PLOTs load|
00000460  65 64 20 69 6e 20 41 20  72 65 67 69 73 74 65 72  |ed in A register|
00000470  20 61 6e 64 1a 20 74 68  65 1a 20 61 64 64 72 65  | and. the. addre|
00000480  73 73 1a 20 6f 66 0d 74  68 65 20 64 61 74 61 20  |ss. of.the data |
00000490  6c 6f 61 64 65 64 20 69  6e 20 58 20 61 6e 64 20  |loaded in X and |
000004a0  59 20 72 65 67 69 73 74  65 72 73 2c 20 61 73 20  |Y registers, as |
000004b0  65 78 70 6c 61 69 6e 65  64 20 66 6f 72 20 70 72  |explained for pr|
000004c0  65 76 69 6f 75 73 20 72  6f 75 74 69 6e 65 73 2c  |evious routines,|
000004d0  0d 62 65 66 6f 72 65 20  74 68 65 20 72 6f 75 74  |.before the rout|
000004e0  69 6e 65 20 69 73 20 63  61 6c 6c 65 64 2e 0d 0d  |ine is called...|
000004f0  20 20 20 2e 70 6c 6f 74  20 53 54 58 61 64 64 72  |   .plot STXaddr|
00000500  3a 53 54 59 61 64 64 72  2b 31 3a 53 54 41 6c 65  |:STYaddr+1:STAle|
00000510  6e 3a 4c 44 59 23 30 20  20 0d 20 20 20 2e 70 6c  |n:LDY#0  .   .pl|
00000520  6f 6f 70 20 4c 44 41 23  32 35 3a 4a 53 52 26 46  |oop LDA#25:JSR&F|
00000530  46 45 45 20 20 20 20 20  20 20 20 20 20 20 20 20  |FEE             |
00000540  20 20 20 20 20 20 20 20  5c 20 56 44 55 20 32 35  |        \ VDU 25|
00000550  0d 20 20 20 4c 44 58 23  35 20 20 0d 20 20 20 2e  |.   LDX#5  .   .|
00000560  70 6c 6f 6f 70 32 20 4c  44 41 28 61 64 64 72 29  |ploop2 LDA(addr)|
00000570  2c 59 3a 4a 53 52 26 46  46 45 45 20 20 20 20 20  |,Y:JSR&FFEE     |
00000580  20 20 20 20 20 20 20 20  20 20 5c 20 65 6e 74 65  |          \ ente|
00000590  72 20 64 61 74 61 20 62  79 74 65 0d 20 20 20 49  |r data byte.   I|
000005a0  4e 59 3a 42 4e 45 6e 6f  74 6f 76 65 72 3a 49 4e  |NY:BNEnotover:IN|
000005b0  43 20 61 64 64 72 2b 31  20 20 0d 20 20 20 2e 6e  |C addr+1  .   .n|
000005c0  6f 74 6f 76 65 72 20 44  45 58 3a 42 4e 45 70 6c  |otover DEX:BNEpl|
000005d0  6f 6f 70 32 0d 20 20 20  44 45 43 6c 65 6e 3a 42  |oop2.   DEClen:B|
000005e0  4e 45 20 70 6c 6f 6f 70  20 20 0d 20 20 20 52 54  |NE ploop  .   RT|
000005f0  53 20 20 0d 0d 4e 6f 74  65 2e 0d 54 68 65 72 65  |S  ..Note..There|
00000600  20 61 72 65 20 74 77 6f  20 76 61 72 69 61 62 6c  | are two variabl|
00000610  65 73 20 69 6e 1a 20 74  68 69 73 1a 20 6c 69 73  |es in. this. lis|
00000620  74 69 6e 67 20 77 68 69  63 68 20 73 68 6f 75 6c  |ting which shoul|
00000630  64 20 62 65 20 61 6c 6c  6f 63 61 74 65 64 20 62  |d be allocated b|
00000640  65 66 6f 72 65 0d 74 68  65 20 61 73 73 65 6d 62  |efore.the assemb|
00000650  6c 79 20 6c 6f 6f 70 20  73 6f 20 61 64 64 20 2d  |ly loop so add -|
00000660  0d 0d 20 20 20 20 20 20  31 35 20 61 64 64 72 3d  |..      15 addr=|
00000670  26 37 30 3a 6c 65 6e 3d  38 30 0d 0d 59 6f 75 20  |&70:len=80..You |
00000680  6d 61 79 20 61 6c 73 6f  20 61 64 64 20 74 68 65  |may also add the|
00000690  20 61 64 64 72 65 73 73  20 6f 66 20 4f 53 57 52  | address of OSWR|
000006a0  43 48 20 61 73 20 61 20  76 61 72 69 61 62 6c 65  |CH as a variable|
000006b0  20 73 69 6e 63 65 20 69  74 20 69 73 20 65 61 73  | since it is eas|
000006c0  69 65 72 20 74 6f 0d 77  72 69 74 65 20 61 6e 64  |ier to.write and|
000006d0  20 73 61 76 65 73 20 72  65 6d 65 6d 62 65 72 69  | saves rememberi|
000006e0  6e 67 20 74 68 65 20 61  64 64 72 65 73 73 2e 20  |ng the address. |
000006f0  20 41 64 64 20 20 2d 20  3a 6f 73 77 72 63 68 3d  | Add  - :oswrch=|
00000700  26 46 46 45 45 20 74 6f  20 6c 69 6e 65 20 31 35  |&FFEE to line 15|
00000710  2e 0d 54 68 69 73 20 63  6f 75 6c 64 20 65 76 65  |..This could eve|
00000720  6e 20 62 65 20 73 68 6f  72 74 65 6e 65 64 20 66  |n be shortened f|
00000730  75 72 74 68 65 72 20 28  65 67 20 2d 20 20 6f 73  |urther (eg -  os|
00000740  29 20 70 72 6f 76 69 64  65 64 20 69 74 20 64 6f  |) provided it do|
00000750  65 73 20 6e 6f 74 20 63  6c 61 73 68 0d 77 69 74  |es not clash.wit|
00000760  68 20 6f 74 68 65 72 20  76 61 72 69 61 62 6c 65  |h other variable|
00000770  73 2e 0d 0d 49 74 20 69  73 20 75 73 75 61 6c 6c  |s...It is usuall|
00000780  79 20 67 6f 6f 64 20 70  72 61 63 74 69 63 65 1a  |y good practice.|
00000790  20 74 6f 1a 20 61 6c 6c  6f 63 61 74 65 20 61 6e  | to. allocate an|
000007a0  79 20 76 61 72 69 61 62  6c 65 73 20 69 6e 20 74  |y variables in t|
000007b0  68 69 73 20 77 61 79 20  61 74 20 74 68 65 0d 62  |his way at the.b|
000007c0  65 67 69 6e 6e 69 6e 67  20 6f 66 20 74 68 65 20  |eginning of the |
000007d0  70 72 6f 67 72 61 6d 2e  0d 0d 0d 54 68 65 20 73  |program....The s|
000007e0  75 62 72 6f 75 74 69 6e  65 20 66 69 72 73 74 20  |ubroutine first |
000007f0  65 6e 74 65 72 73 20 74  68 65 20 76 61 6c 75 65  |enters the value|
00000800  20 32 35 20 62 65 66 6f  72 65 20 63 61 6c 6c 69  | 25 before calli|
00000810  6e 67 20 4f 53 57 52 43  48 20 74 68 65 6e 20 65  |ng OSWRCH then e|
00000820  6e 74 65 72 73 0d 74 68  65 20 6c 6f 6f 70 20 27  |nters.the loop '|
00000830  70 6c 6f 6f 70 32 27 20  77 68 69 63 68 20 72 65  |ploop2' which re|
00000840  70 65 61 74 73 20 35 20  74 69 6d 65 73 1a 20 74  |peats 5 times. t|
00000850  6f 1a 20 65 6e 74 65 72  1a 20 74 68 65 20 35 20  |o. enter. the 5 |
00000860  64 61 74 61 20 62 79 74  65 73 2e 20 20 54 68 65  |data bytes.  The|
00000870  0d 76 61 72 69 61 62 6c  65 1a 20 27 6c 65 6e 27  |.variable. 'len'|
00000880  1a 20 69 73 1a 20 74 68  65 6e 1a 20 64 65 63 72  |. is. then. decr|
00000890  65 6d 65 6e 74 65 64 1a  20 61 6e 64 20 69 66 20  |emented. and if |
000008a0  6e 6f 74 20 7a 65 72 6f  20 74 68 65 6e 1a 20 74  |not zero then. t|
000008b0  68 65 1a 20 72 6f 75 74  69 6e 65 0d 62 72 61 6e  |he. routine.bran|
000008c0  63 68 65 73 20 62 61 63  6b 20 74 6f 20 27 70 6c  |ches back to 'pl|
000008d0  6f 6f 70 31 27 20 66 6f  72 20 74 68 65 1a 20 6e  |oop1' for the. n|
000008e0  65 78 74 1a 20 70 6c 6f  74 2e 20 20 49 66 20 74  |ext. plot.  If t|
000008f0  68 65 20 64 61 74 61 20  69 73 20 6c 6f 6e 67 65  |he data is longe|
00000900  72 20 74 68 61 6e 0d 32  35 35 20 62 79 74 65 73  |r than.255 bytes|
00000910  2c 20 59 20 72 65 67 69  73 74 65 72 20 77 69 6c  |, Y register wil|
00000920  6c 20 72 65 74 75 72 6e  20 74 6f 20 7a 65 72 6f  |l return to zero|
00000930  20 61 6e 64 20 74 68 65  20 62 72 61 6e 63 68 20  | and the branch |
00000940  74 6f 20 27 6e 6f 74 6f  76 65 72 27 20 77 69 6c  |to 'notover' wil|
00000950  6c 0d 6e 6f 74 20 6f 63  63 75 72 20 73 6f 20 74  |l.not occur so t|
00000960  68 61 74 20 74 68 65 20  68 69 67 68 20 62 79 74  |hat the high byt|
00000970  65 20 6f 66 20 27 61 64  64 72 27 20 69 73 20 69  |e of 'addr' is i|
00000980  6e 63 72 65 6d 65 6e 74  65 64 2e 0d 0d 54 68 65  |ncremented...The|
00000990  20 50 72 69 6e 74 20 72  6f 75 74 69 6e 65 20 63  | Print routine c|
000009a0  6f 75 6c 64 20 62 65 20  6d 6f 64 69 66 69 65 64  |ould be modified|
000009b0  20 69 6e 20 61 20 73 69  6d 69 6c 61 72 20 77 61  | in a similar wa|
000009c0  79 20 74 6f 20 65 6e 61  62 6c 65 20 69 74 20 74  |y to enable it t|
000009d0  6f 20 70 72 69 6e 74 0d  6c 6f 6e 67 65 72 20 74  |o print.longer t|
000009e0  65 78 74 20 61 73 20 69  74 20 77 69 6c 6c 20 6f  |ext as it will o|
000009f0  6e 6c 79 20 70 72 69 6e  74 20 75 70 20 74 6f 20  |nly print up to |
00000a00  32 35 35 20 63 68 61 72  61 63 74 65 72 73 20 61  |255 characters a|
00000a10  74 20 70 72 65 73 65 6e  74 2e 0d 0d 0d 55 53 45  |t present....USE|
00000a20  52 20 44 45 46 49 4e 45  44 20 43 48 41 52 41 43  |R DEFINED CHARAC|
00000a30  54 45 52 53 0d 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |TERS.~~~~~~~~~~~|
00000a40  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 0d 54 68 65  |~~~~~~~~~~~~.The|
00000a50  73 65 1a 20 61 72 65 1a  20 64 65 66 69 6e 65 64  |se. are. defined|
00000a60  1a 20 62 79 1a 20 56 44  55 32 33 2c 63 68 61 72  |. by. VDU23,char|
00000a70  2c 61 2c 62 2c 63 2c 64  2c 65 2c 66 2c 67 2c 68  |,a,b,c,d,e,f,g,h|
00000a80  1a 20 61 73 1a 20 69 6e  20 42 41 53 49 43 20 61  |. as. in BASIC a|
00000a90  6e 64 20 74 68 69 73 0d  72 6f 75 74 69 6e 65 20  |nd this.routine |
00000aa0  77 69 6c 6c 20 73 65 74  20 75 70 20 61 6e 79 20  |will set up any |
00000ab0  6e 75 6d 62 65 72 20 6f  66 20 63 68 61 72 61 63  |number of charac|
00000ac0  74 65 72 73 20 66 72 6f  6d 20 6e 75 6d 62 65 72  |ters from number|
00000ad0  20 32 32 34 20 69 6e 20  73 65 71 75 6e 63 65 2e  | 224 in sequnce.|
00000ae0  0d 0d 49 74 1a 77 69 6c  6c 20 72 65 61 64 20 61  |..It.will read a|
00000af0  20 73 65 72 69 65 73 20  6f 66 20 64 61 74 61 20  | series of data |
00000b00  6c 69 6e 65 73 20 69 6e  20 74 68 65 20 73 61 6d  |lines in the sam|
00000b10  65 20 77 61 79 20 61 73  20 74 68 65 20 61 62 6f  |e way as the abo|
00000b20  76 65 20 72 6f 75 74 69  6e 65 2e 0d 54 68 65 20  |ve routine..The |
00000b30  64 61 74 61 20 63 61 6e  20 62 65 20 65 6e 74 65  |data can be ente|
00000b40  72 65 64 2c 20 66 6f 6c  6c 6f 77 69 6e 67 20 74  |red, following t|
00000b50  68 65 20 6c 61 62 65 6c  20 27 2e 63 68 61 72 64  |he label '.chard|
00000b60  61 74 61 27 2c 20 61 73  20 2d 0d 20 20 20 20 20  |ata', as -.     |
00000b70  20 0d 20 20 20 20 20 20  45 51 55 42 20 61 3a 45  | .      EQUB a:E|
00000b80  51 55 42 20 62 3a 45 51  55 42 20 63 3a 2e 2e 2e  |QUB b:EQUB c:...|
00000b90  2e 2e 2e 2e 2e 2e 2e 2e  45 51 55 42 20 68 0d 0d  |........EQUB h..|
00000ba0  54 68 69 73 20 63 61 6e  20 62 65 1a 20 73 69 6d  |This can be. sim|
00000bb0  70 6c 69 66 69 65 64 1a  20 62 79 20 75 73 69 6e  |plified. by usin|
00000bc0  67 20 45 51 55 44 3a 45  51 55 44 20 62 75 74 20  |g EQUD:EQUD but |
00000bd0  74 68 65 20 6e 75 6d 62  65 72 73 20 6d 75 73 74  |the numbers must|
00000be0  20 62 65 20 69 6e 20 68  65 78 0d 61 6e 64 20 65  | be in hex.and e|
00000bf0  61 63 68 20 66 6f 75 72  20 64 69 67 69 74 73 20  |ach four digits |
00000c00  6d 75 73 74 1a 20 65 6e  74 65 72 65 64 20 69 6e  |must. entered in|
00000c10  20 72 65 76 65 72 73 65  20 6f 72 64 65 72 20 61  | reverse order a|
00000c20  73 20 45 51 55 44 20 65  6e 74 65 72 73 20 74 68  |s EQUD enters th|
00000c30  65 6d 20 69 6e 0d 72 65  76 65 72 73 65 20 6f 72  |em in.reverse or|
00000c40  64 65 72 2e 20 54 68 69  73 20 74 68 65 6e 20 62  |der. This then b|
00000c50  65 63 6f 6d 65 73 20 2d  0d 0d 20 20 20 20 20 20  |ecomes -..      |
00000c60  20 45 51 55 44 20 26 64  63 62 61 3a 45 51 55 44  | EQUD &dcba:EQUD|
00000c70  20 26 68 67 66 65 0d 0d  54 68 69 73 20 72 6f 75  | &hgfe..This rou|
00000c80  74 69 6e 65 20 6e 65 65  64 73 20 74 68 65 20 76  |tine needs the v|
00000c90  61 72 69 61 62 6c 65 73  2c 20 74 65 6d 70 3d 26  |ariables, temp=&|
00000ca0  38 31 20 61 6e 64 20 6f  73 77 72 63 68 3d 26 46  |81 and oswrch=&F|
00000cb0  46 45 45 2c 1a 20 65 6e  74 65 72 69 6e 67 1a 20  |FEE,. entering. |
00000cc0  69 6e 0d 6c 69 6e 65 20  31 35 20 61 73 20 6d 65  |in.line 15 as me|
00000cd0  6e 74 69 6f 6e 65 64 20  61 62 6f 76 65 2e 0d 0d  |ntioned above...|
00000ce0  20 20 20 2e 63 68 61 72  73 20 4c 44 59 23 30 3a  |   .chars LDY#0:|
00000cf0  4c 44 58 23 32 32 34 20  0d 20 20 20 2e 63 68 6c  |LDX#224 .   .chl|
00000d00  6f 6f 70 31 20 53 54 58  74 65 6d 70 20 0d 20 20  |oop1 STXtemp .  |
00000d10  20 4c 44 41 23 32 33 3a  4a 53 52 6f 73 77 72 63  | LDA#23:JSRoswrc|
00000d20  68 20 20 20 20 20 20 20  20 20 20 20 5c 20 56 44  |h           \ VD|
00000d30  55 20 32 33 0d 20 20 20  54 58 41 3a 4a 53 52 6f  |U 23.   TXA:JSRo|
00000d40  73 77 72 63 68 20 20 20  20 20 20 20 20 20 20 20  |swrch           |
00000d50  20 20 20 5c 20 63 68 61  72 61 63 74 65 72 20 6e  |   \ character n|
00000d60  6f 2e 0d 20 20 20 4c 44  58 23 38 20 0d 20 20 20  |o..   LDX#8 .   |
00000d70  2e 63 68 6c 6f 6f 70 32  20 4c 44 41 63 68 64 61  |.chloop2 LDAchda|
00000d80  74 61 2c 59 20 20 20 20  20 20 20 5c 20 72 65 61  |ta,Y       \ rea|
00000d90  64 20 64 61 74 61 20 62  79 74 65 0d 20 20 20 4a  |d data byte.   J|
00000da0  53 52 6f 73 77 72 63 68  0d 20 20 20 49 4e 59 20  |SRoswrch.   INY |
00000db0  0d 20 20 20 44 45 58 20  0d 20 20 20 42 4e 45 63  |.   DEX .   BNEc|
00000dc0  68 6c 6f 6f 70 32 0d 20  20 20 4c 44 58 74 65 6d  |hloop2.   LDXtem|
00000dd0  70 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |p               |
00000de0  20 20 20 20 20 20 5c 20  72 65 6c 6f 61 64 20 63  |      \ reload c|
00000df0  68 61 72 20 6e 6f 2e 0d  20 20 20 49 4e 58 20 20  |har no..   INX  |
00000e00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000e10  20 20 20 20 20 20 20 5c  20 69 6e 63 72 65 6d 65  |       \ increme|
00000e20  6e 74 20 63 68 61 72 20  6e 6f 2e 0d 20 20 20 43  |nt char no..   C|
00000e30  50 58 23 32 34 32 20 20  20 20 20 20 20 20 20 20  |PX#242          |
00000e40  20 20 20 20 20 20 20 20  20 20 20 5c 20 6c 61 73  |           \ las|
00000e50  74 20 63 68 61 72 20 6e  6f 2e 20 2b 31 0d 20 20  |t char no. +1.  |
00000e60  20 42 4e 45 63 68 6c 6f  6f 70 31 0d 20 20 20 52  | BNEchloop1.   R|
00000e70  54 53 20 0d 0d 58 1a 20  72 65 67 69 73 74 65 72  |TS ..X. register|
00000e80  1a 20 69 73 1a 20 6c 6f  61 64 65 64 20 77 69 74  |. is. loaded wit|
00000e90  68 20 32 32 34 2c 20 74  68 65 20 66 69 72 73 74  |h 224, the first|
00000ea0  20 63 68 61 72 61 63 74  65 72 20 76 61 6c 75 65  | character value|
00000eb0  2c 20 61 6e 64 1a 20 74  68 69 73 1a 20 69 73 0d  |, and. this. is.|
00000ec0  73 74 6f 72 65 64 1a 20  69 6e 1a 20 27 74 65 6d  |stored. in. 'tem|
00000ed0  70 27 1a 20 77 69 74 68  69 6e 1a 20 6c 6f 6f 70  |p'. within. loop|
00000ee0  20 27 63 68 6c 6f 6f 70  31 27 20 73 69 6e 63 65  | 'chloop1' since|
00000ef0  20 58 20 72 65 67 69 73  74 65 72 20 69 73 20 75  | X register is u|
00000f00  73 65 64 20 69 6e 20 74  68 65 0d 73 65 63 6f 6e  |sed in the.secon|
00000f10  64 20 6c 6f 6f 70 20 74  6f 20 63 6f 75 6e 74 20  |d loop to count |
00000f20  74 68 65 20 38 20 64 61  74 61 20 62 79 74 65 73  |the 8 data bytes|
00000f30  2e 20 20 41 20 72 65 67  69 73 74 65 72 20 69 73  |.  A register is|
00000f40  20 66 69 72 73 74 20 6c  6f 61 64 65 64 20 77 69  | first loaded wi|
00000f50  74 68 20 32 33 0d 74 68  65 6e 20 74 68 65 20 76  |th 23.then the v|
00000f60  61 6c 75 65 20 69 6e 20  58 1a 20 74 6f 20 67 69  |alue in X. to gi|
00000f70  76 65 20 74 68 65 20 66  69 72 73 74 20 74 77 6f  |ve the first two|
00000f80  20 70 61 72 74 73 20 6f  66 20 74 68 65 20 63 6f  | parts of the co|
00000f90  6d 6d 61 6e 64 2e 20 20  54 68 65 20 6c 6f 6f 70  |mmand.  The loop|
00000fa0  0d 27 63 68 6c 6f 6f 70  32 27 20 74 68 65 6e 20  |.'chloop2' then |
00000fb0  6c 6f 61 64 73 20 74 68  65 20 38 20 64 61 74 61  |loads the 8 data|
00000fc0  1a 20 62 79 74 65 73 2e  1a 20 20 52 65 67 69 73  |. bytes..  Regis|
00000fd0  74 65 72 1a 20 58 1a 20  69 73 20 74 68 65 6e 20  |ter. X. is then |
00000fe0  6c 6f 61 64 65 64 20 66  72 6f 6d 0d 27 74 65 6d  |loaded from.'tem|
00000ff0  70 27 1a 1a 20 61 6e 64  1a 20 69 6e 63 72 65 6d  |p'.. and. increm|
00001000  65 6e 74 65 64 1a 20 62  65 66 6f 72 65 1a 20 72  |ented. before. r|
00001010  65 70 65 61 74 69 6e 67  1a 20 74 68 65 1a 20 70  |epeating. the. p|
00001020  72 6f 63 65 73 73 1a 20  66 6f 72 1a 20 74 68 65  |rocess. for. the|
00001030  1a 20 6e 65 78 74 0d 63  68 61 72 61 63 74 65 72  |. next.character|
00001040  2e 1a 20 20 57 68 65 6e  20 74 68 65 20 66 69 6e  |..  When the fin|
00001050  61 6c 20 63 68 61 72 61  63 74 65 72 20 64 65 66  |al character def|
00001060  69 6e 69 74 69 6f 6e 20  69 73 20 63 6f 6d 70 6c  |inition is compl|
00001070  65 74 65 64 2c 20 74 68  65 20 72 6f 75 74 69 6e  |eted, the routin|
00001080  65 0d 64 6f 65 73 20 6e  6f 74 1a 20 62 72 61 6e  |e.does not. bran|
00001090  63 68 20 62 61 63 6b 20  61 73 20 74 68 65 20 63  |ch back as the c|
000010a0  6f 6d 70 61 72 69 73 6f  6e 20 69 73 20 6d 65 74  |omparison is met|
000010b0  2e 20 20 54 68 65 20 76  61 6c 75 65 20 6f 66 20  |.  The value of |
000010c0  74 68 69 73 20 6d 75 73  74 20 62 65 0d 65 6e 74  |this must be.ent|
000010d0  65 72 65 64 20 61 63 63  6f 72 64 69 6e 67 20 74  |ered according t|
000010e0  6f 20 74 68 65 20 6e 75  6d 62 65 72 20 6f 66 20  |o the number of |
000010f0  63 68 61 72 61 63 74 65  72 73 20 74 6f 20 62 65  |characters to be|
00001100  20 64 65 66 69 6e 65 64  2e 0d 0d 54 68 69 73 20  | defined...This |
00001110  72 6f 75 74 69 6e 65 20  75 73 65 73 1a 20 74 68  |routine uses. th|
00001120  65 1a 20 49 6e 64 65 78  65 64 20 41 64 64 72 65  |e. Indexed Addre|
00001130  73 73 69 6e 67 20 6d 6f  64 65 20 61 6e 64 20 61  |ssing mode and a|
00001140  73 20 77 72 69 74 74 65  6e 20 63 61 6e 20 6f 6e  |s written can on|
00001150  6c 79 20 62 65 0d 75 73  65 64 20 6f 6e 63 65 20  |ly be.used once |
00001160  69 6e 20 74 68 65 20 70  72 6f 67 72 61 6d 2e 1a  |in the program..|
00001170  20 20 49 66 20 73 6f 6d  65 20 63 68 61 72 61 63  |  If some charac|
00001180  74 65 72 73 20 6e 65 65  64 20 74 6f 20 62 65 20  |ters need to be |
00001190  72 65 64 65 66 69 6e 65  64 20 64 75 72 69 6e 67  |redefined during|
000011a0  0d 74 68 65 20 72 75 6e  6e 69 6e 67 20 6f 66 20  |.the running of |
000011b0  61 20 70 72 6f 67 72 61  6d 2c 20 69 74 1a 20 73  |a program, it. s|
000011c0  68 6f 75 6c 64 20 62 65  20 70 6f 73 73 69 62 6c  |hould be possibl|
000011d0  65 20 74 6f 20 72 65 2d  77 72 69 74 65 20 74 68  |e to re-write th|
000011e0  65 20 63 6f 64 65 20 69  6e 20 61 0d 73 69 6d 69  |e code in a.simi|
000011f0  6c 61 72 20 77 61 79 20  74 6f 20 74 68 65 20 70  |lar way to the p|
00001200  72 69 6e 74 20 72 6f 75  74 69 6e 65 20 73 6f 1a  |rint routine so.|
00001210  20 74 68 61 74 1a 20 73  6f 6d 65 20 63 6f 75 6c  | that. some coul|
00001220  64 20 62 65 20 72 65 2d  64 65 66 69 6e 65 64 20  |d be re-defined |
00001230  66 72 6f 6d 20 61 0d 73  65 63 6f 6e 64 20 73 65  |from a.second se|
00001240  74 20 6f 66 20 64 61 74  61 2e 20 20 48 6f 77 20  |t of data.  How |
00001250  61 62 6f 75 74 20 74 72  79 69 6e 67 20 74 68 69  |about trying thi|
00001260  73 3f 20 20 59 6f 75 1a  20 77 6f 75 6c 64 1a 20  |s?  You. would. |
00001270  6e 65 65 64 1a 20 74 6f  1a 20 64 6f 1a 20 74 68  |need. to. do. th|
00001280  65 0d 63 68 61 72 61 63  74 65 72 73 20 69 6e 20  |e.characters in |
00001290  72 65 76 65 72 73 65 20  6f 72 64 65 72 20 2d 20  |reverse order - |
000012a0  73 61 79 20 66 72 6f 6d  20 32 35 30 20 64 6f 77  |say from 250 dow|
000012b0  6e 20 74 6f 20 32 32 34  20 61 6e 64 20 66 72 6f  |n to 224 and fro|
000012c0  6d 20 73 61 79 20 32 33  30 20 74 6f 0d 32 32 34  |m say 230 to.224|
000012d0  20 74 6f 20 72 65 2d 64  65 66 69 6e 65 20 74 68  | to re-define th|
000012e0  65 73 65 2e 20 20 49 20  77 69 6c 6c 20 63 6f 76  |ese.  I will cov|
000012f0  65 72 20 74 68 69 73 20  6c 61 74 65 72 20 69 66  |er this later if|
00001300  20 6e 65 65 64 65 64 2e  0d 0d 49 1a 20 68 6f 70  | needed...I. hop|
00001310  65 1a 20 74 6f 1a 20 63  6f 76 65 72 1a 20 6b 65  |e. to. cover. ke|
00001320  79 1a 20 65 6e 74 72 79  20 72 6f 75 74 69 6e 65  |y. entry routine|
00001330  73 20 66 6f 72 20 6d 61  6b 69 6e 67 20 6d 65 6e  |s for making men|
00001340  75 20 63 68 6f 69 63 65  73 20 61 6e 64 20 6d 6f  |u choices and mo|
00001350  76 69 6e 67 0d 63 68 61  72 61 63 74 65 72 73 20  |ving.characters |
00001360  61 62 6f 75 74 20 74 68  65 20 73 63 72 65 65 6e  |about the screen|
00001370  20 6e 65 78 74 20 74 69  6d 65 2e 0d              | next time..|
0000137c
F/m\ctut1.m0
F/m\ctut1.m1
F/m\ctut1.m2
F/m\ctut1.m4
F/m\ctut1.m5