Home » CEEFAX disks » telesoftware9.adl » 02-09-88/T\SWR09

02-09-88/T\SWR09

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 » telesoftware9.adl
Filename: 02-09-88/T\SWR09
Read OK:
File size: 3B9C bytes
Load address: 0000
Exec address: FFFFFFFF
Duplicates

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

File contents
Mastering Sideways ROM & RAM - Module 09 - Numerical arguments
--------------------------------------------------------------

  In modules 6 and 7 you were shown how to use the MOS to read
numerical arguments by defining new Osbyte and Osword routines. In
this module I will show you one way of reading numerical arguments and
converting them into binary.

  There is no one correct way of reading numerical arguments and, as
with most programming problems, there are as many solutions as there
are people to write them. The method I will demonstrate is quite
useful for sideways ram programs because it uses the minimum amount of
user memory and restores that memory after use.

  The method demonstrated in this module will read a hexadecimal
argument in the range from &00 to &FFFF and convert the argument into
a two byte binary number. The routine includes range and error
checking to exclude invalid characters. The binary representation of
the argument is stored in two bytes of zero page memory ready to be
used by the rest of the routine. These two bytes can be restored
before returning from the rom.

  When you design your SWR programs you should anticipate how they
will be used. If the instructions for using your program tell the user
to enter, for example, the hexadecimal argument one-two-three, your
program should recognise &123 &0123 123 and 0123 as all the same,
correct, argument. Your program should not insist on using leading
zeros or an ampersand (&) prefix if a hexadecimal number is expected
but it should accept them without generating an error.

  It is not a good idea to get your SWR program running with a *
command, then prompt for a number and use Osrdch to read it byte after
byte. That style of programming works but it looks very unprofessional
and writing a program which allows the user to edit the number with
the Delete key is quite complicated. The argument(s) should follow the
command so that if, for example, you have written a program which
prints the contents of a memory location and you want to use it to
print the contents of location &900 your SWR interpreter should accept
any of the commands in figure 9.1 to call the routine and print the
answer.




>*PEEK &900 <Return>
>*PEEK &0900 <Return>
>*peek "900" <Return>
>*pe. 0900 <Return>

Figure 9.1  Valid commands and arguments
----------------------------------------




  Up to four ASCII characters can be used to represent a two byte
hexadecimal number. The nybble represented by the first ASCII
character depends on how many characters are used to represent the
number. For example, the A in &AB represents the most significant
nybble of the least significant byte but the A in &ABC represents the
least significant nybble of the most significant byte.

  If you read the ASCII characters from right to left, instead of the
more natural left to right, the first byte you read will always be the
least significant nybble of the least significant byte. If you read
the characters from left to right you either have to know in advance
how many characters are used so that, if necessary, you can pad out
the number with leading zeros or you have to type the leading zeros to
establish the place value of each character in the argument.

  To convert the ASCII representation of a hexadecimal argument into
binary you should start with the least significant nybble of the least
significant byte unless you use an elaborate conversion algorithm or
leading zeros. This presents a problem because the Gsread routine used
to read the ASCII characters from the argument reads from left to
right. To get round this problem you can read each nybble of the
argument, convert it into binary and push it on the stack until you
read the termination character. Then pull each nybble off the stack
and they will be in reverse order, as if they had been read from right
to left.

  If you keep a count of the number of nybbles read from the argument
it is a simple matter to pull the nybbles off the stack and convert
each nybble, or pair of nybbles, into a byte. This technique is
illustrated in figure 9.2.




.found
        CLC           \ terminate with space, return or "
        JSR &FFC2     \ initialise argument with Gsinit
        LDX #0        \ initial result = &0000
        STX &70       \ least sig. byte of result
        STX &71       \ most sig. byte of result
        DEX           \ X will count number of nybbles - 1
.argloop
        JSR &FFC5     \ read character from argument with Gsread
        BCS endarg    \ branch if termination character
        CMP #ASC("&") \ is it "&"?
        BEQ argloop   \ ignore "&"
        JSR convert   \ convert nybble into binary
        PHA           \ push nybble on stack
        INX           \ count nybble in X register
        BPL argloop   \ branch for next character
.endarg
        CPX #4        \ more than 4 characters?
        BCS error     \ branch if too many
        PLA           \ pull LS nybble of LS byte
        STA &70       \ store as LS byte
        DEX           \ is that the only nybble?
        BMI finish    \ branch if it is
        PLA           \ pull MS nybble of LS byte
        ASL A         \ shift
        ASL A         \ left
        ASL A         \ four
        ASL A         \ bits
        ORA &70       \ OR with &70
        STA &70       \ and store LS byte
        DEX           \ was that the last nybble?
        BMI finish    \ branch if it was
        PLA           \ pull LS nybble of MS byte
        STA &71       \ store as MS byte
        DEX           \ was that the last nybble?
        BMI finish    \ branch if it was
        PLA           \ pull MS nybble of MS byte
        ASL A         \ shift
        ASL A         \ left
        ASL A         \ four
        ASL A         \ bits
        ORA &71       \ OR with &71
        STA &71       \ and store MS byte
.finish


Figure 9.2  Converting from ASCII to binary
-----------------------------------------




  After recognising the * command the interpreter will pass control to
the label ".found". The carry flag should be cleared before
initialising the argument so that either a second quotation mark, a
carriage return or a space will be read as the termination character
of the argument.

  In figure 9.2 the X register is loaded with zero and then the
content of X is stored in the two consecutive memory locations to be
used for the result. The X register will be used to count the number
of ASCII characters read from the argument minus one. X is decremented
to start with X = &FF when no characters have been read. The argument
is read one character at a time, ignoring any leading ampersand. Each
character is converted from an ASCII character into a binary nybble
and pushed on the stack. The X register is incremented with every
binary nybble pushed on the stack. The routine will keep reading until
the termination character is found.

  After reading the termination character the number stored in the X
register should be between 0 and 3 inclusive. If it is outside that
range either too many characters have been included in the argument or
the argument has been omitted. In either case a branch to an error
routine will be made.

  When all the characters have been read from the argument the routine
starts pulling the binary nybbles off the stack. The X register is
decremented and tested after each nybble has been processed to see if
that nybble was the first one read from the argument.

  There must be at least one nybble to pull off the stack and not more
than four. The first nybble pulled off the stack can be stored in the
memory location reserved for the least significant byte. If a second
nybble is available it has all its bits shifted left four times and
ORed with the first nybble to form the least significant byte. A third
nybble can be stored in the memory location reserved for the most
significant byte and a forth nybble should have all its bits shifted
left four times and ORed with the third nybble to form the most
significant byte.

  The result is then available from the two consecutive zero page
memory locations. No other part of user memory or SWR has been used by
the conversion. The error routine and the ASCII character to binary
nybble conversion subroutine are only refered to by name in figure 9.2
but suitable actual routines can be found in the program PEEK.

  The program PEEK uses the conversion routine outlined in figure 9.2
to implement the new command *PEEK <hex.number>. To use the program
load the object code it generates into SWR and press the Break key.
You can use the new command to print the hexadecimal value of the
number stored in any byte of the I/O processor's memory. For example,
*PEEK &900, *PEEK 0900 and *PEEK "900" are all equivalent and will all
print the number stored in &900 in the I/O processor's memory.

  The program uses a one-command interpreter (lines 300-570) similar
to the ones used in the earlier modules of the course. It uses the
routine in figure 9.2 to read the argument and store the binary
conversion in two zero page bytes (lines 580-1050). The read and
convert routine has been modified slightly to store the two zero page
bytes by pushing them on the stack before making the conversion (lines
610-640). The two bytes can then be restored before returning to the
MOS (lines 1100-1130).

  The two zero page bytes are used with post-indexed indirect
addressing to load the accumulator with the byte specified by the
argument (lines 1060-1070). The accumulator content is printed using
the two subroutines in lines 1190-1340. After printing the result the
zero page locations are restored (lines 1100-1130). The registers
pushed on the stack by the interpreter are pulled off to balance the
stack (lines 1140-1160). The accumulator is reset to zero (line 1170)
to inform the other roms that the request has been recognised, and
control is returned to the MOS (line 1180).

  The ASCII to binary conversion subroutine is in lines 1350 to 1480.
As well as converting the ASCII character into a binary nybble the
subroutine also checks for valid characters. If an invalid character
is found a branch is made to an error routine (lines 1490-1660)
similar to the one introduced in Module 8.

  Because errors can be detected at any stage of the conversion,
restoring the zero page bytes when an error is found would add extra
complications to the error routine. All the information you need to
restore the zero page bytes from the error routine is available in the
X register. If you need the exercise you could modify the error
routine to restore the zero page bytes before printing the error
message. If you do there is no need to balance the stack as well
because it will be reset by BASIC when control passes to the BRK
instruction at &100.



   10 REM: PEEK
   20 MODE7
   30 HIMEM=&3C00
   40 DIM save 50
   50 diff=&8000-HIMEM
   60 address=&70
   70 errstack=&100
   80 comvec=&F2
   90 gsinit=&FFC2
  100 gsread=&FFC5
  110 osasci=&FFE3
  120 osnewl=&FFE7
  130 oscli=&FFF7
  140 FOR pass = 0 TO 2 STEP 2
  150 P%=HIMEM
  160 [       OPT pass
  170         BRK
  180         BRK
  190         BRK
  200         JMP service+diff
  210         OPT FNequb(&82)
  220         OPT FNequb((copyright+diff) MOD 256)
  230         BRK
  240 .title
  250         OPT FNequs("PEEK")
  260 .copyright
  270         BRK
  280         OPT FNequs("(C) Gordon Horsington 1987")
  290         BRK
  300 .service
  310         CMP #4
  320         BEQ unrecognised
  330         RTS
  340 .unrecognised
  350         PHA
  360         TXA
  370         PHA
  380         TYA
  390         PHA
  400         LDX #&FF
  410 .comloop
  420         INX
  430         LDA title+diff,X
  440         BEQ found
  450         LDA (comvec),Y
  460         INY
  470         CMP #ASC(".")
  480         BEQ found
  490         AND #&DF
  500         CMP title+diff,X
  510         BEQ comloop
  520         PLA
  530         TAY
  540         PLA
  550         TAX
  560         PLA
  570         RTS
  580 .found
  590         CLC
  600         JSR gsinit
  610         LDA address
  620         PHA
  630         LDA address+1
  640         PHA
  650         LDX #0
  660         STX address
  670         STX address+1
  680         DEX
  690 .argloop
  700         JSR gsread
  710         BCS endarg
  720         CMP #ASC("&")
  730         BEQ argloop
  740         JSR convert+diff
  750         PHA           \ Push hex nybbles
  760         INX
  770         BPL argloop
  780 .endarg
  790         CPX #4
  800         BCS error
  810         PLA           \ LS nybble low byte
  820         STA address
  830         DEX
  840         BMI finish
  850         PLA           \ MS nybble low byte
  860         ASL A
  870         ASL A
  880         ASL A
  890         ASL A
  900         ORA address
  910         STA address   \ LS byte
  920         DEX
  930         BMI finish
  940         PLA           \ LS nybble high byte
  950         STA address+1
  960         DEX
  970         BMI finish
  980         PLA           \ MS nybble high byte
  990         ASL A
 1000         ASL A
 1010         ASL A
 1020         ASL A
 1030         ORA address+1
 1040         STA address+1 \ MS byte
 1050 .finish
 1060         LDY #0
 1070         LDA (address),Y
 1080         JSR hexbyte+diff
 1090         JSR osnewl
 1100         PLA
 1110         STA address+1
 1120         PLA
 1130         STA address
 1140         PLA
 1150         PLA
 1160         PLA
 1170         LDA #0
 1180         RTS
 1190 .hexbyte
 1200         PHA
 1210         LSR A
 1220         LSR A
 1230         LSR A
 1240         LSR A
 1250         JSR nybble+diff
 1260         PLA
 1270 .nybble
 1280         AND #&F
 1290         SED
 1300         CLC
 1310         ADC #&90
 1320         ADC #&40
 1330         CLD
 1340         JMP osasci
 1350 .convert
 1360         CMP #ASC("9")+1
 1370         BCS letters
 1380         CMP #ASC("0")
 1390         BMI error
 1400         AND #&F
 1410         RTS
 1420 .letters
 1430         SBC #&37
 1440         CMP #&A
 1450         BMI error
 1460         CMP #&10
 1470         BCS error
 1480         RTS
 1490 .error
 1500         LDA #(errormsg+diff) MOD 256
 1510         STA address
 1520         LDA #(errormsg+diff) DIV 256
 1530         STA address+1
 1540         LDY #&FF
 1550 .errorloop
 1560         INY
 1570         LDA (address),Y
 1580         STA errstack,Y
 1590         BPL errorloop
 1600         JMP errstack
 1610 .errormsg
 1620         BRK
 1630         BRK
 1640         OPT FNequs("Out of range")
 1650         BRK
 1660         OPT FNequb(&FF)
 1670 .lastbyte
 1680 ]
 1690 NEXT
 1700 INPUT'"Save filename = "filename$
 1710 IF filename$="" END
 1720 $save="SAVE "+filename$+" "+STR$~(HIMEM)+" "+STR$~(las
      tbyte)+" FFFF8000 FFFF8000"
 1730 X%=save MOD 256
 1740 Y%=save DIV 256
 1750 *OPT1,2
 1760 CALL oscli
 1770 *OPT1,0
 1780 END
 1790 DEFFNequb(byte)
 1800 ?P%=byte
 1810 P%=P%+1
 1820 =pass
 1830 DEFFNequw(word)
 1840 ?P%=word MOD 256
 1850 P%?1=word DIV 256
 1860 P%=P%+2
 1870 =pass
 1880 DEFFNequd(double)
 1890 !P%=double
 1900 P%=P%+4
 1910 =pass
 1920 DEFFNequs(string$)
 1930 $P%=string$
 1940 P%=P%+LEN(string$)
 1950 =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 30 39  20 2d 20 4e 75 6d 65 72  |odule 09 - Numer|
