Home » CEEFAX disks » telesoftware5.adl » 20-03-88/T\SWR20

20-03-88/T\SWR20

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 » CEEFAX disks » telesoftware5.adl
Filename: 20-03-88/T\SWR20
Read OK:
File size: 1FD8 bytes
Load address: 0000
Exec address: FFFFFFFF
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
Mastering Sideways ROM & RAM - Module 20 - RFS * commands
---------------------------------------------------------

  The RFS formatting programs used in the previous modules of the
course have allowed you to store BASIC and machine code programs in
the RFS and to run them in user memory by selecting the RFS and then
either chaining or *RUNning the programs.

  It is usually more convenient to run programs from SWR with *
commands. In this module I will demonstrate how to do this using the
familiar one command interpreter in an RFS rom image with a service
entry point. You can adapt the technique and use it with the multiple
command interpreter introduced in Module 15.

  When an unrecognised * command is matched with the rom title string
the one command interpreter usually passes control to a new routine
which is executed in SWR and followed by a return to the MOS. It is
not possible to run programs stored in the RFS in this way. Files are
stored in the RFS in a format similar to cassette files and, like
cassette files, they must be loaded into user memory before they can
run. Files can not run in the RFS memory even if they are sideways ram
programs. If you want to store SWR files in the RFS they will have to
be loaded from the RFS into another SWR bank and initialised before
they will run.

  To run programs from the RFS with a new * command it is necessary
for the interpreter to recognise the command and then pass control to
a routine which will select the RFS, load the program into user memory
and run the program. If you have the program DEMO stored in the RFS
you could achieve this same objective by typing:

>*BASIC
>*ROM
>CHAIN "DEMO"

  The interpreter in the program RFSERV runs the program DEMO by
passing control to a routine which does just what you would do but in
a different order. It first selects the RFS with Osbyte &8D. It then
flushes the keyboard buffer and inserts the string CHAIN "DEMO"
<Return> into the buffer and finally it uses Osbyte &BB to find BASIC
and Osbyte &8E to enter BASIC. When BASIC is entered in this way it
executes the command in the keyboard buffer and, in this example, it
will chain the program DEMO from the active filing system, the RFS.

  The coding executed when the new command is recognised is shown in
figure 20.1. The command stored in the string starting at the label
".rfscomm" can be replaced with whatever command, or series of
commands, you need to run your program.




.found
        LDA #&8D      \ Osbyte &8D
        JSR &FFF4     \ *ROM
        LDA #&0F      \ Osbyte &0F
        LDX #0
        JSR &FFF4     \ flush all buffers
        LDA #&FF      \ initialise offset
        PHA           \ store offset
.keyboard
        PLA           \ load A with offset
        TAX           \ offset in X
        INX           \ increment offset
        TXA           \ copy offset into A
        PHA           \ and store
        LDY rfscomm,X \ load character
        BEQ endkey    \ branch if end of text marker
        LDA #&8A      \ Osbyte &8A
        LDX #&0       \ keyboard buffer
        JSR &FFF4     \ load character into buffer
        JMP keyboard  \ go for next character
.endkey
        PLA           \ balance stack
        LDA #&BB      \ Osbyte &BB
        LDX #0
        LDY #&FF
        JSR &FFF4     \ find BASIC
        LDA #&8E      \ Osbyte &8E
        JMP &FFF4     \ enter BASIC, no return
.rfscomm
        EQUS "CHAIN""DEMO"""
        EQUB &0D      \ <Return>
        BRK           \ end of text marker

Figure 20.1  Inserting CHAIN "DEMO" into the keyboard buffer.
-----------  ------------------------------------------------



  The program RFSERV uses the RFS interpreter (lines 540-880)
introduced in Module 18 and the unrecognised * command interpreter
(lines 290-530) first used in Module 3. When this interpreter matches
an unrecognised command with the rom title string it passes control to
the label ".found" (line 890). It uses the routine in figure 20.1 to
insert the command CHAIN "DEMO" <Return> into the keyboard buffer and
exits the rom image by entering BASIC (lines  1150-1200). There is no
need to balance the stack before entering BASIC in this way because,
as you should know by now, BASIC will reset the stack when it is
initialised. If you want to use this program to run any other program
from the RFS you will obviously have to alter the command string in
lines 1220 to 1240 and the rom title in line 230.

  As with all the RFS header programs used to illustrate this course
RFSERV is used to create RFS rom images with RFSGEN and DEMO. Chain
RFSERV from a disc or tape which also contains both these programs.
Load the rom image they create into SWR and press the Break key. Type
*DEMO and press Return and the demonstration program will load into
user memory and run. Module 18 has more detailed instructions on using
the RFS formatting programs if you need them.





   10 REM: RFSERV
   20 MODE7
   30 HIMEM=&3C00
   40 diff=&8000-HIMEM
   50 H%=HIMEM
   60 comvec=&F2
   70 romnumber=&F4
   80 phrom=&F5
   90 rompoint=&F6
  100 gsread=&FFC5
  110 osbyte=&FFF4
  120 FOR pass = 0 TO 2 STEP 2
  130 P%=HIMEM
  140 [       OPT pass
  150         BRK
  160         BRK
  170         BRK
  180         JMP service+diff
  190         OPT FNequb(&82)
  200         OPT FNequb((copyright+diff) MOD 256)
  210         BRK
  220 .title
  230         OPT FNequs("DEMO")
  240 .copyright
  250         BRK
  260         OPT FNequs("(C) Gordon Horsington 1987")
  270         BRK
  280 .service
  290         PHA
  300         CMP #4
  310         BNE trythirteen
  320         TXA
  330         PHA
  340         TYA
  350         PHA
  360         LDX #&FF
  370 .comloop
  380         INX
  390         LDA title+diff,X
  400         BEQ found
  410         LDA (comvec),Y
  420         INY
  430         CMP #ASC(".")
  440         BEQ found
  450         AND #&DF
  460         CMP title+diff,X
  470         BEQ comloop
  480         PLA
  490         TAY
  500         PLA
  510         TAX
  520         PLA
  530         RTS
  540 .trythirteen
  550         CMP #13
  560         BNE fourteen
  570         TYA
  580         EOR #&F
  590         CMP romnumber
  600         BCC out
  610         LDA #(lastbyte+diff) MOD 256
  620         STA rompoint
  630         LDA #(lastbyte+diff) DIV 256
  640         STA rompoint+1
  650         LDA romnumber
  660         EOR #&F
  670         STA phrom
  680 .exit
  690         PLA
  700         LDA #0
  710         RTS
  720 .fourteen
  730         CMP #14
  740         BNE out
  750         LDA phrom
  760         EOR #&F
  770         CMP romnumber
  780         BNE out
  790         LDY #0
  800         LDA (rompoint),Y
  810         TAY
  820         INC rompoint
  830         BNE exit
  840         INC rompoint+1
  850         JMP exit+diff
  860 .out
  870         PLA
  880         RTS
  890 .found
  900         LDA #&8D
  910         JSR osbyte    \ *ROM
  920         LDA #&8B
  930         LDX #1
  940         LDY #0
  950         JSR osbyte    \ *OPT1,0
  960         LDA #&0F
  970         LDX #0
  980         JSR osbyte    \ Flush all buffers
  990         LDA #&FF
 1000         PHA
 1010 .keyboard
 1020         PLA
 1030         TAX
 1040         INX
 1050         TXA
 1060         PHA
 1070         LDY rfscomm+diff,X
 1080         BEQ endkey
 1090         LDA #&8A
 1100         LDX #0
 1110         JSR osbyte
 1120         JMP keyboard+diff
 1130 .endkey
 1140         PLA
 1150         LDA #&BB
 1160         LDX #0
 1170         LDY #&FF
 1180         JSR osbyte    \ Find BASIC
 1190         LDA #&8E
 1200         JMP osbyte    \ Enter BASIC
 1210 .rfscomm
 1220         OPT FNequs("CHAIN""DEMO""")
 1230         OPT FNequb(&0D)
 1240         BRK
 1250 .lastbyte
 1260 ]
 1270 NEXT
 1280 O%=lastbyte
 1290 CHAIN"RFSGEN"
 1300 DEFFNequb(byte)
 1310 ?P%=byte
 1320 P%=P%+1
 1330 =pass
 1340 DEFFNequw(word)
 1350 ?P%=word MOD 256
 1360 P%?1=word DIV 256
 1370 P%=P%+2
 1380 =pass
 1390 DEFFNequd(double)
 1400 !P%=double
 1410 P%=P%+4
 1420 =pass
 1430 DEFFNequs(string$)
 1440 $P%=string$
 1450 P%=P%+LEN(string$)
 1460 =pass
