Home » CEEFAX disks » telesoftware6.adl » 15-04-88/T\SWR24

15-04-88/T\SWR24

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 » telesoftware6.adl
Filename: 15-04-88/T\SWR24
Read OK:
File size: 3EB9 bytes
Load address: 0000
Exec address: 0000
Duplicates

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

File contents
Mastering Sideways ROM & RAM - Module 24 - Forward referencing
--------------------------------------------------------------

  All the source code programs used in this course to generate rom
images have had HIMEM set to &3C00. This allows up to 16k of object
code to be held in memory in mode 7. The DFS sets PAGE to &1900 on the
BBC B leaving only 8.75k for the source code. This is plenty of room
when generating simple RFS rom images but when designing a rom which
uses a large amount of machine code it is sometimes necessary to use a
modular program design with forward referencing to overcome the memory
limitations of the BBC microcomputer.

  Modular programming has already been used in the RFS course modules
and involves little more than spliting up a large program into a
number of smaller programs.

  Forward referencing is a technique which can be used with modular
Assembly language programs. It uses the resident integer variables (A%
to X%) as labels to store the addresses of memory locations. The
contents of these memory locations are unknown in the program which
defines them but become known or can be calculated when a later
program is executed. The contents of the locations stored in the
resident integer variables are given dummy values in the initial
program. These dummy values are altered in the later program when the
actual values to be stored in the memory locations become available.

  This idea is illustrated in the two short example programs FIRST and
LAST. The program FIRST needs to load the X and Y registers with the
low and high byte of the address of a command to be used with the
command line interpreter (CLI). The actual address of the command is
determined in LAST but it is unknown to FIRST and so the index
registers are loaded with the dummy address &0000 in FIRST. X% and Y%
are used to label the instruction before each address byte. It is not
possible to label the address bytes directly.




   10 REM: FIRST
   20 HIMEM=&5000
   30 oscli=&FFF7
   40 FOR pass=0TO3 STEP3
   50 P%=HIMEM
   60 [       OPT pass
   70 .X%
   80         LDX #0
   90 .Y%
  100         LDY #0
  110         JSR oscli
  120 ]
  130 NEXT
  140 O%=P%
  150 CHAIN"LAST"




  When the program FIRST chains the program LAST the address of the
LDX instruction in FIRST becomes available to LAST in X% and the
address of the LDY instruction in FIRST becomes available to LAST in
Y%. After LAST has assembled the command for the CLI, the address of
the first byte of the command can be poked into the bytes following
the LDX and LDY instructions assembled in FIRST. This is done in lines
120 and 130 of LAST.




   10 REM: LAST
   20 HIMEM=&5000
   30 FOR pass=0TO3 STEP3
   40 P%=O%
   50 [       OPT pass
   60         RTS
   70 .help
   80         EQUS "HELP"
   90         EQUB &0D
  100 ]
  110 NEXT
  120 X%?1=help MOD 256
  130 Y%?1=help DIV 256




  When the instructions in the programs FIRST and LAST are assembled
they produce the listing shown in figure 24.1. You can see in figure
24.1 that the dummy address &0000 has been used to specify the address
of the CLI command. The label X% points to the LDX instruction and the
label Y% points to the LDY instruction.




>CHAIN "FIRST"
5000          OPT pass
5000          .X%
5000 A2 00    LDX #0
5002          .Y%
5002 A0 00    LDY #0
5004 20 F7 FF JSR oscli
5007          OPT pass
5007 60       RTS
5008          .help
5008 48 45 4C 
     50       EQUS "HELP"
500C 0D       EQUB &0D
>

Figure 24.1  Listing created by FIRST and LAST
-----------  -----------------------------------



  The area of memory used to store the object code is disassembled in
figure 24.2. You can see in figure 24.2 that the dummy address
following the LDX and LDY instructions has been replaced with the
actual address of the CLI command.