00000030  69 63 61 6c 20 61 72 67  75 6d 65 6e 74 73 0d 2d  |ical arguments.-|
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 49 6e 20 6d 6f 64 75  6c 65 73 20 36 20 61 6e  | In modules 6 an|
00000090  64 20 37 20 79 6f 75 20  77 65 72 65 20 73 68 6f  |d 7 you were sho|
000000a0  77 6e 20 68 6f 77 20 74  6f 20 75 73 65 20 74 68  |wn how to use th|
000000b0  65 20 4d 4f 53 20 74 6f  20 72 65 61 64 0d 6e 75  |e MOS to read.nu|
000000c0  6d 65 72 69 63 61 6c 20  61 72 67 75 6d 65 6e 74  |merical argument|
000000d0  73 20 62 79 20 64 65 66  69 6e 69 6e 67 20 6e 65  |s by defining ne|
000000e0  77 20 4f 73 62 79 74 65  20 61 6e 64 20 4f 73 77  |w Osbyte and Osw|
000000f0  6f 72 64 20 72 6f 75 74  69 6e 65 73 2e 20 49 6e  |ord routines. In|
00000100  0d 74 68 69 73 20 6d 6f  64 75 6c 65 20 49 20 77  |.this module I w|
00000110  69 6c 6c 20 73 68 6f 77  20 79 6f 75 20 6f 6e 65  |ill show you one|
00000120  20 77 61 79 20 6f 66 20  72 65 61 64 69 6e 67 20  | way of reading |
00000130  6e 75 6d 65 72 69 63 61  6c 20 61 72 67 75 6d 65  |numerical argume|
00000140  6e 74 73 20 61 6e 64 0d  63 6f 6e 76 65 72 74 69  |nts and.converti|
00000150  6e 67 20 74 68 65 6d 20  69 6e 74 6f 20 62 69 6e  |ng them into bin|
00000160  61 72 79 2e 0d 0d 20 20  54 68 65 72 65 20 69 73  |ary...  There is|
00000170  20 6e 6f 20 6f 6e 65 20  63 6f 72 72 65 63 74 20  | no one correct |
00000180  77 61 79 20 6f 66 20 72  65 61 64 69 6e 67 20 6e  |way of reading n|
00000190  75 6d 65 72 69 63 61 6c  20 61 72 67 75 6d 65 6e  |umerical argumen|
000001a0  74 73 20 61 6e 64 2c 20  61 73 0d 77 69 74 68 20  |ts and, as.with |
000001b0  6d 6f 73 74 20 70 72 6f  67 72 61 6d 6d 69 6e 67  |most programming|
000001c0  20 70 72 6f 62 6c 65 6d  73 2c 20 74 68 65 72 65  | problems, there|
000001d0  20 61 72 65 20 61 73 20  6d 61 6e 79 20 73 6f 6c  | are as many sol|
000001e0  75 74 69 6f 6e 73 20 61  73 20 74 68 65 72 65 0d  |utions as there.|
000001f0  61 72 65 20 70 65 6f 70  6c 65 20 74 6f 20 77 72  |are people to wr|
00000200  69 74 65 20 74 68 65 6d  2e 20 54 68 65 20 6d 65  |ite them. The me|
00000210  74 68 6f 64 20 49 20 77  69 6c 6c 20 64 65 6d 6f  |thod I will demo|
00000220  6e 73 74 72 61 74 65 20  69 73 20 71 75 69 74 65  |nstrate is quite|
00000230  0d 75 73 65 66 75 6c 20  66 6f 72 20 73 69 64 65  |.useful for side|
00000240  77 61 79 73 20 72 61 6d  20 70 72 6f 67 72 61 6d  |ways ram program|
00000250  73 20 62 65 63 61 75 73  65 20 69 74 20 75 73 65  |s because it use|
00000260  73 20 74 68 65 20 6d 69  6e 69 6d 75 6d 20 61 6d  |s the minimum am|
00000270  6f 75 6e 74 20 6f 66 0d  75 73 65 72 20 6d 65 6d  |ount of.user mem|
00000280  6f 72 79 20 61 6e 64 20  72 65 73 74 6f 72 65 73  |ory and restores|
00000290  20 74 68 61 74 20 6d 65  6d 6f 72 79 20 61 66 74  | that memory aft|
000002a0  65 72 20 75 73 65 2e 0d  0d 20 20 54 68 65 20 6d  |er use...  The m|
000002b0  65 74 68 6f 64 20 64 65  6d 6f 6e 73 74 72 61 74  |ethod demonstrat|
000002c0  65 64 20 69 6e 20 74 68  69 73 20 6d 6f 64 75 6c  |ed in this modul|
000002d0  65 20 77 69 6c 6c 20 72  65 61 64 20 61 20 68 65  |e will read a he|
000002e0  78 61 64 65 63 69 6d 61  6c 0d 61 72 67 75 6d 65  |xadecimal.argume|
000002f0  6e 74 20 69 6e 20 74 68  65 20 72 61 6e 67 65 20  |nt in the range |
00000300  66 72 6f 6d 20 26 30 30  20 74 6f 20 26 46 46 46  |from &00 to &FFF|
00000310  46 20 61 6e 64 20 63 6f  6e 76 65 72 74 20 74 68  |F and convert th|
00000320  65 20 61 72 67 75 6d 65  6e 74 20 69 6e 74 6f 0d  |e argument into.|
00000330  61 20 74 77 6f 20 62 79  74 65 20 62 69 6e 61 72  |a two byte binar|
00000340  79 20 6e 75 6d 62 65 72  2e 20 54 68 65 20 72 6f  |y number. The ro|
00000350  75 74 69 6e 65 20 69 6e  63 6c 75 64 65 73 20 72  |utine includes r|
00000360  61 6e 67 65 20 61 6e 64  20 65 72 72 6f 72 0d 63  |ange and error.c|
00000370  68 65 63 6b 69 6e 67 20  74 6f 20 65 78 63 6c 75  |hecking to exclu|
00000380  64 65 20 69 6e 76 61 6c  69 64 20 63 68 61 72 61  |de invalid chara|
00000390  63 74 65 72 73 2e 20 54  68 65 20 62 69 6e 61 72  |cters. The binar|
000003a0  79 20 72 65 70 72 65 73  65 6e 74 61 74 69 6f 6e  |y representation|
000003b0  20 6f 66 0d 74 68 65 20  61 72 67 75 6d 65 6e 74  | of.the argument|
000003c0  20 69 73 20 73 74 6f 72  65 64 20 69 6e 20 74 77  | is stored in tw|
000003d0  6f 20 62 79 74 65 73 20  6f 66 20 7a 65 72 6f 20  |o bytes of zero |
000003e0  70 61 67 65 20 6d 65 6d  6f 72 79 20 72 65 61 64  |page memory read|
000003f0  79 20 74 6f 20 62 65 0d  75 73 65 64 20 62 79 20  |y to be.used by |
00000400  74 68 65 20 72 65 73 74  20 6f 66 20 74 68 65 20  |the rest of the |
00000410  72 6f 75 74 69 6e 65 2e  20 54 68 65 73 65 20 74  |routine. These t|
00000420  77 6f 20 62 79 74 65 73  20 63 61 6e 20 62 65 20  |wo bytes can be |
00000430  72 65 73 74 6f 72 65 64  0d 62 65 66 6f 72 65 20  |restored.before |
00000440  72 65 74 75 72 6e 69 6e  67 20 66 72 6f 6d 20 74  |returning from t|
00000450  68 65 20 72 6f 6d 2e 0d  0d 20 20 57 68 65 6e 20  |he rom...  When |
00000460  79 6f 75 20 64 65 73 69  67 6e 20 79 6f 75 72 20  |you design your |
00000470  53 57 52 20 70 72 6f 67  72 61 6d 73 20 79 6f 75  |SWR programs you|
00000480  20 73 68 6f 75 6c 64 20  61 6e 74 69 63 69 70 61  | should anticipa|
00000490  74 65 20 68 6f 77 20 74  68 65 79 0d 77 69 6c 6c  |te how they.will|
000004a0  20 62 65 20 75 73 65 64  2e 20 49 66 20 74 68 65  | be used. If the|
000004b0  20 69 6e 73 74 72 75 63  74 69 6f 6e 73 20 66 6f  | instructions fo|
000004c0  72 20 75 73 69 6e 67 20  79 6f 75 72 20 70 72 6f  |r using your pro|
000004d0  67 72 61 6d 20 74 65 6c  6c 20 74 68 65 20 75 73  |gram tell the us|
000004e0  65 72 0d 74 6f 20 65 6e  74 65 72 2c 20 66 6f 72  |er.to enter, for|
000004f0  20 65 78 61 6d 70 6c 65  2c 20 74 68 65 20 68 65  | example, the he|
00000500  78 61 64 65 63 69 6d 61  6c 20 61 72 67 75 6d 65  |xadecimal argume|
00000510  6e 74 20 6f 6e 65 2d 74  77 6f 2d 74 68 72 65 65  |nt one-two-three|
00000520  2c 20 79 6f 75 72 0d 70  72 6f 67 72 61 6d 20 73  |, your.program s|
00000530  68 6f 75 6c 64 20 72 65  63 6f 67 6e 69 73 65 20  |hould recognise |
00000540  26 31 32 33 20 26 30 31  32 33 20 31 32 33 20 61  |&123 &0123 123 a|
00000550  6e 64 20 30 31 32 33 20  61 73 20 61 6c 6c 20 74  |nd 0123 as all t|
00000560  68 65 20 73 61 6d 65 2c  0d 63 6f 72 72 65 63 74  |he same,.correct|
00000570  2c 20 61 72 67 75 6d 65  6e 74 2e 20 59 6f 75 72  |, argument. Your|
00000580  20 70 72 6f 67 72 61 6d  20 73 68 6f 75 6c 64 20  | program should |
00000590  6e 6f 74 20 69 6e 73 69  73 74 20 6f 6e 20 75 73  |not insist on us|
000005a0  69 6e 67 20 6c 65 61 64  69 6e 67 0d 7a 65 72 6f  |ing leading.zero|
000005b0  73 20 6f 72 20 61 6e 20  61 6d 70 65 72 73 61 6e  |s or an ampersan|
000005c0  64 20 28 26 29 20 70 72  65 66 69 78 20 69 66 20  |d (&) prefix if |
000005d0  61 20 68 65 78 61 64 65  63 69 6d 61 6c 20 6e 75  |a hexadecimal nu|
000005e0  6d 62 65 72 20 69 73 20  65 78 70 65 63 74 65 64  |mber is expected|
000005f0  0d 62 75 74 20 69 74 20  73 68 6f 75 6c 64 20 61  |.but it should a|
00000600  63 63 65 70 74 20 74 68  65 6d 20 77 69 74 68 6f  |ccept them witho|
00000610  75 74 20 67 65 6e 65 72  61 74 69 6e 67 20 61 6e  |ut generating an|
00000620  20 65 72 72 6f 72 2e 0d  0d 20 20 49 74 20 69 73  | error...  It is|
00000630  20 6e 6f 74 20 61 20 67  6f 6f 64 20 69 64 65 61  | not a good idea|
00000640  20 74 6f 20 67 65 74 20  79 6f 75 72 20 53 57 52  | to get your SWR|
00000650  20 70 72 6f 67 72 61 6d  20 72 75 6e 6e 69 6e 67  | program running|
00000660  20 77 69 74 68 20 61 20  2a 0d 63 6f 6d 6d 61 6e  | with a *.comman|
00000670  64 2c 20 74 68 65 6e 20  70 72 6f 6d 70 74 20 66  |d, then prompt f|
00000680  6f 72 20 61 20 6e 75 6d  62 65 72 20 61 6e 64 20  |or a number and |
00000690  75 73 65 20 4f 73 72 64  63 68 20 74 6f 20 72 65  |use Osrdch to re|
000006a0  61 64 20 69 74 20 62 79  74 65 20 61 66 74 65 72  |ad it byte after|
000006b0  0d 62 79 74 65 2e 20 54  68 61 74 20 73 74 79 6c  |.byte. That styl|
000006c0  65 20 6f 66 20 70 72 6f  67 72 61 6d 6d 69 6e 67  |e of programming|
000006d0  20 77 6f 72 6b 73 20 62  75 74 20 69 74 20 6c 6f  | works but it lo|
000006e0  6f 6b 73 20 76 65 72 79  20 75 6e 70 72 6f 66 65  |oks very unprofe|
000006f0  73 73 69 6f 6e 61 6c 0d  61 6e 64 20 77 72 69 74  |ssional.and writ|
00000700  69 6e 67 20 61 20 70 72  6f 67 72 61 6d 20 77 68  |ing a program wh|
00000710  69 63 68 20 61 6c 6c 6f  77 73 20 74 68 65 20 75  |ich allows the u|
00000720  73 65 72 20 74 6f 20 65  64 69 74 20 74 68 65 20  |ser to edit the |
00000730  6e 75 6d 62 65 72 20 77  69 74 68 0d 74 68 65 20  |number with.the |
00000740  44 65 6c 65 74 65 20 6b  65 79 20 69 73 20 71 75  |Delete key is qu|
00000750  69 74 65 20 63 6f 6d 70  6c 69 63 61 74 65 64 2e  |ite complicated.|
00000760  20 54 68 65 20 61 72 67  75 6d 65 6e 74 28 73 29  | The argument(s)|
00000770  20 73 68 6f 75 6c 64 20  66 6f 6c 6c 6f 77 20 74  | should follow t|
00000780  68 65 0d 63 6f 6d 6d 61  6e 64 20 73 6f 20 74 68  |he.command so th|
00000790  61 74 20 69 66 2c 20 66  6f 72 20 65 78 61 6d 70  |at if, for examp|
000007a0  6c 65 2c 20 79 6f 75 20  68 61 76 65 20 77 72 69  |le, you have wri|
000007b0  74 74 65 6e 20 61 20 70  72 6f 67 72 61 6d 20 77  |tten a program w|
000007c0  68 69 63 68 0d 70 72 69  6e 74 73 20 74 68 65 20  |hich.prints the |
000007d0  63 6f 6e 74 65 6e 74 73  20 6f 66 20 61 20 6d 65  |contents of a me|
000007e0  6d 6f 72 79 20 6c 6f 63  61 74 69 6f 6e 20 61 6e  |mory location an|
000007f0  64 20 79 6f 75 20 77 61  6e 74 20 74 6f 20 75 73  |d you want to us|
00000800  65 20 69 74 20 74 6f 0d  70 72 69 6e 74 20 74 68  |e it to.print th|
00000810  65 20 63 6f 6e 74 65 6e  74 73 20 6f 66 20 6c 6f  |e contents of lo|
00000820  63 61 74 69 6f 6e 20 26  39 30 30 20 79 6f 75 72  |cation &900 your|
00000830  20 53 57 52 20 69 6e 74  65 72 70 72 65 74 65 72  | SWR interpreter|
00000840  20 73 68 6f 75 6c 64 20  61 63 63 65 70 74 0d 61  | should accept.a|
00000850  6e 79 20 6f 66 20 74 68  65 20 63 6f 6d 6d 61 6e  |ny of the comman|
00000860  64 73 20 69 6e 20 66 69  67 75 72 65 20 39 2e 31  |ds in figure 9.1|
00000870  20 74 6f 20 63 61 6c 6c  20 74 68 65 20 72 6f 75  | to call the rou|
00000880  74 69 6e 65 20 61 6e 64  20 70 72 69 6e 74 20 74  |tine and print t|
00000890  68 65 0d 61 6e 73 77 65  72 2e 0d 0d 0d 0d 0d 3e  |he.answer......>|
000008a0  2a 50 45 45 4b 20 26 39  30 30 20 3c 52 65 74 75  |*PEEK &900 <Retu|
000008b0  72 6e 3e 0d 3e 2a 50 45  45 4b 20 26 30 39 30 30  |rn>.>*PEEK &0900|
000008c0  20 3c 52 65 74 75 72 6e  3e 0d 3e 2a 70 65 65 6b  | <Return>.>*peek|
000008d0  20 22 39 30 30 22 20 3c  52 65 74 75 72 6e 3e 0d  | "900" <Return>.|
000008e0  3e 2a 70 65 2e 20 30 39  30 30 20 3c 52 65 74 75  |>*pe. 0900 <Retu|
000008f0  72 6e 3e 0d 0d 46 69 67  75 72 65 20 39 2e 31 20  |rn>..Figure 9.1 |
00000900  20 56 61 6c 69 64 20 63  6f 6d 6d 61 6e 64 73 20  | Valid commands |
00000910  61 6e 64 20 61 72 67 75  6d 65 6e 74 73 0d 2d 2d  |and arguments.--|
00000920  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000940  2d 2d 2d 2d 2d 2d 0d 0d  0d 0d 0d 20 20 55 70 20  |------.....  Up |
00000950  74 6f 20 66 6f 75 72 20  41 53 43 49 49 20 63 68  |to four ASCII ch|
00000960  61 72 61 63 74 65 72 73  20 63 61 6e 20 62 65 20  |aracters can be |
00000970  75 73 65 64 20 74 6f 20  72 65 70 72 65 73 65 6e  |used to represen|
00000980  74 20 61 20 74 77 6f 20  62 79 74 65 0d 68 65 78  |t a two byte.hex|
00000990  61 64 65 63 69 6d 61 6c  20 6e 75 6d 62 65 72 2e  |adecimal number.|
000009a0  20 54 68 65 20 6e 79 62  62 6c 65 20 72 65 70 72  | The nybble repr|
000009b0  65 73 65 6e 74 65 64 20  62 79 20 74 68 65 20 66  |esented by the f|
000009c0  69 72 73 74 20 41 53 43  49 49 0d 63 68 61 72 61  |irst ASCII.chara|
000009d0  63 74 65 72 20 64 65 70  65 6e 64 73 20 6f 6e 20  |cter depends on |
000009e0  68 6f 77 20 6d 61 6e 79  20 63 68 61 72 61 63 74  |how many charact|
000009f0  65 72 73 20 61 72 65 20  75 73 65 64 20 74 6f 20  |ers are used to |
00000a00  72 65 70 72 65 73 65 6e  74 20 74 68 65 0d 6e 75  |represent the.nu|
00000a10  6d 62 65 72 2e 20 46 6f  72 20 65 78 61 6d 70 6c  |mber. For exampl|
00000a20  65 2c 20 74 68 65 20 41  20 69 6e 20 26 41 42 20  |e, the A in &AB |
00000a30  72 65 70 72 65 73 65 6e  74 73 20 74 68 65 20 6d  |represents the m|
00000a40  6f 73 74 20 73 69 67 6e  69 66 69 63 61 6e 74 0d  |ost significant.|
00000a50  6e 79 62 62 6c 65 20 6f  66 20 74 68 65 20 6c 65  |nybble of the le|
00000a60  61 73 74 20 73 69 67 6e  69 66 69 63 61 6e 74 20  |ast significant |
00000a70  62 79 74 65 20 62 75 74  20 74 68 65 20 41 20 69  |byte but the A i|
00000a80  6e 20 26 41 42 43 20 72  65 70 72 65 73 65 6e 74  |n &ABC represent|
00000a90  73 20 74 68 65 0d 6c 65  61 73 74 20 73 69 67 6e  |s the.least sign|
00000aa0  69 66 69 63 61 6e 74 20  6e 79 62 62 6c 65 20 6f  |ificant nybble o|
00000ab0  66 20 74 68 65 20 6d 6f  73 74 20 73 69 67 6e 69  |f the most signi|
00000ac0  66 69 63 61 6e 74 20 62  79 74 65 2e 0d 0d 20 20  |ficant byte...  |
00000ad0  49 66 20 79 6f 75 20 72  65 61 64 20 74 68 65 20  |If you read the |
00000ae0  41 53 43 49 49 20 63 68  61 72 61 63 74 65 72 73  |ASCII characters|
00000af0  20 66 72 6f 6d 20 72 69  67 68 74 20 74 6f 20 6c  | from right to l|
00000b00  65 66 74 2c 20 69 6e 73  74 65 61 64 20 6f 66 20  |eft, instead of |
00000b10  74 68 65 0d 6d 6f 72 65  20 6e 61 74 75 72 61 6c  |the.more natural|
00000b20  20 6c 65 66 74 20 74 6f  20 72 69 67 68 74 2c 20  | left to right, |
00000b30  74 68 65 20 66 69 72 73  74 20 62 79 74 65 20 79  |the first byte y|
00000b40  6f 75 20 72 65 61 64 20  77 69 6c 6c 20 61 6c 77  |ou read will alw|
00000b50  61 79 73 20 62 65 20 74  68 65 0d 6c 65 61 73 74  |ays be the.least|
00000b60  20 73 69 67 6e 69 66 69  63 61 6e 74 20 6e 79 62  | significant nyb|
00000b70  62 6c 65 20 6f 66 20 74  68 65 20 6c 65 61 73 74  |ble of the least|
00000b80  20 73 69 67 6e 69 66 69  63 61 6e 74 20 62 79 74  | significant byt|
00000b90  65 2e 20 49 66 20 79 6f  75 20 72 65 61 64 0d 74  |e. If you read.t|
00000ba0  68 65 20 63 68 61 72 61  63 74 65 72 73 20 66 72  |he characters fr|
00000bb0  6f 6d 20 6c 65 66 74 20  74 6f 20 72 69 67 68 74  |om left to right|
00000bc0  20 79 6f 75 20 65 69 74  68 65 72 20 68 61 76 65  | you either have|
00000bd0  20 74 6f 20 6b 6e 6f 77  20 69 6e 20 61 64 76 61  | to know in adva|
00000be0  6e 63 65 0d 68 6f 77 20  6d 61 6e 79 20 63 68 61  |nce.how many cha|
00000bf0  72 61 63 74 65 72 73 20  61 72 65 20 75 73 65 64  |racters are used|
00000c00  20 73 6f 20 74 68 61 74  2c 20 69 66 20 6e 65 63  | so that, if nec|
00000c10  65 73 73 61 72 79 2c 20  79 6f 75 20 63 61 6e 20  |essary, you can |
00000c20  70 61 64 20 6f 75 74 0d  74 68 65 20 6e 75 6d 62  |pad out.the numb|
00000c30  65 72 20 77 69 74 68 20  6c 65 61 64 69 6e 67 20  |er with leading |
00000c40  7a 65 72 6f 73 20 6f 72  20 79 6f 75 20 68 61 76  |zeros or you hav|
00000c50  65 20 74 6f 20 74 79 70  65 20 74 68 65 20 6c 65  |e to type the le|
00000c60  61 64 69 6e 67 20 7a 65  72 6f 73 20 74 6f 0d 65  |ading zeros to.e|
00000c70  73 74 61 62 6c 69 73 68  20 74 68 65 20 70 6c 61  |stablish the pla|
00000c80  63 65 20 76 61 6c 75 65  20 6f 66 20 65 61 63 68  |ce value of each|
00000c90  20 63 68 61 72 61 63 74  65 72 20 69 6e 20 74 68  | character in th|
00000ca0  65 20 61 72 67 75 6d 65  6e 74 2e 0d 0d 20 20 54  |e argument...  T|
00000cb0  6f 20 63 6f 6e 76 65 72  74 20 74 68 65 20 41 53  |o convert the AS|
00000cc0  43 49 49 20 72 65 70 72  65 73 65 6e 74 61 74 69  |CII representati|
00000cd0  6f 6e 20 6f 66 20 61 20  68 65 78 61 64 65 63 69  |on of a hexadeci|
00000ce0  6d 61 6c 20 61 72 67 75  6d 65 6e 74 20 69 6e 74  |mal argument int|
00000cf0  6f 0d 62 69 6e 61 72 79  20 79 6f 75 20 73 68 6f  |o.binary you sho|
00000d00  75 6c 64 20 73 74 61 72  74 20 77 69 74 68 20 74  |uld start with t|
00000d10  68 65 20 6c 65 61 73 74  20 73 69 67 6e 69 66 69  |he least signifi|
00000d20  63 61 6e 74 20 6e 79 62  62 6c 65 20 6f 66 20 74  |cant nybble of t|
00000d30  68 65 20 6c 65 61 73 74  0d 73 69 67 6e 69 66 69  |he least.signifi|
00000d40  63 61 6e 74 20 62 79 74  65 20 75 6e 6c 65 73 73  |cant byte unless|
00000d50  20 79 6f 75 20 75 73 65  20 61 6e 20 65 6c 61 62  | you use an elab|
00000d60  6f 72 61 74 65 20 63 6f  6e 76 65 72 73 69 6f 6e  |orate conversion|
00000d70  20 61 6c 67 6f 72 69 74  68 6d 20 6f 72 0d 6c 65  | algorithm or.le|
00000d80  61 64 69 6e 67 20 7a 65  72 6f 73 2e 20 54 68 69  |ading zeros. Thi|
00000d90  73 20 70 72 65 73 65 6e  74 73 20 61 20 70 72 6f  |s presents a pro|
00000da0  62 6c 65 6d 20 62 65 63  61 75 73 65 20 74 68 65  |blem because the|
00000db0  20 47 73 72 65 61 64 20  72 6f 75 74 69 6e 65 20  | Gsread routine |
00000dc0  75 73 65 64 0d 74 6f 20  72 65 61 64 20 74 68 65  |used.to read the|
00000dd0  20 41 53 43 49 49 20 63  68 61 72 61 63 74 65 72  | ASCII character|
00000de0  73 20 66 72 6f 6d 20 74  68 65 20 61 72 67 75 6d  |s from the argum|
00000df0  65 6e 74 20 72 65 61 64  73 20 66 72 6f 6d 20 6c  |ent reads from l|
00000e00  65 66 74 20 74 6f 0d 72  69 67 68 74 2e 20 54 6f  |eft to.right. To|
00000e10  20 67 65 74 20 72 6f 75  6e 64 20 74 68 69 73 20  | get round this |
00000e20  70 72 6f 62 6c 65 6d 20  79 6f 75 20 63 61 6e 20  |problem you can |
00000e30  72 65 61 64 20 65 61 63  68 20 6e 79 62 62 6c 65  |read each nybble|
00000e40  20 6f 66 20 74 68 65 0d  61 72 67 75 6d 65 6e 74  | of the.argument|
00000e50  2c 20 63 6f 6e 76 65 72  74 20 69 74 20 69 6e 74  |, convert it int|
00000e60  6f 20 62 69 6e 61 72 79  20 61 6e 64 20 70 75 73  |o binary and pus|
00000e70  68 20 69 74 20 6f 6e 20  74 68 65 20 73 74 61 63  |h it on the stac|
00000e80  6b 20 75 6e 74 69 6c 20  79 6f 75 0d 72 65 61 64  |k until you.read|
00000e90  20 74 68 65 20 74 65 72  6d 69 6e 61 74 69 6f 6e  | the termination|
00000ea0  20 63 68 61 72 61 63 74  65 72 2e 20 54 68 65 6e  | character. Then|
00000eb0  20 70 75 6c 6c 20 65 61  63 68 20 6e 79 62 62 6c  | pull each nybbl|
00000ec0  65 20 6f 66 66 20 74 68  65 20 73 74 61 63 6b 0d  |e off the stack.|
00000ed0  61 6e 64 20 74 68 65 79  20 77 69 6c 6c 20 62 65  |and they will be|
00000ee0  20 69 6e 20 72 65 76 65  72 73 65 20 6f 72 64 65  | in reverse orde|
00000ef0  72 2c 20 61 73 20 69 66  20 74 68 65 79 20 68 61  |r, as if they ha|
00000f00  64 20 62 65 65 6e 20 72  65 61 64 20 66 72 6f 6d  |d been read from|
00000f10  20 72 69 67 68 74 0d 74  6f 20 6c 65 66 74 2e 0d  | right.to left..|
00000f20  0d 20 20 49 66 20 79 6f  75 20 6b 65 65 70 20 61  |.  If you keep a|
00000f30  20 63 6f 75 6e 74 20 6f  66 20 74 68 65 20 6e 75  | count of the nu|
00000f40  6d 62 65 72 20 6f 66 20  6e 79 62 62 6c 65 73 20  |mber of nybbles |
00000f50  72 65 61 64 20 66 72 6f  6d 20 74 68 65 20 61 72  |read from the ar|
00000f60  67 75 6d 65 6e 74 0d 69  74 20 69 73 20 61 20 73  |gument.it is a s|
00000f70  69 6d 70 6c 65 20 6d 61  74 74 65 72 20 74 6f 20  |imple matter to |
00000f80  70 75 6c 6c 20 74 68 65  20 6e 79 62 62 6c 65 73  |pull the nybbles|
00000f90  20 6f 66 66 20 74 68 65  20 73 74 61 63 6b 20 61  | off the stack a|
00000fa0  6e 64 20 63 6f 6e 76 65  72 74 0d 65 61 63 68 20  |nd convert.each |
00000fb0  6e 79 62 62 6c 65 2c 20  6f 72 20 70 61 69 72 20  |nybble, or pair |
00000fc0  6f 66 20 6e 79 62 62 6c  65 73 2c 20 69 6e 74 6f  |of nybbles, into|
00000fd0  20 61 20 62 79 74 65 2e  20 54 68 69 73 20 74 65  | a byte. This te|
00000fe0  63 68 6e 69 71 75 65 20  69 73 0d 69 6c 6c 75 73  |chnique is.illus|
00000ff0  74 72 61 74 65 64 20 69  6e 20 66 69 67 75 72 65  |trated in figure|
00001000  20 39 2e 32 2e 0d 0d 0d  0d 0d 2e 66 6f 75 6e 64  | 9.2.......found|
00001010  0d 20 20 20 20 20 20 20  20 43 4c 43 20 20 20 20  |.        CLC    |
00001020  20 20 20 20 20 20 20 5c  20 74 65 72 6d 69 6e 61  |       \ termina|
00001030  74 65 20 77 69 74 68 20  73 70 61 63 65 2c 20 72  |te with space, r|
00001040  65 74 75 72 6e 20 6f 72  20 22 0d 20 20 20 20 20  |eturn or ".     |
00001050  20 20 20 4a 53 52 20 26  46 46 43 32 20 20 20 20  |   JSR &FFC2    |
00001060  20 5c 20 69 6e 69 74 69  61 6c 69 73 65 20 61 72  | \ initialise ar|
00001070  67 75 6d 65 6e 74 20 77  69 74 68 20 47 73 69 6e  |gument with Gsin|
00001080  69 74 0d 20 20 20 20 20  20 20 20 4c 44 58 20 23  |it.        LDX #|
00001090  30 20 20 20 20 20 20 20  20 5c 20 69 6e 69 74 69  |0        \ initi|
000010a0  61 6c 20 72 65 73 75 6c  74 20 3d 20 26 30 30 30  |al result = &000|
000010b0  30 0d 20 20 20 20 20 20  20 20 53 54 58 20 26 37  |0.        STX &7|
000010c0  30 20 20 20 20 20 20 20  5c 20 6c 65 61 73 74 20  |0       \ least |
000010d0  73 69 67 2e 20 62 79 74  65 20 6f 66 20 72 65 73  |sig. byte of res|
000010e0  75 6c 74 0d 20 20 20 20  20 20 20 20 53 54 58 20  |ult.        STX |
000010f0  26 37 31 20 20 20 20 20  20 20 5c 20 6d 6f 73 74  |&71       \ most|
00001100  20 73 69 67 2e 20 62 79  74 65 20 6f 66 20 72 65  | sig. byte of re|
00001110  73 75 6c 74 0d 20 20 20  20 20 20 20 20 44 45 58  |sult.        DEX|
00001120  20 20 20 20 20 20 20 20  20 20 20 5c 20 58 20 77  |           \ X w|
00001130  69 6c 6c 20 63 6f 75 6e  74 20 6e 75 6d 62 65 72  |ill count number|
00001140  20 6f 66 20 6e 79 62 62  6c 65 73 20 2d 20 31 0d  | of nybbles - 1.|
00001150  2e 61 72 67 6c 6f 6f 70  0d 20 20 20 20 20 20 20  |.argloop.       |
00001160  20 4a 53 52 20 26 46 46  43 35 20 20 20 20 20 5c  | JSR &FFC5     \|
00001170  20 72 65 61 64 20 63 68  61 72 61 63 74 65 72 20  | read character |
00001180  66 72 6f 6d 20 61 72 67  75 6d 65 6e 74 20 77 69  |from argument wi|
00001190  74 68 20 47 73 72 65 61  64 0d 20 20 20 20 20 20  |th Gsread.      |
000011a0  20 20 42 43 53 20 65 6e  64 61 72 67 20 20 20 20  |  BCS endarg    |
000011b0  5c 20 62 72 61 6e 63 68  20 69 66 20 74 65 72 6d  |\ branch if term|
000011c0  69 6e 61 74 69 6f 6e 20  63 68 61 72 61 63 74 65  |ination characte|
000011d0  72 0d 20 20 20 20 20 20  20 20 43 4d 50 20 23 41  |r.        CMP #A|
000011e0  53 43 28 22 26 22 29 20  5c 20 69 73 20 69 74 20  |SC("&") \ is it |
000011f0  22 26 22 3f 0d 20 20 20  20 20 20 20 20 42 45 51  |"&"?.        BEQ|
00001200  20 61 72 67 6c 6f 6f 70  20 20 20 5c 20 69 67 6e  | argloop   \ ign|
00001210  6f 72 65 20 22 26 22 0d  20 20 20 20 20 20 20 20  |ore "&".        |
00001220  4a 53 52 20 63 6f 6e 76  65 72 74 20 20 20 5c 20  |JSR convert   \ |
00001230  63 6f 6e 76 65 72 74 20  6e 79 62 62 6c 65 20 69  |convert nybble i|
00001240  6e 74 6f 20 62 69 6e 61  72 79 0d 20 20 20 20 20  |nto binary.     |
00001250  20 20 20 50 48 41 20 20  20 20 20 20 20 20 20 20  |   PHA          |
00001260  20 5c 20 70 75 73 68 20  6e 79 62 62 6c 65 20 6f  | \ push nybble o|
00001270  6e 20 73 74 61 63 6b 0d  20 20 20 20 20 20 20 20  |n stack.        |
00001280  49 4e 58 20 20 20 20 20  20 20 20 20 20 20 5c 20  |INX           \ |
00001290  63 6f 75 6e 74 20 6e 79  62 62 6c 65 20 69 6e 20  |count nybble in |
000012a0  58 20 72 65 67 69 73 74  65 72 0d 20 20 20 20 20  |X register.     |
000012b0  20 20 20 42 50 4c 20 61  72 67 6c 6f 6f 70 20 20  |   BPL argloop  |
000012c0  20 5c 20 62 72 61 6e 63  68 20 66 6f 72 20 6e 65  | \ branch for ne|
000012d0  78 74 20 63 68 61 72 61  63 74 65 72 0d 2e 65 6e  |xt character..en|
000012e0  64 61 72 67 0d 20 20 20  20 20 20 20 20 43 50 58  |darg.        CPX|
000012f0  20 23 34 20 20 20 20 20  20 20 20 5c 20 6d 6f 72  | #4        \ mor|
00001300  65 20 74 68 61 6e 20 34  20 63 68 61 72 61 63 74  |e than 4 charact|
00001310  65 72 73 3f 0d 20 20 20  20 20 20 20 20 42 43 53  |ers?.        BCS|
00001320  20 65 72 72 6f 72 20 20  20 20 20 5c 20 62 72 61  | error     \ bra|
00001330  6e 63 68 20 69 66 20 74  6f 6f 20 6d 61 6e 79 0d  |nch if too many.|
00001340  20 20 20 20 20 20 20 20  50 4c 41 20 20 20 20 20  |        PLA     |
00001350  20 20 20 20 20 20 5c 20  70 75 6c 6c 20 4c 53 20  |      \ pull LS |
00001360  6e 79 62 62 6c 65 20 6f  66 20 4c 53 20 62 79 74  |nybble of LS byt|
00001370  65 0d 20 20 20 20 20 20  20 20 53 54 41 20 26 37  |e.        STA &7|
00001380  30 20 20 20 20 20 20 20  5c 20 73 74 6f 72 65 20  |0       \ store |
00001390  61 73 20 4c 53 20 62 79  74 65 0d 20 20 20 20 20  |as LS byte.     |
000013a0  20 20 20 44 45 58 20 20  20 20 20 20 20 20 20 20  |   DEX          |
000013b0  20 5c 20 69 73 20 74 68  61 74 20 74 68 65 20 6f  | \ is that the o|
000013c0  6e 6c 79 20 6e 79 62 62  6c 65 3f 0d 20 20 20 20  |nly nybble?.    |
000013d0  20 20 20 20 42 4d 49 20  66 69 6e 69 73 68 20 20  |    BMI finish  |
000013e0  20 20 5c 20 62 72 61 6e  63 68 20 69 66 20 69 74  |  \ branch if it|
000013f0  20 69 73 0d 20 20 20 20  20 20 20 20 50 4c 41 20  | is.        PLA |
00001400  20 20 20 20 20 20 20 20  20 20 5c 20 70 75 6c 6c  |          \ pull|
00001410  20 4d 53 20 6e 79 62 62  6c 65 20 6f 66 20 4c 53  | MS nybble of LS|
00001420  20 62 79 74 65 0d 20 20  20 20 20 20 20 20 41 53  | byte.        AS|
00001430  4c 20 41 20 20 20 20 20  20 20 20 20 5c 20 73 68  |L A         \ sh|
00001440  69 66 74 0d 20 20 20 20  20 20 20 20 41 53 4c 20  |ift.        ASL |
00001450  41 20 20 20 20 20 20 20  20 20 5c 20 6c 65 66 74  |A         \ left|
00001460  0d 20 20 20 20 20 20 20  20 41 53 4c 20 41 20 20  |.        ASL A  |
00001470  20 20 20 20 20 20 20 5c  20 66 6f 75 72 0d 20 20  |       \ four.  |
00001480  20 20 20 20 20 20 41 53  4c 20 41 20 20 20 20 20  |      ASL A     |
00001490  20 20 20 20 5c 20 62 69  74 73 0d 20 20 20 20 20  |    \ bits.     |
000014a0  20 20 20 4f 52 41 20 26  37 30 20 20 20 20 20 20  |   ORA &70      |
000014b0  20 5c 20 4f 52 20 77 69  74 68 20 26 37 30 0d 20  | \ OR with &70. |
000014c0  20 20 20 20 20 20 20 53  54 41 20 26 37 30 20 20  |       STA &70  |
000014d0  20 20 20 20 20 5c 20 61  6e 64 20 73 74 6f 72 65  |     \ and store|
000014e0  20 4c 53 20 62 79 74 65  0d 20 20 20 20 20 20 20  | LS byte.       |
000014f0  20 44 45 58 20 20 20 20  20 20 20 20 20 20 20 5c  | DEX           \|
00001500  20 77 61 73 20 74 68 61  74 20 74 68 65 20 6c 61  | was that the la|
00001510  73 74 20 6e 79 62 62 6c  65 3f 0d 20 20 20 20 20  |st nybble?.     |
00001520  20 20 20 42 4d 49 20 66  69 6e 69 73 68 20 20 20  |   BMI finish   |
00001530  20 5c 20 62 72 61 6e 63  68 20 69 66 20 69 74 20  | \ branch if it |
00001540  77 61 73 0d 20 20 20 20  20 20 20 20 50 4c 41 20  |was.        PLA |
00001550  20 20 20 20 20 20 20 20  20 20 5c 20 70 75 6c 6c  |          \ pull|
00001560  20 4c 53 20 6e 79 62 62  6c 65 20 6f 66 20 4d 53  | LS nybble of MS|
00001570  20 62 79 74 65 0d 20 20  20 20 20 20 20 20 53 54  | byte.        ST|
00001580  41 20 26 37 31 20 20 20  20 20 20 20 5c 20 73 74  |A &71       \ st|
00001590  6f 72 65 20 61 73 20 4d  53 20 62 79 74 65 0d 20  |ore as MS byte. |
000015a0  20 20 20 20 20 20 20 44  45 58 20 20 20 20 20 20  |       DEX      |
000015b0  20 20 20 20 20 5c 20 77  61 73 20 74 68 61 74 20  |     \ was that |
000015c0  74 68 65 20 6c 61 73 74  20 6e 79 62 62 6c 65 3f  |the last nybble?|
000015d0  0d 20 20 20 20 20 20 20  20 42 4d 49 20 66 69 6e  |.        BMI fin|
000015e0  69 73 68 20 20 20 20 5c  20 62 72 61 6e 63 68 20  |ish    \ branch |
000015f0  69 66 20 69 74 20 77 61  73 0d 20 20 20 20 20 20  |if it was.      |
00001600  20 20 50 4c 41 20 20 20  20 20 20 20 20 20 20 20  |  PLA           |
00001610  5c 20 70 75 6c 6c 20 4d  53 20 6e 79 62 62 6c 65  |\ pull MS nybble|
00001620  20 6f 66 20 4d 53 20 62  79 74 65 0d 20 20 20 20  | of MS byte.    |
00001630  20 20 20 20 41 53 4c 20  41 20 20 20 20 20 20 20  |    ASL A       |
00001640  20 20 5c 20 73 68 69 66  74 0d 20 20 20 20 20 20  |  \ shift.      |
00001650  20 20 41 53 4c 20 41 20  20 20 20 20 20 20 20 20  |  ASL A         |
00001660  5c 20 6c 65 66 74 0d 20  20 20 20 20 20 20 20 41  |\ left.        A|
00001670  53 4c 20 41 20 20 20 20  20 20 20 20 20 5c 20 66  |SL A         \ f|
00001680  6f 75 72 0d 20 20 20 20  20 20 20 20 41 53 4c 20  |our.        ASL |
00001690  41 20 20 20 20 20 20 20  20 20 5c 20 62 69 74 73  |A         \ bits|
000016a0  0d 20 20 20 20 20 20 20  20 4f 52 41 20 26 37 31  |.        ORA &71|
000016b0  20 20 20 20 20 20 20 5c  20 4f 52 20 77 69 74 68  |       \ OR with|
000016c0  20 26 37 31 0d 20 20 20  20 20 20 20 20 53 54 41  | &71.        STA|
000016d0  20 26 37 31 20 20 20 20  20 20 20 5c 20 61 6e 64  | &71       \ and|
000016e0  20 73 74 6f 72 65 20 4d  53 20 62 79 74 65 0d 2e  | store MS byte..|
000016f0  66 69 6e 69 73 68 0d 0d  0d 46 69 67 75 72 65 20  |finish...Figure |
00001700  39 2e 32 20 20 43 6f 6e  76 65 72 74 69 6e 67 20  |9.2  Converting |
00001710  66 72 6f 6d 20 41 53 43  49 49 20 74 6f 20 62 69  |from ASCII to bi|
00001720  6e 61 72 79 0d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |nary.-----------|
00001730  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001740  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0d 0d  |--------------..|
00001750  0d 0d 0d 20 20 41 66 74  65 72 20 72 65 63 6f 67  |...  After recog|
00001760  6e 69 73 69 6e 67 20 74  68 65 20 2a 20 63 6f 6d  |nising the * com|
00001770  6d 61 6e 64 20 74 68 65  20 69 6e 74 65 72 70 72  |mand the interpr|
00001780  65 74 65 72 20 77 69 6c  6c 20 70 61 73 73 20 63  |eter will pass c|
00001790  6f 6e 74 72 6f 6c 20 74  6f 0d 74 68 65 20 6c 61  |ontrol to.the la|
000017a0  62 65 6c 20 22 2e 66 6f  75 6e 64 22 2e 20 54 68  |bel ".found". Th|
000017b0  65 20 63 61 72 72 79 20  66 6c 61 67 20 73 68 6f  |e carry flag sho|
000017c0  75 6c 64 20 62 65 20 63  6c 65 61 72 65 64 20 62  |uld be cleared b|
000017d0  65 66 6f 72 65 0d 69 6e  69 74 69 61 6c 69 73 69  |efore.initialisi|
000017e0  6e 67 20 74 68 65 20 61  72 67 75 6d 65 6e 74 20  |ng the argument |
000017f0  73 6f 20 74 68 61 74 20  65 69 74 68 65 72 20 61  |so that either a|
00001800  20 73 65 63 6f 6e 64 20  71 75 6f 74 61 74 69 6f  | second quotatio|
00001810  6e 20 6d 61 72 6b 2c 20  61 0d 63 61 72 72 69 61  |n mark, a.carria|
00001820  67 65 20 72 65 74 75 72  6e 20 6f 72 20 61 20 73  |ge return or a s|
00001830  70 61 63 65 20 77 69 6c  6c 20 62 65 20 72 65 61  |pace will be rea|
00001840  64 20 61 73 20 74 68 65  20 74 65 72 6d 69 6e 61  |d as the termina|
00001850  74 69 6f 6e 20 63 68 61  72 61 63 74 65 72 0d 6f  |tion character.o|
00001860  66 20 74 68 65 20 61 72  67 75 6d 65 6e 74 2e 0d  |f the argument..|
00001870  0d 20 20 49 6e 20 66 69  67 75 72 65 20 39 2e 32  |.  In figure 9.2|
00001880  20 74 68 65 20 58 20 72  65 67 69 73 74 65 72 20  | the X register |
00001890  69 73 20 6c 6f 61 64 65  64 20 77 69 74 68 20 7a  |is loaded with z|
000018a0  65 72 6f 20 61 6e 64 20  74 68 65 6e 20 74 68 65  |ero and then the|
000018b0  0d 63 6f 6e 74 65 6e 74  20 6f 66 20 58 20 69 73  |.content of X is|
000018c0  20 73 74 6f 72 65 64 20  69 6e 20 74 68 65 20 74  | stored in the t|
000018d0  77 6f 20 63 6f 6e 73 65  63 75 74 69 76 65 20 6d  |wo consecutive m|
000018e0  65 6d 6f 72 79 20 6c 6f  63 61 74 69 6f 6e 73 20  |emory locations |
000018f0  74 6f 20 62 65 0d 75 73  65 64 20 66 6f 72 20 74  |to be.used for t|
00001900  68 65 20 72 65 73 75 6c  74 2e 20 54 68 65 20 58  |he result. The X|
00001910  20 72 65 67 69 73 74 65  72 20 77 69 6c 6c 20 62  | register will b|
00001920  65 20 75 73 65 64 20 74  6f 20 63 6f 75 6e 74 20  |e used to count |
00001930  74 68 65 20 6e 75 6d 62  65 72 0d 6f 66 20 41 53  |the number.of AS|
00001940  43 49 49 20 63 68 61 72  61 63 74 65 72 73 20 72  |CII characters r|
00001950  65 61 64 20 66 72 6f 6d  20 74 68 65 20 61 72 67  |ead from the arg|
00001960  75 6d 65 6e 74 20 6d 69  6e 75 73 20 6f 6e 65 2e  |ument minus one.|
00001970  20 58 20 69 73 20 64 65  63 72 65 6d 65 6e 74 65  | X is decremente|
00001980  64 0d 74 6f 20 73 74 61  72 74 20 77 69 74 68 20  |d.to start with |
00001990  58 20 3d 20 26 46 46 20  77 68 65 6e 20 6e 6f 20  |X = &FF when no |
000019a0  63 68 61 72 61 63 74 65  72 73 20 68 61 76 65 20  |characters have |
000019b0  62 65 65 6e 20 72 65 61  64 2e 20 54 68 65 20 61  |been read. The a|
000019c0  72 67 75 6d 65 6e 74 0d  69 73 20 72 65 61 64 20  |rgument.is read |
000019d0  6f 6e 65 20 63 68 61 72  61 63 74 65 72 20 61 74  |one character at|
000019e0  20 61 20 74 69 6d 65 2c  20 69 67 6e 6f 72 69 6e  | a time, ignorin|
000019f0  67 20 61 6e 79 20 6c 65  61 64 69 6e 67 20 61 6d  |g any leading am|
00001a00  70 65 72 73 61 6e 64 2e  20 45 61 63 68 0d 63 68  |persand. Each.ch|
00001a10  61 72 61 63 74 65 72 20  69 73 20 63 6f 6e 76 65  |aracter is conve|
00001a20  72 74 65 64 20 66 72 6f  6d 20 61 6e 20 41 53 43  |rted from an ASC|
00001a30  49 49 20 63 68 61 72 61  63 74 65 72 20 69 6e 74  |II character int|
00001a40  6f 20 61 20 62 69 6e 61  72 79 20 6e 79 62 62 6c  |o a binary nybbl|
00001a50  65 0d 61 6e 64 20 70 75  73 68 65 64 20 6f 6e 20  |e.and pushed on |
00001a60  74 68 65 20 73 74 61 63  6b 2e 20 54 68 65 20 58  |the stack. The X|
00001a70  20 72 65 67 69 73 74 65  72 20 69 73 20 69 6e 63  | register is inc|
00001a80  72 65 6d 65 6e 74 65 64  20 77 69 74 68 20 65 76  |remented with ev|
00001a90  65 72 79 0d 62 69 6e 61  72 79 20 6e 79 62 62 6c  |ery.binary nybbl|
00001aa0  65 20 70 75 73 68 65 64  20 6f 6e 20 74 68 65 20  |e pushed on the |
00001ab0  73 74 61 63 6b 2e 20 54  68 65 20 72 6f 75 74 69  |stack. The routi|
00001ac0  6e 65 20 77 69 6c 6c 20  6b 65 65 70 20 72 65 61  |ne will keep rea|
00001ad0  64 69 6e 67 20 75 6e 74  69 6c 0d 74 68 65 20 74  |ding until.the t|
00001ae0  65 72 6d 69 6e 61 74 69  6f 6e 20 63 68 61 72 61  |ermination chara|
00001af0  63 74 65 72 20 69 73 20  66 6f 75 6e 64 2e 0d 0d  |cter is found...|
00001b00  20 20 41 66 74 65 72 20  72 65 61 64 69 6e 67 20  |  After reading |
00001b10  74 68 65 20 74 65 72 6d  69 6e 61 74 69 6f 6e 20  |the termination |
00001b20  63 68 61 72 61 63 74 65  72 20 74 68 65 20 6e 75  |character the nu|
00001b30  6d 62 65 72 20 73 74 6f  72 65 64 20 69 6e 20 74  |mber stored in t|
00001b40  68 65 20 58 0d 72 65 67  69 73 74 65 72 20 73 68  |he X.register sh|
00001b50  6f 75 6c 64 20 62 65 20  62 65 74 77 65 65 6e 20  |ould be between |
00001b60  30 20 61 6e 64 20 33 20  69 6e 63 6c 75 73 69 76  |0 and 3 inclusiv|
00001b70  65 2e 20 49 66 20 69 74  20 69 73 20 6f 75 74 73  |e. If it is outs|
00001b80  69 64 65 20 74 68 61 74  0d 72 61 6e 67 65 20 65  |ide that.range e|
00001b90  69 74 68 65 72 20 74 6f  6f 20 6d 61 6e 79 20 63  |ither too many c|
00001ba0  68 61 72 61 63 74 65 72  73 20 68 61 76 65 20 62  |haracters have b|
00001bb0  65 65 6e 20 69 6e 63 6c  75 64 65 64 20 69 6e 20  |een included in |
00001bc0  74 68 65 20 61 72 67 75  6d 65 6e 74 20 6f 72 0d  |the argument or.|
00001bd0  74 68 65 20 61 72 67 75  6d 65 6e 74 20 68 61 73  |the argument has|
00001be0  20 62 65 65 6e 20 6f 6d  69 74 74 65 64 2e 20 49  | been omitted. I|
00001bf0  6e 20 65 69 74 68 65 72  20 63 61 73 65 20 61 20  |n either case a |
00001c00  62 72 61 6e 63 68 20 74  6f 20 61 6e 20 65 72 72  |branch to an err|
00001c10  6f 72 0d 72 6f 75 74 69  6e 65 20 77 69 6c 6c 20  |or.routine will |
00001c20  62 65 20 6d 61 64 65 2e  0d 0d 20 20 57 68 65 6e  |be made...  When|
00001c30  20 61 6c 6c 20 74 68 65  20 63 68 61 72 61 63 74  | all the charact|
00001c40  65 72 73 20 68 61 76 65  20 62 65 65 6e 20 72 65  |ers have been re|
00001c50  61 64 20 66 72 6f 6d 20  74 68 65 20 61 72 67 75  |ad from the argu|
00001c60  6d 65 6e 74 20 74 68 65  20 72 6f 75 74 69 6e 65  |ment the routine|
00001c70  0d 73 74 61 72 74 73 20  70 75 6c 6c 69 6e 67 20  |.starts pulling |
00001c80  74 68 65 20 62 69 6e 61  72 79 20 6e 79 62 62 6c  |the binary nybbl|
00001c90  65 73 20 6f 66 66 20 74  68 65 20 73 74 61 63 6b  |es off the stack|
00001ca0  2e 20 54 68 65 20 58 20  72 65 67 69 73 74 65 72  |. The X register|
00001cb0  20 69 73 0d 64 65 63 72  65 6d 65 6e 74 65 64 20  | is.decremented |
00001cc0  61 6e 64 20 74 65 73 74  65 64 20 61 66 74 65 72  |and tested after|
00001cd0  20 65 61 63 68 20 6e 79  62 62 6c 65 20 68 61 73  | each nybble has|
00001ce0  20 62 65 65 6e 20 70 72  6f 63 65 73 73 65 64 20  | been processed |
00001cf0  74 6f 20 73 65 65 20 69  66 0d 74 68 61 74 20 6e  |to see if.that n|
00001d00  79 62 62 6c 65 20 77 61  73 20 74 68 65 20 66 69  |ybble was the fi|
00001d10  72 73 74 20 6f 6e 65 20  72 65 61 64 20 66 72 6f  |rst one read fro|
00001d20  6d 20 74 68 65 20 61 72  67 75 6d 65 6e 74 2e 0d  |m the argument..|
00001d30  0d 20 20 54 68 65 72 65  20 6d 75 73 74 20 62 65  |.  There must be|
00001d40  20 61 74 20 6c 65 61 73  74 20 6f 6e 65 20 6e 79  | at least one ny|
00001d50  62 62 6c 65 20 74 6f 20  70 75 6c 6c 20 6f 66 66  |bble to pull off|
00001d60  20 74 68 65 20 73 74 61  63 6b 20 61 6e 64 20 6e  | the stack and n|
00001d70  6f 74 20 6d 6f 72 65 0d  74 68 61 6e 20 66 6f 75  |ot more.than fou|
00001d80  72 2e 20 54 68 65 20 66  69 72 73 74 20 6e 79 62  |r. The first nyb|
00001d90  62 6c 65 20 70 75 6c 6c  65 64 20 6f 66 66 20 74  |ble pulled off t|
00001da0  68 65 20 73 74 61 63 6b  20 63 61 6e 20 62 65 20  |he stack can be |
00001db0  73 74 6f 72 65 64 20 69  6e 20 74 68 65 0d 6d 65  |stored in the.me|
00001dc0  6d 6f 72 79 20 6c 6f 63  61 74 69 6f 6e 20 72 65  |mory location re|
00001dd0  73 65 72 76 65 64 20 66  6f 72 20 74 68 65 20 6c  |served for the l|
00001de0  65 61 73 74 20 73 69 67  6e 69 66 69 63 61 6e 74  |east significant|
00001df0  20 62 79 74 65 2e 20 49  66 20 61 20 73 65 63 6f  | byte. If a seco|
00001e00  6e 64 0d 6e 79 62 62 6c  65 20 69 73 20 61 76 61  |nd.nybble is ava|
00001e10  69 6c 61 62 6c 65 20 69  74 20 68 61 73 20 61 6c  |ilable it has al|
00001e20  6c 20 69 74 73 20 62 69  74 73 20 73 68 69 66 74  |l its bits shift|
00001e30  65 64 20 6c 65 66 74 20  66 6f 75 72 20 74 69 6d  |ed left four tim|
00001e40  65 73 20 61 6e 64 0d 4f  52 65 64 20 77 69 74 68  |es and.ORed with|
00001e50  20 74 68 65 20 66 69 72  73 74 20 6e 79 62 62 6c  | the first nybbl|
00001e60  65 20 74 6f 20 66 6f 72  6d 20 74 68 65 20 6c 65  |e to form the le|
00001e70  61 73 74 20 73 69 67 6e  69 66 69 63 61 6e 74 20  |ast significant |
00001e80  62 79 74 65 2e 20 41 20  74 68 69 72 64 0d 6e 79  |byte. A third.ny|
00001e90  62 62 6c 65 20 63 61 6e  20 62 65 20 73 74 6f 72  |bble can be stor|
00001ea0  65 64 20 69 6e 20 74 68  65 20 6d 65 6d 6f 72 79  |ed in the memory|
00001eb0  20 6c 6f 63 61 74 69 6f  6e 20 72 65 73 65 72 76  | location reserv|
00001ec0  65 64 20 66 6f 72 20 74  68 65 20 6d 6f 73 74 0d  |ed for the most.|
00001ed0  73 69 67 6e 69 66 69 63  61 6e 74 20 62 79 74 65  |significant byte|
00001ee0  20 61 6e 64 20 61 20 66  6f 72 74 68 20 6e 79 62  | and a forth nyb|
00001ef0  62 6c 65 20 73 68 6f 75  6c 64 20 68 61 76 65 20  |ble should have |
00001f00  61 6c 6c 20 69 74 73 20  62 69 74 73 20 73 68 69  |all its bits shi|
00001f10  66 74 65 64 0d 6c 65 66  74 20 66 6f 75 72 20 74  |fted.left four t|
00001f20  69 6d 65 73 20 61 6e 64  20 4f 52 65 64 20 77 69  |imes and ORed wi|
00001f30  74 68 20 74 68 65 20 74  68 69 72 64 20 6e 79 62  |th the third nyb|
00001f40  62 6c 65 20 74 6f 20 66  6f 72 6d 20 74 68 65 20  |ble to form the |
00001f50  6d 6f 73 74 0d 73 69 67  6e 69 66 69 63 61 6e 74  |most.significant|
00001f60  20 62 79 74 65 2e 0d 0d  20 20 54 68 65 20 72 65  | byte...  The re|
00001f70  73 75 6c 74 20 69 73 20  74 68 65 6e 20 61 76 61  |sult is then ava|
00001f80  69 6c 61 62 6c 65 20 66  72 6f 6d 20 74 68 65 20  |ilable from the |
00001f90  74 77 6f 20 63 6f 6e 73  65 63 75 74 69 76 65 20  |two consecutive |
00001fa0  7a 65 72 6f 20 70 61 67  65 0d 6d 65 6d 6f 72 79  |zero page.memory|
00001fb0  20 6c 6f 63 61 74 69 6f  6e 73 2e 20 4e 6f 20 6f  | locations. No o|
00001fc0  74 68 65 72 20 70 61 72  74 20 6f 66 20 75 73 65  |ther part of use|
00001fd0  72 20 6d 65 6d 6f 72 79  20 6f 72 20 53 57 52 20  |r memory or SWR |
00001fe0  68 61 73 20 62 65 65 6e  20 75 73 65 64 20 62 79  |has been used by|
00001ff0  0d 74 68 65 20 63 6f 6e  76 65 72 73 69 6f 6e 2e  |.the conversion.|
00002000  20 54 68 65 20 65 72 72  6f 72 20 72 6f 75 74 69  | The error routi|
00002010  6e 65 20 61 6e 64 20 74  68 65 20 41 53 43 49 49  |ne and the ASCII|
00002020  20 63 68 61 72 61 63 74  65 72 20 74 6f 20 62 69  | character to bi|
00002030  6e 61 72 79 0d 6e 79 62  62 6c 65 20 63 6f 6e 76  |nary.nybble conv|
00002040  65 72 73 69 6f 6e 20 73  75 62 72 6f 75 74 69 6e  |ersion subroutin|
00002050  65 20 61 72 65 20 6f 6e  6c 79 20 72 65 66 65 72  |e are only refer|
00002060  65 64 20 74 6f 20 62 79  20 6e 61 6d 65 20 69 6e  |ed to by name in|
00002070  20 66 69 67 75 72 65 20  39 2e 32 0d 62 75 74 20  | figure 9.2.but |
00002080  73 75 69 74 61 62 6c 65  20 61 63 74 75 61 6c 20  |suitable actual |
00002090  72 6f 75 74 69 6e 65 73  20 63 61 6e 20 62 65 20  |routines can be |
000020a0  66 6f 75 6e 64 20 69 6e  20 74 68 65 20 70 72 6f  |found in the pro|
000020b0  67 72 61 6d 20 50 45 45  4b 2e 0d 0d 20 20 54 68  |gram PEEK...  Th|
000020c0  65 20 70 72 6f 67 72 61  6d 20 50 45 45 4b 20 75  |e program PEEK u|
000020d0  73 65 73 20 74 68 65 20  63 6f 6e 76 65 72 73 69  |ses the conversi|
000020e0  6f 6e 20 72 6f 75 74 69  6e 65 20 6f 75 74 6c 69  |on routine outli|
000020f0  6e 65 64 20 69 6e 20 66  69 67 75 72 65 20 39 2e  |ned in figure 9.|
00002100  32 0d 74 6f 20 69 6d 70  6c 65 6d 65 6e 74 20 74  |2.to implement t|
00002110  68 65 20 6e 65 77 20 63  6f 6d 6d 61 6e 64 20 2a  |he new command *|
00002120  50 45 45 4b 20 3c 68 65  78 2e 6e 75 6d 62 65 72  |PEEK <hex.number|
00002130  3e 2e 20 54 6f 20 75 73  65 20 74 68 65 20 70 72  |>. To use the pr|
00002140  6f 67 72 61 6d 0d 6c 6f  61 64 20 74 68 65 20 6f  |ogram.load the o|
00002150  62 6a 65 63 74 20 63 6f  64 65 20 69 74 20 67 65  |bject code it ge|
00002160  6e 65 72 61 74 65 73 20  69 6e 74 6f 20 53 57 52  |nerates into SWR|
00002170  20 61 6e 64 20 70 72 65  73 73 20 74 68 65 20 42  | and press the B|
00002180  72 65 61 6b 20 6b 65 79  2e 0d 59 6f 75 20 63 61  |reak key..You ca|
00002190  6e 20 75 73 65 20 74 68  65 20 6e 65 77 20 63 6f  |n use the new co|
000021a0  6d 6d 61 6e 64 20 74 6f  20 70 72 69 6e 74 20 74  |mmand to print t|
000021b0  68 65 20 68 65 78 61 64  65 63 69 6d 61 6c 20 76  |he hexadecimal v|
000021c0  61 6c 75 65 20 6f 66 20  74 68 65 0d 6e 75 6d 62  |alue of the.numb|
000021d0  65 72 20 73 74 6f 72 65  64 20 69 6e 20 61 6e 79  |er stored in any|
000021e0  20 62 79 74 65 20 6f 66  20 74 68 65 20 49 2f 4f  | byte of the I/O|
000021f0  20 70 72 6f 63 65 73 73  6f 72 27 73 20 6d 65 6d  | processor's mem|
00002200  6f 72 79 2e 20 46 6f 72  20 65 78 61 6d 70 6c 65  |ory. For example|
00002210  2c 0d 2a 50 45 45 4b 20  26 39 30 30 2c 20 2a 50  |,.*PEEK &900, *P|
00002220  45 45 4b 20 30 39 30 30  20 61 6e 64 20 2a 50 45  |EEK 0900 and *PE|
00002230  45 4b 20 22 39 30 30 22  20 61 72 65 20 61 6c 6c  |EK "900" are all|
00002240  20 65 71 75 69 76 61 6c  65 6e 74 20 61 6e 64 20  | equivalent and |
00002250  77 69 6c 6c 20 61 6c 6c  0d 70 72 69 6e 74 20 74  |will all.print t|
00002260  68 65 20 6e 75 6d 62 65  72 20 73 74 6f 72 65 64  |he number stored|
00002270  20 69 6e 20 26 39 30 30  20 69 6e 20 74 68 65 20  | in &900 in the |
00002280  49 2f 4f 20 70 72 6f 63  65 73 73 6f 72 27 73 20  |I/O processor's |
00002290  6d 65 6d 6f 72 79 2e 0d  0d 20 20 54 68 65 20 70  |memory...  The p|
000022a0  72 6f 67 72 61 6d 20 75  73 65 73 20 61 20 6f 6e  |rogram uses a on|
000022b0  65 2d 63 6f 6d 6d 61 6e  64 20 69 6e 74 65 72 70  |e-command interp|
000022c0  72 65 74 65 72 20 28 6c  69 6e 65 73 20 33 30 30  |reter (lines 300|
000022d0  2d 35 37 30 29 20 73 69  6d 69 6c 61 72 0d 74 6f  |-570) similar.to|
000022e0  20 74 68 65 20 6f 6e 65  73 20 75 73 65 64 20 69  | the ones used i|
000022f0  6e 20 74 68 65 20 65 61  72 6c 69 65 72 20 6d 6f  |n the earlier mo|
00002300  64 75 6c 65 73 20 6f 66  20 74 68 65 20 63 6f 75  |dules of the cou|
00002310  72 73 65 2e 20 49 74 20  75 73 65 73 20 74 68 65  |rse. It uses the|
00002320  0d 72 6f 75 74 69 6e 65  20 69 6e 20 66 69 67 75  |.routine in figu|
00002330  72 65 20 39 2e 32 20 74  6f 20 72 65 61 64 20 74  |re 9.2 to read t|
00002340  68 65 20 61 72 67 75 6d  65 6e 74 20 61 6e 64 20  |he argument and |
00002350  73 74 6f 72 65 20 74 68  65 20 62 69 6e 61 72 79  |store the binary|
00002360  0d 63 6f 6e 76 65 72 73  69 6f 6e 20 69 6e 20 74  |.conversion in t|
00002370  77 6f 20 7a 65 72 6f 20  70 61 67 65 20 62 79 74  |wo zero page byt|
00002380  65 73 20 28 6c 69 6e 65  73 20 35 38 30 2d 31 30  |es (lines 580-10|
00002390  35 30 29 2e 20 54 68 65  20 72 65 61 64 20 61 6e  |50). The read an|
000023a0  64 0d 63 6f 6e 76 65 72  74 20 72 6f 75 74 69 6e  |d.convert routin|
000023b0  65 20 68 61 73 20 62 65  65 6e 20 6d 6f 64 69 66  |e has been modif|
000023c0  69 65 64 20 73 6c 69 67  68 74 6c 79 20 74 6f 20  |ied slightly to |
000023d0  73 74 6f 72 65 20 74 68  65 20 74 77 6f 20 7a 65  |store the two ze|
000023e0  72 6f 20 70 61 67 65 0d  62 79 74 65 73 20 62 79  |ro page.bytes by|
000023f0  20 70 75 73 68 69 6e 67  20 74 68 65 6d 20 6f 6e  | pushing them on|
00002400  20 74 68 65 20 73 74 61  63 6b 20 62 65 66 6f 72  | the stack befor|
00002410  65 20 6d 61 6b 69 6e 67  20 74 68 65 20 63 6f 6e  |e making the con|
00002420  76 65 72 73 69 6f 6e 20  28 6c 69 6e 65 73 0d 36  |version (lines.6|
00002430  31 30 2d 36 34 30 29 2e  20 54 68 65 20 74 77 6f  |10-640). The two|
00002440  20 62 79 74 65 73 20 63  61 6e 20 74 68 65 6e 20  | bytes can then |
00002450  62 65 20 72 65 73 74 6f  72 65 64 20 62 65 66 6f  |be restored befo|
00002460  72 65 20 72 65 74 75 72  6e 69 6e 67 20 74 6f 20  |re returning to |
00002470  74 68 65 0d 4d 4f 53 20  28 6c 69 6e 65 73 20 31  |the.MOS (lines 1|
00002480  31 30 30 2d 31 31 33 30  29 2e 0d 0d 20 20 54 68  |100-1130)...  Th|
00002490  65 20 74 77 6f 20 7a 65  72 6f 20 70 61 67 65 20  |e two zero page |
000024a0  62 79 74 65 73 20 61 72  65 20 75 73 65 64 20 77  |bytes are used w|
000024b0  69 74 68 20 70 6f 73 74  2d 69 6e 64 65 78 65 64  |ith post-indexed|
000024c0  20 69 6e 64 69 72 65 63  74 0d 61 64 64 72 65 73  | indirect.addres|
000024d0  73 69 6e 67 20 74 6f 20  6c 6f 61 64 20 74 68 65  |sing to load the|
000024e0  20 61 63 63 75 6d 75 6c  61 74 6f 72 20 77 69 74  | accumulator wit|
000024f0  68 20 74 68 65 20 62 79  74 65 20 73 70 65 63 69  |h the byte speci|
00002500  66 69 65 64 20 62 79 20  74 68 65 0d 61 72 67 75  |fied by the.argu|
00002510  6d 65 6e 74 20 28 6c 69  6e 65 73 20 31 30 36 30  |ment (lines 1060|
00002520  2d 31 30 37 30 29 2e 20  54 68 65 20 61 63 63 75  |-1070). The accu|
00002530  6d 75 6c 61 74 6f 72 20  63 6f 6e 74 65 6e 74 20  |mulator content |
00002540  69 73 20 70 72 69 6e 74  65 64 20 75 73 69 6e 67  |is printed using|
00002550  0d 74 68 65 20 74 77 6f  20 73 75 62 72 6f 75 74  |.the two subrout|
00002560  69 6e 65 73 20 69 6e 20  6c 69 6e 65 73 20 31 31  |ines in lines 11|
00002570  39 30 2d 31 33 34 30 2e  20 41 66 74 65 72 20 70  |90-1340. After p|
00002580  72 69 6e 74 69 6e 67 20  74 68 65 20 72 65 73 75  |rinting the resu|
00002590  6c 74 20 74 68 65 0d 7a  65 72 6f 20 70 61 67 65  |lt the.zero page|
000025a0  20 6c 6f 63 61 74 69 6f  6e 73 20 61 72 65 20 72  | locations are r|
000025b0  65 73 74 6f 72 65 64 20  28 6c 69 6e 65 73 20 31  |estored (lines 1|
000025c0  31 30 30 2d 31 31 33 30  29 2e 20 54 68 65 20 72  |100-1130). The r|
000025d0  65 67 69 73 74 65 72 73  0d 70 75 73 68 65 64 20  |egisters.pushed |
000025e0  6f 6e 20 74 68 65 20 73  74 61 63 6b 20 62 79 20  |on the stack by |
000025f0  74 68 65 20 69 6e 74 65  72 70 72 65 74 65 72 20  |the interpreter |
00002600  61 72 65 20 70 75 6c 6c  65 64 20 6f 66 66 20 74  |are pulled off t|
00002610  6f 20 62 61 6c 61 6e 63  65 20 74 68 65 0d 73 74  |o balance the.st|
00002620  61 63 6b 20 28 6c 69 6e  65 73 20 31 31 34 30 2d  |ack (lines 1140-|
00002630  31 31 36 30 29 2e 20 54  68 65 20 61 63 63 75 6d  |1160). The accum|
00002640  75 6c 61 74 6f 72 20 69  73 20 72 65 73 65 74 20  |ulator is reset |
00002650  74 6f 20 7a 65 72 6f 20  28 6c 69 6e 65 20 31 31  |to zero (line 11|
00002660  37 30 29 0d 74 6f 20 69  6e 66 6f 72 6d 20 74 68  |70).to inform th|
00002670  65 20 6f 74 68 65 72 20  72 6f 6d 73 20 74 68 61  |e other roms tha|
00002680  74 20 74 68 65 20 72 65  71 75 65 73 74 20 68 61  |t the request ha|
00002690  73 20 62 65 65 6e 20 72  65 63 6f 67 6e 69 73 65  |s been recognise|
000026a0  64 2c 20 61 6e 64 0d 63  6f 6e 74 72 6f 6c 20 69  |d, and.control i|
000026b0  73 20 72 65 74 75 72 6e  65 64 20 74 6f 20 74 68  |s returned to th|
000026c0  65 20 4d 4f 53 20 28 6c  69 6e 65 20 31 31 38 30  |e MOS (line 1180|
000026d0  29 2e 0d 0d 20 20 54 68  65 20 41 53 43 49 49 20  |)...  The ASCII |
000026e0  74 6f 20 62 69 6e 61 72  79 20 63 6f 6e 76 65 72  |to binary conver|
000026f0  73 69 6f 6e 20 73 75 62  72 6f 75 74 69 6e 65 20  |sion subroutine |
00002700  69 73 20 69 6e 20 6c 69  6e 65 73 20 31 33 35 30  |is in lines 1350|
00002710  20 74 6f 20 31 34 38 30  2e 0d 41 73 20 77 65 6c  | to 1480..As wel|
00002720  6c 20 61 73 20 63 6f 6e  76 65 72 74 69 6e 67 20  |l as converting |
00002730  74 68 65 20 41 53 43 49  49 20 63 68 61 72 61 63  |the ASCII charac|
00002740  74 65 72 20 69 6e 74 6f  20 61 20 62 69 6e 61 72  |ter into a binar|
00002750  79 20 6e 79 62 62 6c 65  20 74 68 65 0d 73 75 62  |y nybble the.sub|
00002760  72 6f 75 74 69 6e 65 20  61 6c 73 6f 20 63 68 65  |routine also che|
00002770  63 6b 73 20 66 6f 72 20  76 61 6c 69 64 20 63 68  |cks for valid ch|
00002780  61 72 61 63 74 65 72 73  2e 20 49 66 20 61 6e 20  |aracters. If an |
00002790  69 6e 76 61 6c 69 64 20  63 68 61 72 61 63 74 65  |invalid characte|
000027a0  72 0d 69 73 20 66 6f 75  6e 64 20 61 20 62 72 61  |r.is found a bra|
000027b0  6e 63 68 20 69 73 20 6d  61 64 65 20 74 6f 20 61  |nch is made to a|
000027c0  6e 20 65 72 72 6f 72 20  72 6f 75 74 69 6e 65 20  |n error routine |
000027d0  28 6c 69 6e 65 73 20 31  34 39 30 2d 31 36 36 30  |(lines 1490-1660|
000027e0  29 0d 73 69 6d 69 6c 61  72 20 74 6f 20 74 68 65  |).similar to the|
000027f0  20 6f 6e 65 20 69 6e 74  72 6f 64 75 63 65 64 20  | one introduced |
00002800  69 6e 20 4d 6f 64 75 6c  65 20 38 2e 0d 0d 20 20  |in Module 8...  |
00002810  42 65 63 61 75 73 65 20  65 72 72 6f 72 73 20 63  |Because errors c|
00002820  61 6e 20 62 65 20 64 65  74 65 63 74 65 64 20 61  |an be detected a|
00002830  74 20 61 6e 79 20 73 74  61 67 65 20 6f 66 20 74  |t any stage of t|
00002840  68 65 20 63 6f 6e 76 65  72 73 69 6f 6e 2c 0d 72  |he conversion,.r|
00002850  65 73 74 6f 72 69 6e 67  20 74 68 65 20 7a 65 72  |estoring the zer|
00002860  6f 20 70 61 67 65 20 62  79 74 65 73 20 77 68 65  |o page bytes whe|
00002870  6e 20 61 6e 20 65 72 72  6f 72 20 69 73 20 66 6f  |n an error is fo|
00002880  75 6e 64 20 77 6f 75 6c  64 20 61 64 64 20 65 78  |und would add ex|
00002890  74 72 61 0d 63 6f 6d 70  6c 69 63 61 74 69 6f 6e  |tra.complication|
000028a0  73 20 74 6f 20 74 68 65  20 65 72 72 6f 72 20 72  |s to the error r|
000028b0  6f 75 74 69 6e 65 2e 20  41 6c 6c 20 74 68 65 20  |outine. All the |
000028c0  69 6e 66 6f 72 6d 61 74  69 6f 6e 20 79 6f 75 20  |information you |
000028d0  6e 65 65 64 20 74 6f 0d  72 65 73 74 6f 72 65 20  |need to.restore |
000028e0  74 68 65 20 7a 65 72 6f  20 70 61 67 65 20 62 79  |the zero page by|
000028f0  74 65 73 20 66 72 6f 6d  20 74 68 65 20 65 72 72  |tes from the err|
00002900  6f 72 20 72 6f 75 74 69  6e 65 20 69 73 20 61 76  |or routine is av|
00002910  61 69 6c 61 62 6c 65 20  69 6e 20 74 68 65 0d 58  |ailable in the.X|
00002920  20 72 65 67 69 73 74 65  72 2e 20 49 66 20 79 6f  | register. If yo|
00002930  75 20 6e 65 65 64 20 74  68 65 20 65 78 65 72 63  |u need the exerc|
00002940  69 73 65 20 79 6f 75 20  63 6f 75 6c 64 20 6d 6f  |ise you could mo|
00002950  64 69 66 79 20 74 68 65  20 65 72 72 6f 72 0d 72  |dify the error.r|
00002960  6f 75 74 69 6e 65 20 74  6f 20 72 65 73 74 6f 72  |outine to restor|
00002970  65 20 74 68 65 20 7a 65  72 6f 20 70 61 67 65 20  |e the zero page |
00002980  62 79 74 65 73 20 62 65  66 6f 72 65 20 70 72 69  |bytes before pri|
00002990  6e 74 69 6e 67 20 74 68  65 20 65 72 72 6f 72 0d  |nting the error.|
000029a0  6d 65 73 73 61 67 65 2e  20 49 66 20 79 6f 75 20  |message. If you |
000029b0  64 6f 20 74 68 65 72 65  20 69 73 20 6e 6f 20 6e  |do there is no n|
000029c0  65 65 64 20 74 6f 20 62  61 6c 61 6e 63 65 20 74  |eed to balance t|
000029d0  68 65 20 73 74 61 63 6b  20 61 73 20 77 65 6c 6c  |he stack as well|
000029e0  0d 62 65 63 61 75 73 65  20 69 74 20 77 69 6c 6c  |.because it will|
000029f0  20 62 65 20 72 65 73 65  74 20 62 79 20 42 41 53  | be reset by BAS|
00002a00  49 43 20 77 68 65 6e 20  63 6f 6e 74 72 6f 6c 20  |IC when control |
00002a10  70 61 73 73 65 73 20 74  6f 20 74 68 65 20 42 52  |passes to the BR|
00002a20  4b 0d 69 6e 73 74 72 75  63 74 69 6f 6e 20 61 74  |K.instruction at|
00002a30  20 26 31 30 30 2e 0d 0d  0d 0d 20 20 20 31 30 20  | &100.....   10 |
00002a40  52 45 4d 3a 20 50 45 45  4b 0d 20 20 20 32 30 20  |REM: PEEK.   20 |
00002a50  4d 4f 44 45 37 0d 20 20  20 33 30 20 48 49 4d 45  |MODE7.   30 HIME|
00002a60  4d 3d 26 33 43 30 30 0d  20 20 20 34 30 20 44 49  |M=&3C00.   40 DI|
00002a70  4d 20 73 61 76 65 20 35  30 0d 20 20 20 35 30 20  |M save 50.   50 |
00002a80  64 69 66 66 3d 26 38 30  30 30 2d 48 49 4d 45 4d  |diff=&8000-HIMEM|
00002a90  0d 20 20 20 36 30 20 61  64 64 72 65 73 73 3d 26  |.   60 address=&|
00002aa0  37 30 0d 20 20 20 37 30  20 65 72 72 73 74 61 63  |70.   70 errstac|
00002ab0  6b 3d 26 31 30 30 0d 20  20 20 38 30 20 63 6f 6d  |k=&100.   80 com|
00002ac0  76 65 63 3d 26 46 32 0d  20 20 20 39 30 20 67 73  |vec=&F2.   90 gs|
00002ad0  69 6e 69 74 3d 26 46 46  43 32 0d 20 20 31 30 30  |init=&FFC2.  100|
00002ae0  20 67 73 72 65 61 64 3d  26 46 46 43 35 0d 20 20  | gsread=&FFC5.  |
00002af0  31 31 30 20 6f 73 61 73  63 69 3d 26 46 46 45 33  |110 osasci=&FFE3|
00002b00  0d 20 20 31 32 30 20 6f  73 6e 65 77 6c 3d 26 46  |.  120 osnewl=&F|
00002b10  46 45 37 0d 20 20 31 33  30 20 6f 73 63 6c 69 3d  |FE7.  130 oscli=|
00002b20  26 46 46 46 37 0d 20 20  31 34 30 20 46 4f 52 20  |&FFF7.  140 FOR |
00002b30  70 61 73 73 20 3d 20 30  20 54 4f 20 32 20 53 54  |pass = 0 TO 2 ST|
00002b40  45 50 20 32 0d 20 20 31  35 30 20 50 25 3d 48 49  |EP 2.  150 P%=HI|
00002b50  4d 45 4d 0d 20 20 31 36  30 20 5b 20 20 20 20 20  |MEM.  160 [     |
00002b60  20 20 4f 50 54 20 70 61  73 73 0d 20 20 31 37 30  |  OPT pass.  170|
00002b70  20 20 20 20 20 20 20 20  20 42 52 4b 0d 20 20 31  |         BRK.  1|
00002b80  38 30 20 20 20 20 20 20  20 20 20 42 52 4b 0d 20  |80         BRK. |
00002b90  20 31 39 30 20 20 20 20  20 20 20 20 20 42 52 4b  | 190         BRK|
00002ba0  0d 20 20 32 30 30 20 20  20 20 20 20 20 20 20 4a  |.  200         J|
00002bb0  4d 50 20 73 65 72 76 69  63 65 2b 64 69 66 66 0d  |MP service+diff.|
00002bc0  20 20 32 31 30 20 20 20  20 20 20 20 20 20 4f 50  |  210         OP|
00002bd0  54 20 46 4e 65 71 75 62  28 26 38 32 29 0d 20 20  |T FNequb(&82).  |
00002be0  32 32 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |220         OPT |
00002bf0  46 4e 65 71 75 62 28 28  63 6f 70 79 72 69 67 68  |FNequb((copyrigh|
00002c00  74 2b 64 69 66 66 29 20  4d 4f 44 20 32 35 36 29  |t+diff) MOD 256)|
00002c10  0d 20 20 32 33 30 20 20  20 20 20 20 20 20 20 42  |.  230         B|
00002c20  52 4b 0d 20 20 32 34 30  20 2e 74 69 74 6c 65 0d  |RK.  240 .title.|
00002c30  20 20 32 35 30 20 20 20  20 20 20 20 20 20 4f 50  |  250         OP|
00002c40  54 20 46 4e 65 71 75 73  28 22 50 45 45 4b 22 29  |T FNequs("PEEK")|
00002c50  0d 20 20 32 36 30 20 2e  63 6f 70 79 72 69 67 68  |.  260 .copyrigh|
00002c60  74 0d 20 20 32 37 30 20  20 20 20 20 20 20 20 20  |t.  270         |
00002c70  42 52 4b 0d 20 20 32 38  30 20 20 20 20 20 20 20  |BRK.  280       |
00002c80  20 20 4f 50 54 20 46 4e  65 71 75 73 28 22 28 43  |  OPT FNequs("(C|
00002c90  29 20 47 6f 72 64 6f 6e  20 48 6f 72 73 69 6e 67  |) Gordon Horsing|
00002ca0  74 6f 6e 20 31 39 38 37  22 29 0d 20 20 32 39 30  |ton 1987").  290|
00002cb0  20 20 20 20 20 20 20 20  20 42 52 4b 0d 20 20 33  |         BRK.  3|
00002cc0  30 30 20 2e 73 65 72 76  69 63 65 0d 20 20 33 31  |00 .service.  31|
00002cd0  30 20 20 20 20 20 20 20  20 20 43 4d 50 20 23 34  |0         CMP #4|
00002ce0  0d 20 20 33 32 30 20 20  20 20 20 20 20 20 20 42  |.  320         B|
00002cf0  45 51 20 75 6e 72 65 63  6f 67 6e 69 73 65 64 0d  |EQ unrecognised.|
00002d00  20 20 33 33 30 20 20 20  20 20 20 20 20 20 52 54  |  330         RT|
00002d10  53 0d 20 20 33 34 30 20  2e 75 6e 72 65 63 6f 67  |S.  340 .unrecog|
00002d20  6e 69 73 65 64 0d 20 20  33 35 30 20 20 20 20 20  |nised.  350     |
00002d30  20 20 20 20 50 48 41 0d  20 20 33 36 30 20 20 20  |    PHA.  360   |
00002d40  20 20 20 20 20 20 54 58  41 0d 20 20 33 37 30 20  |      TXA.  370 |
00002d50  20 20 20 20 20 20 20 20  50 48 41 0d 20 20 33 38  |        PHA.  38|
00002d60  30 20 20 20 20 20 20 20  20 20 54 59 41 0d 20 20  |0         TYA.  |
00002d70  33 39 30 20 20 20 20 20  20 20 20 20 50 48 41 0d  |390         PHA.|
00002d80  20 20 34 30 30 20 20 20  20 20 20 20 20 20 4c 44  |  400         LD|
00002d90  58 20 23 26 46 46 0d 20  20 34 31 30 20 2e 63 6f  |X #&FF.  410 .co|
00002da0  6d 6c 6f 6f 70 0d 20 20  34 32 30 20 20 20 20 20  |mloop.  420     |
00002db0  20 20 20 20 49 4e 58 0d  20 20 34 33 30 20 20 20  |    INX.  430   |
00002dc0  20 20 20 20 20 20 4c 44  41 20 74 69 74 6c 65 2b  |      LDA title+|
00002dd0  64 69 66 66 2c 58 0d 20  20 34 34 30 20 20 20 20  |diff,X.  440    |
00002de0  20 20 20 20 20 42 45 51  20 66 6f 75 6e 64 0d 20  |     BEQ found. |
00002df0  20 34 35 30 20 20 20 20  20 20 20 20 20 4c 44 41  | 450         LDA|
00002e00  20 28 63 6f 6d 76 65 63  29 2c 59 0d 20 20 34 36  | (comvec),Y.  46|
00002e10  30 20 20 20 20 20 20 20  20 20 49 4e 59 0d 20 20  |0         INY.  |
00002e20  34 37 30 20 20 20 20 20  20 20 20 20 43 4d 50 20  |470         CMP |
00002e30  23 41 53 43 28 22 2e 22  29 0d 20 20 34 38 30 20  |#ASC(".").  480 |
00002e40  20 20 20 20 20 20 20 20  42 45 51 20 66 6f 75 6e  |        BEQ foun|
00002e50  64 0d 20 20 34 39 30 20  20 20 20 20 20 20 20 20  |d.  490         |
00002e60  41 4e 44 20 23 26 44 46  0d 20 20 35 30 30 20 20  |AND #&DF.  500  |
00002e70  20 20 20 20 20 20 20 43  4d 50 20 74 69 74 6c 65  |       CMP title|
00002e80  2b 64 69 66 66 2c 58 0d  20 20 35 31 30 20 20 20  |+diff,X.  510   |
00002e90  20 20 20 20 20 20 42 45  51 20 63 6f 6d 6c 6f 6f  |      BEQ comloo|
00002ea0  70 0d 20 20 35 32 30 20  20 20 20 20 20 20 20 20  |p.  520         |
00002eb0  50 4c 41 0d 20 20 35 33  30 20 20 20 20 20 20 20  |PLA.  530       |
00002ec0  20 20 54 41 59 0d 20 20  35 34 30 20 20 20 20 20  |  TAY.  540     |
00002ed0  20 20 20 20 50 4c 41 0d  20 20 35 35 30 20 20 20  |    PLA.  550   |
00002ee0  20 20 20 20 20 20 54 41  58 0d 20 20 35 36 30 20  |      TAX.  560 |
00002ef0  20 20 20 20 20 20 20 20  50 4c 41 0d 20 20 35 37  |        PLA.  57|
00002f00  30 20 20 20 20 20 20 20  20 20 52 54 53 0d 20 20  |0         RTS.  |
00002f10  35 38 30 20 2e 66 6f 75  6e 64 0d 20 20 35 39 30  |580 .found.  590|
00002f20  20 20 20 20 20 20 20 20  20 43 4c 43 0d 20 20 36  |         CLC.  6|
00002f30  30 30 20 20 20 20 20 20  20 20 20 4a 53 52 20 67  |00         JSR g|
00002f40  73 69 6e 69 74 0d 20 20  36 31 30 20 20 20 20 20  |sinit.  610     |
00002f50  20 20 20 20 4c 44 41 20  61 64 64 72 65 73 73 0d  |    LDA address.|
00002f60  20 20 36 32 30 20 20 20  20 20 20 20 20 20 50 48  |  620         PH|
00002f70  41 0d 20 20 36 33 30 20  20 20 20 20 20 20 20 20  |A.  630         |
00002f80  4c 44 41 20 61 64 64 72  65 73 73 2b 31 0d 20 20  |LDA address+1.  |
00002f90  36 34 30 20 20 20 20 20  20 20 20 20 50 48 41 0d  |640         PHA.|
00002fa0  20 20 36 35 30 20 20 20  20 20 20 20 20 20 4c 44  |  650         LD|
00002fb0  58 20 23 30 0d 20 20 36  36 30 20 20 20 20 20 20  |X #0.  660      |
00002fc0  20 20 20 53 54 58 20 61  64 64 72 65 73 73 0d 20  |   STX address. |
00002fd0  20 36 37 30 20 20 20 20  20 20 20 20 20 53 54 58  | 670         STX|
00002fe0  20 61 64 64 72 65 73 73  2b 31 0d 20 20 36 38 30  | address+1.  680|
00002ff0  20 20 20 20 20 20 20 20  20 44 45 58 0d 20 20 36  |         DEX.  6|
00003000  39 30 20 2e 61 72 67 6c  6f 6f 70 0d 20 20 37 30  |90 .argloop.  70|
00003010  30 20 20 20 20 20 20 20  20 20 4a 53 52 20 67 73  |0         JSR gs|
00003020  72 65 61 64 0d 20 20 37  31 30 20 20 20 20 20 20  |read.  710      |
00003030  20 20 20 42 43 53 20 65  6e 64 61 72 67 0d 20 20  |   BCS endarg.  |
00003040  37 32 30 20 20 20 20 20  20 20 20 20 43 4d 50 20  |720         CMP |
00003050  23 41 53 43 28 22 26 22  29 0d 20 20 37 33 30 20  |#ASC("&").  730 |
00003060  20 20 20 20 20 20 20 20  42 45 51 20 61 72 67 6c  |        BEQ argl|
00003070  6f 6f 70 0d 20 20 37 34  30 20 20 20 20 20 20 20  |oop.  740       |
00003080  20 20 4a 53 52 20 63 6f  6e 76 65 72 74 2b 64 69  |  JSR convert+di|
00003090  66 66 0d 20 20 37 35 30  20 20 20 20 20 20 20 20  |ff.  750        |
000030a0  20 50 48 41 20 20 20 20  20 20 20 20 20 20 20 5c  | PHA           \|
000030b0  20 50 75 73 68 20 68 65  78 20 6e 79 62 62 6c 65  | Push hex nybble|
000030c0  73 0d 20 20 37 36 30 20  20 20 20 20 20 20 20 20  |s.  760         |
000030d0  49 4e 58 0d 20 20 37 37  30 20 20 20 20 20 20 20  |INX.  770       |
000030e0  20 20 42 50 4c 20 61 72  67 6c 6f 6f 70 0d 20 20  |  BPL argloop.  |
000030f0  37 38 30 20 2e 65 6e 64  61 72 67 0d 20 20 37 39  |780 .endarg.  79|
00003100  30 20 20 20 20 20 20 20  20 20 43 50 58 20 23 34  |0         CPX #4|
00003110  0d 20 20 38 30 30 20 20  20 20 20 20 20 20 20 42  |.  800         B|
00003120  43 53 20 65 72 72 6f 72  0d 20 20 38 31 30 20 20  |CS error.  810  |
00003130  20 20 20 20 20 20 20 50  4c 41 20 20 20 20 20 20  |       PLA      |
00003140  20 20 20 20 20 5c 20 4c  53 20 6e 79 62 62 6c 65  |     \ LS nybble|
00003150  20 6c 6f 77 20 62 79 74  65 0d 20 20 38 32 30 20  | low byte.  820 |
00003160  20 20 20 20 20 20 20 20  53 54 41 20 61 64 64 72  |        STA addr|
00003170  65 73 73 0d 20 20 38 33  30 20 20 20 20 20 20 20  |ess.  830       |
00003180  20 20 44 45 58 0d 20 20  38 34 30 20 20 20 20 20  |  DEX.  840     |
00003190  20 20 20 20 42 4d 49 20  66 69 6e 69 73 68 0d 20  |    BMI finish. |
000031a0  20 38 35 30 20 20 20 20  20 20 20 20 20 50 4c 41  | 850         PLA|
000031b0  20 20 20 20 20 20 20 20  20 20 20 5c 20 4d 53 20  |           \ MS |
000031c0  6e 79 62 62 6c 65 20 6c  6f 77 20 62 79 74 65 0d  |nybble low byte.|
000031d0  20 20 38 36 30 20 20 20  20 20 20 20 20 20 41 53  |  860         AS|
000031e0  4c 20 41 0d 20 20 38 37  30 20 20 20 20 20 20 20  |L A.  870       |
000031f0  20 20 41 53 4c 20 41 0d  20 20 38 38 30 20 20 20  |  ASL A.  880   |
00003200  20 20 20 20 20 20 41 53  4c 20 41 0d 20 20 38 39  |      ASL A.  89|
00003210  30 20 20 20 20 20 20 20  20 20 41 53 4c 20 41 0d  |0         ASL A.|
00003220  20 20 39 30 30 20 20 20  20 20 20 20 20 20 4f 52  |  900         OR|
00003230  41 20 61 64 64 72 65 73  73 0d 20 20 39 31 30 20  |A address.  910 |
00003240  20 20 20 20 20 20 20 20  53 54 41 20 61 64 64 72  |        STA addr|
00003250  65 73 73 20 20 20 5c 20  4c 53 20 62 79 74 65 0d  |ess   \ LS byte.|
00003260  20 20 39 32 30 20 20 20  20 20 20 20 20 20 44 45  |  920         DE|
00003270  58 0d 20 20 39 33 30 20  20 20 20 20 20 20 20 20  |X.  930         |
00003280  42 4d 49 20 66 69 6e 69  73 68 0d 20 20 39 34 30  |BMI finish.  940|
00003290  20 20 20 20 20 20 20 20  20 50 4c 41 20 20 20 20  |         PLA    |
000032a0  20 20 20 20 20 20 20 5c  20 4c 53 20 6e 79 62 62  |       \ LS nybb|
000032b0  6c 65 20 68 69 67 68 20  62 79 74 65 0d 20 20 39  |le high byte.  9|
000032c0  35 30 20 20 20 20 20 20  20 20 20 53 54 41 20 61  |50         STA a|
000032d0  64 64 72 65 73 73 2b 31  0d 20 20 39 36 30 20 20  |ddress+1.  960  |
000032e0  20 20 20 20 20 20 20 44  45 58 0d 20 20 39 37 30  |       DEX.  970|
000032f0  20 20 20 20 20 20 20 20  20 42 4d 49 20 66 69 6e  |         BMI fin|
00003300  69 73 68 0d 20 20 39 38  30 20 20 20 20 20 20 20  |ish.  980       |
00003310  20 20 50 4c 41 20 20 20  20 20 20 20 20 20 20 20  |  PLA           |
00003320  5c 20 4d 53 20 6e 79 62  62 6c 65 20 68 69 67 68  |\ MS nybble high|
00003330  20 62 79 74 65 0d 20 20  39 39 30 20 20 20 20 20  | byte.  990     |
00003340  20 20 20 20 41 53 4c 20  41 0d 20 31 30 30 30 20  |    ASL A. 1000 |
00003350  20 20 20 20 20 20 20 20  41 53 4c 20 41 0d 20 31  |        ASL A. 1|
00003360  30 31 30 20 20 20 20 20  20 20 20 20 41 53 4c 20  |010         ASL |
00003370  41 0d 20 31 30 32 30 20  20 20 20 20 20 20 20 20  |A. 1020         |
00003380  41 53 4c 20 41 0d 20 31  30 33 30 20 20 20 20 20  |ASL A. 1030     |
00003390  20 20 20 20 4f 52 41 20  61 64 64 72 65 73 73 2b  |    ORA address+|
000033a0  31 0d 20 31 30 34 30 20  20 20 20 20 20 20 20 20  |1. 1040         |
000033b0  53 54 41 20 61 64 64 72  65 73 73 2b 31 20 5c 20  |STA address+1 \ |
000033c0  4d 53 20 62 79 74 65 0d  20 31 30 35 30 20 2e 66  |MS byte. 1050 .f|
000033d0  69 6e 69 73 68 0d 20 31  30 36 30 20 20 20 20 20  |inish. 1060     |
000033e0  20 20 20 20 4c 44 59 20  23 30 0d 20 31 30 37 30  |    LDY #0. 1070|
000033f0  20 20 20 20 20 20 20 20  20 4c 44 41 20 28 61 64  |         LDA (ad|
00003400  64 72 65 73 73 29 2c 59  0d 20 31 30 38 30 20 20  |dress),Y. 1080  |
00003410  20 20 20 20 20 20 20 4a  53 52 20 68 65 78 62 79  |       JSR hexby|
00003420  74 65 2b 64 69 66 66 0d  20 31 30 39 30 20 20 20  |te+diff. 1090   |
00003430  20 20 20 20 20 20 4a 53  52 20 6f 73 6e 65 77 6c  |      JSR osnewl|
00003440  0d 20 31 31 30 30 20 20  20 20 20 20 20 20 20 50  |. 1100         P|
00003450  4c 41 0d 20 31 31 31 30  20 20 20 20 20 20 20 20  |LA. 1110        |
00003460  20 53 54 41 20 61 64 64  72 65 73 73 2b 31 0d 20  | STA address+1. |
00003470  31 31 32 30 20 20 20 20  20 20 20 20 20 50 4c 41  |1120         PLA|
00003480  0d 20 31 31 33 30 20 20  20 20 20 20 20 20 20 53  |. 1130         S|
00003490  54 41 20 61 64 64 72 65  73 73 0d 20 31 31 34 30  |TA address. 1140|
000034a0  20 20 20 20 20 20 20 20  20 50 4c 41 0d 20 31 31  |         PLA. 11|
000034b0  35 30 20 20 20 20 20 20  20 20 20 50 4c 41 0d 20  |50         PLA. |
000034c0  31 31 36 30 20 20 20 20  20 20 20 20 20 50 4c 41  |1160         PLA|
000034d0  0d 20 31 31 37 30 20 20  20 20 20 20 20 20 20 4c  |. 1170         L|
000034e0  44 41 20 23 30 0d 20 31  31 38 30 20 20 20 20 20  |DA #0. 1180     |
000034f0  20 20 20 20 52 54 53 0d  20 31 31 39 30 20 2e 68  |    RTS. 1190 .h|
00003500  65 78 62 79 74 65 0d 20  31 32 30 30 20 20 20 20  |exbyte. 1200    |
00003510  20 20 20 20 20 50 48 41  0d 20 31 32 31 30 20 20  |     PHA. 1210  |
00003520  20 20 20 20 20 20 20 4c  53 52 20 41 0d 20 31 32  |       LSR A. 12|
00003530  32 30 20 20 20 20 20 20  20 20 20 4c 53 52 20 41  |20         LSR A|
00003540  0d 20 31 32 33 30 20 20  20 20 20 20 20 20 20 4c  |. 1230         L|
00003550  53 52 20 41 0d 20 31 32  34 30 20 20 20 20 20 20  |SR A. 1240      |
00003560  20 20 20 4c 53 52 20 41  0d 20 31 32 35 30 20 20  |   LSR A. 1250  |
00003570  20 20 20 20 20 20 20 4a  53 52 20 6e 79 62 62 6c  |       JSR nybbl|
00003580  65 2b 64 69 66 66 0d 20  31 32 36 30 20 20 20 20  |e+diff. 1260    |
00003590  20 20 20 20 20 50 4c 41  0d 20 31 32 37 30 20 2e  |     PLA. 1270 .|
000035a0  6e 79 62 62 6c 65 0d 20  31 32 38 30 20 20 20 20  |nybble. 1280    |
000035b0  20 20 20 20 20 41 4e 44  20 23 26 46 0d 20 31 32  |     AND #&F. 12|
000035c0  39 30 20 20 20 20 20 20  20 20 20 53 45 44 0d 20  |90         SED. |
000035d0  31 33 30 30 20 20 20 20  20 20 20 20 20 43 4c 43  |1300         CLC|
000035e0  0d 20 31 33 31 30 20 20  20 20 20 20 20 20 20 41  |. 1310         A|
000035f0  44 43 20 23 26 39 30 0d  20 31 33 32 30 20 20 20  |DC #&90. 1320   |
00003600  20 20 20 20 20 20 41 44  43 20 23 26 34 30 0d 20  |      ADC #&40. |
00003610  31 33 33 30 20 20 20 20  20 20 20 20 20 43 4c 44  |1330         CLD|
00003620  0d 20 31 33 34 30 20 20  20 20 20 20 20 20 20 4a  |. 1340         J|
00003630  4d 50 20 6f 73 61 73 63  69 0d 20 31 33 35 30 20  |MP osasci. 1350 |
00003640  2e 63 6f 6e 76 65 72 74  0d 20 31 33 36 30 20 20  |.convert. 1360  |
00003650  20 20 20 20 20 20 20 43  4d 50 20 23 41 53 43 28  |       CMP #ASC(|
00003660  22 39 22 29 2b 31 0d 20  31 33 37 30 20 20 20 20  |"9")+1. 1370    |
00003670  20 20 20 20 20 42 43 53  20 6c 65 74 74 65 72 73  |     BCS letters|
00003680  0d 20 31 33 38 30 20 20  20 20 20 20 20 20 20 43  |. 1380         C|
00003690  4d 50 20 23 41 53 43 28  22 30 22 29 0d 20 31 33  |MP #ASC("0"). 13|
000036a0  39 30 20 20 20 20 20 20  20 20 20 42 4d 49 20 65  |90         BMI e|
000036b0  72 72 6f 72 0d 20 31 34  30 30 20 20 20 20 20 20  |rror. 1400      |
000036c0  20 20 20 41 4e 44 20 23  26 46 0d 20 31 34 31 30  |   AND #&F. 1410|
000036d0  20 20 20 20 20 20 20 20  20 52 54 53 0d 20 31 34  |         RTS. 14|
000036e0  32 30 20 2e 6c 65 74 74  65 72 73 0d 20 31 34 33  |20 .letters. 143|
000036f0  30 20 20 20 20 20 20 20  20 20 53 42 43 20 23 26  |0         SBC #&|
00003700  33 37 0d 20 31 34 34 30  20 20 20 20 20 20 20 20  |37. 1440        |
00003710  20 43 4d 50 20 23 26 41  0d 20 31 34 35 30 20 20  | CMP #&A. 1450  |
00003720  20 20 20 20 20 20 20 42  4d 49 20 65 72 72 6f 72  |       BMI error|
00003730  0d 20 31 34 36 30 20 20  20 20 20 20 20 20 20 43  |. 1460         C|
00003740  4d 50 20 23 26 31 30 0d  20 31 34 37 30 20 20 20  |MP #&10. 1470   |
00003750  20 20 20 20 20 20 42 43  53 20 65 72 72 6f 72 0d  |      BCS error.|
00003760  20 31 34 38 30 20 20 20  20 20 20 20 20 20 52 54  | 1480         RT|
00003770  53 0d 20 31 34 39 30 20  2e 65 72 72 6f 72 0d 20  |S. 1490 .error. |
00003780  31 35 30 30 20 20 20 20  20 20 20 20 20 4c 44 41  |1500         LDA|
00003790  20 23 28 65 72 72 6f 72  6d 73 67 2b 64 69 66 66  | #(errormsg+diff|
000037a0  29 20 4d 4f 44 20 32 35  36 0d 20 31 35 31 30 20  |) MOD 256. 1510 |
000037b0  20 20 20 20 20 20 20 20  53 54 41 20 61 64 64 72  |        STA addr|
000037c0  65 73 73 0d 20 31 35 32  30 20 20 20 20 20 20 20  |ess. 1520       |
000037d0  20 20 4c 44 41 20 23 28  65 72 72 6f 72 6d 73 67  |  LDA #(errormsg|
000037e0  2b 64 69 66 66 29 20 44  49 56 20 32 35 36 0d 20  |+diff) DIV 256. |
000037f0  31 35 33 30 20 20 20 20  20 20 20 20 20 53 54 41  |1530         STA|
00003800  20 61 64 64 72 65 73 73  2b 31 0d 20 31 35 34 30  | address+1. 1540|
00003810  20 20 20 20 20 20 20 20  20 4c 44 59 20 23 26 46  |         LDY #&F|
00003820  46 0d 20 31 35 35 30 20  2e 65 72 72 6f 72 6c 6f  |F. 1550 .errorlo|
00003830  6f 70 0d 20 31 35 36 30  20 20 20 20 20 20 20 20  |op. 1560        |
00003840  20 49 4e 59 0d 20 31 35  37 30 20 20 20 20 20 20  | INY. 1570      |
00003850  20 20 20 4c 44 41 20 28  61 64 64 72 65 73 73 29  |   LDA (address)|
00003860  2c 59 0d 20 31 35 38 30  20 20 20 20 20 20 20 20  |,Y. 1580        |
00003870  20 53 54 41 20 65 72 72  73 74 61 63 6b 2c 59 0d  | STA errstack,Y.|
00003880  20 31 35 39 30 20 20 20  20 20 20 20 20 20 42 50  | 1590         BP|
00003890  4c 20 65 72 72 6f 72 6c  6f 6f 70 0d 20 31 36 30  |L errorloop. 160|
000038a0  30 20 20 20 20 20 20 20  20 20 4a 4d 50 20 65 72  |0         JMP er|
000038b0  72 73 74 61 63 6b 0d 20  31 36 31 30 20 2e 65 72  |rstack. 1610 .er|
000038c0  72 6f 72 6d 73 67 0d 20  31 36 32 30 20 20 20 20  |rormsg. 1620    |
000038d0  20 20 20 20 20 42 52 4b  0d 20 31 36 33 30 20 20  |     BRK. 1630  |
000038e0  20 20 20 20 20 20 20 42  52 4b 0d 20 31 36 34 30  |       BRK. 1640|
000038f0  20 20 20 20 20 20 20 20  20 4f 50 54 20 46 4e 65  |         OPT FNe|
00003900  71 75 73 28 22 4f 75 74  20 6f 66 20 72 61 6e 67  |qus("Out of rang|
00003910  65 22 29 0d 20 31 36 35  30 20 20 20 20 20 20 20  |e"). 1650       |
00003920  20 20 42 52 4b 0d 20 31  36 36 30 20 20 20 20 20  |  BRK. 1660     |
00003930  20 20 20 20 4f 50 54 20  46 4e 65 71 75 62 28 26  |    OPT FNequb(&|
00003940  46 46 29 0d 20 31 36 37  30 20 2e 6c 61 73 74 62  |FF). 1670 .lastb|
00003950  79 74 65 0d 20 31 36 38  30 20 5d 0d 20 31 36 39  |yte. 1680 ]. 169|
00003960  30 20 4e 45 58 54 0d 20  31 37 30 30 20 49 4e 50  |0 NEXT. 1700 INP|
00003970  55 54 27 22 53 61 76 65  20 66 69 6c 65 6e 61 6d  |UT'"Save filenam|
00003980  65 20 3d 20 22 66 69 6c  65 6e 61 6d 65 24 0d 20  |e = "filename$. |
00003990  31 37 31 30 20 49 46 20  66 69 6c 65 6e 61 6d 65  |1710 IF filename|
000039a0  24 3d 22 22 20 45 4e 44  0d 20 31 37 32 30 20 24  |$="" END. 1720 $|
000039b0  73 61 76 65 3d 22 53 41  56 45 20 22 2b 66 69 6c  |save="SAVE "+fil|
000039c0  65 6e 61 6d 65 24 2b 22  20 22 2b 53 54 52 24 7e  |ename$+" "+STR$~|
000039d0  28 48 49 4d 45 4d 29 2b  22 20 22 2b 53 54 52 24  |(HIMEM)+" "+STR$|
000039e0  7e 28 6c 61 73 0d 20 20  20 20 20 20 74 62 79 74  |~(las.      tbyt|
000039f0  65 29 2b 22 20 46 46 46  46 38 30 30 30 20 46 46  |e)+" FFFF8000 FF|
00003a00  46 46 38 30 30 30 22 0d  20 31 37 33 30 20 58 25  |FF8000". 1730 X%|
00003a10  3d 73 61 76 65 20 4d 4f  44 20 32 35 36 0d 20 31  |=save MOD 256. 1|
00003a20  37 34 30 20 59 25 3d 73  61 76 65 20 44 49 56 20  |740 Y%=save DIV |
00003a30  32 35 36 0d 20 31 37 35  30 20 2a 4f 50 54 31 2c  |256. 1750 *OPT1,|
00003a40  32 0d 20 31 37 36 30 20  43 41 4c 4c 20 6f 73 63  |2. 1760 CALL osc|
00003a50  6c 69 0d 20 31 37 37 30  20 2a 4f 50 54 31 2c 30  |li. 1770 *OPT1,0|
00003a60  0d 20 31 37 38 30 20 45  4e 44 0d 20 31 37 39 30  |. 1780 END. 1790|
00003a70  20 44 45 46 46 4e 65 71  75 62 28 62 79 74 65 29  | DEFFNequb(byte)|
00003a80  0d 20 31 38 30 30 20 3f  50 25 3d 62 79 74 65 0d  |. 1800 ?P%=byte.|
00003a90  20 31 38 31 30 20 50 25  3d 50 25 2b 31 0d 20 31  | 1810 P%=P%+1. 1|
00003aa0  38 32 30 20 3d 70 61 73  73 0d 20 31 38 33 30 20  |820 =pass. 1830 |
00003ab0  44 45 46 46 4e 65 71 75  77 28 77 6f 72 64 29 0d  |DEFFNequw(word).|
00003ac0  20 31 38 34 30 20 3f 50  25 3d 77 6f 72 64 20 4d  | 1840 ?P%=word M|
00003ad0  4f 44 20 32 35 36 0d 20  31 38 35 30 20 50 25 3f  |OD 256. 1850 P%?|
00003ae0  31 3d 77 6f 72 64 20 44  49 56 20 32 35 36 0d 20  |1=word DIV 256. |
00003af0  31 38 36 30 20 50 25 3d  50 25 2b 32 0d 20 31 38  |1860 P%=P%+2. 18|
00003b00  37 30 20 3d 70 61 73 73  0d 20 31 38 38 30 20 44  |70 =pass. 1880 D|
00003b10  45 46 46 4e 65 71 75 64  28 64 6f 75 62 6c 65 29  |EFFNequd(double)|
00003b20  0d 20 31 38 39 30 20 21  50 25 3d 64 6f 75 62 6c  |. 1890 !P%=doubl|
00003b30  65 0d 20 31 39 30 30 20  50 25 3d 50 25 2b 34 0d  |e. 1900 P%=P%+4.|
00003b40  20 31 39 31 30 20 3d 70  61 73 73 0d 20 31 39 32  | 1910 =pass. 192|
00003b50  30 20 44 45 46 46 4e 65  71 75 73 28 73 74 72 69  |0 DEFFNequs(stri|
00003b60  6e 67 24 29 0d 20 31 39  33 30 20 24 50 25 3d 73  |ng$). 1930 $P%=s|
00003b70  74 72 69 6e 67 24 0d 20  31 39 34 30 20 50 25 3d  |tring$. 1940 P%=|
00003b80  50 25 2b 4c 45 4e 28 73  74 72 69 6e 67 24 29 0d  |P%+LEN(string$).|
00003b90  20 31 39 35 30 20 3d 70  61 73 73 0d              | 1950 =pass.|
00003b9c
02-09-88/T\SWR09.m0
02-09-88/T\SWR09.m1
02-09-88/T\SWR09.m2
02-09-88/T\SWR09.m4
02-09-88/T\SWR09.m5