00000000  4d 61 73 74 65 72 69 6e  67 20 53 69 64 65 77 61  |Mastering Sidewa|
00000010  79 73 20 52 4f 4d 20 26  20 52 41 4d 20 2d 20 4d  |ys ROM & RAM - M|
00000020  6f 64 75 6c 65 20 32 30  20 2d 20 52 46 53 20 2a  |odule 20 - RFS *|
00000030  20 63 6f 6d 6d 61 6e 64  73 0d 2d 2d 2d 2d 2d 2d  | commands.------|
00000040  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000070  2d 2d 2d 0d 0d 20 20 54  68 65 20 52 46 53 20 66  |---..  The RFS f|
00000080  6f 72 6d 61 74 74 69 6e  67 20 70 72 6f 67 72 61  |ormatting progra|
00000090  6d 73 20 75 73 65 64 20  69 6e 20 74 68 65 20 70  |ms used in the p|
000000a0  72 65 76 69 6f 75 73 20  6d 6f 64 75 6c 65 73 20  |revious modules |
000000b0  6f 66 20 74 68 65 0d 63  6f 75 72 73 65 20 68 61  |of the.course ha|
000000c0  76 65 20 61 6c 6c 6f 77  65 64 20 79 6f 75 20 74  |ve allowed you t|
000000d0  6f 20 73 74 6f 72 65 20  42 41 53 49 43 20 61 6e  |o store BASIC an|
000000e0  64 20 6d 61 63 68 69 6e  65 20 63 6f 64 65 20 70  |d machine code p|
000000f0  72 6f 67 72 61 6d 73 20  69 6e 0d 74 68 65 20 52  |rograms in.the R|
00000100  46 53 20 61 6e 64 20 74  6f 20 72 75 6e 20 74 68  |FS and to run th|
00000110  65 6d 20 69 6e 20 75 73  65 72 20 6d 65 6d 6f 72  |em in user memor|
00000120  79 20 62 79 20 73 65 6c  65 63 74 69 6e 67 20 74  |y by selecting t|
00000130  68 65 20 52 46 53 20 61  6e 64 20 74 68 65 6e 0d  |he RFS and then.|
00000140  65 69 74 68 65 72 20 63  68 61 69 6e 69 6e 67 20  |either chaining |
00000150  6f 72 20 2a 52 55 4e 6e  69 6e 67 20 74 68 65 20  |or *RUNning the |
00000160  70 72 6f 67 72 61 6d 73  2e 0d 0d 20 20 49 74 20  |programs...  It |
00000170  69 73 20 75 73 75 61 6c  6c 79 20 6d 6f 72 65 20  |is usually more |
00000180  63 6f 6e 76 65 6e 69 65  6e 74 20 74 6f 20 72 75  |convenient to ru|
00000190  6e 20 70 72 6f 67 72 61  6d 73 20 66 72 6f 6d 20  |n programs from |
000001a0  53 57 52 20 77 69 74 68  20 2a 0d 63 6f 6d 6d 61  |SWR with *.comma|
000001b0  6e 64 73 2e 20 49 6e 20  74 68 69 73 20 6d 6f 64  |nds. In this mod|
000001c0  75 6c 65 20 49 20 77 69  6c 6c 20 64 65 6d 6f 6e  |ule I will demon|
000001d0  73 74 72 61 74 65 20 68  6f 77 20 74 6f 20 64 6f  |strate how to do|
000001e0  20 74 68 69 73 20 75 73  69 6e 67 20 74 68 65 0d  | this using the.|
000001f0  66 61 6d 69 6c 69 61 72  20 6f 6e 65 20 63 6f 6d  |familiar one com|
00000200  6d 61 6e 64 20 69 6e 74  65 72 70 72 65 74 65 72  |mand interpreter|
00000210  20 69 6e 20 61 6e 20 52  46 53 20 72 6f 6d 20 69  | in an RFS rom i|
00000220  6d 61 67 65 20 77 69 74  68 20 61 20 73 65 72 76  |mage with a serv|
00000230  69 63 65 0d 65 6e 74 72  79 20 70 6f 69 6e 74 2e  |ice.entry point.|
00000240  20 59 6f 75 20 63 61 6e  20 61 64 61 70 74 20 74  | You can adapt t|
00000250  68 65 20 74 65 63 68 6e  69 71 75 65 20 61 6e 64  |he technique and|
00000260  20 75 73 65 20 69 74 20  77 69 74 68 20 74 68 65  | use it with the|
00000270  20 6d 75 6c 74 69 70 6c  65 0d 63 6f 6d 6d 61 6e  | multiple.comman|
00000280  64 20 69 6e 74 65 72 70  72 65 74 65 72 20 69 6e  |d interpreter in|
00000290  74 72 6f 64 75 63 65 64  20 69 6e 20 4d 6f 64 75  |troduced in Modu|
000002a0  6c 65 20 31 35 2e 0d 0d  20 20 57 68 65 6e 20 61  |le 15...  When a|
000002b0  6e 20 75 6e 72 65 63 6f  67 6e 69 73 65 64 20 2a  |n unrecognised *|
000002c0  20 63 6f 6d 6d 61 6e 64  20 69 73 20 6d 61 74 63  | command is matc|
000002d0  68 65 64 20 77 69 74 68  20 74 68 65 20 72 6f 6d  |hed with the rom|
000002e0  20 74 69 74 6c 65 20 73  74 72 69 6e 67 0d 74 68  | title string.th|
000002f0  65 20 6f 6e 65 20 63 6f  6d 6d 61 6e 64 20 69 6e  |e one command in|
00000300  74 65 72 70 72 65 74 65  72 20 75 73 75 61 6c 6c  |terpreter usuall|
00000310  79 20 70 61 73 73 65 73  20 63 6f 6e 74 72 6f 6c  |y passes control|
00000320  20 74 6f 20 61 20 6e 65  77 20 72 6f 75 74 69 6e  | to a new routin|
00000330  65 0d 77 68 69 63 68 20  69 73 20 65 78 65 63 75  |e.which is execu|
00000340  74 65 64 20 69 6e 20 53  57 52 20 61 6e 64 20 66  |ted in SWR and f|
00000350  6f 6c 6c 6f 77 65 64 20  62 79 20 61 20 72 65 74  |ollowed by a ret|
00000360  75 72 6e 20 74 6f 20 74  68 65 20 4d 4f 53 2e 20  |urn to the MOS. |
00000370  49 74 20 69 73 0d 6e 6f  74 20 70 6f 73 73 69 62  |It is.not possib|
00000380  6c 65 20 74 6f 20 72 75  6e 20 70 72 6f 67 72 61  |le to run progra|
00000390  6d 73 20 73 74 6f 72 65  64 20 69 6e 20 74 68 65  |ms stored in the|
000003a0  20 52 46 53 20 69 6e 20  74 68 69 73 20 77 61 79  | RFS in this way|
000003b0  2e 20 46 69 6c 65 73 20  61 72 65 0d 73 74 6f 72  |. Files are.stor|
000003c0  65 64 20 69 6e 20 74 68  65 20 52 46 53 20 69 6e  |ed in the RFS in|
000003d0  20 61 20 66 6f 72 6d 61  74 20 73 69 6d 69 6c 61  | a format simila|
000003e0  72 20 74 6f 20 63 61 73  73 65 74 74 65 20 66 69  |r to cassette fi|
000003f0  6c 65 73 20 61 6e 64 2c  20 6c 69 6b 65 0d 63 61  |les and, like.ca|
00000400  73 73 65 74 74 65 20 66  69 6c 65 73 2c 20 74 68  |ssette files, th|
00000410  65 79 20 6d 75 73 74 20  62 65 20 6c 6f 61 64 65  |ey must be loade|
00000420  64 20 69 6e 74 6f 20 75  73 65 72 20 6d 65 6d 6f  |d into user memo|
00000430  72 79 20 62 65 66 6f 72  65 20 74 68 65 79 20 63  |ry before they c|
00000440  61 6e 0d 72 75 6e 2e 20  46 69 6c 65 73 20 63 61  |an.run. Files ca|
00000450  6e 20 6e 6f 74 20 72 75  6e 20 69 6e 20 74 68 65  |n not run in the|
00000460  20 52 46 53 20 6d 65 6d  6f 72 79 20 65 76 65 6e  | RFS memory even|
00000470  20 69 66 20 74 68 65 79  20 61 72 65 20 73 69 64  | if they are sid|
00000480  65 77 61 79 73 20 72 61  6d 0d 70 72 6f 67 72 61  |eways ram.progra|
00000490  6d 73 2e 20 49 66 20 79  6f 75 20 77 61 6e 74 20  |ms. If you want |
000004a0  74 6f 20 73 74 6f 72 65  20 53 57 52 20 66 69 6c  |to store SWR fil|
000004b0  65 73 20 69 6e 20 74 68  65 20 52 46 53 20 74 68  |es in the RFS th|
000004c0  65 79 20 77 69 6c 6c 20  68 61 76 65 20 74 6f 0d  |ey will have to.|
000004d0  62 65 20 6c 6f 61 64 65  64 20 66 72 6f 6d 20 74  |be loaded from t|
000004e0  68 65 20 52 46 53 20 69  6e 74 6f 20 61 6e 6f 74  |he RFS into anot|
000004f0  68 65 72 20 53 57 52 20  62 61 6e 6b 20 61 6e 64  |her SWR bank and|
00000500  20 69 6e 69 74 69 61 6c  69 73 65 64 20 62 65 66  | initialised bef|
00000510  6f 72 65 0d 74 68 65 79  20 77 69 6c 6c 20 72 75  |ore.they will ru|
00000520  6e 2e 0d 0d 20 20 54 6f  20 72 75 6e 20 70 72 6f  |n...  To run pro|
00000530  67 72 61 6d 73 20 66 72  6f 6d 20 74 68 65 20 52  |grams from the R|
00000540  46 53 20 77 69 74 68 20  61 20 6e 65 77 20 2a 20  |FS with a new * |
00000550  63 6f 6d 6d 61 6e 64 20  69 74 20 69 73 20 6e 65  |command it is ne|
00000560  63 65 73 73 61 72 79 0d  66 6f 72 20 74 68 65 20  |cessary.for the |
00000570  69 6e 74 65 72 70 72 65  74 65 72 20 74 6f 20 72  |interpreter to r|
00000580  65 63 6f 67 6e 69 73 65  20 74 68 65 20 63 6f 6d  |ecognise the com|
00000590  6d 61 6e 64 20 61 6e 64  20 74 68 65 6e 20 70 61  |mand and then pa|
000005a0  73 73 20 63 6f 6e 74 72  6f 6c 20 74 6f 0d 61 20  |ss control to.a |
000005b0  72 6f 75 74 69 6e 65 20  77 68 69 63 68 20 77 69  |routine which wi|
000005c0  6c 6c 20 73 65 6c 65 63  74 20 74 68 65 20 52 46  |ll select the RF|
000005d0  53 2c 20 6c 6f 61 64 20  74 68 65 20 70 72 6f 67  |S, load the prog|
000005e0  72 61 6d 20 69 6e 74 6f  20 75 73 65 72 20 6d 65  |ram into user me|
000005f0  6d 6f 72 79 0d 61 6e 64  20 72 75 6e 20 74 68 65  |mory.and run the|
00000600  20 70 72 6f 67 72 61 6d  2e 20 49 66 20 79 6f 75  | program. If you|
00000610  20 68 61 76 65 20 74 68  65 20 70 72 6f 67 72 61  | have the progra|
00000620  6d 20 44 45 4d 4f 20 73  74 6f 72 65 64 20 69 6e  |m DEMO stored in|
00000630  20 74 68 65 20 52 46 53  0d 79 6f 75 20 63 6f 75  | the RFS.you cou|
00000640  6c 64 20 61 63 68 69 65  76 65 20 74 68 69 73 20  |ld achieve this |
00000650  73 61 6d 65 20 6f 62 6a  65 63 74 69 76 65 20 62  |same objective b|
00000660  79 20 74 79 70 69 6e 67  3a 0d 0d 3e 2a 42 41 53  |y typing:..>*BAS|
00000670  49 43 0d 3e 2a 52 4f 4d  0d 3e 43 48 41 49 4e 20  |IC.>*ROM.>CHAIN |
00000680  22 44 45 4d 4f 22 0d 0d  20 20 54 68 65 20 69 6e  |"DEMO"..  The in|
00000690  74 65 72 70 72 65 74 65  72 20 69 6e 20 74 68 65  |terpreter in the|
000006a0  20 70 72 6f 67 72 61 6d  20 52 46 53 45 52 56 20  | program RFSERV |
000006b0  72 75 6e 73 20 74 68 65  20 70 72 6f 67 72 61 6d  |runs the program|
000006c0  20 44 45 4d 4f 20 62 79  0d 70 61 73 73 69 6e 67  | DEMO by.passing|
000006d0  20 63 6f 6e 74 72 6f 6c  20 74 6f 20 61 20 72 6f  | control to a ro|
000006e0  75 74 69 6e 65 20 77 68  69 63 68 20 64 6f 65 73  |utine which does|
000006f0  20 6a 75 73 74 20 77 68  61 74 20 79 6f 75 20 77  | just what you w|
00000700  6f 75 6c 64 20 64 6f 20  62 75 74 20 69 6e 0d 61  |ould do but in.a|
00000710  20 64 69 66 66 65 72 65  6e 74 20 6f 72 64 65 72  | different order|
00000720  2e 20 49 74 20 66 69 72  73 74 20 73 65 6c 65 63  |. It first selec|
00000730  74 73 20 74 68 65 20 52  46 53 20 77 69 74 68 20  |ts the RFS with |
00000740  4f 73 62 79 74 65 20 26  38 44 2e 20 49 74 20 74  |Osbyte &8D. It t|
00000750  68 65 6e 0d 66 6c 75 73  68 65 73 20 74 68 65 20  |hen.flushes the |
00000760  6b 65 79 62 6f 61 72 64  20 62 75 66 66 65 72 20  |keyboard buffer |
00000770  61 6e 64 20 69 6e 73 65  72 74 73 20 74 68 65 20  |and inserts the |
00000780  73 74 72 69 6e 67 20 43  48 41 49 4e 20 22 44 45  |string CHAIN "DE|
00000790  4d 4f 22 0d 3c 52 65 74  75 72 6e 3e 20 69 6e 74  |MO".<Return> int|
000007a0  6f 20 74 68 65 20 62 75  66 66 65 72 20 61 6e 64  |o the buffer and|
000007b0  20 66 69 6e 61 6c 6c 79  20 69 74 20 75 73 65 73  | finally it uses|
000007c0  20 4f 73 62 79 74 65 20  26 42 42 20 74 6f 20 66  | Osbyte &BB to f|
000007d0  69 6e 64 20 42 41 53 49  43 0d 61 6e 64 20 4f 73  |ind BASIC.and Os|
000007e0  62 79 74 65 20 26 38 45  20 74 6f 20 65 6e 74 65  |byte &8E to ente|
000007f0  72 20 42 41 53 49 43 2e  20 57 68 65 6e 20 42 41  |r BASIC. When BA|
00000800  53 49 43 20 69 73 20 65  6e 74 65 72 65 64 20 69  |SIC is entered i|
00000810  6e 20 74 68 69 73 20 77  61 79 20 69 74 0d 65 78  |n this way it.ex|
00000820  65 63 75 74 65 73 20 74  68 65 20 63 6f 6d 6d 61  |ecutes the comma|
00000830  6e 64 20 69 6e 20 74 68  65 20 6b 65 79 62 6f 61  |nd in the keyboa|
00000840  72 64 20 62 75 66 66 65  72 20 61 6e 64 2c 20 69  |rd buffer and, i|
00000850  6e 20 74 68 69 73 20 65  78 61 6d 70 6c 65 2c 20  |n this example, |
00000860  69 74 0d 77 69 6c 6c 20  63 68 61 69 6e 20 74 68  |it.will chain th|
00000870  65 20 70 72 6f 67 72 61  6d 20 44 45 4d 4f 20 66  |e program DEMO f|
00000880  72 6f 6d 20 74 68 65 20  61 63 74 69 76 65 20 66  |rom the active f|
00000890  69 6c 69 6e 67 20 73 79  73 74 65 6d 2c 20 74 68  |iling system, th|
000008a0  65 20 52 46 53 2e 0d 0d  20 20 54 68 65 20 63 6f  |e RFS...  The co|
000008b0  64 69 6e 67 20 65 78 65  63 75 74 65 64 20 77 68  |ding executed wh|
000008c0  65 6e 20 74 68 65 20 6e  65 77 20 63 6f 6d 6d 61  |en the new comma|
000008d0  6e 64 20 69 73 20 72 65  63 6f 67 6e 69 73 65 64  |nd is recognised|
000008e0  20 69 73 20 73 68 6f 77  6e 20 69 6e 0d 66 69 67  | is shown in.fig|
000008f0  75 72 65 20 32 30 2e 31  2e 20 54 68 65 20 63 6f  |ure 20.1. The co|
00000900  6d 6d 61 6e 64 20 73 74  6f 72 65 64 20 69 6e 20  |mmand stored in |
00000910  74 68 65 20 73 74 72 69  6e 67 20 73 74 61 72 74  |the string start|
00000920  69 6e 67 20 61 74 20 74  68 65 20 6c 61 62 65 6c  |ing at the label|
00000930  0d 22 2e 72 66 73 63 6f  6d 6d 22 20 63 61 6e 20  |.".rfscomm" can |
00000940  62 65 20 72 65 70 6c 61  63 65 64 20 77 69 74 68  |be replaced with|
00000950  20 77 68 61 74 65 76 65  72 20 63 6f 6d 6d 61 6e  | whatever comman|
00000960  64 2c 20 6f 72 20 73 65  72 69 65 73 20 6f 66 0d  |d, or series of.|
00000970  63 6f 6d 6d 61 6e 64 73  2c 20 79 6f 75 20 6e 65  |commands, you ne|
00000980  65 64 20 74 6f 20 72 75  6e 20 79 6f 75 72 20 70  |ed to run your p|
00000990  72 6f 67 72 61 6d 2e 0d  0d 0d 0d 0d 2e 66 6f 75  |rogram.......fou|
000009a0  6e 64 0d 20 20 20 20 20  20 20 20 4c 44 41 20 23  |nd.        LDA #|
000009b0  26 38 44 20 20 20 20 20  20 5c 20 4f 73 62 79 74  |&8D      \ Osbyt|
000009c0  65 20 26 38 44 0d 20 20  20 20 20 20 20 20 4a 53  |e &8D.        JS|
000009d0  52 20 26 46 46 46 34 20  20 20 20 20 5c 20 2a 52  |R &FFF4     \ *R|
000009e0  4f 4d 0d 20 20 20 20 20  20 20 20 4c 44 41 20 23  |OM.        LDA #|
000009f0  26 30 46 20 20 20 20 20  20 5c 20 4f 73 62 79 74  |&0F      \ Osbyt|
00000a00  65 20 26 30 46 0d 20 20  20 20 20 20 20 20 4c 44  |e &0F.        LD|
00000a10  58 20 23 30 0d 20 20 20  20 20 20 20 20 4a 53 52  |X #0.        JSR|
00000a20  20 26 46 46 46 34 20 20  20 20 20 5c 20 66 6c 75  | &FFF4     \ flu|
00000a30  73 68 20 61 6c 6c 20 62  75 66 66 65 72 73 0d 20  |sh all buffers. |
00000a40  20 20 20 20 20 20 20 4c  44 41 20 23 26 46 46 20  |       LDA #&FF |
00000a50  20 20 20 20 20 5c 20 69  6e 69 74 69 61 6c 69 73  |     \ initialis|
00000a60  65 20 6f 66 66 73 65 74  0d 20 20 20 20 20 20 20  |e offset.       |
00000a70  20 50 48 41 20 20 20 20  20 20 20 20 20 20 20 5c  | PHA           \|
00000a80  20 73 74 6f 72 65 20 6f  66 66 73 65 74 0d 2e 6b  | store offset..k|
00000a90  65 79 62 6f 61 72 64 0d  20 20 20 20 20 20 20 20  |eyboard.        |
00000aa0  50 4c 41 20 20 20 20 20  20 20 20 20 20 20 5c 20  |PLA           \ |
00000ab0  6c 6f 61 64 20 41 20 77  69 74 68 20 6f 66 66 73  |load A with offs|
00000ac0  65 74 0d 20 20 20 20 20  20 20 20 54 41 58 20 20  |et.        TAX  |
00000ad0  20 20 20 20 20 20 20 20  20 5c 20 6f 66 66 73 65  |         \ offse|
00000ae0  74 20 69 6e 20 58 0d 20  20 20 20 20 20 20 20 49  |t in X.        I|
00000af0  4e 58 20 20 20 20 20 20  20 20 20 20 20 5c 20 69  |NX           \ i|
00000b00  6e 63 72 65 6d 65 6e 74  20 6f 66 66 73 65 74 0d  |ncrement offset.|
00000b10  20 20 20 20 20 20 20 20  54 58 41 20 20 20 20 20  |        TXA     |
00000b20  20 20 20 20 20 20 5c 20  63 6f 70 79 20 6f 66 66  |      \ copy off|
00000b30  73 65 74 20 69 6e 74 6f  20 41 0d 20 20 20 20 20  |set into A.     |
00000b40  20 20 20 50 48 41 20 20  20 20 20 20 20 20 20 20  |   PHA          |
00000b50  20 5c 20 61 6e 64 20 73  74 6f 72 65 0d 20 20 20  | \ and store.   |
00000b60  20 20 20 20 20 4c 44 59  20 72 66 73 63 6f 6d 6d  |     LDY rfscomm|
00000b70  2c 58 20 5c 20 6c 6f 61  64 20 63 68 61 72 61 63  |,X \ load charac|
00000b80  74 65 72 0d 20 20 20 20  20 20 20 20 42 45 51 20  |ter.        BEQ |
00000b90  65 6e 64 6b 65 79 20 20  20 20 5c 20 62 72 61 6e  |endkey    \ bran|
00000ba0  63 68 20 69 66 20 65 6e  64 20 6f 66 20 74 65 78  |ch if end of tex|
00000bb0  74 20 6d 61 72 6b 65 72  0d 20 20 20 20 20 20 20  |t marker.       |
00000bc0  20 4c 44 41 20 23 26 38  41 20 20 20 20 20 20 5c  | LDA #&8A      \|
00000bd0  20 4f 73 62 79 74 65 20  26 38 41 0d 20 20 20 20  | Osbyte &8A.    |
00000be0  20 20 20 20 4c 44 58 20  23 26 30 20 20 20 20 20  |    LDX #&0     |
00000bf0  20 20 5c 20 6b 65 79 62  6f 61 72 64 20 62 75 66  |  \ keyboard buf|
00000c00  66 65 72 0d 20 20 20 20  20 20 20 20 4a 53 52 20  |fer.        JSR |
00000c10  26 46 46 46 34 20 20 20  20 20 5c 20 6c 6f 61 64  |&FFF4     \ load|
00000c20  20 63 68 61 72 61 63 74  65 72 20 69 6e 74 6f 20  | character into |
00000c30  62 75 66 66 65 72 0d 20  20 20 20 20 20 20 20 4a  |buffer.        J|
00000c40  4d 50 20 6b 65 79 62 6f  61 72 64 20 20 5c 20 67  |MP keyboard  \ g|
00000c50  6f 20 66 6f 72 20 6e 65  78 74 20 63 68 61 72 61  |o for next chara|
00000c60  63 74 65 72 0d 2e 65 6e  64 6b 65 79 0d 20 20 20  |cter..endkey.   |
00000c70  20 20 20 20 20 50 4c 41  20 20 20 20 20 20 20 20  |     PLA        |
00000c80  20 20 20 5c 20 62 61 6c  61 6e 63 65 20 73 74 61  |   \ balance sta|
00000c90  63 6b 0d 20 20 20 20 20  20 20 20 4c 44 41 20 23  |ck.        LDA #|
00000ca0  26 42 42 20 20 20 20 20  20 5c 20 4f 73 62 79 74  |&BB      \ Osbyt|
00000cb0  65 20 26 42 42 0d 20 20  20 20 20 20 20 20 4c 44  |e &BB.        LD|
00000cc0  58 20 23 30 0d 20 20 20  20 20 20 20 20 4c 44 59  |X #0.        LDY|
00000cd0  20 23 26 46 46 0d 20 20  20 20 20 20 20 20 4a 53  | #&FF.        JS|
00000ce0  52 20 26 46 46 46 34 20  20 20 20 20 5c 20 66 69  |R &FFF4     \ fi|
00000cf0  6e 64 20 42 41 53 49 43  0d 20 20 20 20 20 20 20  |nd BASIC.       |
00000d00  20 4c 44 41 20 23 26 38  45 20 20 20 20 20 20 5c  | LDA #&8E      \|
00000d10  20 4f 73 62 79 74 65 20  26 38 45 0d 20 20 20 20  | Osbyte &8E.    |
00000d20  20 20 20 20 4a 4d 50 20  26 46 46 46 34 20 20 20  |    JMP &FFF4   |
00000d30  20 20 5c 20 65 6e 74 65  72 20 42 41 53 49 43 2c  |  \ enter BASIC,|
00000d40  20 6e 6f 20 72 65 74 75  72 6e 0d 2e 72 66 73 63  | no return..rfsc|
00000d50  6f 6d 6d 0d 20 20 20 20  20 20 20 20 45 51 55 53  |omm.        EQUS|
00000d60  20 22 43 48 41 49 4e 22  22 44 45 4d 4f 22 22 22  | "CHAIN""DEMO"""|
00000d70  0d 20 20 20 20 20 20 20  20 45 51 55 42 20 26 30  |.        EQUB &0|
00000d80  44 20 20 20 20 20 20 5c  20 3c 52 65 74 75 72 6e  |D      \ <Return|
00000d90  3e 0d 20 20 20 20 20 20  20 20 42 52 4b 20 20 20  |>.        BRK   |
00000da0  20 20 20 20 20 20 20 20  5c 20 65 6e 64 20 6f 66  |        \ end of|
00000db0  20 74 65 78 74 20 6d 61  72 6b 65 72 0d 0d 46 69  | text marker..Fi|
00000dc0  67 75 72 65 20 32 30 2e  31 20 20 49 6e 73 65 72  |gure 20.1  Inser|
00000dd0  74 69 6e 67 20 43 48 41  49 4e 20 22 44 45 4d 4f  |ting CHAIN "DEMO|
00000de0  22 20 69 6e 74 6f 20 74  68 65 20 6b 65 79 62 6f  |" into the keybo|
00000df0  61 72 64 20 62 75 66 66  65 72 2e 0d 2d 2d 2d 2d  |ard buffer..----|
00000e00  2d 2d 2d 2d 2d 2d 2d 20  20 2d 2d 2d 2d 2d 2d 2d  |-------  -------|
00000e10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000e30  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 0d 0d 0d 20 20 54  |---------....  T|
00000e40  68 65 20 70 72 6f 67 72  61 6d 20 52 46 53 45 52  |he program RFSER|
00000e50  56 20 75 73 65 73 20 74  68 65 20 52 46 53 20 69  |V uses the RFS i|
00000e60  6e 74 65 72 70 72 65 74  65 72 20 28 6c 69 6e 65  |nterpreter (line|
00000e70  73 20 35 34 30 2d 38 38  30 29 0d 69 6e 74 72 6f  |s 540-880).intro|
00000e80  64 75 63 65 64 20 69 6e  20 4d 6f 64 75 6c 65 20  |duced in Module |
00000e90  31 38 20 61 6e 64 20 74  68 65 20 75 6e 72 65 63  |18 and the unrec|
00000ea0  6f 67 6e 69 73 65 64 20  2a 20 63 6f 6d 6d 61 6e  |ognised * comman|
00000eb0  64 20 69 6e 74 65 72 70  72 65 74 65 72 0d 28 6c  |d interpreter.(l|
00000ec0  69 6e 65 73 20 32 39 30  2d 35 33 30 29 20 66 69  |ines 290-530) fi|
00000ed0  72 73 74 20 75 73 65 64  20 69 6e 20 4d 6f 64 75  |rst used in Modu|
00000ee0  6c 65 20 33 2e 20 57 68  65 6e 20 74 68 69 73 20  |le 3. When this |
00000ef0  69 6e 74 65 72 70 72 65  74 65 72 20 6d 61 74 63  |interpreter matc|
00000f00  68 65 73 0d 61 6e 20 75  6e 72 65 63 6f 67 6e 69  |hes.an unrecogni|
00000f10  73 65 64 20 63 6f 6d 6d  61 6e 64 20 77 69 74 68  |sed command with|
00000f20  20 74 68 65 20 72 6f 6d  20 74 69 74 6c 65 20 73  | the rom title s|
00000f30  74 72 69 6e 67 20 69 74  20 70 61 73 73 65 73 20  |tring it passes |
00000f40  63 6f 6e 74 72 6f 6c 20  74 6f 0d 74 68 65 20 6c  |control to.the l|
00000f50  61 62 65 6c 20 22 2e 66  6f 75 6e 64 22 20 28 6c  |abel ".found" (l|
00000f60  69 6e 65 20 38 39 30 29  2e 20 49 74 20 75 73 65  |ine 890). It use|
00000f70  73 20 74 68 65 20 72 6f  75 74 69 6e 65 20 69 6e  |s the routine in|
00000f80  20 66 69 67 75 72 65 20  32 30 2e 31 20 74 6f 0d  | figure 20.1 to.|
00000f90  69 6e 73 65 72 74 20 74  68 65 20 63 6f 6d 6d 61  |insert the comma|
00000fa0  6e 64 20 43 48 41 49 4e  20 22 44 45 4d 4f 22 20  |nd CHAIN "DEMO" |
00000fb0  3c 52 65 74 75 72 6e 3e  20 69 6e 74 6f 20 74 68  |<Return> into th|
00000fc0  65 20 6b 65 79 62 6f 61  72 64 20 62 75 66 66 65  |e keyboard buffe|
00000fd0  72 20 61 6e 64 0d 65 78  69 74 73 20 74 68 65 20  |r and.exits the |
00000fe0  72 6f 6d 20 69 6d 61 67  65 20 62 79 20 65 6e 74  |rom image by ent|
00000ff0  65 72 69 6e 67 20 42 41  53 49 43 20 28 6c 69 6e  |ering BASIC (lin|
00001000  65 73 20 20 31 31 35 30  2d 31 32 30 30 29 2e 20  |es  1150-1200). |
00001010  54 68 65 72 65 20 69 73  20 6e 6f 0d 6e 65 65 64  |There is no.need|
00001020  20 74 6f 20 62 61 6c 61  6e 63 65 20 74 68 65 20  | to balance the |
00001030  73 74 61 63 6b 20 62 65  66 6f 72 65 20 65 6e 74  |stack before ent|
00001040  65 72 69 6e 67 20 42 41  53 49 43 20 69 6e 20 74  |ering BASIC in t|
00001050  68 69 73 20 77 61 79 20  62 65 63 61 75 73 65 2c  |his way because,|
00001060  0d 61 73 20 79 6f 75 20  73 68 6f 75 6c 64 20 6b  |.as you should k|
00001070  6e 6f 77 20 62 79 20 6e  6f 77 2c 20 42 41 53 49  |now by now, BASI|
00001080  43 20 77 69 6c 6c 20 72  65 73 65 74 20 74 68 65  |C will reset the|
00001090  20 73 74 61 63 6b 20 77  68 65 6e 20 69 74 20 69  | stack when it i|
000010a0  73 0d 69 6e 69 74 69 61  6c 69 73 65 64 2e 20 49  |s.initialised. I|
000010b0  66 20 79 6f 75 20 77 61  6e 74 20 74 6f 20 75 73  |f you want to us|
000010c0  65 20 74 68 69 73 20 70  72 6f 67 72 61 6d 20 74  |e this program t|
000010d0  6f 20 72 75 6e 20 61 6e  79 20 6f 74 68 65 72 20  |o run any other |
000010e0  70 72 6f 67 72 61 6d 0d  66 72 6f 6d 20 74 68 65  |program.from the|
000010f0  20 52 46 53 20 79 6f 75  20 77 69 6c 6c 20 6f 62  | RFS you will ob|
00001100  76 69 6f 75 73 6c 79 20  68 61 76 65 20 74 6f 20  |viously have to |
00001110  61 6c 74 65 72 20 74 68  65 20 63 6f 6d 6d 61 6e  |alter the comman|
00001120  64 20 73 74 72 69 6e 67  20 69 6e 0d 6c 69 6e 65  |d string in.line|
00001130  73 20 31 32 32 30 20 74  6f 20 31 32 34 30 20 61  |s 1220 to 1240 a|
00001140  6e 64 20 74 68 65 20 72  6f 6d 20 74 69 74 6c 65  |nd the rom title|
00001150  20 69 6e 20 6c 69 6e 65  20 32 33 30 2e 0d 0d 20  | in line 230... |
00001160  20 41 73 20 77 69 74 68  20 61 6c 6c 20 74 68 65  | As with all the|
00001170  20 52 46 53 20 68 65 61  64 65 72 20 70 72 6f 67  | RFS header prog|
00001180  72 61 6d 73 20 75 73 65  64 20 74 6f 20 69 6c 6c  |rams used to ill|
00001190  75 73 74 72 61 74 65 20  74 68 69 73 20 63 6f 75  |ustrate this cou|
000011a0  72 73 65 0d 52 46 53 45  52 56 20 69 73 20 75 73  |rse.RFSERV is us|
000011b0  65 64 20 74 6f 20 63 72  65 61 74 65 20 52 46 53  |ed to create RFS|
000011c0  20 72 6f 6d 20 69 6d 61  67 65 73 20 77 69 74 68  | rom images with|
000011d0  20 52 46 53 47 45 4e 20  61 6e 64 20 44 45 4d 4f  | RFSGEN and DEMO|
000011e0  2e 20 43 68 61 69 6e 0d  52 46 53 45 52 56 20 66  |. Chain.RFSERV f|
000011f0  72 6f 6d 20 61 20 64 69  73 63 20 6f 72 20 74 61  |rom a disc or ta|
00001200  70 65 20 77 68 69 63 68  20 61 6c 73 6f 20 63 6f  |pe which also co|
00001210  6e 74 61 69 6e 73 20 62  6f 74 68 20 74 68 65 73  |ntains both thes|
00001220  65 20 70 72 6f 67 72 61  6d 73 2e 0d 4c 6f 61 64  |e programs..Load|
00001230  20 74 68 65 20 72 6f 6d  20 69 6d 61 67 65 20 74  | the rom image t|
00001240  68 65 79 20 63 72 65 61  74 65 20 69 6e 74 6f 20  |hey create into |
00001250  53 57 52 20 61 6e 64 20  70 72 65 73 73 20 74 68  |SWR and press th|
00001260  65 20 42 72 65 61 6b 20  6b 65 79 2e 20 54 79 70  |e Break key. Typ|
00001270  65 0d 2a 44 45 4d 4f 20  61 6e 64 20 70 72 65 73  |e.*DEMO and pres|
00001280  73 20 52 65 74 75 72 6e  20 61 6e 64 20 74 68 65  |s Return and the|
00001290  20 64 65 6d 6f 6e 73 74  72 61 74 69 6f 6e 20 70  | demonstration p|
000012a0  72 6f 67 72 61 6d 20 77  69 6c 6c 20 6c 6f 61 64  |rogram will load|
000012b0  20 69 6e 74 6f 0d 75 73  65 72 20 6d 65 6d 6f 72  | into.user memor|
000012c0  79 20 61 6e 64 20 72 75  6e 2e 20 4d 6f 64 75 6c  |y and run. Modul|
000012d0  65 20 31 38 20 68 61 73  20 6d 6f 72 65 20 64 65  |e 18 has more de|
000012e0  74 61 69 6c 65 64 20 69  6e 73 74 72 75 63 74 69  |tailed instructi|
000012f0  6f 6e 73 20 6f 6e 20 75  73 69 6e 67 0d 74 68 65  |ons on using.the|
00001300  20 52 46 53 20 66 6f 72  6d 61 74 74 69 6e 67 20  | RFS formatting |
00001310  70 72 6f 67 72 61 6d 73  20 69 66 20 79 6f 75 20  |programs if you |
00001320  6e 65 65 64 20 74 68 65  6d 2e 0d 0d 0d 0d 0d 0d  |need them.......|
00001330  20 20 20 31 30 20 52 45  4d 3a 20 52 46 53 45 52  |   10 REM: RFSER|
00001340  56 0d 20 20 20 32 30 20  4d 4f 44 45 37 0d 20 20  |V.   20 MODE7.  |
00001350  20 33 30 20 48 49 4d 45  4d 3d 26 33 43 30 30 0d  | 30 HIMEM=&3C00.|
00001360  20 20 20 34 30 20 64 69  66 66 3d 26 38 30 30 30  |   40 diff=&8000|
00001370  2d 48 49 4d 45 4d 0d 20  20 20 35 30 20 48 25 3d  |-HIMEM.   50 H%=|
00001380  48 49 4d 45 4d 0d 20 20  20 36 30 20 63 6f 6d 76  |HIMEM.   60 comv|
00001390  65 63 3d 26 46 32 0d 20  20 20 37 30 20 72 6f 6d  |ec=&F2.   70 rom|
000013a0  6e 75 6d 62 65 72 3d 26  46 34 0d 20 20 20 38 30  |number=&F4.   80|
000013b0  20 70 68 72 6f 6d 3d 26  46 35 0d 20 20 20 39 30  | phrom=&F5.   90|
000013c0  20 72 6f 6d 70 6f 69 6e  74 3d 26 46 36 0d 20 20  | rompoint=&F6.  |
000013d0  31 30 30 20 67 73 72 65  61 64 3d 26 46 46 43 35  |100 gsread=&FFC5|
000013e0  0d 20 20 31 31 30 20 6f  73 62 79 74 65 3d 26 46  |.  110 osbyte=&F|
000013f0  46 46 34 0d 20 20 31 32  30 20 46 4f 52 20 70 61  |FF4.  120 FOR pa|
00001400  73 73 20 3d 20 30 20 54  4f 20 32 20 53 54 45 50  |ss = 0 TO 2 STEP|
00001410  20 32 0d 20 20 31 33 30  20 50 25 3d 48 49 4d 45  | 2.  130 P%=HIME|
00001420  4d 0d 20 20 31 34 30 20  5b 20 20 20 20 20 20 20  |M.  140 [       |
00001430  4f 50 54 20 70 61 73 73  0d 20 20 31 35 30 20 20  |OPT pass.  150  |
00001440  20 20 20 20 20 20 20 42  52 4b 0d 20 20 31 36 30  |       BRK.  160|
00001450  20 20 20 20 20 20 20 20  20 42 52 4b 0d 20 20 31  |         BRK.  1|
00001460  37 30 20 20 20 20 20 20  20 20 20 42 52 4b 0d 20  |70         BRK. |
00001470  20 31 38 30 20 20 20 20  20 20 20 20 20 4a 4d 50  | 180         JMP|
00001480  20 73 65 72 76 69 63 65  2b 64 69 66 66 0d 20 20  | service+diff.  |
00001490  31 39 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |190         OPT |
000014a0  46 4e 65 71 75 62 28 26  38 32 29 0d 20 20 32 30  |FNequb(&82).  20|
000014b0  30 20 20 20 20 20 20 20  20 20 4f 50 54 20 46 4e  |0         OPT FN|
000014c0  65 71 75 62 28 28 63 6f  70 79 72 69 67 68 74 2b  |equb((copyright+|
000014d0  64 69 66 66 29 20 4d 4f  44 20 32 35 36 29 0d 20  |diff) MOD 256). |
000014e0  20 32 31 30 20 20 20 20  20 20 20 20 20 42 52 4b  | 210         BRK|
000014f0  0d 20 20 32 32 30 20 2e  74 69 74 6c 65 0d 20 20  |.  220 .title.  |
00001500  32 33 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |230         OPT |
00001510  46 4e 65 71 75 73 28 22  44 45 4d 4f 22 29 0d 20  |FNequs("DEMO"). |
00001520  20 32 34 30 20 2e 63 6f  70 79 72 69 67 68 74 0d  | 240 .copyright.|
00001530  20 20 32 35 30 20 20 20  20 20 20 20 20 20 42 52  |  250         BR|
00001540  4b 0d 20 20 32 36 30 20  20 20 20 20 20 20 20 20  |K.  260         |
00001550  4f 50 54 20 46 4e 65 71  75 73 28 22 28 43 29 20  |OPT FNequs("(C) |
00001560  47 6f 72 64 6f 6e 20 48  6f 72 73 69 6e 67 74 6f  |Gordon Horsingto|
00001570  6e 20 31 39 38 37 22 29  0d 20 20 32 37 30 20 20  |n 1987").  270  |
00001580  20 20 20 20 20 20 20 42  52 4b 0d 20 20 32 38 30  |       BRK.  280|
00001590  20 2e 73 65 72 76 69 63  65 0d 20 20 32 39 30 20  | .service.  290 |
000015a0  20 20 20 20 20 20 20 20  50 48 41 0d 20 20 33 30  |        PHA.  30|
000015b0  30 20 20 20 20 20 20 20  20 20 43 4d 50 20 23 34  |0         CMP #4|
000015c0  0d 20 20 33 31 30 20 20  20 20 20 20 20 20 20 42  |.  310         B|
000015d0  4e 45 20 74 72 79 74 68  69 72 74 65 65 6e 0d 20  |NE trythirteen. |
000015e0  20 33 32 30 20 20 20 20  20 20 20 20 20 54 58 41  | 320         TXA|
000015f0  0d 20 20 33 33 30 20 20  20 20 20 20 20 20 20 50  |.  330         P|
00001600  48 41 0d 20 20 33 34 30  20 20 20 20 20 20 20 20  |HA.  340        |
00001610  20 54 59 41 0d 20 20 33  35 30 20 20 20 20 20 20  | TYA.  350      |
00001620  20 20 20 50 48 41 0d 20  20 33 36 30 20 20 20 20  |   PHA.  360    |
00001630  20 20 20 20 20 4c 44 58  20 23 26 46 46 0d 20 20  |     LDX #&FF.  |
00001640  33 37 30 20 2e 63 6f 6d  6c 6f 6f 70 0d 20 20 33  |370 .comloop.  3|
00001650  38 30 20 20 20 20 20 20  20 20 20 49 4e 58 0d 20  |80         INX. |
00001660  20 33 39 30 20 20 20 20  20 20 20 20 20 4c 44 41  | 390         LDA|
00001670  20 74 69 74 6c 65 2b 64  69 66 66 2c 58 0d 20 20  | title+diff,X.  |
00001680  34 30 30 20 20 20 20 20  20 20 20 20 42 45 51 20  |400         BEQ |
00001690  66 6f 75 6e 64 0d 20 20  34 31 30 20 20 20 20 20  |found.  410     |
000016a0  20 20 20 20 4c 44 41 20  28 63 6f 6d 76 65 63 29  |    LDA (comvec)|
000016b0  2c 59 0d 20 20 34 32 30  20 20 20 20 20 20 20 20  |,Y.  420        |
000016c0  20 49 4e 59 0d 20 20 34  33 30 20 20 20 20 20 20  | INY.  430      |
000016d0  20 20 20 43 4d 50 20 23  41 53 43 28 22 2e 22 29  |   CMP #ASC(".")|
000016e0  0d 20 20 34 34 30 20 20  20 20 20 20 20 20 20 42  |.  440         B|
000016f0  45 51 20 66 6f 75 6e 64  0d 20 20 34 35 30 20 20  |EQ found.  450  |
00001700  20 20 20 20 20 20 20 41  4e 44 20 23 26 44 46 0d  |       AND #&DF.|
00001710  20 20 34 36 30 20 20 20  20 20 20 20 20 20 43 4d  |  460         CM|
00001720  50 20 74 69 74 6c 65 2b  64 69 66 66 2c 58 0d 20  |P title+diff,X. |
00001730  20 34 37 30 20 20 20 20  20 20 20 20 20 42 45 51  | 470         BEQ|
00001740  20 63 6f 6d 6c 6f 6f 70  0d 20 20 34 38 30 20 20  | comloop.  480  |
00001750  20 20 20 20 20 20 20 50  4c 41 0d 20 20 34 39 30  |       PLA.  490|
00001760  20 20 20 20 20 20 20 20  20 54 41 59 0d 20 20 35  |         TAY.  5|
00001770  30 30 20 20 20 20 20 20  20 20 20 50 4c 41 0d 20  |00         PLA. |
00001780  20 35 31 30 20 20 20 20  20 20 20 20 20 54 41 58  | 510         TAX|
00001790  0d 20 20 35 32 30 20 20  20 20 20 20 20 20 20 50  |.  520         P|
000017a0  4c 41 0d 20 20 35 33 30  20 20 20 20 20 20 20 20  |LA.  530        |
000017b0  20 52 54 53 0d 20 20 35  34 30 20 2e 74 72 79 74  | RTS.  540 .tryt|
000017c0  68 69 72 74 65 65 6e 0d  20 20 35 35 30 20 20 20  |hirteen.  550   |
000017d0  20 20 20 20 20 20 43 4d  50 20 23 31 33 0d 20 20  |      CMP #13.  |
000017e0  35 36 30 20 20 20 20 20  20 20 20 20 42 4e 45 20  |560         BNE |
000017f0  66 6f 75 72 74 65 65 6e  0d 20 20 35 37 30 20 20  |fourteen.  570  |
00001800  20 20 20 20 20 20 20 54  59 41 0d 20 20 35 38 30  |       TYA.  580|
00001810  20 20 20 20 20 20 20 20  20 45 4f 52 20 23 26 46  |         EOR #&F|
00001820  0d 20 20 35 39 30 20 20  20 20 20 20 20 20 20 43  |.  590         C|
00001830  4d 50 20 72 6f 6d 6e 75  6d 62 65 72 0d 20 20 36  |MP romnumber.  6|
00001840  30 30 20 20 20 20 20 20  20 20 20 42 43 43 20 6f  |00         BCC o|
00001850  75 74 0d 20 20 36 31 30  20 20 20 20 20 20 20 20  |ut.  610        |
00001860  20 4c 44 41 20 23 28 6c  61 73 74 62 79 74 65 2b  | LDA #(lastbyte+|
00001870  64 69 66 66 29 20 4d 4f  44 20 32 35 36 0d 20 20  |diff) MOD 256.  |
00001880  36 32 30 20 20 20 20 20  20 20 20 20 53 54 41 20  |620         STA |
00001890  72 6f 6d 70 6f 69 6e 74  0d 20 20 36 33 30 20 20  |rompoint.  630  |
000018a0  20 20 20 20 20 20 20 4c  44 41 20 23 28 6c 61 73  |       LDA #(las|
000018b0  74 62 79 74 65 2b 64 69  66 66 29 20 44 49 56 20  |tbyte+diff) DIV |
000018c0  32 35 36 0d 20 20 36 34  30 20 20 20 20 20 20 20  |256.  640       |
000018d0  20 20 53 54 41 20 72 6f  6d 70 6f 69 6e 74 2b 31  |  STA rompoint+1|
000018e0  0d 20 20 36 35 30 20 20  20 20 20 20 20 20 20 4c  |.  650         L|
000018f0  44 41 20 72 6f 6d 6e 75  6d 62 65 72 0d 20 20 36  |DA romnumber.  6|
00001900  36 30 20 20 20 20 20 20  20 20 20 45 4f 52 20 23  |60         EOR #|
00001910  26 46 0d 20 20 36 37 30  20 20 20 20 20 20 20 20  |&F.  670        |
00001920  20 53 54 41 20 70 68 72  6f 6d 0d 20 20 36 38 30  | STA phrom.  680|
00001930  20 2e 65 78 69 74 0d 20  20 36 39 30 20 20 20 20  | .exit.  690    |
00001940  20 20 20 20 20 50 4c 41  0d 20 20 37 30 30 20 20  |     PLA.  700  |
00001950  20 20 20 20 20 20 20 4c  44 41 20 23 30 0d 20 20  |       LDA #0.  |
00001960  37 31 30 20 20 20 20 20  20 20 20 20 52 54 53 0d  |710         RTS.|
00001970  20 20 37 32 30 20 2e 66  6f 75 72 74 65 65 6e 0d  |  720 .fourteen.|
00001980  20 20 37 33 30 20 20 20  20 20 20 20 20 20 43 4d  |  730         CM|
00001990  50 20 23 31 34 0d 20 20  37 34 30 20 20 20 20 20  |P #14.  740     |
000019a0  20 20 20 20 42 4e 45 20  6f 75 74 0d 20 20 37 35  |    BNE out.  75|
000019b0  30 20 20 20 20 20 20 20  20 20 4c 44 41 20 70 68  |0         LDA ph|
000019c0  72 6f 6d 0d 20 20 37 36  30 20 20 20 20 20 20 20  |rom.  760       |
000019d0  20 20 45 4f 52 20 23 26  46 0d 20 20 37 37 30 20  |  EOR #&F.  770 |
000019e0  20 20 20 20 20 20 20 20  43 4d 50 20 72 6f 6d 6e  |        CMP romn|
000019f0  75 6d 62 65 72 0d 20 20  37 38 30 20 20 20 20 20  |umber.  780     |
00001a00  20 20 20 20 42 4e 45 20  6f 75 74 0d 20 20 37 39  |    BNE out.  79|
00001a10  30 20 20 20 20 20 20 20  20 20 4c 44 59 20 23 30  |0         LDY #0|
00001a20  0d 20 20 38 30 30 20 20  20 20 20 20 20 20 20 4c  |.  800         L|
00001a30  44 41 20 28 72 6f 6d 70  6f 69 6e 74 29 2c 59 0d  |DA (rompoint),Y.|
00001a40  20 20 38 31 30 20 20 20  20 20 20 20 20 20 54 41  |  810         TA|
00001a50  59 0d 20 20 38 32 30 20  20 20 20 20 20 20 20 20  |Y.  820         |
00001a60  49 4e 43 20 72 6f 6d 70  6f 69 6e 74 0d 20 20 38  |INC rompoint.  8|
00001a70  33 30 20 20 20 20 20 20  20 20 20 42 4e 45 20 65  |30         BNE e|
00001a80  78 69 74 0d 20 20 38 34  30 20 20 20 20 20 20 20  |xit.  840       |
00001a90  20 20 49 4e 43 20 72 6f  6d 70 6f 69 6e 74 2b 31  |  INC rompoint+1|
00001aa0  0d 20 20 38 35 30 20 20  20 20 20 20 20 20 20 4a  |.  850         J|
00001ab0  4d 50 20 65 78 69 74 2b  64 69 66 66 0d 20 20 38  |MP exit+diff.  8|
00001ac0  36 30 20 2e 6f 75 74 0d  20 20 38 37 30 20 20 20  |60 .out.  870   |
00001ad0  20 20 20 20 20 20 50 4c  41 0d 20 20 38 38 30 20  |      PLA.  880 |
00001ae0  20 20 20 20 20 20 20 20  52 54 53 0d 20 20 38 39  |        RTS.  89|
00001af0  30 20 2e 66 6f 75 6e 64  0d 20 20 39 30 30 20 20  |0 .found.  900  |
00001b00  20 20 20 20 20 20 20 4c  44 41 20 23 26 38 44 0d  |       LDA #&8D.|
00001b10  20 20 39 31 30 20 20 20  20 20 20 20 20 20 4a 53  |  910         JS|
00001b20  52 20 6f 73 62 79 74 65  20 20 20 20 5c 20 2a 52  |R osbyte    \ *R|
00001b30  4f 4d 0d 20 20 39 32 30  20 20 20 20 20 20 20 20  |OM.  920        |
00001b40  20 4c 44 41 20 23 26 38  42 0d 20 20 39 33 30 20  | LDA #&8B.  930 |
00001b50  20 20 20 20 20 20 20 20  4c 44 58 20 23 31 0d 20  |        LDX #1. |
00001b60  20 39 34 30 20 20 20 20  20 20 20 20 20 4c 44 59  | 940         LDY|
00001b70  20 23 30 0d 20 20 39 35  30 20 20 20 20 20 20 20  | #0.  950       |
00001b80  20 20 4a 53 52 20 6f 73  62 79 74 65 20 20 20 20  |  JSR osbyte    |
00001b90  5c 20 2a 4f 50 54 31 2c  30 0d 20 20 39 36 30 20  |\ *OPT1,0.  960 |
00001ba0  20 20 20 20 20 20 20 20  4c 44 41 20 23 26 30 46  |        LDA #&0F|
00001bb0  0d 20 20 39 37 30 20 20  20 20 20 20 20 20 20 4c  |.  970         L|
00001bc0  44 58 20 23 30 0d 20 20  39 38 30 20 20 20 20 20  |DX #0.  980     |
00001bd0  20 20 20 20 4a 53 52 20  6f 73 62 79 74 65 20 20  |    JSR osbyte  |
00001be0  20 20 5c 20 46 6c 75 73  68 20 61 6c 6c 20 62 75  |  \ Flush all bu|
00001bf0  66 66 65 72 73 0d 20 20  39 39 30 20 20 20 20 20  |ffers.  990     |
00001c00  20 20 20 20 4c 44 41 20  23 26 46 46 0d 20 31 30  |    LDA #&FF. 10|
00001c10  30 30 20 20 20 20 20 20  20 20 20 50 48 41 0d 20  |00         PHA. |
00001c20  31 30 31 30 20 2e 6b 65  79 62 6f 61 72 64 0d 20  |1010 .keyboard. |
00001c30  31 30 32 30 20 20 20 20  20 20 20 20 20 50 4c 41  |1020         PLA|
00001c40  0d 20 31 30 33 30 20 20  20 20 20 20 20 20 20 54  |. 1030         T|
00001c50  41 58 0d 20 31 30 34 30  20 20 20 20 20 20 20 20  |AX. 1040        |
00001c60  20 49 4e 58 0d 20 31 30  35 30 20 20 20 20 20 20  | INX. 1050      |
00001c70  20 20 20 54 58 41 0d 20  31 30 36 30 20 20 20 20  |   TXA. 1060    |
00001c80  20 20 20 20 20 50 48 41  0d 20 31 30 37 30 20 20  |     PHA. 1070  |
00001c90  20 20 20 20 20 20 20 4c  44 59 20 72 66 73 63 6f  |       LDY rfsco|
00001ca0  6d 6d 2b 64 69 66 66 2c  58 0d 20 31 30 38 30 20  |mm+diff,X. 1080 |
00001cb0  20 20 20 20 20 20 20 20  42 45 51 20 65 6e 64 6b  |        BEQ endk|
00001cc0  65 79 0d 20 31 30 39 30  20 20 20 20 20 20 20 20  |ey. 1090        |
00001cd0  20 4c 44 41 20 23 26 38  41 0d 20 31 31 30 30 20  | LDA #&8A. 1100 |
00001ce0  20 20 20 20 20 20 20 20  4c 44 58 20 23 30 0d 20  |        LDX #0. |
00001cf0  31 31 31 30 20 20 20 20  20 20 20 20 20 4a 53 52  |1110         JSR|
00001d00  20 6f 73 62 79 74 65 0d  20 31 31 32 30 20 20 20  | osbyte. 1120   |
00001d10  20 20 20 20 20 20 4a 4d  50 20 6b 65 79 62 6f 61  |      JMP keyboa|
00001d20  72 64 2b 64 69 66 66 0d  20 31 31 33 30 20 2e 65  |rd+diff. 1130 .e|
00001d30  6e 64 6b 65 79 0d 20 31  31 34 30 20 20 20 20 20  |ndkey. 1140     |
00001d40  20 20 20 20 50 4c 41 0d  20 31 31 35 30 20 20 20  |    PLA. 1150   |
00001d50  20 20 20 20 20 20 4c 44  41 20 23 26 42 42 0d 20  |      LDA #&BB. |
00001d60  31 31 36 30 20 20 20 20  20 20 20 20 20 4c 44 58  |1160         LDX|
00001d70  20 23 30 0d 20 31 31 37  30 20 20 20 20 20 20 20  | #0. 1170       |
00001d80  20 20 4c 44 59 20 23 26  46 46 0d 20 31 31 38 30  |  LDY #&FF. 1180|
00001d90  20 20 20 20 20 20 20 20  20 4a 53 52 20 6f 73 62  |         JSR osb|
00001da0  79 74 65 20 20 20 20 5c  20 46 69 6e 64 20 42 41  |yte    \ Find BA|
00001db0  53 49 43 0d 20 31 31 39  30 20 20 20 20 20 20 20  |SIC. 1190       |
00001dc0  20 20 4c 44 41 20 23 26  38 45 0d 20 31 32 30 30  |  LDA #&8E. 1200|
00001dd0  20 20 20 20 20 20 20 20  20 4a 4d 50 20 6f 73 62  |         JMP osb|
00001de0  79 74 65 20 20 20 20 5c  20 45 6e 74 65 72 20 42  |yte    \ Enter B|
00001df0  41 53 49 43 0d 20 31 32  31 30 20 2e 72 66 73 63  |ASIC. 1210 .rfsc|
00001e00  6f 6d 6d 0d 20 31 32 32  30 20 20 20 20 20 20 20  |omm. 1220       |
00001e10  20 20 4f 50 54 20 46 4e  65 71 75 73 28 22 43 48  |  OPT FNequs("CH|
00001e20  41 49 4e 22 22 44 45 4d  4f 22 22 22 29 0d 20 31  |AIN""DEMO"""). 1|
00001e30  32 33 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |230         OPT |
00001e40  46 4e 65 71 75 62 28 26  30 44 29 0d 20 31 32 34  |FNequb(&0D). 124|
00001e50  30 20 20 20 20 20 20 20  20 20 42 52 4b 0d 20 31  |0         BRK. 1|
00001e60  32 35 30 20 2e 6c 61 73  74 62 79 74 65 0d 20 31  |250 .lastbyte. 1|
00001e70  32 36 30 20 5d 0d 20 31  32 37 30 20 4e 45 58 54  |260 ]. 1270 NEXT|
00001e80  0d 20 31 32 38 30 20 4f  25 3d 6c 61 73 74 62 79  |. 1280 O%=lastby|
00001e90  74 65 0d 20 31 32 39 30  20 43 48 41 49 4e 22 52  |te. 1290 CHAIN"R|
00001ea0  46 53 47 45 4e 22 0d 20  31 33 30 30 20 44 45 46  |FSGEN". 1300 DEF|
00001eb0  46 4e 65 71 75 62 28 62  79 74 65 29 0d 20 31 33  |FNequb(byte). 13|
00001ec0  31 30 20 3f 50 25 3d 62  79 74 65 0d 20 31 33 32  |10 ?P%=byte. 132|
00001ed0  30 20 50 25 3d 50 25 2b  31 0d 20 31 33 33 30 20  |0 P%=P%+1. 1330 |
00001ee0  3d 70 61 73 73 0d 20 31  33 34 30 20 44 45 46 46  |=pass. 1340 DEFF|
00001ef0  4e 65 71 75 77 28 77 6f  72 64 29 0d 20 31 33 35  |Nequw(word). 135|
00001f00  30 20 3f 50 25 3d 77 6f  72 64 20 4d 4f 44 20 32  |0 ?P%=word MOD 2|
00001f10  35 36 0d 20 31 33 36 30  20 50 25 3f 31 3d 77 6f  |56. 1360 P%?1=wo|
00001f20  72 64 20 44 49 56 20 32  35 36 0d 20 31 33 37 30  |rd DIV 256. 1370|
00001f30  20 50 25 3d 50 25 2b 32  0d 20 31 33 38 30 20 3d  | P%=P%+2. 1380 =|
00001f40  70 61 73 73 0d 20 31 33  39 30 20 44 45 46 46 4e  |pass. 1390 DEFFN|
00001f50  65 71 75 64 28 64 6f 75  62 6c 65 29 0d 20 31 34  |equd(double). 14|
00001f60  30 30 20 21 50 25 3d 64  6f 75 62 6c 65 0d 20 31  |00 !P%=double. 1|
00001f70  34 31 30 20 50 25 3d 50  25 2b 34 0d 20 31 34 32  |410 P%=P%+4. 142|
00001f80  30 20 3d 70 61 73 73 0d  20 31 34 33 30 20 44 45  |0 =pass. 1430 DE|
00001f90  46 46 4e 65 71 75 73 28  73 74 72 69 6e 67 24 29  |FFNequs(string$)|
00001fa0  0d 20 31 34 34 30 20 24  50 25 3d 73 74 72 69 6e  |. 1440 $P%=strin|
00001fb0  67 24 0d 20 31 34 35 30  20 50 25 3d 50 25 2b 4c  |g$. 1450 P%=P%+L|
00001fc0  45 4e 28 73 74 72 69 6e  67 24 29 0d 20 31 34 36  |EN(string$). 146|
00001fd0  30 20 3d 70 61 73 73 0d                           |0 =pass.|
00001fd8
20-03-88/T\SWR20.m0
20-03-88/T\SWR20.m1
20-03-88/T\SWR20.m2
20-03-88/T\SWR20.m4
20-03-88/T\SWR20.m5