>*DIS 5000
5000  A2 08     ..   LDX #&08
5002  A0 50     .P   LDY #&50
5004  20 F7 FF   ..  JSR OSCLI 
5007  60        `    RTS 

5008  48        H    PHA 
5009  45 4C     EL   EOR &4C
500B  50 0D     P.   BVC &501A

Figure 24.2  A disassembly of the memory used by FIRST and LAST
-----------  ----------------------------------------------------



  This technique has been used in the demonstration programs MODONE
and MODTWO. These programs are used with RFSGEN and DEMO to produce a
rom image which includes a multiple * command interpreter, extended
help, RFS files and booting the RFS with Ctrl+R+Break. The source code
for this rom image would require more than the 8.75k available if it
was all in one program and so a modular approach was used to write the
source code programs.

  Forward referencing was necessary because the address of the start
of the RFS files was required in lines 390 and 420 of MODONE but this
address was determined by the size of the object code created by
MODTWO. The addresses (minus 1) of the memory locations used for the
low and high bytes of the RFS dummy address are stored in A% and B%
and the actual address of the start of the RFS files is poked into
these memory locations in lines 2040 and 2050 of MODTWO.

  The print subroutine in MODONE is labeled with C% (line 1410 of
MODONE) and this address is also passed over to MODTWO (line 110 of
MODTWO) so that the same routine can be used in the second program
(lines 300 and 470 of MODTWO) without having to write the code for the
subroutine in MODTWO.

  This technique can be used to produce 16k of object code with only
8.75k of memory available for the source code.

  The lack of memory in the BBC B is not always a disadvantage. The
small files used in modular programs are much easier to debug than the
huge source code program which would be required to produce a 16k
object code file from just one source code file.




   10 REM: MODONE
   20 MODE7
   30 HIMEM=&3C00
   40 diff=&8000-HIMEM
   50 H%=HIMEM
   60 address=&70
   70 romnumber=&F4
   80 phrom=&F5
   90 rompoint=&F6
  100 stack=&103
  110 osasci=&FFE3
  120 osnewl=&FFE7
  130 osbyte=&FFF4
  140 oscli=&FFF7
  150 FOR pass = 0 TO 2 STEP 2
  160 P%=HIMEM
  170 [       OPT pass
  180         BRK
  190         BRK
  200         BRK
  210         JMP service+diff
  220         OPT FNequb(&82)
  230         OPT FNequb((copyright+diff) MOD 256)
  240         BRK
  250         OPT FNequs("MODULAR ROM DESIGN")
  260 .copyright
  270         BRK
  280         OPT FNequs("(C) Gordon Horsington 1987")
  290         BRK
  300 .service
  310         PHA
  320         CMP #13
  330         BNE fourteen
  340         TYA
  350         EOR #&F
  360         CMP romnumber
  370         BCC out
  380 .A%
  390         LDA #0        \ replace with LSB of RFS data
  400         STA rompoint
  410 .B%
  420         LDA #0        \ replace with MSB of RFS data
  430         STA rompoint+1
  440         LDA romnumber
  450         EOR #&F
  460         STA phrom
  470 .exit
  480         PLA
  490         LDA #0
  500         RTS
  510 .fourteen
  520         CMP #14
  530         BNE trythree
  540         LDA phrom
  550         EOR #&F
  560         CMP romnumber
  570         BNE out
  580         LDY #0
  590         LDA (rompoint),Y
  600         TAY
  610         INC rompoint
  620         BNE exit
  630         INC rompoint+1
  640         JMP exit+diff
  650 .out
  660         PLA
  670         RTS
  680 .trythree
  690         TXA
  700         PHA
  710         TYA
  720         PHA
  730         TSX
  740         LDA stack,X
  750         CMP #3
  760         BEQ three
  770         JMP lastbyte+diff \ continue in MODULE2
  780 .three
  790         LDA #&7A
  800         JSR osbyte
  810         CPX #&33      \ Is it R Break?
  820         BEQ rbreak
  830         PLA
  840         TAY
  850         PLA
  860         TAX
  870         PLA
  880         RTS
  890 .rbreak
  900         LDA #&C9
  910         LDX #1
  920         LDY #0
  930         JSR osbyte    \ Disable keyboard
  940         LDA #&0F
  950         LDX #0
  960         JSR osbyte    \ Flush all buffers
  970         LDA address
  980         PHA
  990         LDA address+1
 1000         PHA
 1010         LDX #(rfs+diff) MOD 256
 1020         LDY #(rfs+diff) DIV 256
 1030         JSR print+diff
 1040         LDX #(cat+diff) MOD 256
 1050         LDY #(cat+diff) DIV 256
 1060         JSR print+diff
 1070         LDA #&8D
 1080         JSR osbyte    \ Select RFS
 1090         LDA #&8B
 1100         LDX #1
 1110         LDY #2
 1120         JSR osbyte    \ *OPT1,2
 1130         LDX #(dot+diff) MOD 256
 1140         LDY #(dot+diff) DIV 256
 1150         JSR oscli     \ Catalogue RFS
 1160         LDA #&8B
 1170         LDX #0
 1180         LDY #0
 1190         JSR osbyte    \ *OPT 1,0
 1200         JSR osnewl
 1210         LDX #(rfs+diff) MOD 256
 1220         LDY #(rfs+diff) DIV 256
 1230         JSR print+diff
 1240         LDX #(act+diff) MOD 256
 1250         LDY #(act+diff) DIV 256
 1260         JSR print+diff
 1270         PLA
 1280         STA address+1
 1290         PLA
 1300         STA address
 1310         LDA #&C9
 1320         LDX #0
 1330         LDY #0
 1340         JSR osbyte    \ Enable keyboard
 1350         PLA
 1360         PLA
 1370         PLA
 1380         LDA #0
 1390         RTS
 1400 .print
 1410 .C%
 1420         STX address
 1430         STY address+1
 1440         LDY #&FF
 1450 .printloop
 1460         INY
 1470         LDA (address),Y
 1480         BEQ endprint
 1490         JSR osasci
 1500         JMP printloop+diff
 1510 .endprint
 1520         RTS
 1530 .dot
 1540         OPT FNequs("CAT")
 1550         OPT FNequb(&0D)
 1560 .rfs
 1570         OPT FNequs("ROM Filing System ")
 1580         BRK
 1590 .cat
 1600         OPT FNequs("Catalogue")
 1610         OPT FNequb(&0D)
 1620         BRK
 1630 .act
 1640         OPT FNequs("active")
 1650         OPT FNequw(&0D0D)
 1660         BRK
 1670 .lastbyte
 1680 ]
 1690 NEXT
 1700 O%=lastbyte
 1710 CHAIN"MODTWO"
 1720 DEFFNequb(byte)
 1730 ?P%=byte
 1740 P%=P%+1
 1750 =pass
 1760 DEFFNequw(word)
 1770 ?P%=word MOD 256
 1780 P%?1=word DIV 256
 1790 P%=P%+2
 1800 =pass
 1810 DEFFNequd(double)
 1820 !P%=double
 1830 P%=P%+4
 1840 =pass
 1850 DEFFNequs(string$)
 1860 $P%=string$
 1870 P%=P%+LEN(string$)
 1880 =pass





   10 REM: MODTWO
   20 HIMEM=&3C00
   30 diff=&8000-HIMEM
   40 address=&70
   50 comvec=&F2
   60 stack=&105
   70 gsinit=&FFC2
   80 gsread=&FFC5
   90 osasci=&FFE3
  100 osword=&FFF1
  110 printer=C%
  120 FOR pass = 0 TO 2 STEP 2
  130 P%=O%
  140 [       OPT pass
  150         LDA address
  160         PHA
  170         LDA address+1
  180         PHA
  190         TSX
  200         LDA stack,X
  210         CMP #9
  220         BNE tryfour
  230         SEC
  240         JSR gsinit
  250         LDX #0
  260         JSR gsread
  270         BCC tryextended
  280         LDX #(helpmsg+diff) MOD 256
  290         LDY #(helpmsg+diff) DIV 256
  300         JSR printer+diff
  310         BEQ quit
  320 .helploop
  330         INX
  340         JSR gsread
  350 .tryextended
  360         CMP #ASC(".")
  370         BEQ okextended
  380         AND #&DF
  390         CMP helptitle+diff,X
  400         BEQ helploop
  410         LDA #&FF
  420         CMP helptitle+diff,X
  430         BNE quit
  440 .okextended
  450         LDX #(helpinfo+diff) MOD 256
  460         LDY #(helpinfo+diff) DIV 256
  470         JSR printer+diff
  480         BEQ quit
  490 .tryfour
  500         CMP #4
  510         BNE quit
  520         LDX #&FE
  530         TYA
  540         PHA
  550 .firstchar
  560         INX
  570         PLA
  580         TAY
  590         PHA
  600         LDA (comvec),Y
  610         AND #&DF
  620         CMP #ASC("X")
  630         BNE interpret
  640         INY
  650 .interpret
  660         INX
  670         LDA commtable+diff,X
  680         BMI found
  690         LDA (comvec),Y
  700         INY
  710         CMP #ASC(".")
  720         BEQ founddot
  730         AND #&DF
  740         CMP commtable+diff,X
  750         BEQ interpret
  760 .another
  770         INX
  780         LDA commtable+diff,X
  790         BPL another
  800         CMP #&FF
  810         BNE firstchar
  820 .exit
  830         PLA
  840 .quit
  850         PLA
  860         STA address+1
  870         PLA
  880         STA address
  890         PLA
  900         TAY
  910         PLA
  920         TAX
  930         PLA
  940         RTS
  950 .founddot
  960         INX
  970         LDA commtable+diff,X
  980         BPL founddot
  990 .found
 1000         CMP #&FF
 1010         BEQ exit
 1020         STA address+1
 1030         INX
 1040         LDA commtable+diff,X
 1050         STA address
 1060         PLA
 1070         SEC
 1080         JSR gsinit
 1090         JMP (address)
 1100 .commtable
 1110         OPT FNequs("REVERB")
 1120         OPT FNequb((reverb+diff) DIV 256)
 1130         OPT FNequb((reverb+diff) MOD 256)
 1140         OPT FNequs("ALARM")
 1150         OPT FNequb((alarm+diff) DIV 256)
 1160         OPT FNequb((alarm+diff) MOD 256)
 1170         OPT FNequs("ZOING")
 1180         OPT FNequb((zoing+diff) DIV 256)
 1190         OPT FNequb((zoing+diff) MOD 256)
 1200         OPT FNequb(&FF)
 1210 .helpmsg
 1220         OPT FNequb(&0D)
 1230         OPT FNequs("MODULAR ROM")
 1240         OPT FNequb(&0D)
 1250         OPT FNequw(&2020)
 1260 .helptitle
 1270         OPT FNequs("MOD")
 1280         OPT FNequw(&0DFF)
 1290         BRK
 1300 .helpinfo
 1310         OPT FNequw(&200D)
 1320         OPT FNequs("*ALARM")
 1330         OPT FNequw(&200D)
 1340         OPT FNequs("*REVERB")
 1350         OPT FNequw(&200D)
 1360         OPT FNequs("*ZOING")
 1370         OPT FNequw(&000D)
 1380 .alarm
 1390         LDA #8
 1400         LDX #(ealarm+diff) MOD 256
 1410         LDY #(ealarm+diff) DIV 256
 1420         JSR osword    \ Envelope
 1430         LDA #7
 1440         LDX #(salarm+diff) MOD 256
 1450         LDY #(salarm+diff) DIV 256
 1460         JSR osword    \ Sound
 1470 .pullout
 1480         PLA
 1490         STA address+1
 1500         PLA
 1510         STA address
 1520         PLA
 1530         PLA
 1540         PLA
 1550         LDA #0
 1560         RTS
 1570 .reverb
 1580         LDA #8
 1590         LDX #(ereverb+diff) MOD 256
 1600         LDY #(ereverb+diff) DIV 256
 1610         JSR osword    \ Envelope
 1620         LDA #7
 1630         LDX #(sreverb+diff) MOD 256
 1640         LDY #(sreverb+diff) DIV 256
 1650         JSR osword    \ Sound
 1660         JMP pullout+diff
 1670 .zoing
 1680         LDA #8
 1690         LDX #(ezoing+diff) MOD 256
 1700         LDY #(ezoing+diff) DIV 256
 1710         JSR osword    \ Envelope
 1720         LDA #7
 1730         LDX #(szoing+diff) MOD 256
 1740         LDY #(szoing+diff) DIV 256
 1750         JSR osword    \ Sound
 1760         JMP pullout+diff
 1770 .ealarm
 1780         OPT FNequd(&00010101)
 1790         OPT FNequd(&00004800)
 1800         OPT FNequd(&01FF00FD)
 1810         OPT FNequw(&7E7E)
 1820 .salarm
 1830         OPT FNequd(&00010011)
 1840         OPT FNequd(&00FF0032)
 1850 .ereverb
 1860         OPT FNequd(&FF010803)
 1870         OPT FNequd(&01010101)
 1880         OPT FNequd(&79F6FBFE)
 1890         OPT FNequw(&7E7E)
 1900 .sreverb
 1910         OPT FNequd(&00030010)
 1920         OPT FNequd(&00400000)
 1930 .ezoing
 1940         OPT FNequd(&EC140102)
 1950         OPT FNequd(&64646414)
 1960         OPT FNequd(&0000FF7F)
 1970         OPT FNequd(&007E)
 1980 .szoing
 1990         OPT FNequd(&00020012)
 2000         OPT FNequd(&003200CC)
 2010 .lastbyte
 2020 ]
 2030 NEXT
 2040 A%?1=((lastbyte+diff) MOD 256)
 2050 B%?1=((lastbyte+diff) DIV 256)
 2060 REM: Poke address of the start of
 2070 REM: RFS into MODONE
 2080 O%=lastbyte
 2090 CHAIN"RFSGEN"
 2100 END
 2110 DEFFNequb(byte)
 2120 ?P%=byte
 2130 P%=P%+1
 2140 =pass
 2150 DEFFNequw(word)
 2160 ?P%=word MOD 256
 2170 P%?1=word DIV 256
 2180 P%=P%+2
 2190 =pass
 2200 DEFFNequd(double)
 2210 !P%=double
 2220 P%=P%+4
 2230 =pass
 2240 DEFFNequs(string$)
 2250 $P%=string$
 2260 P%=P%+LEN(string$)
 2270 =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 34  20 2d 20 46 6f 72 77 61  |odule 24 - Forwa|
00000030  72 64 20 72 65 66 65 72  65 6e 63 69 6e 67 0d 2d  |rd referencing.-|
00000040  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000070  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0d 0d 20  |-------------.. |
00000080  20 41 6c 6c 20 74 68 65  20 73 6f 75 72 63 65 20  | All the source |
00000090  63 6f 64 65 20 70 72 6f  67 72 61 6d 73 20 75 73  |code programs us|
000000a0  65 64 20 69 6e 20 74 68  69 73 20 63 6f 75 72 73  |ed in this cours|
000000b0  65 20 74 6f 20 67 65 6e  65 72 61 74 65 20 72 6f  |e to generate ro|
000000c0  6d 0d 69 6d 61 67 65 73  20 68 61 76 65 20 68 61  |m.images have ha|
000000d0  64 20 48 49 4d 45 4d 20  73 65 74 20 74 6f 20 26  |d HIMEM set to &|
000000e0  33 43 30 30 2e 20 54 68  69 73 20 61 6c 6c 6f 77  |3C00. This allow|
000000f0  73 20 75 70 20 74 6f 20  31 36 6b 20 6f 66 20 6f  |s up to 16k of o|
00000100  62 6a 65 63 74 0d 63 6f  64 65 20 74 6f 20 62 65  |bject.code to be|
00000110  20 68 65 6c 64 20 69 6e  20 6d 65 6d 6f 72 79 20  | held in memory |
00000120  69 6e 20 6d 6f 64 65 20  37 2e 20 54 68 65 20 44  |in mode 7. The D|
00000130  46 53 20 73 65 74 73 20  50 41 47 45 20 74 6f 20  |FS sets PAGE to |
00000140  26 31 39 30 30 20 6f 6e  20 74 68 65 0d 42 42 43  |&1900 on the.BBC|
00000150  20 42 20 6c 65 61 76 69  6e 67 20 6f 6e 6c 79 20  | B leaving only |
00000160  38 2e 37 35 6b 20 66 6f  72 20 74 68 65 20 73 6f  |8.75k for the so|
00000170  75 72 63 65 20 63 6f 64  65 2e 20 54 68 69 73 20  |urce code. This |
00000180  69 73 20 70 6c 65 6e 74  79 20 6f 66 20 72 6f 6f  |is plenty of roo|
00000190  6d 0d 77 68 65 6e 20 67  65 6e 65 72 61 74 69 6e  |m.when generatin|
000001a0  67 20 73 69 6d 70 6c 65  20 52 46 53 20 72 6f 6d  |g simple RFS rom|
000001b0  20 69 6d 61 67 65 73 20  62 75 74 20 77 68 65 6e  | images but when|
000001c0  20 64 65 73 69 67 6e 69  6e 67 20 61 20 72 6f 6d  | designing a rom|
000001d0  20 77 68 69 63 68 0d 75  73 65 73 20 61 20 6c 61  | which.uses a la|
000001e0  72 67 65 20 61 6d 6f 75  6e 74 20 6f 66 20 6d 61  |rge amount of ma|
000001f0  63 68 69 6e 65 20 63 6f  64 65 20 69 74 20 69 73  |chine code it is|
00000200  20 73 6f 6d 65 74 69 6d  65 73 20 6e 65 63 65 73  | sometimes neces|
00000210  73 61 72 79 20 74 6f 20  75 73 65 20 61 0d 6d 6f  |sary to use a.mo|
00000220  64 75 6c 61 72 20 70 72  6f 67 72 61 6d 20 64 65  |dular program de|
00000230  73 69 67 6e 20 77 69 74  68 20 66 6f 72 77 61 72  |sign with forwar|
00000240  64 20 72 65 66 65 72 65  6e 63 69 6e 67 20 74 6f  |d referencing to|
00000250  20 6f 76 65 72 63 6f 6d  65 20 74 68 65 20 6d 65  | overcome the me|
00000260  6d 6f 72 79 0d 6c 69 6d  69 74 61 74 69 6f 6e 73  |mory.limitations|
00000270  20 6f 66 20 74 68 65 20  42 42 43 20 6d 69 63 72  | of the BBC micr|
00000280  6f 63 6f 6d 70 75 74 65  72 2e 0d 0d 20 20 4d 6f  |ocomputer...  Mo|
00000290  64 75 6c 61 72 20 70 72  6f 67 72 61 6d 6d 69 6e  |dular programmin|
000002a0  67 20 68 61 73 20 61 6c  72 65 61 64 79 20 62 65  |g has already be|
000002b0  65 6e 20 75 73 65 64 20  69 6e 20 74 68 65 20 52  |en used in the R|
000002c0  46 53 20 63 6f 75 72 73  65 20 6d 6f 64 75 6c 65  |FS course module|
000002d0  73 0d 61 6e 64 20 69 6e  76 6f 6c 76 65 73 20 6c  |s.and involves l|
000002e0  69 74 74 6c 65 20 6d 6f  72 65 20 74 68 61 6e 20  |ittle more than |
000002f0  73 70 6c 69 74 69 6e 67  20 75 70 20 61 20 6c 61  |spliting up a la|
00000300  72 67 65 20 70 72 6f 67  72 61 6d 20 69 6e 74 6f  |rge program into|
00000310  20 61 0d 6e 75 6d 62 65  72 20 6f 66 20 73 6d 61  | a.number of sma|
00000320  6c 6c 65 72 20 70 72 6f  67 72 61 6d 73 2e 0d 0d  |ller programs...|
00000330  20 20 46 6f 72 77 61 72  64 20 72 65 66 65 72 65  |  Forward refere|
00000340  6e 63 69 6e 67 20 69 73  20 61 20 74 65 63 68 6e  |ncing is a techn|
00000350  69 71 75 65 20 77 68 69  63 68 20 63 61 6e 20 62  |ique which can b|
00000360  65 20 75 73 65 64 20 77  69 74 68 20 6d 6f 64 75  |e used with modu|
00000370  6c 61 72 0d 41 73 73 65  6d 62 6c 79 20 6c 61 6e  |lar.Assembly lan|
00000380  67 75 61 67 65 20 70 72  6f 67 72 61 6d 73 2e 20  |guage programs. |
00000390  49 74 20 75 73 65 73 20  74 68 65 20 72 65 73 69  |It uses the resi|
000003a0  64 65 6e 74 20 69 6e 74  65 67 65 72 20 76 61 72  |dent integer var|
000003b0  69 61 62 6c 65 73 20 28  41 25 0d 74 6f 20 58 25  |iables (A%.to X%|
000003c0  29 20 61 73 20 6c 61 62  65 6c 73 20 74 6f 20 73  |) as labels to s|
000003d0  74 6f 72 65 20 74 68 65  20 61 64 64 72 65 73 73  |tore the address|
000003e0  65 73 20 6f 66 20 6d 65  6d 6f 72 79 20 6c 6f 63  |es of memory loc|
000003f0  61 74 69 6f 6e 73 2e 20  54 68 65 0d 63 6f 6e 74  |ations. The.cont|
00000400  65 6e 74 73 20 6f 66 20  74 68 65 73 65 20 6d 65  |ents of these me|
00000410  6d 6f 72 79 20 6c 6f 63  61 74 69 6f 6e 73 20 61  |mory locations a|
00000420  72 65 20 75 6e 6b 6e 6f  77 6e 20 69 6e 20 74 68  |re unknown in th|
00000430  65 20 70 72 6f 67 72 61  6d 20 77 68 69 63 68 0d  |e program which.|
00000440  64 65 66 69 6e 65 73 20  74 68 65 6d 20 62 75 74  |defines them but|
00000450  20 62 65 63 6f 6d 65 20  6b 6e 6f 77 6e 20 6f 72  | become known or|
00000460  20 63 61 6e 20 62 65 20  63 61 6c 63 75 6c 61 74  | can be calculat|
00000470  65 64 20 77 68 65 6e 20  61 20 6c 61 74 65 72 0d  |ed when a later.|
00000480  70 72 6f 67 72 61 6d 20  69 73 20 65 78 65 63 75  |program is execu|
00000490  74 65 64 2e 20 54 68 65  20 63 6f 6e 74 65 6e 74  |ted. The content|
000004a0  73 20 6f 66 20 74 68 65  20 6c 6f 63 61 74 69 6f  |s of the locatio|
000004b0  6e 73 20 73 74 6f 72 65  64 20 69 6e 20 74 68 65  |ns stored in the|
000004c0  0d 72 65 73 69 64 65 6e  74 20 69 6e 74 65 67 65  |.resident intege|
000004d0  72 20 76 61 72 69 61 62  6c 65 73 20 61 72 65 20  |r variables are |
000004e0  67 69 76 65 6e 20 64 75  6d 6d 79 20 76 61 6c 75  |given dummy valu|
000004f0  65 73 20 69 6e 20 74 68  65 20 69 6e 69 74 69 61  |es in the initia|
00000500  6c 0d 70 72 6f 67 72 61  6d 2e 20 54 68 65 73 65  |l.program. These|
00000510  20 64 75 6d 6d 79 20 76  61 6c 75 65 73 20 61 72  | dummy values ar|
00000520  65 20 61 6c 74 65 72 65  64 20 69 6e 20 74 68 65  |e altered in the|
00000530  20 6c 61 74 65 72 20 70  72 6f 67 72 61 6d 20 77  | later program w|
00000540  68 65 6e 20 74 68 65 0d  61 63 74 75 61 6c 20 76  |hen the.actual v|
00000550  61 6c 75 65 73 20 74 6f  20 62 65 20 73 74 6f 72  |alues to be stor|
00000560  65 64 20 69 6e 20 74 68  65 20 6d 65 6d 6f 72 79  |ed in the memory|
00000570  20 6c 6f 63 61 74 69 6f  6e 73 20 62 65 63 6f 6d  | locations becom|
00000580  65 20 61 76 61 69 6c 61  62 6c 65 2e 0d 0d 20 20  |e available...  |
00000590  54 68 69 73 20 69 64 65  61 20 69 73 20 69 6c 6c  |This idea is ill|
000005a0  75 73 74 72 61 74 65 64  20 69 6e 20 74 68 65 20  |ustrated in the |
000005b0  74 77 6f 20 73 68 6f 72  74 20 65 78 61 6d 70 6c  |two short exampl|
000005c0  65 20 70 72 6f 67 72 61  6d 73 20 46 49 52 53 54  |e programs FIRST|
000005d0  20 61 6e 64 0d 4c 41 53  54 2e 20 54 68 65 20 70  | and.LAST. The p|
000005e0  72 6f 67 72 61 6d 20 46  49 52 53 54 20 6e 65 65  |rogram FIRST nee|
000005f0  64 73 20 74 6f 20 6c 6f  61 64 20 74 68 65 20 58  |ds to load the X|
00000600  20 61 6e 64 20 59 20 72  65 67 69 73 74 65 72 73  | and Y registers|
00000610  20 77 69 74 68 20 74 68  65 0d 6c 6f 77 20 61 6e  | with the.low an|
00000620  64 20 68 69 67 68 20 62  79 74 65 20 6f 66 20 74  |d high byte of t|
00000630  68 65 20 61 64 64 72 65  73 73 20 6f 66 20 61 20  |he address of a |
00000640  63 6f 6d 6d 61 6e 64 20  74 6f 20 62 65 20 75 73  |command to be us|
00000650  65 64 20 77 69 74 68 20  74 68 65 0d 63 6f 6d 6d  |ed with the.comm|
00000660  61 6e 64 20 6c 69 6e 65  20 69 6e 74 65 72 70 72  |and line interpr|
00000670  65 74 65 72 20 28 43 4c  49 29 2e 20 54 68 65 20  |eter (CLI). The |
00000680  61 63 74 75 61 6c 20 61  64 64 72 65 73 73 20 6f  |actual address o|
00000690  66 20 74 68 65 20 63 6f  6d 6d 61 6e 64 20 69 73  |f the command is|
000006a0  0d 64 65 74 65 72 6d 69  6e 65 64 20 69 6e 20 4c  |.determined in L|
000006b0  41 53 54 20 62 75 74 20  69 74 20 69 73 20 75 6e  |AST but it is un|
000006c0  6b 6e 6f 77 6e 20 74 6f  20 46 49 52 53 54 20 61  |known to FIRST a|
000006d0  6e 64 20 73 6f 20 74 68  65 20 69 6e 64 65 78 0d  |nd so the index.|
000006e0  72 65 67 69 73 74 65 72  73 20 61 72 65 20 6c 6f  |registers are lo|
000006f0  61 64 65 64 20 77 69 74  68 20 74 68 65 20 64 75  |aded with the du|
00000700  6d 6d 79 20 61 64 64 72  65 73 73 20 26 30 30 30  |mmy address &000|
00000710  30 20 69 6e 20 46 49 52  53 54 2e 20 58 25 20 61  |0 in FIRST. X% a|
00000720  6e 64 20 59 25 0d 61 72  65 20 75 73 65 64 20 74  |nd Y%.are used t|
00000730  6f 20 6c 61 62 65 6c 20  74 68 65 20 69 6e 73 74  |o label the inst|
00000740  72 75 63 74 69 6f 6e 20  62 65 66 6f 72 65 20 65  |ruction before e|
00000750  61 63 68 20 61 64 64 72  65 73 73 20 62 79 74 65  |ach address byte|
00000760  2e 20 49 74 20 69 73 20  6e 6f 74 0d 70 6f 73 73  |. It is not.poss|
00000770  69 62 6c 65 20 74 6f 20  6c 61 62 65 6c 20 74 68  |ible to label th|
00000780  65 20 61 64 64 72 65 73  73 20 62 79 74 65 73 20  |e address bytes |
00000790  64 69 72 65 63 74 6c 79  2e 0d 0d 0d 0d 0d 20 20  |directly......  |
000007a0  20 31 30 20 52 45 4d 3a  20 46 49 52 53 54 0d 20  | 10 REM: FIRST. |
000007b0  20 20 32 30 20 48 49 4d  45 4d 3d 26 35 30 30 30  |  20 HIMEM=&5000|
000007c0  0d 20 20 20 33 30 20 6f  73 63 6c 69 3d 26 46 46  |.   30 oscli=&FF|
000007d0  46 37 0d 20 20 20 34 30  20 46 4f 52 20 70 61 73  |F7.   40 FOR pas|
000007e0  73 3d 30 54 4f 33 20 53  54 45 50 33 0d 20 20 20  |s=0TO3 STEP3.   |
000007f0  35 30 20 50 25 3d 48 49  4d 45 4d 0d 20 20 20 36  |50 P%=HIMEM.   6|
00000800  30 20 5b 20 20 20 20 20  20 20 4f 50 54 20 70 61  |0 [       OPT pa|
00000810  73 73 0d 20 20 20 37 30  20 2e 58 25 0d 20 20 20  |ss.   70 .X%.   |
00000820  38 30 20 20 20 20 20 20  20 20 20 4c 44 58 20 23  |80         LDX #|
00000830  30 0d 20 20 20 39 30 20  2e 59 25 0d 20 20 31 30  |0.   90 .Y%.  10|
00000840  30 20 20 20 20 20 20 20  20 20 4c 44 59 20 23 30  |0         LDY #0|
00000850  0d 20 20 31 31 30 20 20  20 20 20 20 20 20 20 4a  |.  110         J|
00000860  53 52 20 6f 73 63 6c 69  0d 20 20 31 32 30 20 5d  |SR oscli.  120 ]|
00000870  0d 20 20 31 33 30 20 4e  45 58 54 0d 20 20 31 34  |.  130 NEXT.  14|
00000880  30 20 4f 25 3d 50 25 0d  20 20 31 35 30 20 43 48  |0 O%=P%.  150 CH|
00000890  41 49 4e 22 4c 41 53 54  22 0d 0d 0d 0d 0d 20 20  |AIN"LAST".....  |
000008a0  57 68 65 6e 20 74 68 65  20 70 72 6f 67 72 61 6d  |When the program|
000008b0  20 46 49 52 53 54 20 63  68 61 69 6e 73 20 74 68  | FIRST chains th|
000008c0  65 20 70 72 6f 67 72 61  6d 20 4c 41 53 54 20 74  |e program LAST t|
000008d0  68 65 20 61 64 64 72 65  73 73 20 6f 66 20 74 68  |he address of th|
000008e0  65 0d 4c 44 58 20 69 6e  73 74 72 75 63 74 69 6f  |e.LDX instructio|
000008f0  6e 20 69 6e 20 46 49 52  53 54 20 62 65 63 6f 6d  |n in FIRST becom|
00000900  65 73 20 61 76 61 69 6c  61 62 6c 65 20 74 6f 20  |es available to |
00000910  4c 41 53 54 20 69 6e 20  58 25 20 61 6e 64 20 74  |LAST in X% and t|
00000920  68 65 0d 61 64 64 72 65  73 73 20 6f 66 20 74 68  |he.address of th|
00000930  65 20 4c 44 59 20 69 6e  73 74 72 75 63 74 69 6f  |e LDY instructio|
00000940  6e 20 69 6e 20 46 49 52  53 54 20 62 65 63 6f 6d  |n in FIRST becom|
00000950  65 73 20 61 76 61 69 6c  61 62 6c 65 20 74 6f 20  |es available to |
00000960  4c 41 53 54 20 69 6e 0d  59 25 2e 20 41 66 74 65  |LAST in.Y%. Afte|
00000970  72 20 4c 41 53 54 20 68  61 73 20 61 73 73 65 6d  |r LAST has assem|
00000980  62 6c 65 64 20 74 68 65  20 63 6f 6d 6d 61 6e 64  |bled the command|
00000990  20 66 6f 72 20 74 68 65  20 43 4c 49 2c 20 74 68  | for the CLI, th|
000009a0  65 20 61 64 64 72 65 73  73 20 6f 66 0d 74 68 65  |e address of.the|
000009b0  20 66 69 72 73 74 20 62  79 74 65 20 6f 66 20 74  | first byte of t|
000009c0  68 65 20 63 6f 6d 6d 61  6e 64 20 63 61 6e 20 62  |he command can b|
000009d0  65 20 70 6f 6b 65 64 20  69 6e 74 6f 20 74 68 65  |e poked into the|
000009e0  20 62 79 74 65 73 20 66  6f 6c 6c 6f 77 69 6e 67  | bytes following|
000009f0  0d 74 68 65 20 4c 44 58  20 61 6e 64 20 4c 44 59  |.the LDX and LDY|
00000a00  20 69 6e 73 74 72 75 63  74 69 6f 6e 73 20 61 73  | instructions as|
00000a10  73 65 6d 62 6c 65 64 20  69 6e 20 46 49 52 53 54  |sembled in FIRST|
00000a20  2e 20 54 68 69 73 20 69  73 20 64 6f 6e 65 20 69  |. This is done i|
00000a30  6e 20 6c 69 6e 65 73 0d  31 32 30 20 61 6e 64 20  |n lines.120 and |
00000a40  31 33 30 20 6f 66 20 4c  41 53 54 2e 0d 0d 0d 0d  |130 of LAST.....|
00000a50  0d 20 20 20 31 30 20 52  45 4d 3a 20 4c 41 53 54  |.   10 REM: LAST|
00000a60  0d 20 20 20 32 30 20 48  49 4d 45 4d 3d 26 35 30  |.   20 HIMEM=&50|
00000a70  30 30 0d 20 20 20 33 30  20 46 4f 52 20 70 61 73  |00.   30 FOR pas|
00000a80  73 3d 30 54 4f 33 20 53  54 45 50 33 0d 20 20 20  |s=0TO3 STEP3.   |
00000a90  34 30 20 50 25 3d 4f 25  0d 20 20 20 35 30 20 5b  |40 P%=O%.   50 [|
00000aa0  20 20 20 20 20 20 20 4f  50 54 20 70 61 73 73 0d  |       OPT pass.|
00000ab0  20 20 20 36 30 20 20 20  20 20 20 20 20 20 52 54  |   60         RT|
00000ac0  53 0d 20 20 20 37 30 20  2e 68 65 6c 70 0d 20 20  |S.   70 .help.  |
00000ad0  20 38 30 20 20 20 20 20  20 20 20 20 45 51 55 53  | 80         EQUS|
00000ae0  20 22 48 45 4c 50 22 0d  20 20 20 39 30 20 20 20  | "HELP".   90   |
00000af0  20 20 20 20 20 20 45 51  55 42 20 26 30 44 0d 20  |      EQUB &0D. |
00000b00  20 31 30 30 20 5d 0d 20  20 31 31 30 20 4e 45 58  | 100 ].  110 NEX|
00000b10  54 0d 20 20 31 32 30 20  58 25 3f 31 3d 68 65 6c  |T.  120 X%?1=hel|
00000b20  70 20 4d 4f 44 20 32 35  36 0d 20 20 31 33 30 20  |p MOD 256.  130 |
00000b30  59 25 3f 31 3d 68 65 6c  70 20 44 49 56 20 32 35  |Y%?1=help DIV 25|
00000b40  36 0d 0d 0d 0d 0d 20 20  57 68 65 6e 20 74 68 65  |6.....  When the|
00000b50  20 69 6e 73 74 72 75 63  74 69 6f 6e 73 20 69 6e  | instructions in|
00000b60  20 74 68 65 20 70 72 6f  67 72 61 6d 73 20 46 49  | the programs FI|
00000b70  52 53 54 20 61 6e 64 20  4c 41 53 54 20 61 72 65  |RST and LAST are|
00000b80  20 61 73 73 65 6d 62 6c  65 64 0d 74 68 65 79 20  | assembled.they |
00000b90  70 72 6f 64 75 63 65 20  74 68 65 20 6c 69 73 74  |produce the list|
00000ba0  69 6e 67 20 73 68 6f 77  6e 20 69 6e 20 66 69 67  |ing shown in fig|
00000bb0  75 72 65 20 32 34 2e 31  2e 20 59 6f 75 20 63 61  |ure 24.1. You ca|
00000bc0  6e 20 73 65 65 20 69 6e  20 66 69 67 75 72 65 0d  |n see in figure.|
00000bd0  32 34 2e 31 20 74 68 61  74 20 74 68 65 20 64 75  |24.1 that the du|
00000be0  6d 6d 79 20 61 64 64 72  65 73 73 20 26 30 30 30  |mmy address &000|
00000bf0  30 20 68 61 73 20 62 65  65 6e 20 75 73 65 64 20  |0 has been used |
00000c00  74 6f 20 73 70 65 63 69  66 79 20 74 68 65 20 61  |to specify the a|
00000c10  64 64 72 65 73 73 0d 6f  66 20 74 68 65 20 43 4c  |ddress.of the CL|
00000c20  49 20 63 6f 6d 6d 61 6e  64 2e 20 54 68 65 20 6c  |I command. The l|
00000c30  61 62 65 6c 20 58 25 20  70 6f 69 6e 74 73 20 74  |abel X% points t|
00000c40  6f 20 74 68 65 20 4c 44  58 20 69 6e 73 74 72 75  |o the LDX instru|
00000c50  63 74 69 6f 6e 20 61 6e  64 20 74 68 65 0d 6c 61  |ction and the.la|
00000c60  62 65 6c 20 59 25 20 70  6f 69 6e 74 73 20 74 6f  |bel Y% points to|
00000c70  20 74 68 65 20 4c 44 59  20 69 6e 73 74 72 75 63  | the LDY instruc|
00000c80  74 69 6f 6e 2e 0d 0d 0d  0d 0d 3e 43 48 41 49 4e  |tion......>CHAIN|
00000c90  20 22 46 49 52 53 54 22  0d 35 30 30 30 20 20 20  | "FIRST".5000   |
00000ca0  20 20 20 20 20 20 20 4f  50 54 20 70 61 73 73 0d  |       OPT pass.|
00000cb0  35 30 30 30 20 20 20 20  20 20 20 20 20 20 2e 58  |5000          .X|
00000cc0  25 0d 35 30 30 30 20 41  32 20 30 30 20 20 20 20  |%.5000 A2 00    |
00000cd0  4c 44 58 20 23 30 0d 35  30 30 32 20 20 20 20 20  |LDX #0.5002     |
00000ce0  20 20 20 20 20 2e 59 25  0d 35 30 30 32 20 41 30  |     .Y%.5002 A0|
00000cf0  20 30 30 20 20 20 20 4c  44 59 20 23 30 0d 35 30  | 00    LDY #0.50|
00000d00  30 34 20 32 30 20 46 37  20 46 46 20 4a 53 52 20  |04 20 F7 FF JSR |
00000d10  6f 73 63 6c 69 0d 35 30  30 37 20 20 20 20 20 20  |oscli.5007      |
00000d20  20 20 20 20 4f 50 54 20  70 61 73 73 0d 35 30 30  |    OPT pass.500|
00000d30  37 20 36 30 20 20 20 20  20 20 20 52 54 53 0d 35  |7 60       RTS.5|
00000d40  30 30 38 20 20 20 20 20  20 20 20 20 20 2e 68 65  |008          .he|
00000d50  6c 70 0d 35 30 30 38 20  34 38 20 34 35 20 34 43  |lp.5008 48 45 4C|
00000d60  20 0d 20 20 20 20 20 35  30 20 20 20 20 20 20 20  | .     50       |
00000d70  45 51 55 53 20 22 48 45  4c 50 22 0d 35 30 30 43  |EQUS "HELP".500C|
00000d80  20 30 44 20 20 20 20 20  20 20 45 51 55 42 20 26  | 0D       EQUB &|
00000d90  30 44 0d 3e 0d 0d 46 69  67 75 72 65 20 32 34 2e  |0D.>..Figure 24.|
00000da0  31 20 20 4c 69 73 74 69  6e 67 20 63 72 65 61 74  |1  Listing creat|
00000db0  65 64 20 62 79 20 46 49  52 53 54 20 61 6e 64 20  |ed by FIRST and |
00000dc0  4c 41 53 54 0d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |LAST.-----------|
00000dd0  20 20 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |  --------------|
00000de0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000df0  2d 2d 2d 2d 2d 0d 0d 0d  0d 20 20 54 68 65 20 61  |-----....  The a|
00000e00  72 65 61 20 6f 66 20 6d  65 6d 6f 72 79 20 75 73  |rea of memory us|
00000e10  65 64 20 74 6f 20 73 74  6f 72 65 20 74 68 65 20  |ed to store the |
00000e20  6f 62 6a 65 63 74 20 63  6f 64 65 20 69 73 20 64  |object code is d|
00000e30  69 73 61 73 73 65 6d 62  6c 65 64 20 69 6e 0d 66  |isassembled in.f|
00000e40  69 67 75 72 65 20 32 34  2e 32 2e 20 59 6f 75 20  |igure 24.2. You |
00000e50  63 61 6e 20 73 65 65 20  69 6e 20 66 69 67 75 72  |can see in figur|
00000e60  65 20 32 34 2e 32 20 74  68 61 74 20 74 68 65 20  |e 24.2 that the |
00000e70  64 75 6d 6d 79 20 61 64  64 72 65 73 73 0d 66 6f  |dummy address.fo|
00000e80  6c 6c 6f 77 69 6e 67 20  74 68 65 20 4c 44 58 20  |llowing the LDX |
00000e90  61 6e 64 20 4c 44 59 20  69 6e 73 74 72 75 63 74  |and LDY instruct|
00000ea0  69 6f 6e 73 20 68 61 73  20 62 65 65 6e 20 72 65  |ions has been re|
00000eb0  70 6c 61 63 65 64 20 77  69 74 68 20 74 68 65 0d  |placed with the.|
00000ec0  61 63 74 75 61 6c 20 61  64 64 72 65 73 73 20 6f  |actual address o|
00000ed0  66 20 74 68 65 20 43 4c  49 20 63 6f 6d 6d 61 6e  |f the CLI comman|
00000ee0  64 2e 0d 0d 0d 0d 0d 3e  2a 44 49 53 20 35 30 30  |d......>*DIS 500|
00000ef0  30 0d 35 30 30 30 20 20  41 32 20 30 38 20 20 20  |0.5000  A2 08   |
00000f00  20 20 2e 2e 20 20 20 4c  44 58 20 23 26 30 38 0d  |  ..   LDX #&08.|
00000f10  35 30 30 32 20 20 41 30  20 35 30 20 20 20 20 20  |5002  A0 50     |
00000f20  2e 50 20 20 20 4c 44 59  20 23 26 35 30 0d 35 30  |.P   LDY #&50.50|
00000f30  30 34 20 20 32 30 20 46  37 20 46 46 20 20 20 2e  |04  20 F7 FF   .|
00000f40  2e 20 20 4a 53 52 20 4f  53 43 4c 49 20 0d 35 30  |.  JSR OSCLI .50|
00000f50  30 37 20 20 36 30 20 20  20 20 20 20 20 20 60 20  |07  60        ` |
00000f60  20 20 20 52 54 53 20 0d  0d 35 30 30 38 20 20 34  |   RTS ..5008  4|
00000f70  38 20 20 20 20 20 20 20  20 48 20 20 20 20 50 48  |8        H    PH|
00000f80  41 20 0d 35 30 30 39 20  20 34 35 20 34 43 20 20  |A .5009  45 4C  |
00000f90  20 20 20 45 4c 20 20 20  45 4f 52 20 26 34 43 0d  |   EL   EOR &4C.|
00000fa0  35 30 30 42 20 20 35 30  20 30 44 20 20 20 20 20  |500B  50 0D     |
00000fb0  50 2e 20 20 20 42 56 43  20 26 35 30 31 41 0d 0d  |P.   BVC &501A..|
00000fc0  46 69 67 75 72 65 20 32  34 2e 32 20 20 41 20 64  |Figure 24.2  A d|
00000fd0  69 73 61 73 73 65 6d 62  6c 79 20 6f 66 20 74 68  |isassembly of th|
00000fe0  65 20 6d 65 6d 6f 72 79  20 75 73 65 64 20 62 79  |e memory used by|
00000ff0  20 46 49 52 53 54 20 61  6e 64 20 4c 41 53 54 0d  | FIRST and LAST.|
00001000  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 20 20 2d 2d 2d  |-----------  ---|
00001010  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001040  2d 0d 0d 0d 0d 20 20 54  68 69 73 20 74 65 63 68  |-....  This tech|
00001050  6e 69 71 75 65 20 68 61  73 20 62 65 65 6e 20 75  |nique has been u|
00001060  73 65 64 20 69 6e 20 74  68 65 20 64 65 6d 6f 6e  |sed in the demon|
00001070  73 74 72 61 74 69 6f 6e  20 70 72 6f 67 72 61 6d  |stration program|
00001080  73 20 4d 4f 44 4f 4e 45  0d 61 6e 64 20 4d 4f 44  |s MODONE.and MOD|
00001090  54 57 4f 2e 20 54 68 65  73 65 20 70 72 6f 67 72  |TWO. These progr|
000010a0  61 6d 73 20 61 72 65 20  75 73 65 64 20 77 69 74  |ams are used wit|
000010b0  68 20 52 46 53 47 45 4e  20 61 6e 64 20 44 45 4d  |h RFSGEN and DEM|
000010c0  4f 20 74 6f 20 70 72 6f  64 75 63 65 20 61 0d 72  |O to produce a.r|
000010d0  6f 6d 20 69 6d 61 67 65  20 77 68 69 63 68 20 69  |om image which i|
000010e0  6e 63 6c 75 64 65 73 20  61 20 6d 75 6c 74 69 70  |ncludes a multip|
000010f0  6c 65 20 2a 20 63 6f 6d  6d 61 6e 64 20 69 6e 74  |le * command int|
00001100  65 72 70 72 65 74 65 72  2c 20 65 78 74 65 6e 64  |erpreter, extend|
00001110  65 64 0d 68 65 6c 70 2c  20 52 46 53 20 66 69 6c  |ed.help, RFS fil|
00001120  65 73 20 61 6e 64 20 62  6f 6f 74 69 6e 67 20 74  |es and booting t|
00001130  68 65 20 52 46 53 20 77  69 74 68 20 43 74 72 6c  |he RFS with Ctrl|
00001140  2b 52 2b 42 72 65 61 6b  2e 20 54 68 65 20 73 6f  |+R+Break. The so|
00001150  75 72 63 65 20 63 6f 64  65 0d 66 6f 72 20 74 68  |urce code.for th|
00001160  69 73 20 72 6f 6d 20 69  6d 61 67 65 20 77 6f 75  |is rom image wou|
00001170  6c 64 20 72 65 71 75 69  72 65 20 6d 6f 72 65 20  |ld require more |
00001180  74 68 61 6e 20 74 68 65  20 38 2e 37 35 6b 20 61  |than the 8.75k a|
00001190  76 61 69 6c 61 62 6c 65  20 69 66 20 69 74 0d 77  |vailable if it.w|
000011a0  61 73 20 61 6c 6c 20 69  6e 20 6f 6e 65 20 70 72  |as all in one pr|
000011b0  6f 67 72 61 6d 20 61 6e  64 20 73 6f 20 61 20 6d  |ogram and so a m|
000011c0  6f 64 75 6c 61 72 20 61  70 70 72 6f 61 63 68 20  |odular approach |
000011d0  77 61 73 20 75 73 65 64  20 74 6f 20 77 72 69 74  |was used to writ|
000011e0  65 20 74 68 65 0d 73 6f  75 72 63 65 20 63 6f 64  |e the.source cod|
000011f0  65 20 70 72 6f 67 72 61  6d 73 2e 0d 0d 20 20 46  |e programs...  F|
00001200  6f 72 77 61 72 64 20 72  65 66 65 72 65 6e 63 69  |orward referenci|
00001210  6e 67 20 77 61 73 20 6e  65 63 65 73 73 61 72 79  |ng was necessary|
00001220  20 62 65 63 61 75 73 65  20 74 68 65 20 61 64 64  | because the add|
00001230  72 65 73 73 20 6f 66 20  74 68 65 20 73 74 61 72  |ress of the star|
00001240  74 0d 6f 66 20 74 68 65  20 52 46 53 20 66 69 6c  |t.of the RFS fil|
00001250  65 73 20 77 61 73 20 72  65 71 75 69 72 65 64 20  |es was required |
00001260  69 6e 20 6c 69 6e 65 73  20 33 39 30 20 61 6e 64  |in lines 390 and|
00001270  20 34 32 30 20 6f 66 20  4d 4f 44 4f 4e 45 20 62  | 420 of MODONE b|
00001280  75 74 20 74 68 69 73 0d  61 64 64 72 65 73 73 20  |ut this.address |
00001290  77 61 73 20 64 65 74 65  72 6d 69 6e 65 64 20 62  |was determined b|
000012a0  79 20 74 68 65 20 73 69  7a 65 20 6f 66 20 74 68  |y the size of th|
000012b0  65 20 6f 62 6a 65 63 74  20 63 6f 64 65 20 63 72  |e object code cr|
000012c0  65 61 74 65 64 20 62 79  0d 4d 4f 44 54 57 4f 2e  |eated by.MODTWO.|
000012d0  20 54 68 65 20 61 64 64  72 65 73 73 65 73 20 28  | The addresses (|
000012e0  6d 69 6e 75 73 20 31 29  20 6f 66 20 74 68 65 20  |minus 1) of the |
000012f0  6d 65 6d 6f 72 79 20 6c  6f 63 61 74 69 6f 6e 73  |memory locations|
00001300  20 75 73 65 64 20 66 6f  72 20 74 68 65 0d 6c 6f  | used for the.lo|
00001310  77 20 61 6e 64 20 68 69  67 68 20 62 79 74 65 73  |w and high bytes|
00001320  20 6f 66 20 74 68 65 20  52 46 53 20 64 75 6d 6d  | of the RFS dumm|
00001330  79 20 61 64 64 72 65 73  73 20 61 72 65 20 73 74  |y address are st|
00001340  6f 72 65 64 20 69 6e 20  41 25 20 61 6e 64 20 42  |ored in A% and B|
00001350  25 0d 61 6e 64 20 74 68  65 20 61 63 74 75 61 6c  |%.and the actual|
00001360  20 61 64 64 72 65 73 73  20 6f 66 20 74 68 65 20  | address of the |
00001370  73 74 61 72 74 20 6f 66  20 74 68 65 20 52 46 53  |start of the RFS|
00001380  20 66 69 6c 65 73 20 69  73 20 70 6f 6b 65 64 20  | files is poked |
00001390  69 6e 74 6f 0d 74 68 65  73 65 20 6d 65 6d 6f 72  |into.these memor|
000013a0  79 20 6c 6f 63 61 74 69  6f 6e 73 20 69 6e 20 6c  |y locations in l|
000013b0  69 6e 65 73 20 32 30 34  30 20 61 6e 64 20 32 30  |ines 2040 and 20|
000013c0  35 30 20 6f 66 20 4d 4f  44 54 57 4f 2e 0d 0d 20  |50 of MODTWO... |
000013d0  20 54 68 65 20 70 72 69  6e 74 20 73 75 62 72 6f  | The print subro|
000013e0  75 74 69 6e 65 20 69 6e  20 4d 4f 44 4f 4e 45 20  |utine in MODONE |
000013f0  69 73 20 6c 61 62 65 6c  65 64 20 77 69 74 68 20  |is labeled with |
00001400  43 25 20 28 6c 69 6e 65  20 31 34 31 30 20 6f 66  |C% (line 1410 of|
00001410  0d 4d 4f 44 4f 4e 45 29  20 61 6e 64 20 74 68 69  |.MODONE) and thi|
00001420  73 20 61 64 64 72 65 73  73 20 69 73 20 61 6c 73  |s address is als|
00001430  6f 20 70 61 73 73 65 64  20 6f 76 65 72 20 74 6f  |o passed over to|
00001440  20 4d 4f 44 54 57 4f 20  28 6c 69 6e 65 20 31 31  | MODTWO (line 11|
00001450  30 20 6f 66 0d 4d 4f 44  54 57 4f 29 20 73 6f 20  |0 of.MODTWO) so |
00001460  74 68 61 74 20 74 68 65  20 73 61 6d 65 20 72 6f  |that the same ro|
00001470  75 74 69 6e 65 20 63 61  6e 20 62 65 20 75 73 65  |utine can be use|
00001480  64 20 69 6e 20 74 68 65  20 73 65 63 6f 6e 64 20  |d in the second |
00001490  70 72 6f 67 72 61 6d 0d  28 6c 69 6e 65 73 20 33  |program.(lines 3|
000014a0  30 30 20 61 6e 64 20 34  37 30 20 6f 66 20 4d 4f  |00 and 470 of MO|
000014b0  44 54 57 4f 29 20 77 69  74 68 6f 75 74 20 68 61  |DTWO) without ha|
000014c0  76 69 6e 67 20 74 6f 20  77 72 69 74 65 20 74 68  |ving to write th|
000014d0  65 20 63 6f 64 65 20 66  6f 72 20 74 68 65 0d 73  |e code for the.s|
000014e0  75 62 72 6f 75 74 69 6e  65 20 69 6e 20 4d 4f 44  |ubroutine in MOD|
000014f0  54 57 4f 2e 0d 0d 20 20  54 68 69 73 20 74 65 63  |TWO...  This tec|
00001500  68 6e 69 71 75 65 20 63  61 6e 20 62 65 20 75 73  |hnique can be us|
00001510  65 64 20 74 6f 20 70 72  6f 64 75 63 65 20 31 36  |ed to produce 16|
00001520  6b 20 6f 66 20 6f 62 6a  65 63 74 20 63 6f 64 65  |k of object code|
00001530  20 77 69 74 68 20 6f 6e  6c 79 0d 38 2e 37 35 6b  | with only.8.75k|
00001540  20 6f 66 20 6d 65 6d 6f  72 79 20 61 76 61 69 6c  | of memory avail|
00001550  61 62 6c 65 20 66 6f 72  20 74 68 65 20 73 6f 75  |able for the sou|
00001560  72 63 65 20 63 6f 64 65  2e 0d 0d 20 20 54 68 65  |rce code...  The|
00001570  20 6c 61 63 6b 20 6f 66  20 6d 65 6d 6f 72 79 20  | lack of memory |
00001580  69 6e 20 74 68 65 20 42  42 43 20 42 20 69 73 20  |in the BBC B is |
00001590  6e 6f 74 20 61 6c 77 61  79 73 20 61 20 64 69 73  |not always a dis|
000015a0  61 64 76 61 6e 74 61 67  65 2e 20 54 68 65 0d 73  |advantage. The.s|
000015b0  6d 61 6c 6c 20 66 69 6c  65 73 20 75 73 65 64 20  |mall files used |
000015c0  69 6e 20 6d 6f 64 75 6c  61 72 20 70 72 6f 67 72  |in modular progr|
000015d0  61 6d 73 20 61 72 65 20  6d 75 63 68 20 65 61 73  |ams are much eas|
000015e0  69 65 72 20 74 6f 20 64  65 62 75 67 20 74 68 61  |ier to debug tha|
000015f0  6e 20 74 68 65 0d 68 75  67 65 20 73 6f 75 72 63  |n the.huge sourc|
00001600  65 20 63 6f 64 65 20 70  72 6f 67 72 61 6d 20 77  |e code program w|
00001610  68 69 63 68 20 77 6f 75  6c 64 20 62 65 20 72 65  |hich would be re|
00001620  71 75 69 72 65 64 20 74  6f 20 70 72 6f 64 75 63  |quired to produc|
00001630  65 20 61 20 31 36 6b 0d  6f 62 6a 65 63 74 20 63  |e a 16k.object c|
00001640  6f 64 65 20 66 69 6c 65  20 66 72 6f 6d 20 6a 75  |ode file from ju|
00001650  73 74 20 6f 6e 65 20 73  6f 75 72 63 65 20 63 6f  |st one source co|
00001660  64 65 20 66 69 6c 65 2e  0d 0d 0d 0d 0d 20 20 20  |de file......   |
00001670  31 30 20 52 45 4d 3a 20  4d 4f 44 4f 4e 45 0d 20  |10 REM: MODONE. |
00001680  20 20 32 30 20 4d 4f 44  45 37 0d 20 20 20 33 30  |  20 MODE7.   30|
00001690  20 48 49 4d 45 4d 3d 26  33 43 30 30 0d 20 20 20  | HIMEM=&3C00.   |
000016a0  34 30 20 64 69 66 66 3d  26 38 30 30 30 2d 48 49  |40 diff=&8000-HI|
000016b0  4d 45 4d 0d 20 20 20 35  30 20 48 25 3d 48 49 4d  |MEM.   50 H%=HIM|
000016c0  45 4d 0d 20 20 20 36 30  20 61 64 64 72 65 73 73  |EM.   60 address|
000016d0  3d 26 37 30 0d 20 20 20  37 30 20 72 6f 6d 6e 75  |=&70.   70 romnu|
000016e0  6d 62 65 72 3d 26 46 34  0d 20 20 20 38 30 20 70  |mber=&F4.   80 p|
000016f0  68 72 6f 6d 3d 26 46 35  0d 20 20 20 39 30 20 72  |hrom=&F5.   90 r|
00001700  6f 6d 70 6f 69 6e 74 3d  26 46 36 0d 20 20 31 30  |ompoint=&F6.  10|
00001710  30 20 73 74 61 63 6b 3d  26 31 30 33 0d 20 20 31  |0 stack=&103.  1|
00001720  31 30 20 6f 73 61 73 63  69 3d 26 46 46 45 33 0d  |10 osasci=&FFE3.|
00001730  20 20 31 32 30 20 6f 73  6e 65 77 6c 3d 26 46 46  |  120 osnewl=&FF|
00001740  45 37 0d 20 20 31 33 30  20 6f 73 62 79 74 65 3d  |E7.  130 osbyte=|
00001750  26 46 46 46 34 0d 20 20  31 34 30 20 6f 73 63 6c  |&FFF4.  140 oscl|
00001760  69 3d 26 46 46 46 37 0d  20 20 31 35 30 20 46 4f  |i=&FFF7.  150 FO|
00001770  52 20 70 61 73 73 20 3d  20 30 20 54 4f 20 32 20  |R pass = 0 TO 2 |
00001780  53 54 45 50 20 32 0d 20  20 31 36 30 20 50 25 3d  |STEP 2.  160 P%=|
00001790  48 49 4d 45 4d 0d 20 20  31 37 30 20 5b 20 20 20  |HIMEM.  170 [   |
000017a0  20 20 20 20 4f 50 54 20  70 61 73 73 0d 20 20 31  |    OPT pass.  1|
000017b0  38 30 20 20 20 20 20 20  20 20 20 42 52 4b 0d 20  |80         BRK. |
000017c0  20 31 39 30 20 20 20 20  20 20 20 20 20 42 52 4b  | 190         BRK|
000017d0  0d 20 20 32 30 30 20 20  20 20 20 20 20 20 20 42  |.  200         B|
000017e0  52 4b 0d 20 20 32 31 30  20 20 20 20 20 20 20 20  |RK.  210        |
000017f0  20 4a 4d 50 20 73 65 72  76 69 63 65 2b 64 69 66  | JMP service+dif|
00001800  66 0d 20 20 32 32 30 20  20 20 20 20 20 20 20 20  |f.  220         |
00001810  4f 50 54 20 46 4e 65 71  75 62 28 26 38 32 29 0d  |OPT FNequb(&82).|
00001820  20 20 32 33 30 20 20 20  20 20 20 20 20 20 4f 50  |  230         OP|
00001830  54 20 46 4e 65 71 75 62  28 28 63 6f 70 79 72 69  |T FNequb((copyri|
00001840  67 68 74 2b 64 69 66 66  29 20 4d 4f 44 20 32 35  |ght+diff) MOD 25|
00001850  36 29 0d 20 20 32 34 30  20 20 20 20 20 20 20 20  |6).  240        |
00001860  20 42 52 4b 0d 20 20 32  35 30 20 20 20 20 20 20  | BRK.  250      |
00001870  20 20 20 4f 50 54 20 46  4e 65 71 75 73 28 22 4d  |   OPT FNequs("M|
00001880  4f 44 55 4c 41 52 20 52  4f 4d 20 44 45 53 49 47  |ODULAR ROM DESIG|
00001890  4e 22 29 0d 20 20 32 36  30 20 2e 63 6f 70 79 72  |N").  260 .copyr|
000018a0  69 67 68 74 0d 20 20 32  37 30 20 20 20 20 20 20  |ight.  270      |
000018b0  20 20 20 42 52 4b 0d 20  20 32 38 30 20 20 20 20  |   BRK.  280    |
000018c0  20 20 20 20 20 4f 50 54  20 46 4e 65 71 75 73 28  |     OPT FNequs(|
000018d0  22 28 43 29 20 47 6f 72  64 6f 6e 20 48 6f 72 73  |"(C) Gordon Hors|
000018e0  69 6e 67 74 6f 6e 20 31  39 38 37 22 29 0d 20 20  |ington 1987").  |
000018f0  32 39 30 20 20 20 20 20  20 20 20 20 42 52 4b 0d  |290         BRK.|
00001900  20 20 33 30 30 20 2e 73  65 72 76 69 63 65 0d 20  |  300 .service. |
00001910  20 33 31 30 20 20 20 20  20 20 20 20 20 50 48 41  | 310         PHA|
00001920  0d 20 20 33 32 30 20 20  20 20 20 20 20 20 20 43  |.  320         C|
00001930  4d 50 20 23 31 33 0d 20  20 33 33 30 20 20 20 20  |MP #13.  330    |
00001940  20 20 20 20 20 42 4e 45  20 66 6f 75 72 74 65 65  |     BNE fourtee|
00001950  6e 0d 20 20 33 34 30 20  20 20 20 20 20 20 20 20  |n.  340         |
00001960  54 59 41 0d 20 20 33 35  30 20 20 20 20 20 20 20  |TYA.  350       |
00001970  20 20 45 4f 52 20 23 26  46 0d 20 20 33 36 30 20  |  EOR #&F.  360 |
00001980  20 20 20 20 20 20 20 20  43 4d 50 20 72 6f 6d 6e  |        CMP romn|
00001990  75 6d 62 65 72 0d 20 20  33 37 30 20 20 20 20 20  |umber.  370     |
000019a0  20 20 20 20 42 43 43 20  6f 75 74 0d 20 20 33 38  |    BCC out.  38|
000019b0  30 20 2e 41 25 0d 20 20  33 39 30 20 20 20 20 20  |0 .A%.  390     |
000019c0  20 20 20 20 4c 44 41 20  23 30 20 20 20 20 20 20  |    LDA #0      |
000019d0  20 20 5c 20 72 65 70 6c  61 63 65 20 77 69 74 68  |  \ replace with|
000019e0  20 4c 53 42 20 6f 66 20  52 46 53 20 64 61 74 61  | LSB of RFS data|
000019f0  0d 20 20 34 30 30 20 20  20 20 20 20 20 20 20 53  |.  400         S|
00001a00  54 41 20 72 6f 6d 70 6f  69 6e 74 0d 20 20 34 31  |TA rompoint.  41|
00001a10  30 20 2e 42 25 0d 20 20  34 32 30 20 20 20 20 20  |0 .B%.  420     |
00001a20  20 20 20 20 4c 44 41 20  23 30 20 20 20 20 20 20  |    LDA #0      |
00001a30  20 20 5c 20 72 65 70 6c  61 63 65 20 77 69 74 68  |  \ replace with|
00001a40  20 4d 53 42 20 6f 66 20  52 46 53 20 64 61 74 61  | MSB of RFS data|
00001a50  0d 20 20 34 33 30 20 20  20 20 20 20 20 20 20 53  |.  430         S|
00001a60  54 41 20 72 6f 6d 70 6f  69 6e 74 2b 31 0d 20 20  |TA rompoint+1.  |
00001a70  34 34 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |440         LDA |
00001a80  72 6f 6d 6e 75 6d 62 65  72 0d 20 20 34 35 30 20  |romnumber.  450 |
00001a90  20 20 20 20 20 20 20 20  45 4f 52 20 23 26 46 0d  |        EOR #&F.|
00001aa0  20 20 34 36 30 20 20 20  20 20 20 20 20 20 53 54  |  460         ST|
00001ab0  41 20 70 68 72 6f 6d 0d  20 20 34 37 30 20 2e 65  |A phrom.  470 .e|
00001ac0  78 69 74 0d 20 20 34 38  30 20 20 20 20 20 20 20  |xit.  480       |
00001ad0  20 20 50 4c 41 0d 20 20  34 39 30 20 20 20 20 20  |  PLA.  490     |
00001ae0  20 20 20 20 4c 44 41 20  23 30 0d 20 20 35 30 30  |    LDA #0.  500|
00001af0  20 20 20 20 20 20 20 20  20 52 54 53 0d 20 20 35  |         RTS.  5|
00001b00  31 30 20 2e 66 6f 75 72  74 65 65 6e 0d 20 20 35  |10 .fourteen.  5|
00001b10  32 30 20 20 20 20 20 20  20 20 20 43 4d 50 20 23  |20         CMP #|
00001b20  31 34 0d 20 20 35 33 30  20 20 20 20 20 20 20 20  |14.  530        |
00001b30  20 42 4e 45 20 74 72 79  74 68 72 65 65 0d 20 20  | BNE trythree.  |
00001b40  35 34 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |540         LDA |
00001b50  70 68 72 6f 6d 0d 20 20  35 35 30 20 20 20 20 20  |phrom.  550     |
00001b60  20 20 20 20 45 4f 52 20  23 26 46 0d 20 20 35 36  |    EOR #&F.  56|
00001b70  30 20 20 20 20 20 20 20  20 20 43 4d 50 20 72 6f  |0         CMP ro|
00001b80  6d 6e 75 6d 62 65 72 0d  20 20 35 37 30 20 20 20  |mnumber.  570   |
00001b90  20 20 20 20 20 20 42 4e  45 20 6f 75 74 0d 20 20  |      BNE out.  |
00001ba0  35 38 30 20 20 20 20 20  20 20 20 20 4c 44 59 20  |580         LDY |
00001bb0  23 30 0d 20 20 35 39 30  20 20 20 20 20 20 20 20  |#0.  590        |
00001bc0  20 4c 44 41 20 28 72 6f  6d 70 6f 69 6e 74 29 2c  | LDA (rompoint),|
00001bd0  59 0d 20 20 36 30 30 20  20 20 20 20 20 20 20 20  |Y.  600         |
00001be0  54 41 59 0d 20 20 36 31  30 20 20 20 20 20 20 20  |TAY.  610       |
00001bf0  20 20 49 4e 43 20 72 6f  6d 70 6f 69 6e 74 0d 20  |  INC rompoint. |
00001c00  20 36 32 30 20 20 20 20  20 20 20 20 20 42 4e 45  | 620         BNE|
00001c10  20 65 78 69 74 0d 20 20  36 33 30 20 20 20 20 20  | exit.  630     |
00001c20  20 20 20 20 49 4e 43 20  72 6f 6d 70 6f 69 6e 74  |    INC rompoint|
00001c30  2b 31 0d 20 20 36 34 30  20 20 20 20 20 20 20 20  |+1.  640        |
00001c40  20 4a 4d 50 20 65 78 69  74 2b 64 69 66 66 0d 20  | JMP exit+diff. |
00001c50  20 36 35 30 20 2e 6f 75  74 0d 20 20 36 36 30 20  | 650 .out.  660 |
00001c60  20 20 20 20 20 20 20 20  50 4c 41 0d 20 20 36 37  |        PLA.  67|
00001c70  30 20 20 20 20 20 20 20  20 20 52 54 53 0d 20 20  |0         RTS.  |
00001c80  36 38 30 20 2e 74 72 79  74 68 72 65 65 0d 20 20  |680 .trythree.  |
00001c90  36 39 30 20 20 20 20 20  20 20 20 20 54 58 41 0d  |690         TXA.|
00001ca0  20 20 37 30 30 20 20 20  20 20 20 20 20 20 50 48  |  700         PH|
00001cb0  41 0d 20 20 37 31 30 20  20 20 20 20 20 20 20 20  |A.  710         |
00001cc0  54 59 41 0d 20 20 37 32  30 20 20 20 20 20 20 20  |TYA.  720       |
00001cd0  20 20 50 48 41 0d 20 20  37 33 30 20 20 20 20 20  |  PHA.  730     |
00001ce0  20 20 20 20 54 53 58 0d  20 20 37 34 30 20 20 20  |    TSX.  740   |
00001cf0  20 20 20 20 20 20 4c 44  41 20 73 74 61 63 6b 2c  |      LDA stack,|
00001d00  58 0d 20 20 37 35 30 20  20 20 20 20 20 20 20 20  |X.  750         |
00001d10  43 4d 50 20 23 33 0d 20  20 37 36 30 20 20 20 20  |CMP #3.  760    |
00001d20  20 20 20 20 20 42 45 51  20 74 68 72 65 65 0d 20  |     BEQ three. |
00001d30  20 37 37 30 20 20 20 20  20 20 20 20 20 4a 4d 50  | 770         JMP|
00001d40  20 6c 61 73 74 62 79 74  65 2b 64 69 66 66 20 5c  | lastbyte+diff \|
00001d50  20 63 6f 6e 74 69 6e 75  65 20 69 6e 20 4d 4f 44  | continue in MOD|
00001d60  55 4c 45 32 0d 20 20 37  38 30 20 2e 74 68 72 65  |ULE2.  780 .thre|
00001d70  65 0d 20 20 37 39 30 20  20 20 20 20 20 20 20 20  |e.  790         |
00001d80  4c 44 41 20 23 26 37 41  0d 20 20 38 30 30 20 20  |LDA #&7A.  800  |
00001d90  20 20 20 20 20 20 20 4a  53 52 20 6f 73 62 79 74  |       JSR osbyt|
00001da0  65 0d 20 20 38 31 30 20  20 20 20 20 20 20 20 20  |e.  810         |
00001db0  43 50 58 20 23 26 33 33  20 20 20 20 20 20 5c 20  |CPX #&33      \ |
00001dc0  49 73 20 69 74 20 52 20  42 72 65 61 6b 3f 0d 20  |Is it R Break?. |
00001dd0  20 38 32 30 20 20 20 20  20 20 20 20 20 42 45 51  | 820         BEQ|
00001de0  20 72 62 72 65 61 6b 0d  20 20 38 33 30 20 20 20  | rbreak.  830   |
00001df0  20 20 20 20 20 20 50 4c  41 0d 20 20 38 34 30 20  |      PLA.  840 |
00001e00  20 20 20 20 20 20 20 20  54 41 59 0d 20 20 38 35  |        TAY.  85|
00001e10  30 20 20 20 20 20 20 20  20 20 50 4c 41 0d 20 20  |0         PLA.  |
00001e20  38 36 30 20 20 20 20 20  20 20 20 20 54 41 58 0d  |860         TAX.|
00001e30  20 20 38 37 30 20 20 20  20 20 20 20 20 20 50 4c  |  870         PL|
00001e40  41 0d 20 20 38 38 30 20  20 20 20 20 20 20 20 20  |A.  880         |
00001e50  52 54 53 0d 20 20 38 39  30 20 2e 72 62 72 65 61  |RTS.  890 .rbrea|
00001e60  6b 0d 20 20 39 30 30 20  20 20 20 20 20 20 20 20  |k.  900         |
00001e70  4c 44 41 20 23 26 43 39  0d 20 20 39 31 30 20 20  |LDA #&C9.  910  |
00001e80  20 20 20 20 20 20 20 4c  44 58 20 23 31 0d 20 20  |       LDX #1.  |
00001e90  39 32 30 20 20 20 20 20  20 20 20 20 4c 44 59 20  |920         LDY |
00001ea0  23 30 0d 20 20 39 33 30  20 20 20 20 20 20 20 20  |#0.  930        |
00001eb0  20 4a 53 52 20 6f 73 62  79 74 65 20 20 20 20 5c  | JSR osbyte    \|
00001ec0  20 44 69 73 61 62 6c 65  20 6b 65 79 62 6f 61 72  | Disable keyboar|
00001ed0  64 0d 20 20 39 34 30 20  20 20 20 20 20 20 20 20  |d.  940         |
00001ee0  4c 44 41 20 23 26 30 46  0d 20 20 39 35 30 20 20  |LDA #&0F.  950  |
00001ef0  20 20 20 20 20 20 20 4c  44 58 20 23 30 0d 20 20  |       LDX #0.  |
00001f00  39 36 30 20 20 20 20 20  20 20 20 20 4a 53 52 20  |960         JSR |
00001f10  6f 73 62 79 74 65 20 20  20 20 5c 20 46 6c 75 73  |osbyte    \ Flus|
00001f20  68 20 61 6c 6c 20 62 75  66 66 65 72 73 0d 20 20  |h all buffers.  |
00001f30  39 37 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |970         LDA |
00001f40  61 64 64 72 65 73 73 0d  20 20 39 38 30 20 20 20  |address.  980   |
00001f50  20 20 20 20 20 20 50 48  41 0d 20 20 39 39 30 20  |      PHA.  990 |
00001f60  20 20 20 20 20 20 20 20  4c 44 41 20 61 64 64 72  |        LDA addr|
00001f70  65 73 73 2b 31 0d 20 31  30 30 30 20 20 20 20 20  |ess+1. 1000     |
00001f80  20 20 20 20 50 48 41 0d  20 31 30 31 30 20 20 20  |    PHA. 1010   |
00001f90  20 20 20 20 20 20 4c 44  58 20 23 28 72 66 73 2b  |      LDX #(rfs+|
00001fa0  64 69 66 66 29 20 4d 4f  44 20 32 35 36 0d 20 31  |diff) MOD 256. 1|
00001fb0  30 32 30 20 20 20 20 20  20 20 20 20 4c 44 59 20  |020         LDY |
00001fc0  23 28 72 66 73 2b 64 69  66 66 29 20 44 49 56 20  |#(rfs+diff) DIV |
00001fd0  32 35 36 0d 20 31 30 33  30 20 20 20 20 20 20 20  |256. 1030       |
00001fe0  20 20 4a 53 52 20 70 72  69 6e 74 2b 64 69 66 66  |  JSR print+diff|
00001ff0  0d 20 31 30 34 30 20 20  20 20 20 20 20 20 20 4c  |. 1040         L|
00002000  44 58 20 23 28 63 61 74  2b 64 69 66 66 29 20 4d  |DX #(cat+diff) M|
00002010  4f 44 20 32 35 36 0d 20  31 30 35 30 20 20 20 20  |OD 256. 1050    |
00002020  20 20 20 20 20 4c 44 59  20 23 28 63 61 74 2b 64  |     LDY #(cat+d|
00002030  69 66 66 29 20 44 49 56  20 32 35 36 0d 20 31 30  |iff) DIV 256. 10|
00002040  36 30 20 20 20 20 20 20  20 20 20 4a 53 52 20 70  |60         JSR p|
00002050  72 69 6e 74 2b 64 69 66  66 0d 20 31 30 37 30 20  |rint+diff. 1070 |
00002060  20 20 20 20 20 20 20 20  4c 44 41 20 23 26 38 44  |        LDA #&8D|
00002070  0d 20 31 30 38 30 20 20  20 20 20 20 20 20 20 4a  |. 1080         J|
00002080  53 52 20 6f 73 62 79 74  65 20 20 20 20 5c 20 53  |SR osbyte    \ S|
00002090  65 6c 65 63 74 20 52 46  53 0d 20 31 30 39 30 20  |elect RFS. 1090 |
000020a0  20 20 20 20 20 20 20 20  4c 44 41 20 23 26 38 42  |        LDA #&8B|
000020b0  0d 20 31 31 30 30 20 20  20 20 20 20 20 20 20 4c  |. 1100         L|
000020c0  44 58 20 23 31 0d 20 31  31 31 30 20 20 20 20 20  |DX #1. 1110     |
000020d0  20 20 20 20 4c 44 59 20  23 32 0d 20 31 31 32 30  |    LDY #2. 1120|
000020e0  20 20 20 20 20 20 20 20  20 4a 53 52 20 6f 73 62  |         JSR osb|
000020f0  79 74 65 20 20 20 20 5c  20 2a 4f 50 54 31 2c 32  |yte    \ *OPT1,2|
00002100  0d 20 31 31 33 30 20 20  20 20 20 20 20 20 20 4c  |. 1130         L|
00002110  44 58 20 23 28 64 6f 74  2b 64 69 66 66 29 20 4d  |DX #(dot+diff) M|
00002120  4f 44 20 32 35 36 0d 20  31 31 34 30 20 20 20 20  |OD 256. 1140    |
00002130  20 20 20 20 20 4c 44 59  20 23 28 64 6f 74 2b 64  |     LDY #(dot+d|
00002140  69 66 66 29 20 44 49 56  20 32 35 36 0d 20 31 31  |iff) DIV 256. 11|
00002150  35 30 20 20 20 20 20 20  20 20 20 4a 53 52 20 6f  |50         JSR o|
00002160  73 63 6c 69 20 20 20 20  20 5c 20 43 61 74 61 6c  |scli     \ Catal|
00002170  6f 67 75 65 20 52 46 53  0d 20 31 31 36 30 20 20  |ogue RFS. 1160  |
00002180  20 20 20 20 20 20 20 4c  44 41 20 23 26 38 42 0d  |       LDA #&8B.|
00002190  20 31 31 37 30 20 20 20  20 20 20 20 20 20 4c 44  | 1170         LD|
000021a0  58 20 23 30 0d 20 31 31  38 30 20 20 20 20 20 20  |X #0. 1180      |
000021b0  20 20 20 4c 44 59 20 23  30 0d 20 31 31 39 30 20  |   LDY #0. 1190 |
000021c0  20 20 20 20 20 20 20 20  4a 53 52 20 6f 73 62 79  |        JSR osby|
000021d0  74 65 20 20 20 20 5c 20  2a 4f 50 54 20 31 2c 30  |te    \ *OPT 1,0|
000021e0  0d 20 31 32 30 30 20 20  20 20 20 20 20 20 20 4a  |. 1200         J|
000021f0  53 52 20 6f 73 6e 65 77  6c 0d 20 31 32 31 30 20  |SR osnewl. 1210 |
00002200  20 20 20 20 20 20 20 20  4c 44 58 20 23 28 72 66  |        LDX #(rf|
00002210  73 2b 64 69 66 66 29 20  4d 4f 44 20 32 35 36 0d  |s+diff) MOD 256.|
00002220  20 31 32 32 30 20 20 20  20 20 20 20 20 20 4c 44  | 1220         LD|
00002230  59 20 23 28 72 66 73 2b  64 69 66 66 29 20 44 49  |Y #(rfs+diff) DI|
00002240  56 20 32 35 36 0d 20 31  32 33 30 20 20 20 20 20  |V 256. 1230     |
00002250  20 20 20 20 4a 53 52 20  70 72 69 6e 74 2b 64 69  |    JSR print+di|
00002260  66 66 0d 20 31 32 34 30  20 20 20 20 20 20 20 20  |ff. 1240        |
00002270  20 4c 44 58 20 23 28 61  63 74 2b 64 69 66 66 29  | LDX #(act+diff)|
00002280  20 4d 4f 44 20 32 35 36  0d 20 31 32 35 30 20 20  | MOD 256. 1250  |
00002290  20 20 20 20 20 20 20 4c  44 59 20 23 28 61 63 74  |       LDY #(act|
000022a0  2b 64 69 66 66 29 20 44  49 56 20 32 35 36 0d 20  |+diff) DIV 256. |
000022b0  31 32 36 30 20 20 20 20  20 20 20 20 20 4a 53 52  |1260         JSR|
000022c0  20 70 72 69 6e 74 2b 64  69 66 66 0d 20 31 32 37  | print+diff. 127|
000022d0  30 20 20 20 20 20 20 20  20 20 50 4c 41 0d 20 31  |0         PLA. 1|
000022e0  32 38 30 20 20 20 20 20  20 20 20 20 53 54 41 20  |280         STA |
000022f0  61 64 64 72 65 73 73 2b  31 0d 20 31 32 39 30 20  |address+1. 1290 |
00002300  20 20 20 20 20 20 20 20  50 4c 41 0d 20 31 33 30  |        PLA. 130|
00002310  30 20 20 20 20 20 20 20  20 20 53 54 41 20 61 64  |0         STA ad|
00002320  64 72 65 73 73 0d 20 31  33 31 30 20 20 20 20 20  |dress. 1310     |
00002330  20 20 20 20 4c 44 41 20  23 26 43 39 0d 20 31 33  |    LDA #&C9. 13|
00002340  32 30 20 20 20 20 20 20  20 20 20 4c 44 58 20 23  |20         LDX #|
00002350  30 0d 20 31 33 33 30 20  20 20 20 20 20 20 20 20  |0. 1330         |
00002360  4c 44 59 20 23 30 0d 20  31 33 34 30 20 20 20 20  |LDY #0. 1340    |
00002370  20 20 20 20 20 4a 53 52  20 6f 73 62 79 74 65 20  |     JSR osbyte |
00002380  20 20 20 5c 20 45 6e 61  62 6c 65 20 6b 65 79 62  |   \ Enable keyb|
00002390  6f 61 72 64 0d 20 31 33  35 30 20 20 20 20 20 20  |oard. 1350      |
000023a0  20 20 20 50 4c 41 0d 20  31 33 36 30 20 20 20 20  |   PLA. 1360    |
000023b0  20 20 20 20 20 50 4c 41  0d 20 31 33 37 30 20 20  |     PLA. 1370  |
000023c0  20 20 20 20 20 20 20 50  4c 41 0d 20 31 33 38 30  |       PLA. 1380|
000023d0  20 20 20 20 20 20 20 20  20 4c 44 41 20 23 30 0d  |         LDA #0.|
000023e0  20 31 33 39 30 20 20 20  20 20 20 20 20 20 52 54  | 1390         RT|
000023f0  53 0d 20 31 34 30 30 20  2e 70 72 69 6e 74 0d 20  |S. 1400 .print. |
00002400  31 34 31 30 20 2e 43 25  0d 20 31 34 32 30 20 20  |1410 .C%. 1420  |
00002410  20 20 20 20 20 20 20 53  54 58 20 61 64 64 72 65  |       STX addre|
00002420  73 73 0d 20 31 34 33 30  20 20 20 20 20 20 20 20  |ss. 1430        |
00002430  20 53 54 59 20 61 64 64  72 65 73 73 2b 31 0d 20  | STY address+1. |
00002440  31 34 34 30 20 20 20 20  20 20 20 20 20 4c 44 59  |1440         LDY|
00002450  20 23 26 46 46 0d 20 31  34 35 30 20 2e 70 72 69  | #&FF. 1450 .pri|
00002460  6e 74 6c 6f 6f 70 0d 20  31 34 36 30 20 20 20 20  |ntloop. 1460    |
00002470  20 20 20 20 20 49 4e 59  0d 20 31 34 37 30 20 20  |     INY. 1470  |
00002480  20 20 20 20 20 20 20 4c  44 41 20 28 61 64 64 72  |       LDA (addr|
00002490  65 73 73 29 2c 59 0d 20  31 34 38 30 20 20 20 20  |ess),Y. 1480    |
000024a0  20 20 20 20 20 42 45 51  20 65 6e 64 70 72 69 6e  |     BEQ endprin|
000024b0  74 0d 20 31 34 39 30 20  20 20 20 20 20 20 20 20  |t. 1490         |
000024c0  4a 53 52 20 6f 73 61 73  63 69 0d 20 31 35 30 30  |JSR osasci. 1500|
000024d0  20 20 20 20 20 20 20 20  20 4a 4d 50 20 70 72 69  |         JMP pri|
000024e0  6e 74 6c 6f 6f 70 2b 64  69 66 66 0d 20 31 35 31  |ntloop+diff. 151|
000024f0  30 20 2e 65 6e 64 70 72  69 6e 74 0d 20 31 35 32  |0 .endprint. 152|
00002500  30 20 20 20 20 20 20 20  20 20 52 54 53 0d 20 31  |0         RTS. 1|
00002510  35 33 30 20 2e 64 6f 74  0d 20 31 35 34 30 20 20  |530 .dot. 1540  |
00002520  20 20 20 20 20 20 20 4f  50 54 20 46 4e 65 71 75  |       OPT FNequ|
00002530  73 28 22 43 41 54 22 29  0d 20 31 35 35 30 20 20  |s("CAT"). 1550  |
00002540  20 20 20 20 20 20 20 4f  50 54 20 46 4e 65 71 75  |       OPT FNequ|
00002550  62 28 26 30 44 29 0d 20  31 35 36 30 20 2e 72 66  |b(&0D). 1560 .rf|
00002560  73 0d 20 31 35 37 30 20  20 20 20 20 20 20 20 20  |s. 1570         |
00002570  4f 50 54 20 46 4e 65 71  75 73 28 22 52 4f 4d 20  |OPT FNequs("ROM |
00002580  46 69 6c 69 6e 67 20 53  79 73 74 65 6d 20 22 29  |Filing System ")|
00002590  0d 20 31 35 38 30 20 20  20 20 20 20 20 20 20 42  |. 1580         B|
000025a0  52 4b 0d 20 31 35 39 30  20 2e 63 61 74 0d 20 31  |RK. 1590 .cat. 1|
000025b0  36 30 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |600         OPT |
000025c0  46 4e 65 71 75 73 28 22  43 61 74 61 6c 6f 67 75  |FNequs("Catalogu|
000025d0  65 22 29 0d 20 31 36 31  30 20 20 20 20 20 20 20  |e"). 1610       |
000025e0  20 20 4f 50 54 20 46 4e  65 71 75 62 28 26 30 44  |  OPT FNequb(&0D|
000025f0  29 0d 20 31 36 32 30 20  20 20 20 20 20 20 20 20  |). 1620         |
00002600  42 52 4b 0d 20 31 36 33  30 20 2e 61 63 74 0d 20  |BRK. 1630 .act. |
00002610  31 36 34 30 20 20 20 20  20 20 20 20 20 4f 50 54  |1640         OPT|
00002620  20 46 4e 65 71 75 73 28  22 61 63 74 69 76 65 22  | FNequs("active"|
00002630  29 0d 20 31 36 35 30 20  20 20 20 20 20 20 20 20  |). 1650         |
00002640  4f 50 54 20 46 4e 65 71  75 77 28 26 30 44 30 44  |OPT FNequw(&0D0D|
00002650  29 0d 20 31 36 36 30 20  20 20 20 20 20 20 20 20  |). 1660         |
00002660  42 52 4b 0d 20 31 36 37  30 20 2e 6c 61 73 74 62  |BRK. 1670 .lastb|
00002670  79 74 65 0d 20 31 36 38  30 20 5d 0d 20 31 36 39  |yte. 1680 ]. 169|
00002680  30 20 4e 45 58 54 0d 20  31 37 30 30 20 4f 25 3d  |0 NEXT. 1700 O%=|
00002690  6c 61 73 74 62 79 74 65  0d 20 31 37 31 30 20 43  |lastbyte. 1710 C|
000026a0  48 41 49 4e 22 4d 4f 44  54 57 4f 22 0d 20 31 37  |HAIN"MODTWO". 17|
000026b0  32 30 20 44 45 46 46 4e  65 71 75 62 28 62 79 74  |20 DEFFNequb(byt|
000026c0  65 29 0d 20 31 37 33 30  20 3f 50 25 3d 62 79 74  |e). 1730 ?P%=byt|
000026d0  65 0d 20 31 37 34 30 20  50 25 3d 50 25 2b 31 0d  |e. 1740 P%=P%+1.|
000026e0  20 31 37 35 30 20 3d 70  61 73 73 0d 20 31 37 36  | 1750 =pass. 176|
000026f0  30 20 44 45 46 46 4e 65  71 75 77 28 77 6f 72 64  |0 DEFFNequw(word|
00002700  29 0d 20 31 37 37 30 20  3f 50 25 3d 77 6f 72 64  |). 1770 ?P%=word|
00002710  20 4d 4f 44 20 32 35 36  0d 20 31 37 38 30 20 50  | MOD 256. 1780 P|
00002720  25 3f 31 3d 77 6f 72 64  20 44 49 56 20 32 35 36  |%?1=word DIV 256|
00002730  0d 20 31 37 39 30 20 50  25 3d 50 25 2b 32 0d 20  |. 1790 P%=P%+2. |
00002740  31 38 30 30 20 3d 70 61  73 73 0d 20 31 38 31 30  |1800 =pass. 1810|
00002750  20 44 45 46 46 4e 65 71  75 64 28 64 6f 75 62 6c  | DEFFNequd(doubl|
00002760  65 29 0d 20 31 38 32 30  20 21 50 25 3d 64 6f 75  |e). 1820 !P%=dou|
00002770  62 6c 65 0d 20 31 38 33  30 20 50 25 3d 50 25 2b  |ble. 1830 P%=P%+|
00002780  34 0d 20 31 38 34 30 20  3d 70 61 73 73 0d 20 31  |4. 1840 =pass. 1|
00002790  38 35 30 20 44 45 46 46  4e 65 71 75 73 28 73 74  |850 DEFFNequs(st|
000027a0  72 69 6e 67 24 29 0d 20  31 38 36 30 20 24 50 25  |ring$). 1860 $P%|
000027b0  3d 73 74 72 69 6e 67 24  0d 20 31 38 37 30 20 50  |=string$. 1870 P|
000027c0  25 3d 50 25 2b 4c 45 4e  28 73 74 72 69 6e 67 24  |%=P%+LEN(string$|
000027d0  29 0d 20 31 38 38 30 20  3d 70 61 73 73 0d 0d 0d  |). 1880 =pass...|
000027e0  0d 0d 0d 20 20 20 31 30  20 52 45 4d 3a 20 4d 4f  |...   10 REM: MO|
000027f0  44 54 57 4f 0d 20 20 20  32 30 20 48 49 4d 45 4d  |DTWO.   20 HIMEM|
00002800  3d 26 33 43 30 30 0d 20  20 20 33 30 20 64 69 66  |=&3C00.   30 dif|
00002810  66 3d 26 38 30 30 30 2d  48 49 4d 45 4d 0d 20 20  |f=&8000-HIMEM.  |
00002820  20 34 30 20 61 64 64 72  65 73 73 3d 26 37 30 0d  | 40 address=&70.|
00002830  20 20 20 35 30 20 63 6f  6d 76 65 63 3d 26 46 32  |   50 comvec=&F2|
00002840  0d 20 20 20 36 30 20 73  74 61 63 6b 3d 26 31 30  |.   60 stack=&10|
00002850  35 0d 20 20 20 37 30 20  67 73 69 6e 69 74 3d 26  |5.   70 gsinit=&|
00002860  46 46 43 32 0d 20 20 20  38 30 20 67 73 72 65 61  |FFC2.   80 gsrea|
00002870  64 3d 26 46 46 43 35 0d  20 20 20 39 30 20 6f 73  |d=&FFC5.   90 os|
00002880  61 73 63 69 3d 26 46 46  45 33 0d 20 20 31 30 30  |asci=&FFE3.  100|
00002890  20 6f 73 77 6f 72 64 3d  26 46 46 46 31 0d 20 20  | osword=&FFF1.  |
000028a0  31 31 30 20 70 72 69 6e  74 65 72 3d 43 25 0d 20  |110 printer=C%. |
000028b0  20 31 32 30 20 46 4f 52  20 70 61 73 73 20 3d 20  | 120 FOR pass = |
000028c0  30 20 54 4f 20 32 20 53  54 45 50 20 32 0d 20 20  |0 TO 2 STEP 2.  |
000028d0  31 33 30 20 50 25 3d 4f  25 0d 20 20 31 34 30 20  |130 P%=O%.  140 |
000028e0  5b 20 20 20 20 20 20 20  4f 50 54 20 70 61 73 73  |[       OPT pass|
000028f0  0d 20 20 31 35 30 20 20  20 20 20 20 20 20 20 4c  |.  150         L|
00002900  44 41 20 61 64 64 72 65  73 73 0d 20 20 31 36 30  |DA address.  160|
00002910  20 20 20 20 20 20 20 20  20 50 48 41 0d 20 20 31  |         PHA.  1|
00002920  37 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 61  |70         LDA a|
00002930  64 64 72 65 73 73 2b 31  0d 20 20 31 38 30 20 20  |ddress+1.  180  |
00002940  20 20 20 20 20 20 20 50  48 41 0d 20 20 31 39 30  |       PHA.  190|
00002950  20 20 20 20 20 20 20 20  20 54 53 58 0d 20 20 32  |         TSX.  2|
00002960  30 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 73  |00         LDA s|
00002970  74 61 63 6b 2c 58 0d 20  20 32 31 30 20 20 20 20  |tack,X.  210    |
00002980  20 20 20 20 20 43 4d 50  20 23 39 0d 20 20 32 32  |     CMP #9.  22|
00002990  30 20 20 20 20 20 20 20  20 20 42 4e 45 20 74 72  |0         BNE tr|
000029a0  79 66 6f 75 72 0d 20 20  32 33 30 20 20 20 20 20  |yfour.  230     |
000029b0  20 20 20 20 53 45 43 0d  20 20 32 34 30 20 20 20  |    SEC.  240   |
000029c0  20 20 20 20 20 20 4a 53  52 20 67 73 69 6e 69 74  |      JSR gsinit|
000029d0  0d 20 20 32 35 30 20 20  20 20 20 20 20 20 20 4c  |.  250         L|
000029e0  44 58 20 23 30 0d 20 20  32 36 30 20 20 20 20 20  |DX #0.  260     |
000029f0  20 20 20 20 4a 53 52 20  67 73 72 65 61 64 0d 20  |    JSR gsread. |
00002a00  20 32 37 30 20 20 20 20  20 20 20 20 20 42 43 43  | 270         BCC|
00002a10  20 74 72 79 65 78 74 65  6e 64 65 64 0d 20 20 32  | tryextended.  2|
00002a20  38 30 20 20 20 20 20 20  20 20 20 4c 44 58 20 23  |80         LDX #|
00002a30  28 68 65 6c 70 6d 73 67  2b 64 69 66 66 29 20 4d  |(helpmsg+diff) M|
00002a40  4f 44 20 32 35 36 0d 20  20 32 39 30 20 20 20 20  |OD 256.  290    |
00002a50  20 20 20 20 20 4c 44 59  20 23 28 68 65 6c 70 6d  |     LDY #(helpm|
00002a60  73 67 2b 64 69 66 66 29  20 44 49 56 20 32 35 36  |sg+diff) DIV 256|
00002a70  0d 20 20 33 30 30 20 20  20 20 20 20 20 20 20 4a  |.  300         J|
00002a80  53 52 20 70 72 69 6e 74  65 72 2b 64 69 66 66 0d  |SR printer+diff.|
00002a90  20 20 33 31 30 20 20 20  20 20 20 20 20 20 42 45  |  310         BE|
00002aa0  51 20 71 75 69 74 0d 20  20 33 32 30 20 2e 68 65  |Q quit.  320 .he|
00002ab0  6c 70 6c 6f 6f 70 0d 20  20 33 33 30 20 20 20 20  |lploop.  330    |
00002ac0  20 20 20 20 20 49 4e 58  0d 20 20 33 34 30 20 20  |     INX.  340  |
00002ad0  20 20 20 20 20 20 20 4a  53 52 20 67 73 72 65 61  |       JSR gsrea|
00002ae0  64 0d 20 20 33 35 30 20  2e 74 72 79 65 78 74 65  |d.  350 .tryexte|
00002af0  6e 64 65 64 0d 20 20 33  36 30 20 20 20 20 20 20  |nded.  360      |
00002b00  20 20 20 43 4d 50 20 23  41 53 43 28 22 2e 22 29  |   CMP #ASC(".")|
00002b10  0d 20 20 33 37 30 20 20  20 20 20 20 20 20 20 42  |.  370         B|
00002b20  45 51 20 6f 6b 65 78 74  65 6e 64 65 64 0d 20 20  |EQ okextended.  |
00002b30  33 38 30 20 20 20 20 20  20 20 20 20 41 4e 44 20  |380         AND |
00002b40  23 26 44 46 0d 20 20 33  39 30 20 20 20 20 20 20  |#&DF.  390      |
00002b50  20 20 20 43 4d 50 20 68  65 6c 70 74 69 74 6c 65  |   CMP helptitle|
00002b60  2b 64 69 66 66 2c 58 0d  20 20 34 30 30 20 20 20  |+diff,X.  400   |
00002b70  20 20 20 20 20 20 42 45  51 20 68 65 6c 70 6c 6f  |      BEQ helplo|
00002b80  6f 70 0d 20 20 34 31 30  20 20 20 20 20 20 20 20  |op.  410        |
00002b90  20 4c 44 41 20 23 26 46  46 0d 20 20 34 32 30 20  | LDA #&FF.  420 |
00002ba0  20 20 20 20 20 20 20 20  43 4d 50 20 68 65 6c 70  |        CMP help|
00002bb0  74 69 74 6c 65 2b 64 69  66 66 2c 58 0d 20 20 34  |title+diff,X.  4|
00002bc0  33 30 20 20 20 20 20 20  20 20 20 42 4e 45 20 71  |30         BNE q|
00002bd0  75 69 74 0d 20 20 34 34  30 20 2e 6f 6b 65 78 74  |uit.  440 .okext|
00002be0  65 6e 64 65 64 0d 20 20  34 35 30 20 20 20 20 20  |ended.  450     |
00002bf0  20 20 20 20 4c 44 58 20  23 28 68 65 6c 70 69 6e  |    LDX #(helpin|
00002c00  66 6f 2b 64 69 66 66 29  20 4d 4f 44 20 32 35 36  |fo+diff) MOD 256|
00002c10  0d 20 20 34 36 30 20 20  20 20 20 20 20 20 20 4c  |.  460         L|
00002c20  44 59 20 23 28 68 65 6c  70 69 6e 66 6f 2b 64 69  |DY #(helpinfo+di|
00002c30  66 66 29 20 44 49 56 20  32 35 36 0d 20 20 34 37  |ff) DIV 256.  47|
00002c40  30 20 20 20 20 20 20 20  20 20 4a 53 52 20 70 72  |0         JSR pr|
00002c50  69 6e 74 65 72 2b 64 69  66 66 0d 20 20 34 38 30  |inter+diff.  480|
00002c60  20 20 20 20 20 20 20 20  20 42 45 51 20 71 75 69  |         BEQ qui|
00002c70  74 0d 20 20 34 39 30 20  2e 74 72 79 66 6f 75 72  |t.  490 .tryfour|
00002c80  0d 20 20 35 30 30 20 20  20 20 20 20 20 20 20 43  |.  500         C|
00002c90  4d 50 20 23 34 0d 20 20  35 31 30 20 20 20 20 20  |MP #4.  510     |
00002ca0  20 20 20 20 42 4e 45 20  71 75 69 74 0d 20 20 35  |    BNE quit.  5|
00002cb0  32 30 20 20 20 20 20 20  20 20 20 4c 44 58 20 23  |20         LDX #|
00002cc0  26 46 45 0d 20 20 35 33  30 20 20 20 20 20 20 20  |&FE.  530       |
00002cd0  20 20 54 59 41 0d 20 20  35 34 30 20 20 20 20 20  |  TYA.  540     |
00002ce0  20 20 20 20 50 48 41 0d  20 20 35 35 30 20 2e 66  |    PHA.  550 .f|
00002cf0  69 72 73 74 63 68 61 72  0d 20 20 35 36 30 20 20  |irstchar.  560  |
00002d00  20 20 20 20 20 20 20 49  4e 58 0d 20 20 35 37 30  |       INX.  570|
00002d10  20 20 20 20 20 20 20 20  20 50 4c 41 0d 20 20 35  |         PLA.  5|
00002d20  38 30 20 20 20 20 20 20  20 20 20 54 41 59 0d 20  |80         TAY. |
00002d30  20 35 39 30 20 20 20 20  20 20 20 20 20 50 48 41  | 590         PHA|
00002d40  0d 20 20 36 30 30 20 20  20 20 20 20 20 20 20 4c  |.  600         L|
00002d50  44 41 20 28 63 6f 6d 76  65 63 29 2c 59 0d 20 20  |DA (comvec),Y.  |
00002d60  36 31 30 20 20 20 20 20  20 20 20 20 41 4e 44 20  |610         AND |
00002d70  23 26 44 46 0d 20 20 36  32 30 20 20 20 20 20 20  |#&DF.  620      |
00002d80  20 20 20 43 4d 50 20 23  41 53 43 28 22 58 22 29  |   CMP #ASC("X")|
00002d90  0d 20 20 36 33 30 20 20  20 20 20 20 20 20 20 42  |.  630         B|
00002da0  4e 45 20 69 6e 74 65 72  70 72 65 74 0d 20 20 36  |NE interpret.  6|
00002db0  34 30 20 20 20 20 20 20  20 20 20 49 4e 59 0d 20  |40         INY. |
00002dc0  20 36 35 30 20 2e 69 6e  74 65 72 70 72 65 74 0d  | 650 .interpret.|
00002dd0  20 20 36 36 30 20 20 20  20 20 20 20 20 20 49 4e  |  660         IN|
00002de0  58 0d 20 20 36 37 30 20  20 20 20 20 20 20 20 20  |X.  670         |
00002df0  4c 44 41 20 63 6f 6d 6d  74 61 62 6c 65 2b 64 69  |LDA commtable+di|
00002e00  66 66 2c 58 0d 20 20 36  38 30 20 20 20 20 20 20  |ff,X.  680      |
00002e10  20 20 20 42 4d 49 20 66  6f 75 6e 64 0d 20 20 36  |   BMI found.  6|
00002e20  39 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 28  |90         LDA (|
00002e30  63 6f 6d 76 65 63 29 2c  59 0d 20 20 37 30 30 20  |comvec),Y.  700 |
00002e40  20 20 20 20 20 20 20 20  49 4e 59 0d 20 20 37 31  |        INY.  71|
00002e50  30 20 20 20 20 20 20 20  20 20 43 4d 50 20 23 41  |0         CMP #A|
00002e60  53 43 28 22 2e 22 29 0d  20 20 37 32 30 20 20 20  |SC(".").  720   |
00002e70  20 20 20 20 20 20 42 45  51 20 66 6f 75 6e 64 64  |      BEQ foundd|
00002e80  6f 74 0d 20 20 37 33 30  20 20 20 20 20 20 20 20  |ot.  730        |
00002e90  20 41 4e 44 20 23 26 44  46 0d 20 20 37 34 30 20  | AND #&DF.  740 |
00002ea0  20 20 20 20 20 20 20 20  43 4d 50 20 63 6f 6d 6d  |        CMP comm|
00002eb0  74 61 62 6c 65 2b 64 69  66 66 2c 58 0d 20 20 37  |table+diff,X.  7|
00002ec0  35 30 20 20 20 20 20 20  20 20 20 42 45 51 20 69  |50         BEQ i|
00002ed0  6e 74 65 72 70 72 65 74  0d 20 20 37 36 30 20 2e  |nterpret.  760 .|
00002ee0  61 6e 6f 74 68 65 72 0d  20 20 37 37 30 20 20 20  |another.  770   |
00002ef0  20 20 20 20 20 20 49 4e  58 0d 20 20 37 38 30 20  |      INX.  780 |
00002f00  20 20 20 20 20 20 20 20  4c 44 41 20 63 6f 6d 6d  |        LDA comm|
00002f10  74 61 62 6c 65 2b 64 69  66 66 2c 58 0d 20 20 37  |table+diff,X.  7|
00002f20  39 30 20 20 20 20 20 20  20 20 20 42 50 4c 20 61  |90         BPL a|
00002f30  6e 6f 74 68 65 72 0d 20  20 38 30 30 20 20 20 20  |nother.  800    |
00002f40  20 20 20 20 20 43 4d 50  20 23 26 46 46 0d 20 20  |     CMP #&FF.  |
00002f50  38 31 30 20 20 20 20 20  20 20 20 20 42 4e 45 20  |810         BNE |
00002f60  66 69 72 73 74 63 68 61  72 0d 20 20 38 32 30 20  |firstchar.  820 |
00002f70  2e 65 78 69 74 0d 20 20  38 33 30 20 20 20 20 20  |.exit.  830     |
00002f80  20 20 20 20 50 4c 41 0d  20 20 38 34 30 20 2e 71  |    PLA.  840 .q|
00002f90  75 69 74 0d 20 20 38 35  30 20 20 20 20 20 20 20  |uit.  850       |
00002fa0  20 20 50 4c 41 0d 20 20  38 36 30 20 20 20 20 20  |  PLA.  860     |
00002fb0  20 20 20 20 53 54 41 20  61 64 64 72 65 73 73 2b  |    STA address+|
00002fc0  31 0d 20 20 38 37 30 20  20 20 20 20 20 20 20 20  |1.  870         |
00002fd0  50 4c 41 0d 20 20 38 38  30 20 20 20 20 20 20 20  |PLA.  880       |
00002fe0  20 20 53 54 41 20 61 64  64 72 65 73 73 0d 20 20  |  STA address.  |
00002ff0  38 39 30 20 20 20 20 20  20 20 20 20 50 4c 41 0d  |890         PLA.|
00003000  20 20 39 30 30 20 20 20  20 20 20 20 20 20 54 41  |  900         TA|
00003010  59 0d 20 20 39 31 30 20  20 20 20 20 20 20 20 20  |Y.  910         |
00003020  50 4c 41 0d 20 20 39 32  30 20 20 20 20 20 20 20  |PLA.  920       |
00003030  20 20 54 41 58 0d 20 20  39 33 30 20 20 20 20 20  |  TAX.  930     |
00003040  20 20 20 20 50 4c 41 0d  20 20 39 34 30 20 20 20  |    PLA.  940   |
00003050  20 20 20 20 20 20 52 54  53 0d 20 20 39 35 30 20  |      RTS.  950 |
00003060  2e 66 6f 75 6e 64 64 6f  74 0d 20 20 39 36 30 20  |.founddot.  960 |
00003070  20 20 20 20 20 20 20 20  49 4e 58 0d 20 20 39 37  |        INX.  97|
00003080  30 20 20 20 20 20 20 20  20 20 4c 44 41 20 63 6f  |0         LDA co|
00003090  6d 6d 74 61 62 6c 65 2b  64 69 66 66 2c 58 0d 20  |mmtable+diff,X. |
000030a0  20 39 38 30 20 20 20 20  20 20 20 20 20 42 50 4c  | 980         BPL|
000030b0  20 66 6f 75 6e 64 64 6f  74 0d 20 20 39 39 30 20  | founddot.  990 |
000030c0  2e 66 6f 75 6e 64 0d 20  31 30 30 30 20 20 20 20  |.found. 1000    |
000030d0  20 20 20 20 20 43 4d 50  20 23 26 46 46 0d 20 31  |     CMP #&FF. 1|
000030e0  30 31 30 20 20 20 20 20  20 20 20 20 42 45 51 20  |010         BEQ |
000030f0  65 78 69 74 0d 20 31 30  32 30 20 20 20 20 20 20  |exit. 1020      |
00003100  20 20 20 53 54 41 20 61  64 64 72 65 73 73 2b 31  |   STA address+1|
00003110  0d 20 31 30 33 30 20 20  20 20 20 20 20 20 20 49  |. 1030         I|
00003120  4e 58 0d 20 31 30 34 30  20 20 20 20 20 20 20 20  |NX. 1040        |
00003130  20 4c 44 41 20 63 6f 6d  6d 74 61 62 6c 65 2b 64  | LDA commtable+d|
00003140  69 66 66 2c 58 0d 20 31  30 35 30 20 20 20 20 20  |iff,X. 1050     |
00003150  20 20 20 20 53 54 41 20  61 64 64 72 65 73 73 0d  |    STA address.|
00003160  20 31 30 36 30 20 20 20  20 20 20 20 20 20 50 4c  | 1060         PL|
00003170  41 0d 20 31 30 37 30 20  20 20 20 20 20 20 20 20  |A. 1070         |
00003180  53 45 43 0d 20 31 30 38  30 20 20 20 20 20 20 20  |SEC. 1080       |
00003190  20 20 4a 53 52 20 67 73  69 6e 69 74 0d 20 31 30  |  JSR gsinit. 10|
000031a0  39 30 20 20 20 20 20 20  20 20 20 4a 4d 50 20 28  |90         JMP (|
000031b0  61 64 64 72 65 73 73 29  0d 20 31 31 30 30 20 2e  |address). 1100 .|
000031c0  63 6f 6d 6d 74 61 62 6c  65 0d 20 31 31 31 30 20  |commtable. 1110 |
000031d0  20 20 20 20 20 20 20 20  4f 50 54 20 46 4e 65 71  |        OPT FNeq|
000031e0  75 73 28 22 52 45 56 45  52 42 22 29 0d 20 31 31  |us("REVERB"). 11|
000031f0  32 30 20 20 20 20 20 20  20 20 20 4f 50 54 20 46  |20         OPT F|
00003200  4e 65 71 75 62 28 28 72  65 76 65 72 62 2b 64 69  |Nequb((reverb+di|
00003210  66 66 29 20 44 49 56 20  32 35 36 29 0d 20 31 31  |ff) DIV 256). 11|
00003220  33 30 20 20 20 20 20 20  20 20 20 4f 50 54 20 46  |30         OPT F|
00003230  4e 65 71 75 62 28 28 72  65 76 65 72 62 2b 64 69  |Nequb((reverb+di|
00003240  66 66 29 20 4d 4f 44 20  32 35 36 29 0d 20 31 31  |ff) MOD 256). 11|
00003250  34 30 20 20 20 20 20 20  20 20 20 4f 50 54 20 46  |40         OPT F|
00003260  4e 65 71 75 73 28 22 41  4c 41 52 4d 22 29 0d 20  |Nequs("ALARM"). |
00003270  31 31 35 30 20 20 20 20  20 20 20 20 20 4f 50 54  |1150         OPT|
00003280  20 46 4e 65 71 75 62 28  28 61 6c 61 72 6d 2b 64  | FNequb((alarm+d|
00003290  69 66 66 29 20 44 49 56  20 32 35 36 29 0d 20 31  |iff) DIV 256). 1|
000032a0  31 36 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |160         OPT |
000032b0  46 4e 65 71 75 62 28 28  61 6c 61 72 6d 2b 64 69  |FNequb((alarm+di|
000032c0  66 66 29 20 4d 4f 44 20  32 35 36 29 0d 20 31 31  |ff) MOD 256). 11|
000032d0  37 30 20 20 20 20 20 20  20 20 20 4f 50 54 20 46  |70         OPT F|
000032e0  4e 65 71 75 73 28 22 5a  4f 49 4e 47 22 29 0d 20  |Nequs("ZOING"). |
000032f0  31 31 38 30 20 20 20 20  20 20 20 20 20 4f 50 54  |1180         OPT|
00003300  20 46 4e 65 71 75 62 28  28 7a 6f 69 6e 67 2b 64  | FNequb((zoing+d|
00003310  69 66 66 29 20 44 49 56  20 32 35 36 29 0d 20 31  |iff) DIV 256). 1|
00003320  31 39 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |190         OPT |
00003330  46 4e 65 71 75 62 28 28  7a 6f 69 6e 67 2b 64 69  |FNequb((zoing+di|
00003340  66 66 29 20 4d 4f 44 20  32 35 36 29 0d 20 31 32  |ff) MOD 256). 12|
00003350  30 30 20 20 20 20 20 20  20 20 20 4f 50 54 20 46  |00         OPT F|
00003360  4e 65 71 75 62 28 26 46  46 29 0d 20 31 32 31 30  |Nequb(&FF). 1210|
00003370  20 2e 68 65 6c 70 6d 73  67 0d 20 31 32 32 30 20  | .helpmsg. 1220 |
00003380  20 20 20 20 20 20 20 20  4f 50 54 20 46 4e 65 71  |        OPT FNeq|
00003390  75 62 28 26 30 44 29 0d  20 31 32 33 30 20 20 20  |ub(&0D). 1230   |
000033a0  20 20 20 20 20 20 4f 50  54 20 46 4e 65 71 75 73  |      OPT FNequs|
000033b0  28 22 4d 4f 44 55 4c 41  52 20 52 4f 4d 22 29 0d  |("MODULAR ROM").|
000033c0  20 31 32 34 30 20 20 20  20 20 20 20 20 20 4f 50  | 1240         OP|
000033d0  54 20 46 4e 65 71 75 62  28 26 30 44 29 0d 20 31  |T FNequb(&0D). 1|
000033e0  32 35 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |250         OPT |
000033f0  46 4e 65 71 75 77 28 26  32 30 32 30 29 0d 20 31  |FNequw(&2020). 1|
00003400  32 36 30 20 2e 68 65 6c  70 74 69 74 6c 65 0d 20  |260 .helptitle. |
00003410  31 32 37 30 20 20 20 20  20 20 20 20 20 4f 50 54  |1270         OPT|
00003420  20 46 4e 65 71 75 73 28  22 4d 4f 44 22 29 0d 20  | FNequs("MOD"). |
00003430  31 32 38 30 20 20 20 20  20 20 20 20 20 4f 50 54  |1280         OPT|
00003440  20 46 4e 65 71 75 77 28  26 30 44 46 46 29 0d 20  | FNequw(&0DFF). |
00003450  31 32 39 30 20 20 20 20  20 20 20 20 20 42 52 4b  |1290         BRK|
00003460  0d 20 31 33 30 30 20 2e  68 65 6c 70 69 6e 66 6f  |. 1300 .helpinfo|
00003470  0d 20 31 33 31 30 20 20  20 20 20 20 20 20 20 4f  |. 1310         O|
00003480  50 54 20 46 4e 65 71 75  77 28 26 32 30 30 44 29  |PT FNequw(&200D)|
00003490  0d 20 31 33 32 30 20 20  20 20 20 20 20 20 20 4f  |. 1320         O|
000034a0  50 54 20 46 4e 65 71 75  73 28 22 2a 41 4c 41 52  |PT FNequs("*ALAR|
000034b0  4d 22 29 0d 20 31 33 33  30 20 20 20 20 20 20 20  |M"). 1330       |
000034c0  20 20 4f 50 54 20 46 4e  65 71 75 77 28 26 32 30  |  OPT FNequw(&20|
000034d0  30 44 29 0d 20 31 33 34  30 20 20 20 20 20 20 20  |0D). 1340       |
000034e0  20 20 4f 50 54 20 46 4e  65 71 75 73 28 22 2a 52  |  OPT FNequs("*R|
000034f0  45 56 45 52 42 22 29 0d  20 31 33 35 30 20 20 20  |EVERB"). 1350   |
00003500  20 20 20 20 20 20 4f 50  54 20 46 4e 65 71 75 77  |      OPT FNequw|
00003510  28 26 32 30 30 44 29 0d  20 31 33 36 30 20 20 20  |(&200D). 1360   |
00003520  20 20 20 20 20 20 4f 50  54 20 46 4e 65 71 75 73  |      OPT FNequs|
00003530  28 22 2a 5a 4f 49 4e 47  22 29 0d 20 31 33 37 30  |("*ZOING"). 1370|
00003540  20 20 20 20 20 20 20 20  20 4f 50 54 20 46 4e 65  |         OPT FNe|
00003550  71 75 77 28 26 30 30 30  44 29 0d 20 31 33 38 30  |quw(&000D). 1380|
00003560  20 2e 61 6c 61 72 6d 0d  20 31 33 39 30 20 20 20  | .alarm. 1390   |
00003570  20 20 20 20 20 20 4c 44  41 20 23 38 0d 20 31 34  |      LDA #8. 14|
00003580  30 30 20 20 20 20 20 20  20 20 20 4c 44 58 20 23  |00         LDX #|
00003590  28 65 61 6c 61 72 6d 2b  64 69 66 66 29 20 4d 4f  |(ealarm+diff) MO|
000035a0  44 20 32 35 36 0d 20 31  34 31 30 20 20 20 20 20  |D 256. 1410     |
000035b0  20 20 20 20 4c 44 59 20  23 28 65 61 6c 61 72 6d  |    LDY #(ealarm|
000035c0  2b 64 69 66 66 29 20 44  49 56 20 32 35 36 0d 20  |+diff) DIV 256. |
000035d0  31 34 32 30 20 20 20 20  20 20 20 20 20 4a 53 52  |1420         JSR|
000035e0  20 6f 73 77 6f 72 64 20  20 20 20 5c 20 45 6e 76  | osword    \ Env|
000035f0  65 6c 6f 70 65 0d 20 31  34 33 30 20 20 20 20 20  |elope. 1430     |
00003600  20 20 20 20 4c 44 41 20  23 37 0d 20 31 34 34 30  |    LDA #7. 1440|
00003610  20 20 20 20 20 20 20 20  20 4c 44 58 20 23 28 73  |         LDX #(s|
00003620  61 6c 61 72 6d 2b 64 69  66 66 29 20 4d 4f 44 20  |alarm+diff) MOD |
00003630  32 35 36 0d 20 31 34 35  30 20 20 20 20 20 20 20  |256. 1450       |
00003640  20 20 4c 44 59 20 23 28  73 61 6c 61 72 6d 2b 64  |  LDY #(salarm+d|
00003650  69 66 66 29 20 44 49 56  20 32 35 36 0d 20 31 34  |iff) DIV 256. 14|
00003660  36 30 20 20 20 20 20 20  20 20 20 4a 53 52 20 6f  |60         JSR o|
00003670  73 77 6f 72 64 20 20 20  20 5c 20 53 6f 75 6e 64  |sword    \ Sound|
00003680  0d 20 31 34 37 30 20 2e  70 75 6c 6c 6f 75 74 0d  |. 1470 .pullout.|
00003690  20 31 34 38 30 20 20 20  20 20 20 20 20 20 50 4c  | 1480         PL|
000036a0  41 0d 20 31 34 39 30 20  20 20 20 20 20 20 20 20  |A. 1490         |
000036b0  53 54 41 20 61 64 64 72  65 73 73 2b 31 0d 20 31  |STA address+1. 1|
000036c0  35 30 30 20 20 20 20 20  20 20 20 20 50 4c 41 0d  |500         PLA.|
000036d0  20 31 35 31 30 20 20 20  20 20 20 20 20 20 53 54  | 1510         ST|
000036e0  41 20 61 64 64 72 65 73  73 0d 20 31 35 32 30 20  |A address. 1520 |
000036f0  20 20 20 20 20 20 20 20  50 4c 41 0d 20 31 35 33  |        PLA. 153|
00003700  30 20 20 20 20 20 20 20  20 20 50 4c 41 0d 20 31  |0         PLA. 1|
00003710  35 34 30 20 20 20 20 20  20 20 20 20 50 4c 41 0d  |540         PLA.|
00003720  20 31 35 35 30 20 20 20  20 20 20 20 20 20 4c 44  | 1550         LD|
00003730  41 20 23 30 0d 20 31 35  36 30 20 20 20 20 20 20  |A #0. 1560      |
00003740  20 20 20 52 54 53 0d 20  31 35 37 30 20 2e 72 65  |   RTS. 1570 .re|
00003750  76 65 72 62 0d 20 31 35  38 30 20 20 20 20 20 20  |verb. 1580      |
00003760  20 20 20 4c 44 41 20 23  38 0d 20 31 35 39 30 20  |   LDA #8. 1590 |
00003770  20 20 20 20 20 20 20 20  4c 44 58 20 23 28 65 72  |        LDX #(er|
00003780  65 76 65 72 62 2b 64 69  66 66 29 20 4d 4f 44 20  |everb+diff) MOD |
00003790  32 35 36 0d 20 31 36 30  30 20 20 20 20 20 20 20  |256. 1600       |
000037a0  20 20 4c 44 59 20 23 28  65 72 65 76 65 72 62 2b  |  LDY #(ereverb+|
000037b0  64 69 66 66 29 20 44 49  56 20 32 35 36 0d 20 31  |diff) DIV 256. 1|
000037c0  36 31 30 20 20 20 20 20  20 20 20 20 4a 53 52 20  |610         JSR |
000037d0  6f 73 77 6f 72 64 20 20  20 20 5c 20 45 6e 76 65  |osword    \ Enve|
000037e0  6c 6f 70 65 0d 20 31 36  32 30 20 20 20 20 20 20  |lope. 1620      |
000037f0  20 20 20 4c 44 41 20 23  37 0d 20 31 36 33 30 20  |   LDA #7. 1630 |
00003800  20 20 20 20 20 20 20 20  4c 44 58 20 23 28 73 72  |        LDX #(sr|
00003810  65 76 65 72 62 2b 64 69  66 66 29 20 4d 4f 44 20  |everb+diff) MOD |
00003820  32 35 36 0d 20 31 36 34  30 20 20 20 20 20 20 20  |256. 1640       |
00003830  20 20 4c 44 59 20 23 28  73 72 65 76 65 72 62 2b  |  LDY #(sreverb+|
00003840  64 69 66 66 29 20 44 49  56 20 32 35 36 0d 20 31  |diff) DIV 256. 1|
00003850  36 35 30 20 20 20 20 20  20 20 20 20 4a 53 52 20  |650         JSR |
00003860  6f 73 77 6f 72 64 20 20  20 20 5c 20 53 6f 75 6e  |osword    \ Soun|
00003870  64 0d 20 31 36 36 30 20  20 20 20 20 20 20 20 20  |d. 1660         |
00003880  4a 4d 50 20 70 75 6c 6c  6f 75 74 2b 64 69 66 66  |JMP pullout+diff|
00003890  0d 20 31 36 37 30 20 2e  7a 6f 69 6e 67 0d 20 31  |. 1670 .zoing. 1|
000038a0  36 38 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |680         LDA |
000038b0  23 38 0d 20 31 36 39 30  20 20 20 20 20 20 20 20  |#8. 1690        |
000038c0  20 4c 44 58 20 23 28 65  7a 6f 69 6e 67 2b 64 69  | LDX #(ezoing+di|
000038d0  66 66 29 20 4d 4f 44 20  32 35 36 0d 20 31 37 30  |ff) MOD 256. 170|
000038e0  30 20 20 20 20 20 20 20  20 20 4c 44 59 20 23 28  |0         LDY #(|
000038f0  65 7a 6f 69 6e 67 2b 64  69 66 66 29 20 44 49 56  |ezoing+diff) DIV|
00003900  20 32 35 36 0d 20 31 37  31 30 20 20 20 20 20 20  | 256. 1710      |
00003910  20 20 20 4a 53 52 20 6f  73 77 6f 72 64 20 20 20  |   JSR osword   |
00003920  20 5c 20 45 6e 76 65 6c  6f 70 65 0d 20 31 37 32  | \ Envelope. 172|
00003930  30 20 20 20 20 20 20 20  20 20 4c 44 41 20 23 37  |0         LDA #7|
00003940  0d 20 31 37 33 30 20 20  20 20 20 20 20 20 20 4c  |. 1730         L|
00003950  44 58 20 23 28 73 7a 6f  69 6e 67 2b 64 69 66 66  |DX #(szoing+diff|
00003960  29 20 4d 4f 44 20 32 35  36 0d 20 31 37 34 30 20  |) MOD 256. 1740 |
00003970  20 20 20 20 20 20 20 20  4c 44 59 20 23 28 73 7a  |        LDY #(sz|
00003980  6f 69 6e 67 2b 64 69 66  66 29 20 44 49 56 20 32  |oing+diff) DIV 2|
00003990  35 36 0d 20 31 37 35 30  20 20 20 20 20 20 20 20  |56. 1750        |
000039a0  20 4a 53 52 20 6f 73 77  6f 72 64 20 20 20 20 5c  | JSR osword    \|
000039b0  20 53 6f 75 6e 64 0d 20  31 37 36 30 20 20 20 20  | Sound. 1760    |
000039c0  20 20 20 20 20 4a 4d 50  20 70 75 6c 6c 6f 75 74  |     JMP pullout|
000039d0  2b 64 69 66 66 0d 20 31  37 37 30 20 2e 65 61 6c  |+diff. 1770 .eal|
000039e0  61 72 6d 0d 20 31 37 38  30 20 20 20 20 20 20 20  |arm. 1780       |
000039f0  20 20 4f 50 54 20 46 4e  65 71 75 64 28 26 30 30  |  OPT FNequd(&00|
00003a00  30 31 30 31 30 31 29 0d  20 31 37 39 30 20 20 20  |010101). 1790   |
00003a10  20 20 20 20 20 20 4f 50  54 20 46 4e 65 71 75 64  |      OPT FNequd|
00003a20  28 26 30 30 30 30 34 38  30 30 29 0d 20 31 38 30  |(&00004800). 180|
00003a30  30 20 20 20 20 20 20 20  20 20 4f 50 54 20 46 4e  |0         OPT FN|
00003a40  65 71 75 64 28 26 30 31  46 46 30 30 46 44 29 0d  |equd(&01FF00FD).|
00003a50  20 31 38 31 30 20 20 20  20 20 20 20 20 20 4f 50  | 1810         OP|
00003a60  54 20 46 4e 65 71 75 77  28 26 37 45 37 45 29 0d  |T FNequw(&7E7E).|
00003a70  20 31 38 32 30 20 2e 73  61 6c 61 72 6d 0d 20 31  | 1820 .salarm. 1|
00003a80  38 33 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |830         OPT |
00003a90  46 4e 65 71 75 64 28 26  30 30 30 31 30 30 31 31  |FNequd(&00010011|
00003aa0  29 0d 20 31 38 34 30 20  20 20 20 20 20 20 20 20  |). 1840         |
00003ab0  4f 50 54 20 46 4e 65 71  75 64 28 26 30 30 46 46  |OPT FNequd(&00FF|
00003ac0  30 30 33 32 29 0d 20 31  38 35 30 20 2e 65 72 65  |0032). 1850 .ere|
00003ad0  76 65 72 62 0d 20 31 38  36 30 20 20 20 20 20 20  |verb. 1860      |
00003ae0  20 20 20 4f 50 54 20 46  4e 65 71 75 64 28 26 46  |   OPT FNequd(&F|
00003af0  46 30 31 30 38 30 33 29  0d 20 31 38 37 30 20 20  |F010803). 1870  |
00003b00  20 20 20 20 20 20 20 4f  50 54 20 46 4e 65 71 75  |       OPT FNequ|
00003b10  64 28 26 30 31 30 31 30  31 30 31 29 0d 20 31 38  |d(&01010101). 18|
00003b20  38 30 20 20 20 20 20 20  20 20 20 4f 50 54 20 46  |80         OPT F|
00003b30  4e 65 71 75 64 28 26 37  39 46 36 46 42 46 45 29  |Nequd(&79F6FBFE)|
00003b40  0d 20 31 38 39 30 20 20  20 20 20 20 20 20 20 4f  |. 1890         O|
00003b50  50 54 20 46 4e 65 71 75  77 28 26 37 45 37 45 29  |PT FNequw(&7E7E)|
00003b60  0d 20 31 39 30 30 20 2e  73 72 65 76 65 72 62 0d  |. 1900 .sreverb.|
00003b70  20 31 39 31 30 20 20 20  20 20 20 20 20 20 4f 50  | 1910         OP|
00003b80  54 20 46 4e 65 71 75 64  28 26 30 30 30 33 30 30  |T FNequd(&000300|
00003b90  31 30 29 0d 20 31 39 32  30 20 20 20 20 20 20 20  |10). 1920       |
00003ba0  20 20 4f 50 54 20 46 4e  65 71 75 64 28 26 30 30  |  OPT FNequd(&00|
00003bb0  34 30 30 30 30 30 29 0d  20 31 39 33 30 20 2e 65  |400000). 1930 .e|
00003bc0  7a 6f 69 6e 67 0d 20 31  39 34 30 20 20 20 20 20  |zoing. 1940     |
00003bd0  20 20 20 20 4f 50 54 20  46 4e 65 71 75 64 28 26  |    OPT FNequd(&|
00003be0  45 43 31 34 30 31 30 32  29 0d 20 31 39 35 30 20  |EC140102). 1950 |
00003bf0  20 20 20 20 20 20 20 20  4f 50 54 20 46 4e 65 71  |        OPT FNeq|
00003c00  75 64 28 26 36 34 36 34  36 34 31 34 29 0d 20 31  |ud(&64646414). 1|
00003c10  39 36 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |960         OPT |
00003c20  46 4e 65 71 75 64 28 26  30 30 30 30 46 46 37 46  |FNequd(&0000FF7F|
00003c30  29 0d 20 31 39 37 30 20  20 20 20 20 20 20 20 20  |). 1970         |
00003c40  4f 50 54 20 46 4e 65 71  75 64 28 26 30 30 37 45  |OPT FNequd(&007E|
00003c50  29 0d 20 31 39 38 30 20  2e 73 7a 6f 69 6e 67 0d  |). 1980 .szoing.|
00003c60  20 31 39 39 30 20 20 20  20 20 20 20 20 20 4f 50  | 1990         OP|
00003c70  54 20 46 4e 65 71 75 64  28 26 30 30 30 32 30 30  |T FNequd(&000200|
00003c80  31 32 29 0d 20 32 30 30  30 20 20 20 20 20 20 20  |12). 2000       |
00003c90  20 20 4f 50 54 20 46 4e  65 71 75 64 28 26 30 30  |  OPT FNequd(&00|
00003ca0  33 32 30 30 43 43 29 0d  20 32 30 31 30 20 2e 6c  |3200CC). 2010 .l|
00003cb0  61 73 74 62 79 74 65 0d  20 32 30 32 30 20 5d 0d  |astbyte. 2020 ].|
00003cc0  20 32 30 33 30 20 4e 45  58 54 0d 20 32 30 34 30  | 2030 NEXT. 2040|
00003cd0  20 41 25 3f 31 3d 28 28  6c 61 73 74 62 79 74 65  | A%?1=((lastbyte|
00003ce0  2b 64 69 66 66 29 20 4d  4f 44 20 32 35 36 29 0d  |+diff) MOD 256).|
00003cf0  20 32 30 35 30 20 42 25  3f 31 3d 28 28 6c 61 73  | 2050 B%?1=((las|
00003d00  74 62 79 74 65 2b 64 69  66 66 29 20 44 49 56 20  |tbyte+diff) DIV |
00003d10  32 35 36 29 0d 20 32 30  36 30 20 52 45 4d 3a 20  |256). 2060 REM: |
00003d20  50 6f 6b 65 20 61 64 64  72 65 73 73 20 6f 66 20  |Poke address of |
00003d30  74 68 65 20 73 74 61 72  74 20 6f 66 0d 20 32 30  |the start of. 20|
00003d40  37 30 20 52 45 4d 3a 20  52 46 53 20 69 6e 74 6f  |70 REM: RFS into|
00003d50  20 4d 4f 44 4f 4e 45 0d  20 32 30 38 30 20 4f 25  | MODONE. 2080 O%|
00003d60  3d 6c 61 73 74 62 79 74  65 0d 20 32 30 39 30 20  |=lastbyte. 2090 |
00003d70  43 48 41 49 4e 22 52 46  53 47 45 4e 22 0d 20 32  |CHAIN"RFSGEN". 2|
00003d80  31 30 30 20 45 4e 44 0d  20 32 31 31 30 20 44 45  |100 END. 2110 DE|
00003d90  46 46 4e 65 71 75 62 28  62 79 74 65 29 0d 20 32  |FFNequb(byte). 2|
00003da0  31 32 30 20 3f 50 25 3d  62 79 74 65 0d 20 32 31  |120 ?P%=byte. 21|
00003db0  33 30 20 50 25 3d 50 25  2b 31 0d 20 32 31 34 30  |30 P%=P%+1. 2140|
00003dc0  20 3d 70 61 73 73 0d 20  32 31 35 30 20 44 45 46  | =pass. 2150 DEF|
00003dd0  46 4e 65 71 75 77 28 77  6f 72 64 29 0d 20 32 31  |FNequw(word). 21|
00003de0  36 30 20 3f 50 25 3d 77  6f 72 64 20 4d 4f 44 20  |60 ?P%=word MOD |
00003df0  32 35 36 0d 20 32 31 37  30 20 50 25 3f 31 3d 77  |256. 2170 P%?1=w|
00003e00  6f 72 64 20 44 49 56 20  32 35 36 0d 20 32 31 38  |ord DIV 256. 218|
00003e10  30 20 50 25 3d 50 25 2b  32 0d 20 32 31 39 30 20  |0 P%=P%+2. 2190 |
00003e20  3d 70 61 73 73 0d 20 32  32 30 30 20 44 45 46 46  |=pass. 2200 DEFF|
00003e30  4e 65 71 75 64 28 64 6f  75 62 6c 65 29 0d 20 32  |Nequd(double). 2|
00003e40  32 31 30 20 21 50 25 3d  64 6f 75 62 6c 65 0d 20  |210 !P%=double. |
00003e50  32 32 32 30 20 50 25 3d  50 25 2b 34 0d 20 32 32  |2220 P%=P%+4. 22|
00003e60  33 30 20 3d 70 61 73 73  0d 20 32 32 34 30 20 44  |30 =pass. 2240 D|
00003e70  45 46 46 4e 65 71 75 73  28 73 74 72 69 6e 67 24  |EFFNequs(string$|
00003e80  29 0d 20 32 32 35 30 20  24 50 25 3d 73 74 72 69  |). 2250 $P%=stri|
00003e90  6e 67 24 0d 20 32 32 36  30 20 50 25 3d 50 25 2b  |ng$. 2260 P%=P%+|
00003ea0  4c 45 4e 28 73 74 72 69  6e 67 24 29 0d 20 32 32  |LEN(string$). 22|
00003eb0  37 30 20 3d 70 61 73 73  0d                       |70 =pass.|
00003eb9
15-04-88/T\SWR24.m0
15-04-88/T\SWR24.m1
15-04-88/T\SWR24.m2
15-04-88/T\SWR24.m4
15-04-88/T\SWR24.m5