Home » CEEFAX disks » telesoftware8.adl » 05-08-88/T\SWR_OLD

05-08-88/T\SWR_OLD

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 » telesoftware8.adl
Filename: 05-08-88/T\SWR_OLD
Read OK:
File size: 2784 bytes
Load address: 0000
Exec address: FFFFFFFF
File contents
Mastering Sideways ROM & RAM - Module 05 - Reading arguments
------------------------------------------------------------

  In this module I will extend the interpreter introduced in Module 3
to include reading arguments which follow the * command.

  There are two MOS subroutines used to read arguments. They are
Gsinit at &FFC2 and Gsread at &FFC5.

  Gsinit should be used to initialise an argument which is to be read
using Gsread. Gsinit uses the text pointers at &F2 and &F3 with an
offset in the Y register to identify the argument address. The
argument can be enclosed by quotation marks but it does not have to
be. Gsinit is used to strip off any leading spaces and to set up an
information byte in zero page which indicates the termination
character of the argument.

  Before calling Gsinit you should clear the carry flag if you want
the second quotation mark, the first space within the argument, or a
carriage return as the terminating character. You should set the carry
flag before calling Gsinit if you do not want a space to be recognised
as a terminating character. If in doubt, set the carry flag before
calling Gsinit.

  After calling Gsinit the Y register contains an offset to the first
character of the argument and the accumulator contains the first
character of the argument. The zero flag is set if the argument is a
null string.

  For example, imagine you have typed *CURSOR ON and the interpreter
has recognised the command CURSOR. Before calling Gsinit, the text
pointers at &F2 and &F3 will point to the command with the offset in Y
pointing to the second R of CURSOR. After calling Gsinit the offset in
Y will point to the O of ON, the zero flag will be clear, and the
terminating character will be the carriage return after the N of ON.
If ON is enclosed by quotation marks the offset in Y will still point
to the O of ON and the zero flag will be clear, but the terminating
character will be the second quotation mark. If an argument is not
typed or if *CURSOR "" is typed the zero flag will be set on return
from Gsinit. Figure 5.1 shows the offset in the Y register pointing to
the end of the command before calling Gsinit and pointing to the
beginning of the argument after calling Gsinit.




       +- Y before Gsinit -+
       !                   !
       v                   v
>*CURSOR ON         >*CURSOR "ON"
         ^                    ^
         !                    !
         +-- Y after Gsinit --+

Figure 5.1 The offset in Y before and after calling Gsinit.
-----------------------------------------------------------




  Gsread is used to read each byte of the argument. This routine
should only be used following a Gsinit call or a previous Gsread.
Following Gsinit the text pointers and Y register will point to the
first byte of the argument. After calling Gsread the accumulator
contains the character read from the argument, Y is incremented to
point to the next character, X is preserved and the carry flag is set
if the terminating character has been read.

  The effect of calling Gsread is similar to, but not the same as:

  LDA (&F2),Y
  INY

  The difference exists because Gsread tests the content of A to see
if the terminating character, and hence the end of the argument, has
been read. The terminating character can be either a second quotation
mark, a space or a carriage return as defined by Gsinit. Using Gsinit
to initialise an argument and Gsread to read it is more versatile than
simply reading the argument using post-indexed indirect addressing
with the text pointers. The difference may seem insignificant with the
simple example used above but it is useful if the argument is a number
when the place value of a particular character depends on its
displacement from the terminating character. Reading numerical
arguments will be covered in module 11.

  Because the effect of using Gsread is very similar to reading a
string using post-indexed indirect addressing with the text pointers
you may be tempted to use Gsread in the interpreter to read the
unrecognised command. If you do you will find that most of the time it
will work but, sooner or later, you will start getting mysterious "bad
string" error messages. Don't be tempted into wasting your time using
Gsread in the interpreter. Stick with the method demonstrated in
Module 3.

  Figure 5.2 shows how the interpreter used in the last two modules
can be modified to read an argument.





.found
         SEC           \ terminate with Return or "
         JSR &FFC2     \ initialise argument with Gsinit
         BEQ exit      \ branch if null argument
         JSR &FFC5     \ read first character with Gsread
         BCS exit      \ branch if end of argument
         AND #&DF      \ force upper case
          .
          .
          .
.exit
         PLA           \ discard Y
         PLA           \ discard X
         PLA           \ discard A
         LDA #0        \ service call recognised
         RTS           \ return to MOS

Figure 5.2 Using Gsinit and Gsread to read an argument.
-------------------------------------------------------




  The carry flag is set before calling Gsinit. The terminating
character of the argument will be a carriage return or a second
quotation mark. After setting the carry flag Gsinit is called to
initialise the argument. If the argument is null Gsinit returns with
the zero flag set. This can be tested and branch to exit if there is
nothing to read. If the zero flag is clear there is an argument to be
read by calling Gsread for each character. Gsread will return with the
carry flag set when the terminating character is read and an
appropriate branch can be made after testing the carry flag.

  This method of reading an argument has been used in the progran
CURSOR. When the interpreter (lines 280-540) recognises the command
*CURSOR it passes control to the label ".found" (line 550). The
argument is initialised (lines 560-570) and the argument is tested
(line 580). If a null argument is detected the program returns control
to the MOS with A=0 (lines 860-910). If an argument is found the
program expects to read either ON or OFF. To test for ON or OFF the
first character can be skipped since it should be an "O" (line 590).
The next character is read using Gsread (line 600) and tested for a
terminating character (line 610) and either "F" (line 630) or "N"
(line 650). There is no need to read and test for the second F of OFF.
If the second character of the argument is "F" the cursor is switched
off (lines 690-850), if it is "N" the cursor is switched on (lines
670-850).

  When you load the object code generated by CURSOR into SWR to see
how it works it is possible to deceive yourself into believing that
there is something wrong with it. If you type *CURSOR OFF and press
Return the cursor will go off as expected. Type *CURSOR ON and it will
come back on. Everything seems OK. Type *CURSOR OFF and Return and
then type *CURSOR and Return. The cursor stays off because you have
not typed an argument. Everything is still OK. Now use the cursor keys
to copy the *CURSOR command without an argument and press Return. The
cursor comes back on when it should have stayed off. This will happen
because you will re-enable the cursor with the cursor keys. There is
nothing wrong with the argument reading technique demonstrated in the
program.





   10 REM: CURSOR
   20 MODE7
   30 HIMEM=&3C00
   40 DIM save 50
   50 diff=&8000-HIMEM
   60 comvec=&F2
   70 gsinit=&FFC2
   80 gsread=&FFC5
   90 osasci=&FFE3
  100 oscli=&FFF7
  110 FOR pass = 0 TO 2 STEP 2
  1AX
  530         PLA
  540         RTS
  550 .found
  560         SEC           \ Terminate with Return or "
  570         JSR gsinit
  580         BEQ exit      \ Branch if null argument
  590         INY           \ First character must be "O"
  600         JSR gsread    \ Second character "F" or "N"
  610         BCS exit      \ Branch if end of argument
  620         AND #&DF      \ Upper case
  630         CMP #ASC("F")
  640         BEQ cursoroff
  650         CMP #ASC("N")
  660         BNE exit
  670         SEC
  680         BCS cursor
  690 .cursoroff
  700         CLC
  710 .cursor
  720         PHP
  730         LDA #23
  740         JSR osasci
  750         LDA #1
  760         JSR osasci
  770         PLA
  780         AND #1
  790         JSR osasci
  800         LDA #0
  810         LDX #7
  820 .cursorloop
  830         JSR osasci
  840         DEX
  850         BNE cursorloop
  860 .exit
  870         PLA
  880         PLA
  890         PLA
  900         LDA #0
  910         RTS
  920 .lastbyte
  930 ]
  940 NEXT
  950 INPUT'"Save filename = "filename$
  960 IF filename$="" END
  970 $save="SAVE "+filename$+" "+STR$~(HIMEM)+" "+STR$~(las
      tbyte)+" FFFF8000 FFFF8000"
  980 X%=save MOD 256
  990 Y%=save DIV 256
 1000 *OPT1,2
 1010 CALL oscli
 1020 *OPT1,0
 1030 END
 1040 DEFFNequb(byte)
 1050 ?P%=byte
 1060 P%=P%+1
 1070 =pass
 1080 DEFFNequw(word)
 1090 ?P%=word MOD 256
 1100 P%?1=word DIV 256
 1110 P%=P%+2
 1120 =pass
 1130 DEFFNequd(double)
 1140 !P%=double
 1150 P%=P%+4
 1160 =pass
 1170 DEFFNequs(string$)
 1180 $P%=string$
 1190 P%=P%+LEN(string$)
 1200 =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 35  20 2d 20 52 65 61 64 69  |odule 05 - Readi|
00000030  6e 67 20 61 72 67 75 6d  65 6e 74 73 0d 2d 2d 2d  |ng 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 0d 0d 20 20 49 6e 20  |---------..  In |
00000080  74 68 69 73 20 6d 6f 64  75 6c 65 20 49 20 77 69  |this module I wi|
00000090  6c 6c 20 65 78 74 65 6e  64 20 74 68 65 20 69 6e  |ll extend the in|
000000a0  74 65 72 70 72 65 74 65  72 20 69 6e 74 72 6f 64  |terpreter introd|
000000b0  75 63 65 64 20 69 6e 20  4d 6f 64 75 6c 65 20 33  |uced in Module 3|
000000c0  0d 74 6f 20 69 6e 63 6c  75 64 65 20 72 65 61 64  |.to include read|
000000d0  69 6e 67 20 61 72 67 75  6d 65 6e 74 73 20 77 68  |ing arguments wh|
000000e0  69 63 68 20 66 6f 6c 6c  6f 77 20 74 68 65 20 2a  |ich follow the *|
000000f0  20 63 6f 6d 6d 61 6e 64  2e 0d 0d 20 20 54 68 65  | command...  The|
00000100  72 65 20 61 72 65 20 74  77 6f 20 4d 4f 53 20 73  |re are two MOS s|
00000110  75 62 72 6f 75 74 69 6e  65 73 20 75 73 65 64 20  |ubroutines used |
00000120  74 6f 20 72 65 61 64 20  61 72 67 75 6d 65 6e 74  |to read argument|
00000130  73 2e 20 54 68 65 79 20  61 72 65 0d 47 73 69 6e  |s. They are.Gsin|
00000140  69 74 20 61 74 20 26 46  46 43 32 20 61 6e 64 20  |it at &FFC2 and |
00000150  47 73 72 65 61 64 20 61  74 20 26 46 46 43 35 2e  |Gsread at &FFC5.|
00000160  0d 0d 20 20 47 73 69 6e  69 74 20 73 68 6f 75 6c  |..  Gsinit shoul|
00000170  64 20 62 65 20 75 73 65  64 20 74 6f 20 69 6e 69  |d be used to ini|
00000180  74 69 61 6c 69 73 65 20  61 6e 20 61 72 67 75 6d  |tialise an argum|
00000190  65 6e 74 20 77 68 69 63  68 20 69 73 20 74 6f 20  |ent which is to |
000001a0  62 65 20 72 65 61 64 0d  75 73 69 6e 67 20 47 73  |be read.using Gs|
000001b0  72 65 61 64 2e 20 47 73  69 6e 69 74 20 75 73 65  |read. Gsinit use|
000001c0  73 20 74 68 65 20 74 65  78 74 20 70 6f 69 6e 74  |s the text point|
000001d0  65 72 73 20 61 74 20 26  46 32 20 61 6e 64 20 26  |ers at &F2 and &|
000001e0  46 33 20 77 69 74 68 20  61 6e 0d 6f 66 66 73 65  |F3 with an.offse|
000001f0  74 20 69 6e 20 74 68 65  20 59 20 72 65 67 69 73  |t in the Y regis|
00000200  74 65 72 20 74 6f 20 69  64 65 6e 74 69 66 79 20  |ter to identify |
00000210  74 68 65 20 61 72 67 75  6d 65 6e 74 20 61 64 64  |the argument add|
00000220  72 65 73 73 2e 20 54 68  65 0d 61 72 67 75 6d 65  |ress. The.argume|
00000230  6e 74 20 63 61 6e 20 62  65 20 65 6e 63 6c 6f 73  |nt can be enclos|
00000240  65 64 20 62 79 20 71 75  6f 74 61 74 69 6f 6e 20  |ed by quotation |
00000250  6d 61 72 6b 73 20 62 75  74 20 69 74 20 64 6f 65  |marks but it doe|
00000260  73 20 6e 6f 74 20 68 61  76 65 20 74 6f 0d 62 65  |s not have to.be|
00000270  2e 20 47 73 69 6e 69 74  20 69 73 20 75 73 65 64  |. Gsinit is used|
00000280  20 74 6f 20 73 74 72 69  70 20 6f 66 66 20 61 6e  | to strip off an|
00000290  79 20 6c 65 61 64 69 6e  67 20 73 70 61 63 65 73  |y leading spaces|
000002a0  20 61 6e 64 20 74 6f 20  73 65 74 20 75 70 20 61  | and to set up a|
000002b0  6e 0d 69 6e 66 6f 72 6d  61 74 69 6f 6e 20 62 79  |n.information by|
000002c0  74 65 20 69 6e 20 7a 65  72 6f 20 70 61 67 65 20  |te in zero page |
000002d0  77 68 69 63 68 20 69 6e  64 69 63 61 74 65 73 20  |which indicates |
000002e0  74 68 65 20 74 65 72 6d  69 6e 61 74 69 6f 6e 0d  |the termination.|
000002f0  63 68 61 72 61 63 74 65  72 20 6f 66 20 74 68 65  |character of the|
00000300  20 61 72 67 75 6d 65 6e  74 2e 0d 0d 20 20 42 65  | argument...  Be|
00000310  66 6f 72 65 20 63 61 6c  6c 69 6e 67 20 47 73 69  |fore calling Gsi|
00000320  6e 69 74 20 79 6f 75 20  73 68 6f 75 6c 64 20 63  |nit you should c|
00000330  6c 65 61 72 20 74 68 65  20 63 61 72 72 79 20 66  |lear the carry f|
00000340  6c 61 67 20 69 66 20 79  6f 75 20 77 61 6e 74 0d  |lag if you want.|
00000350  74 68 65 20 73 65 63 6f  6e 64 20 71 75 6f 74 61  |the second quota|
00000360  74 69 6f 6e 20 6d 61 72  6b 2c 20 74 68 65 20 66  |tion mark, the f|
00000370  69 72 73 74 20 73 70 61  63 65 20 77 69 74 68 69  |irst space withi|
00000380  6e 20 74 68 65 20 61 72  67 75 6d 65 6e 74 2c 20  |n the argument, |
00000390  6f 72 20 61 0d 63 61 72  72 69 61 67 65 20 72 65  |or a.carriage re|
000003a0  74 75 72 6e 20 61 73 20  74 68 65 20 74 65 72 6d  |turn as the term|
000003b0  69 6e 61 74 69 6e 67 20  63 68 61 72 61 63 74 65  |inating characte|
000003c0  72 2e 20 59 6f 75 20 73  68 6f 75 6c 64 20 73 65  |r. You should se|
000003d0  74 20 74 68 65 20 63 61  72 72 79 0d 66 6c 61 67  |t the carry.flag|
000003e0  20 62 65 66 6f 72 65 20  63 61 6c 6c 69 6e 67 20  | before calling |
000003f0  47 73 69 6e 69 74 20 69  66 20 79 6f 75 20 64 6f  |Gsinit if you do|
00000400  20 6e 6f 74 20 77 61 6e  74 20 61 20 73 70 61 63  | not want a spac|
00000410  65 20 74 6f 20 62 65 20  72 65 63 6f 67 6e 69 73  |e to be recognis|
00000420  65 64 0d 61 73 20 61 20  74 65 72 6d 69 6e 61 74  |ed.as a terminat|
00000430  69 6e 67 20 63 68 61 72  61 63 74 65 72 2e 20 49  |ing character. I|
00000440  66 20 69 6e 20 64 6f 75  62 74 2c 20 73 65 74 20  |f in doubt, set |
00000450  74 68 65 20 63 61 72 72  79 20 66 6c 61 67 20 62  |the carry flag b|
00000460  65 66 6f 72 65 0d 63 61  6c 6c 69 6e 67 20 47 73  |efore.calling Gs|
00000470  69 6e 69 74 2e 0d 0d 20  20 41 66 74 65 72 20 63  |init...  After c|
00000480  61 6c 6c 69 6e 67 20 47  73 69 6e 69 74 20 74 68  |alling Gsinit th|
00000490  65 20 59 20 72 65 67 69  73 74 65 72 20 63 6f 6e  |e Y register con|
000004a0  74 61 69 6e 73 20 61 6e  20 6f 66 66 73 65 74 20  |tains an offset |
000004b0  74 6f 20 74 68 65 20 66  69 72 73 74 0d 63 68 61  |to the first.cha|
000004c0  72 61 63 74 65 72 20 6f  66 20 74 68 65 20 61 72  |racter of the ar|
000004d0  67 75 6d 65 6e 74 20 61  6e 64 20 74 68 65 20 61  |gument and the a|
000004e0  63 63 75 6d 75 6c 61 74  6f 72 20 63 6f 6e 74 61  |ccumulator conta|
000004f0  69 6e 73 20 74 68 65 20  66 69 72 73 74 0d 63 68  |ins the first.ch|
00000500  61 72 61 63 74 65 72 20  6f 66 20 74 68 65 20 61  |aracter of the a|
00000510  72 67 75 6d 65 6e 74 2e  20 54 68 65 20 7a 65 72  |rgument. The zer|
00000520  6f 20 66 6c 61 67 20 69  73 20 73 65 74 20 69 66  |o flag is set if|
00000530  20 74 68 65 20 61 72 67  75 6d 65 6e 74 20 69 73  | the argument is|
00000540  20 61 0d 6e 75 6c 6c 20  73 74 72 69 6e 67 2e 0d  | a.null string..|
00000550  0d 20 20 46 6f 72 20 65  78 61 6d 70 6c 65 2c 20  |.  For example, |
00000560  69 6d 61 67 69 6e 65 20  79 6f 75 20 68 61 76 65  |imagine you have|
00000570  20 74 79 70 65 64 20 2a  43 55 52 53 4f 52 20 4f  | typed *CURSOR O|
00000580  4e 20 61 6e 64 20 74 68  65 20 69 6e 74 65 72 70  |N and the interp|
00000590  72 65 74 65 72 0d 68 61  73 20 72 65 63 6f 67 6e  |reter.has recogn|
000005a0  69 73 65 64 20 74 68 65  20 63 6f 6d 6d 61 6e 64  |ised the command|
000005b0  20 43 55 52 53 4f 52 2e  20 42 65 66 6f 72 65 20  | CURSOR. Before |
000005c0  63 61 6c 6c 69 6e 67 20  47 73 69 6e 69 74 2c 20  |calling Gsinit, |
000005d0  74 68 65 20 74 65 78 74  0d 70 6f 69 6e 74 65 72  |the text.pointer|
000005e0  73 20 61 74 20 26 46 32  20 61 6e 64 20 26 46 33  |s at &F2 and &F3|
000005f0  20 77 69 6c 6c 20 70 6f  69 6e 74 20 74 6f 20 74  | will point to t|
00000600  68 65 20 63 6f 6d 6d 61  6e 64 20 77 69 74 68 20  |he command with |
00000610  74 68 65 20 6f 66 66 73  65 74 20 69 6e 20 59 0d  |the offset in Y.|
00000620  70 6f 69 6e 74 69 6e 67  20 74 6f 20 74 68 65 20  |pointing to the |
00000630  73 65 63 6f 6e 64 20 52  20 6f 66 20 43 55 52 53  |second R of CURS|
00000640  4f 52 2e 20 41 66 74 65  72 20 63 61 6c 6c 69 6e  |OR. After callin|
00000650  67 20 47 73 69 6e 69 74  20 74 68 65 20 6f 66 66  |g Gsinit the off|
00000660  73 65 74 20 69 6e 0d 59  20 77 69 6c 6c 20 70 6f  |set in.Y will po|
00000670  69 6e 74 20 74 6f 20 74  68 65 20 4f 20 6f 66 20  |int to the O of |
00000680  4f 4e 2c 20 74 68 65 20  7a 65 72 6f 20 66 6c 61  |ON, the zero fla|
00000690  67 20 77 69 6c 6c 20 62  65 20 63 6c 65 61 72 2c  |g will be clear,|
000006a0  20 61 6e 64 20 74 68 65  0d 74 65 72 6d 69 6e 61  | and the.termina|
000006b0  74 69 6e 67 20 63 68 61  72 61 63 74 65 72 20 77  |ting character w|
000006c0  69 6c 6c 20 62 65 20 74  68 65 20 63 61 72 72 69  |ill be the carri|
000006d0  61 67 65 20 72 65 74 75  72 6e 20 61 66 74 65 72  |age return after|
000006e0  20 74 68 65 20 4e 20 6f  66 20 4f 4e 2e 0d 49 66  | the N of ON..If|
000006f0  20 4f 4e 20 69 73 20 65  6e 63 6c 6f 73 65 64 20  | ON is enclosed |
00000700  62 79 20 71 75 6f 74 61  74 69 6f 6e 20 6d 61 72  |by quotation mar|
00000710  6b 73 20 74 68 65 20 6f  66 66 73 65 74 20 69 6e  |ks the offset in|
00000720  20 59 20 77 69 6c 6c 20  73 74 69 6c 6c 20 70 6f  | Y will still po|
00000730  69 6e 74 0d 74 6f 20 74  68 65 20 4f 20 6f 66 20  |int.to the O of |
00000740  4f 4e 20 61 6e 64 20 74  68 65 20 7a 65 72 6f 20  |ON and the zero |
00000750  66 6c 61 67 20 77 69 6c  6c 20 62 65 20 63 6c 65  |flag will be cle|
00000760  61 72 2c 20 62 75 74 20  74 68 65 20 74 65 72 6d  |ar, but the term|
00000770  69 6e 61 74 69 6e 67 0d  63 68 61 72 61 63 74 65  |inating.characte|
00000780  72 20 77 69 6c 6c 20 62  65 20 74 68 65 20 73 65  |r will be the se|
00000790  63 6f 6e 64 20 71 75 6f  74 61 74 69 6f 6e 20 6d  |cond quotation m|
000007a0  61 72 6b 2e 20 49 66 20  61 6e 20 61 72 67 75 6d  |ark. If an argum|
000007b0  65 6e 74 20 69 73 20 6e  6f 74 0d 74 79 70 65 64  |ent is not.typed|
000007c0  20 6f 72 20 69 66 20 2a  43 55 52 53 4f 52 20 22  | or if *CURSOR "|
000007d0  22 20 69 73 20 74 79 70  65 64 20 74 68 65 20 7a  |" is typed the z|
000007e0  65 72 6f 20 66 6c 61 67  20 77 69 6c 6c 20 62 65  |ero flag will be|
000007f0  20 73 65 74 20 6f 6e 20  72 65 74 75 72 6e 0d 66  | set on return.f|
00000800  72 6f 6d 20 47 73 69 6e  69 74 2e 20 46 69 67 75  |rom Gsinit. Figu|
00000810  72 65 20 35 2e 31 20 73  68 6f 77 73 20 74 68 65  |re 5.1 shows the|
00000820  20 6f 66 66 73 65 74 20  69 6e 20 74 68 65 20 59  | offset in the Y|
00000830  20 72 65 67 69 73 74 65  72 20 70 6f 69 6e 74 69  | register pointi|
00000840  6e 67 20 74 6f 0d 74 68  65 20 65 6e 64 20 6f 66  |ng to.the end of|
00000850  20 74 68 65 20 63 6f 6d  6d 61 6e 64 20 62 65 66  | the command bef|
00000860  6f 72 65 20 63 61 6c 6c  69 6e 67 20 47 73 69 6e  |ore calling Gsin|
00000870  69 74 20 61 6e 64 20 70  6f 69 6e 74 69 6e 67 20  |it and pointing |
00000880  74 6f 20 74 68 65 0d 62  65 67 69 6e 6e 69 6e 67  |to the.beginning|
00000890  20 6f 66 20 74 68 65 20  61 72 67 75 6d 65 6e 74  | of the argument|
000008a0  20 61 66 74 65 72 20 63  61 6c 6c 69 6e 67 20 47  | after calling G|
000008b0  73 69 6e 69 74 2e 0d 0d  0d 0d 0d 20 20 20 20 20  |sinit......     |
000008c0  20 20 2b 2d 20 59 20 62  65 66 6f 72 65 20 47 73  |  +- Y before Gs|
000008d0  69 6e 69 74 20 2d 2b 0d  20 20 20 20 20 20 20 21  |init -+.       !|
000008e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000008f0  20 20 20 21 0d 20 20 20  20 20 20 20 76 20 20 20  |   !.       v   |
00000900  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000910  76 0d 3e 2a 43 55 52 53  4f 52 20 4f 4e 20 20 20  |v.>*CURSOR ON   |
00000920  20 20 20 20 20 20 3e 2a  43 55 52 53 4f 52 20 22  |      >*CURSOR "|
00000930  4f 4e 22 0d 20 20 20 20  20 20 20 20 20 5e 20 20  |ON".         ^  |
00000940  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000950  20 20 5e 0d 20 20 20 20  20 20 20 20 20 21 20 20  |  ^.         !  |
00000960  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000970  20 20 21 0d 20 20 20 20  20 20 20 20 20 2b 2d 2d  |  !.         +--|
00000980  20 59 20 61 66 74 65 72  20 47 73 69 6e 69 74 20  | Y after Gsinit |
00000990  2d 2d 2b 0d 0d 46 69 67  75 72 65 20 35 2e 31 20  |--+..Figure 5.1 |
000009a0  54 68 65 20 6f 66 66 73  65 74 20 69 6e 20 59 20  |The offset in Y |
000009b0  62 65 66 6f 72 65 20 61  6e 64 20 61 66 74 65 72  |before and after|
000009c0  20 63 61 6c 6c 69 6e 67  20 47 73 69 6e 69 74 2e  | calling Gsinit.|
000009d0  0d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.---------------|
000009e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000a00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0d 0d 0d 0d  |------------....|
00000a10  0d 20 20 47 73 72 65 61  64 20 69 73 20 75 73 65  |.  Gsread is use|
00000a20  64 20 74 6f 20 72 65 61  64 20 65 61 63 68 20 62  |d to read each b|
00000a30  79 74 65 20 6f 66 20 74  68 65 20 61 72 67 75 6d  |yte of the argum|
00000a40  65 6e 74 2e 20 54 68 69  73 20 72 6f 75 74 69 6e  |ent. This routin|
00000a50  65 0d 73 68 6f 75 6c 64  20 6f 6e 6c 79 20 62 65  |e.should only be|
00000a60  20 75 73 65 64 20 66 6f  6c 6c 6f 77 69 6e 67 20  | used following |
00000a70  61 20 47 73 69 6e 69 74  20 63 61 6c 6c 20 6f 72  |a Gsinit call or|
00000a80  20 61 20 70 72 65 76 69  6f 75 73 20 47 73 72 65  | a previous Gsre|
00000a90  61 64 2e 0d 46 6f 6c 6c  6f 77 69 6e 67 20 47 73  |ad..Following Gs|
00000aa0  69 6e 69 74 20 74 68 65  20 74 65 78 74 20 70 6f  |init the text po|
00000ab0  69 6e 74 65 72 73 20 61  6e 64 20 59 20 72 65 67  |inters and Y reg|
00000ac0  69 73 74 65 72 20 77 69  6c 6c 20 70 6f 69 6e 74  |ister will point|
00000ad0  20 74 6f 20 74 68 65 0d  66 69 72 73 74 20 62 79  | to the.first by|
00000ae0  74 65 20 6f 66 20 74 68  65 20 61 72 67 75 6d 65  |te of the argume|
00000af0  6e 74 2e 20 41 66 74 65  72 20 63 61 6c 6c 69 6e  |nt. After callin|
00000b00  67 20 47 73 72 65 61 64  20 74 68 65 20 61 63 63  |g Gsread the acc|
00000b10  75 6d 75 6c 61 74 6f 72  0d 63 6f 6e 74 61 69 6e  |umulator.contain|
00000b20  73 20 74 68 65 20 63 68  61 72 61 63 74 65 72 20  |s the character |
00000b30  72 65 61 64 20 66 72 6f  6d 20 74 68 65 20 61 72  |read from the ar|
00000b40  67 75 6d 65 6e 74 2c 20  59 20 69 73 20 69 6e 63  |gument, Y is inc|
00000b50  72 65 6d 65 6e 74 65 64  20 74 6f 0d 70 6f 69 6e  |remented to.poin|
00000b60  74 20 74 6f 20 74 68 65  20 6e 65 78 74 20 63 68  |t to the next ch|
00000b70  61 72 61 63 74 65 72 2c  20 58 20 69 73 20 70 72  |aracter, X is pr|
00000b80  65 73 65 72 76 65 64 20  61 6e 64 20 74 68 65 20  |eserved and the |
00000b90  63 61 72 72 79 20 66 6c  61 67 20 69 73 20 73 65  |carry flag is se|
00000ba0  74 0d 69 66 20 74 68 65  20 74 65 72 6d 69 6e 61  |t.if the termina|
00000bb0  74 69 6e 67 20 63 68 61  72 61 63 74 65 72 20 68  |ting character h|
00000bc0  61 73 20 62 65 65 6e 20  72 65 61 64 2e 0d 0d 20  |as been read... |
00000bd0  20 54 68 65 20 65 66 66  65 63 74 20 6f 66 20 63  | The effect of c|
00000be0  61 6c 6c 69 6e 67 20 47  73 72 65 61 64 20 69 73  |alling Gsread is|
00000bf0  20 73 69 6d 69 6c 61 72  20 74 6f 2c 20 62 75 74  | similar to, but|
00000c00  20 6e 6f 74 20 74 68 65  20 73 61 6d 65 20 61 73  | not the same as|
00000c10  3a 0d 0d 20 20 4c 44 41  20 28 26 46 32 29 2c 59  |:..  LDA (&F2),Y|
00000c20  0d 20 20 49 4e 59 0d 0d  20 20 54 68 65 20 64 69  |.  INY..  The di|
00000c30  66 66 65 72 65 6e 63 65  20 65 78 69 73 74 73 20  |fference exists |
00000c40  62 65 63 61 75 73 65 20  47 73 72 65 61 64 20 74  |because Gsread t|
00000c50  65 73 74 73 20 74 68 65  20 63 6f 6e 74 65 6e 74  |ests the content|
00000c60  20 6f 66 20 41 20 74 6f  20 73 65 65 0d 69 66 20  | of A to see.if |
00000c70  74 68 65 20 74 65 72 6d  69 6e 61 74 69 6e 67 20  |the terminating |
00000c80  63 68 61 72 61 63 74 65  72 2c 20 61 6e 64 20 68  |character, and h|
00000c90  65 6e 63 65 20 74 68 65  20 65 6e 64 20 6f 66 20  |ence the end of |
00000ca0  74 68 65 20 61 72 67 75  6d 65 6e 74 2c 20 68 61  |the argument, ha|
00000cb0  73 0d 62 65 65 6e 20 72  65 61 64 2e 20 54 68 65  |s.been read. The|
00000cc0  20 74 65 72 6d 69 6e 61  74 69 6e 67 20 63 68 61  | terminating cha|
00000cd0  72 61 63 74 65 72 20 63  61 6e 20 62 65 20 65 69  |racter can be ei|
00000ce0  74 68 65 72 20 61 20 73  65 63 6f 6e 64 20 71 75  |ther a second qu|
00000cf0  6f 74 61 74 69 6f 6e 0d  6d 61 72 6b 2c 20 61 20  |otation.mark, a |
00000d00  73 70 61 63 65 20 6f 72  20 61 20 63 61 72 72 69  |space or a carri|
00000d10  61 67 65 20 72 65 74 75  72 6e 20 61 73 20 64 65  |age return as de|
00000d20  66 69 6e 65 64 20 62 79  20 47 73 69 6e 69 74 2e  |fined by Gsinit.|
00000d30  20 55 73 69 6e 67 20 47  73 69 6e 69 74 0d 74 6f  | Using Gsinit.to|
00000d40  20 69 6e 69 74 69 61 6c  69 73 65 20 61 6e 20 61  | initialise an a|
00000d50  72 67 75 6d 65 6e 74 20  61 6e 64 20 47 73 72 65  |rgument and Gsre|
00000d60  61 64 20 74 6f 20 72 65  61 64 20 69 74 20 69 73  |ad to read it is|
00000d70  20 6d 6f 72 65 20 76 65  72 73 61 74 69 6c 65 20  | more versatile |
00000d80  74 68 61 6e 0d 73 69 6d  70 6c 79 20 72 65 61 64  |than.simply read|
00000d90  69 6e 67 20 74 68 65 20  61 72 67 75 6d 65 6e 74  |ing the argument|
00000da0  20 75 73 69 6e 67 20 70  6f 73 74 2d 69 6e 64 65  | using post-inde|
00000db0  78 65 64 20 69 6e 64 69  72 65 63 74 20 61 64 64  |xed indirect add|
00000dc0  72 65 73 73 69 6e 67 0d  77 69 74 68 20 74 68 65  |ressing.with the|
00000dd0  20 74 65 78 74 20 70 6f  69 6e 74 65 72 73 2e 20  | text pointers. |
00000de0  54 68 65 20 64 69 66 66  65 72 65 6e 63 65 20 6d  |The difference m|
00000df0  61 79 20 73 65 65 6d 20  69 6e 73 69 67 6e 69 66  |ay seem insignif|
00000e00  69 63 61 6e 74 20 77 69  74 68 20 74 68 65 0d 73  |icant with the.s|
00000e10  69 6d 70 6c 65 20 65 78  61 6d 70 6c 65 20 75 73  |imple example us|
00000e20  65 64 20 61 62 6f 76 65  20 62 75 74 20 69 74 20  |ed above but it |
00000e30  69 73 20 75 73 65 66 75  6c 20 69 66 20 74 68 65  |is useful if the|
00000e40  20 61 72 67 75 6d 65 6e  74 20 69 73 20 61 20 6e  | argument is a n|
00000e50  75 6d 62 65 72 0d 77 68  65 6e 20 74 68 65 20 70  |umber.when the p|
00000e60  6c 61 63 65 20 76 61 6c  75 65 20 6f 66 20 61 20  |lace value of a |
00000e70  70 61 72 74 69 63 75 6c  61 72 20 63 68 61 72 61  |particular chara|
00000e80  63 74 65 72 20 64 65 70  65 6e 64 73 20 6f 6e 20  |cter depends on |
00000e90  69 74 73 0d 64 69 73 70  6c 61 63 65 6d 65 6e 74  |its.displacement|
00000ea0  20 66 72 6f 6d 20 74 68  65 20 74 65 72 6d 69 6e  | from the termin|
00000eb0  61 74 69 6e 67 20 63 68  61 72 61 63 74 65 72 2e  |ating character.|
00000ec0  20 52 65 61 64 69 6e 67  20 6e 75 6d 65 72 69 63  | Reading numeric|
00000ed0  61 6c 0d 61 72 67 75 6d  65 6e 74 73 20 77 69 6c  |al.arguments wil|
00000ee0  6c 20 62 65 20 63 6f 76  65 72 65 64 20 69 6e 20  |l be covered in |
00000ef0  6d 6f 64 75 6c 65 20 31  31 2e 0d 0d 20 20 42 65  |module 11...  Be|
00000f00  63 61 75 73 65 20 74 68  65 20 65 66 66 65 63 74  |cause the effect|
00000f10  20 6f 66 20 75 73 69 6e  67 20 47 73 72 65 61 64  | of using Gsread|
00000f20  20 69 73 20 76 65 72 79  20 73 69 6d 69 6c 61 72  | is very similar|
00000f30  20 74 6f 20 72 65 61 64  69 6e 67 20 61 0d 73 74  | to reading a.st|
00000f40  72 69 6e 67 20 75 73 69  6e 67 20 70 6f 73 74 2d  |ring using post-|
00000f50  69 6e 64 65 78 65 64 20  69 6e 64 69 72 65 63 74  |indexed indirect|
00000f60  20 61 64 64 72 65 73 73  69 6e 67 20 77 69 74 68  | addressing with|
00000f70  20 74 68 65 20 74 65 78  74 20 70 6f 69 6e 74 65  | the text pointe|
00000f80  72 73 0d 79 6f 75 20 6d  61 79 20 62 65 20 74 65  |rs.you may be te|
00000f90  6d 70 74 65 64 20 74 6f  20 75 73 65 20 47 73 72  |mpted to use Gsr|
00000fa0  65 61 64 20 69 6e 20 74  68 65 20 69 6e 74 65 72  |ead in the inter|
00000fb0  70 72 65 74 65 72 20 74  6f 20 72 65 61 64 20 74  |preter to read t|
00000fc0  68 65 0d 75 6e 72 65 63  6f 67 6e 69 73 65 64 20  |he.unrecognised |
00000fd0  63 6f 6d 6d 61 6e 64 2e  20 49 66 20 79 6f 75 20  |command. If you |
00000fe0  64 6f 20 79 6f 75 20 77  69 6c 6c 20 66 69 6e 64  |do you will find|
00000ff0  20 74 68 61 74 20 6d 6f  73 74 20 6f 66 20 74 68  | that most of th|
00001000  65 20 74 69 6d 65 20 69  74 0d 77 69 6c 6c 20 77  |e time it.will w|
00001010  6f 72 6b 20 62 75 74 2c  20 73 6f 6f 6e 65 72 20  |ork but, sooner |
00001020  6f 72 20 6c 61 74 65 72  2c 20 79 6f 75 20 77 69  |or later, you wi|
00001030  6c 6c 20 73 74 61 72 74  20 67 65 74 74 69 6e 67  |ll start getting|
00001040  20 6d 79 73 74 65 72 69  6f 75 73 20 22 62 61 64  | mysterious "bad|
00001050  0d 73 74 72 69 6e 67 22  20 65 72 72 6f 72 20 6d  |.string" error m|
00001060  65 73 73 61 67 65 73 2e  20 44 6f 6e 27 74 20 62  |essages. Don't b|
00001070  65 20 74 65 6d 70 74 65  64 20 69 6e 74 6f 20 77  |e tempted into w|
00001080  61 73 74 69 6e 67 20 79  6f 75 72 20 74 69 6d 65  |asting your time|
00001090  20 75 73 69 6e 67 0d 47  73 72 65 61 64 20 69 6e  | using.Gsread in|
000010a0  20 74 68 65 20 69 6e 74  65 72 70 72 65 74 65 72  | the interpreter|
000010b0  2e 20 53 74 69 63 6b 20  77 69 74 68 20 74 68 65  |. Stick with the|
000010c0  20 6d 65 74 68 6f 64 20  64 65 6d 6f 6e 73 74 72  | method demonstr|
000010d0  61 74 65 64 20 69 6e 0d  4d 6f 64 75 6c 65 20 33  |ated in.Module 3|
000010e0  2e 0d 0d 20 20 46 69 67  75 72 65 20 35 2e 32 20  |...  Figure 5.2 |
000010f0  73 68 6f 77 73 20 68 6f  77 20 74 68 65 20 69 6e  |shows how the in|
00001100  74 65 72 70 72 65 74 65  72 20 75 73 65 64 20 69  |terpreter used i|
00001110  6e 20 74 68 65 20 6c 61  73 74 20 74 77 6f 20 6d  |n the last two m|
00001120  6f 64 75 6c 65 73 0d 63  61 6e 20 62 65 20 6d 6f  |odules.can be mo|
00001130  64 69 66 69 65 64 20 74  6f 20 72 65 61 64 20 61  |dified to read a|
00001140  6e 20 61 72 67 75 6d 65  6e 74 2e 0d 0d 0d 0d 0d  |n argument......|
00001150  0d 2e 66 6f 75 6e 64 0d  20 20 20 20 20 20 20 20  |..found.        |
00001160  20 53 45 43 20 20 20 20  20 20 20 20 20 20 20 5c  | SEC           \|
00001170  20 74 65 72 6d 69 6e 61  74 65 20 77 69 74 68 20  | terminate with |
00001180  52 65 74 75 72 6e 20 6f  72 20 22 0d 20 20 20 20  |Return or ".    |
00001190  20 20 20 20 20 4a 53 52  20 26 46 46 43 32 20 20  |     JSR &FFC2  |
000011a0  20 20 20 5c 20 69 6e 69  74 69 61 6c 69 73 65 20  |   \ initialise |
000011b0  61 72 67 75 6d 65 6e 74  20 77 69 74 68 20 47 73  |argument with Gs|
000011c0  69 6e 69 74 0d 20 20 20  20 20 20 20 20 20 42 45  |init.         BE|
000011d0  51 20 65 78 69 74 20 20  20 20 20 20 5c 20 62 72  |Q exit      \ br|
000011e0  61 6e 63 68 20 69 66 20  6e 75 6c 6c 20 61 72 67  |anch if null arg|
000011f0  75 6d 65 6e 74 0d 20 20  20 20 20 20 20 20 20 4a  |ument.         J|
00001200  53 52 20 26 46 46 43 35  20 20 20 20 20 5c 20 72  |SR &FFC5     \ r|
00001210  65 61 64 20 66 69 72 73  74 20 63 68 61 72 61 63  |ead first charac|
00001220  74 65 72 20 77 69 74 68  20 47 73 72 65 61 64 0d  |ter with Gsread.|
00001230  20 20 20 20 20 20 20 20  20 42 43 53 20 65 78 69  |         BCS exi|
00001240  74 20 20 20 20 20 20 5c  20 62 72 61 6e 63 68 20  |t      \ branch |
00001250  69 66 20 65 6e 64 20 6f  66 20 61 72 67 75 6d 65  |if end of argume|
00001260  6e 74 0d 20 20 20 20 20  20 20 20 20 41 4e 44 20  |nt.         AND |
00001270  23 26 44 46 20 20 20 20  20 20 5c 20 66 6f 72 63  |#&DF      \ forc|
00001280  65 20 75 70 70 65 72 20  63 61 73 65 0d 20 20 20  |e upper case.   |
00001290  20 20 20 20 20 20 20 2e  0d 20 20 20 20 20 20 20  |       ..       |
000012a0  20 20 20 2e 0d 20 20 20  20 20 20 20 20 20 20 2e  |   ..          .|
000012b0  0d 2e 65 78 69 74 0d 20  20 20 20 20 20 20 20 20  |..exit.         |
000012c0  50 4c 41 20 20 20 20 20  20 20 20 20 20 20 5c 20  |PLA           \ |
000012d0  64 69 73 63 61 72 64 20  59 0d 20 20 20 20 20 20  |discard Y.      |
000012e0  20 20 20 50 4c 41 20 20  20 20 20 20 20 20 20 20  |   PLA          |
000012f0  20 5c 20 64 69 73 63 61  72 64 20 58 0d 20 20 20  | \ discard X.   |
00001300  20 20 20 20 20 20 50 4c  41 20 20 20 20 20 20 20  |      PLA       |
00001310  20 20 20 20 5c 20 64 69  73 63 61 72 64 20 41 0d  |    \ discard A.|
00001320  20 20 20 20 20 20 20 20  20 4c 44 41 20 23 30 20  |         LDA #0 |
00001330  20 20 20 20 20 20 20 5c  20 73 65 72 76 69 63 65  |       \ service|
00001340  20 63 61 6c 6c 20 72 65  63 6f 67 6e 69 73 65 64  | call recognised|
00001350  0d 20 20 20 20 20 20 20  20 20 52 54 53 20 20 20  |.         RTS   |
00001360  20 20 20 20 20 20 20 20  5c 20 72 65 74 75 72 6e  |        \ return|
00001370  20 74 6f 20 4d 4f 53 0d  0d 46 69 67 75 72 65 20  | to MOS..Figure |
00001380  35 2e 32 20 55 73 69 6e  67 20 47 73 69 6e 69 74  |5.2 Using Gsinit|
00001390  20 61 6e 64 20 47 73 72  65 61 64 20 74 6f 20 72  | and Gsread to r|
000013a0  65 61 64 20 61 6e 20 61  72 67 75 6d 65 6e 74 2e  |ead an argument.|
000013b0  0d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.---------------|
000013c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000013e0  2d 2d 2d 2d 2d 2d 2d 2d  0d 0d 0d 0d 0d 20 20 54  |--------.....  T|
000013f0  68 65 20 63 61 72 72 79  20 66 6c 61 67 20 69 73  |he carry flag is|
00001400  20 73 65 74 20 62 65 66  6f 72 65 20 63 61 6c 6c  | set before call|
00001410  69 6e 67 20 47 73 69 6e  69 74 2e 20 54 68 65 20  |ing Gsinit. The |
00001420  74 65 72 6d 69 6e 61 74  69 6e 67 0d 63 68 61 72  |terminating.char|
00001430  61 63 74 65 72 20 6f 66  20 74 68 65 20 61 72 67  |acter of the arg|
00001440  75 6d 65 6e 74 20 77 69  6c 6c 20 62 65 20 61 20  |ument will be a |
00001450  63 61 72 72 69 61 67 65  20 72 65 74 75 72 6e 20  |carriage return |
00001460  6f 72 20 61 20 73 65 63  6f 6e 64 0d 71 75 6f 74  |or a second.quot|
00001470  61 74 69 6f 6e 20 6d 61  72 6b 2e 20 41 66 74 65  |ation mark. Afte|
00001480  72 20 73 65 74 74 69 6e  67 20 74 68 65 20 63 61  |r setting the ca|
00001490  72 72 79 20 66 6c 61 67  20 47 73 69 6e 69 74 20  |rry flag Gsinit |
000014a0  69 73 20 63 61 6c 6c 65  64 20 74 6f 0d 69 6e 69  |is called to.ini|
000014b0  74 69 61 6c 69 73 65 20  74 68 65 20 61 72 67 75  |tialise the argu|
000014c0  6d 65 6e 74 2e 20 49 66  20 74 68 65 20 61 72 67  |ment. If the arg|
000014d0  75 6d 65 6e 74 20 69 73  20 6e 75 6c 6c 20 47 73  |ument is null Gs|
000014e0  69 6e 69 74 20 72 65 74  75 72 6e 73 20 77 69 74  |init returns wit|
000014f0  68 0d 74 68 65 20 7a 65  72 6f 20 66 6c 61 67 20  |h.the zero flag |
00001500  73 65 74 2e 20 54 68 69  73 20 63 61 6e 20 62 65  |set. This can be|
00001510  20 74 65 73 74 65 64 20  61 6e 64 20 62 72 61 6e  | tested and bran|
00001520  63 68 20 74 6f 20 65 78  69 74 20 69 66 20 74 68  |ch to exit if th|
00001530  65 72 65 20 69 73 0d 6e  6f 74 68 69 6e 67 20 74  |ere is.nothing t|
00001540  6f 20 72 65 61 64 2e 20  49 66 20 74 68 65 20 7a  |o read. If the z|
00001550  65 72 6f 20 66 6c 61 67  20 69 73 20 63 6c 65 61  |ero flag is clea|
00001560  72 20 74 68 65 72 65 20  69 73 20 61 6e 20 61 72  |r there is an ar|
00001570  67 75 6d 65 6e 74 20 74  6f 20 62 65 0d 72 65 61  |gument to be.rea|
00001580  64 20 62 79 20 63 61 6c  6c 69 6e 67 20 47 73 72  |d by calling Gsr|
00001590  65 61 64 20 66 6f 72 20  65 61 63 68 20 63 68 61  |ead for each cha|
000015a0  72 61 63 74 65 72 2e 20  47 73 72 65 61 64 20 77  |racter. Gsread w|
000015b0  69 6c 6c 20 72 65 74 75  72 6e 20 77 69 74 68 20  |ill return with |
000015c0  74 68 65 0d 63 61 72 72  79 20 66 6c 61 67 20 73  |the.carry flag s|
000015d0  65 74 20 77 68 65 6e 20  74 68 65 20 74 65 72 6d  |et when the term|
000015e0  69 6e 61 74 69 6e 67 20  63 68 61 72 61 63 74 65  |inating characte|
000015f0  72 20 69 73 20 72 65 61  64 20 61 6e 64 20 61 6e  |r is read and an|
00001600  0d 61 70 70 72 6f 70 72  69 61 74 65 20 62 72 61  |.appropriate bra|
00001610  6e 63 68 20 63 61 6e 20  62 65 20 6d 61 64 65 20  |nch can be made |
00001620  61 66 74 65 72 20 74 65  73 74 69 6e 67 20 74 68  |after testing th|
00001630  65 20 63 61 72 72 79 20  66 6c 61 67 2e 0d 0d 20  |e carry flag... |
00001640  20 54 68 69 73 20 6d 65  74 68 6f 64 20 6f 66 20  | This method of |
00001650  72 65 61 64 69 6e 67 20  61 6e 20 61 72 67 75 6d  |reading an argum|
00001660  65 6e 74 20 68 61 73 20  62 65 65 6e 20 75 73 65  |ent has been use|
00001670  64 20 69 6e 20 74 68 65  20 70 72 6f 67 72 61 6e  |d in the progran|
00001680  0d 43 55 52 53 4f 52 2e  20 57 68 65 6e 20 74 68  |.CURSOR. When th|
00001690  65 20 69 6e 74 65 72 70  72 65 74 65 72 20 28 6c  |e interpreter (l|
000016a0  69 6e 65 73 20 32 38 30  2d 35 34 30 29 20 72 65  |ines 280-540) re|
000016b0  63 6f 67 6e 69 73 65 73  20 74 68 65 20 63 6f 6d  |cognises the com|
000016c0  6d 61 6e 64 0d 2a 43 55  52 53 4f 52 20 69 74 20  |mand.*CURSOR it |
000016d0  70 61 73 73 65 73 20 63  6f 6e 74 72 6f 6c 20 74  |passes control t|
000016e0  6f 20 74 68 65 20 6c 61  62 65 6c 20 22 2e 66 6f  |o the label ".fo|
000016f0  75 6e 64 22 20 28 6c 69  6e 65 20 35 35 30 29 2e  |und" (line 550).|
00001700  20 54 68 65 0d 61 72 67  75 6d 65 6e 74 20 69 73  | The.argument is|
00001710  20 69 6e 69 74 69 61 6c  69 73 65 64 20 28 6c 69  | initialised (li|
00001720  6e 65 73 20 35 36 30 2d  35 37 30 29 20 61 6e 64  |nes 560-570) and|
00001730  20 74 68 65 20 61 72 67  75 6d 65 6e 74 20 69 73  | the argument is|
00001740  20 74 65 73 74 65 64 0d  28 6c 69 6e 65 20 35 38  | tested.(line 58|
00001750  30 29 2e 20 49 66 20 61  20 6e 75 6c 6c 20 61 72  |0). If a null ar|
00001760  67 75 6d 65 6e 74 20 69  73 20 64 65 74 65 63 74  |gument is detect|
00001770  65 64 20 74 68 65 20 70  72 6f 67 72 61 6d 20 72  |ed the program r|
00001780  65 74 75 72 6e 73 20 63  6f 6e 74 72 6f 6c 0d 74  |eturns control.t|
00001790  6f 20 74 68 65 20 4d 4f  53 20 77 69 74 68 20 41  |o the MOS with A|
000017a0  3d 30 20 28 6c 69 6e 65  73 20 38 36 30 2d 39 31  |=0 (lines 860-91|
000017b0  30 29 2e 20 49 66 20 61  6e 20 61 72 67 75 6d 65  |0). If an argume|
000017c0  6e 74 20 69 73 20 66 6f  75 6e 64 20 74 68 65 0d  |nt is found the.|
000017d0  70 72 6f 67 72 61 6d 20  65 78 70 65 63 74 73 20  |program expects |
000017e0  74 6f 20 72 65 61 64 20  65 69 74 68 65 72 20 4f  |to read either O|
000017f0  4e 20 6f 72 20 4f 46 46  2e 20 54 6f 20 74 65 73  |N or OFF. To tes|
00001800  74 20 66 6f 72 20 4f 4e  20 6f 72 20 4f 46 46 20  |t for ON or OFF |
00001810  74 68 65 0d 66 69 72 73  74 20 63 68 61 72 61 63  |the.first charac|
00001820  74 65 72 20 63 61 6e 20  62 65 20 73 6b 69 70 70  |ter can be skipp|
00001830  65 64 20 73 69 6e 63 65  20 69 74 20 73 68 6f 75  |ed since it shou|
00001840  6c 64 20 62 65 20 61 6e  20 22 4f 22 20 28 6c 69  |ld be an "O" (li|
00001850  6e 65 20 35 39 30 29 2e  0d 54 68 65 20 6e 65 78  |ne 590)..The nex|
00001860  74 20 63 68 61 72 61 63  74 65 72 20 69 73 20 72  |t character is r|
00001870  65 61 64 20 75 73 69 6e  67 20 47 73 72 65 61 64  |ead using Gsread|
00001880  20 28 6c 69 6e 65 20 36  30 30 29 20 61 6e 64 20  | (line 600) and |
00001890  74 65 73 74 65 64 20 66  6f 72 20 61 0d 74 65 72  |tested for a.ter|
000018a0  6d 69 6e 61 74 69 6e 67  20 63 68 61 72 61 63 74  |minating charact|
000018b0  65 72 20 28 6c 69 6e 65  20 36 31 30 29 20 61 6e  |er (line 610) an|
000018c0  64 20 65 69 74 68 65 72  20 22 46 22 20 28 6c 69  |d either "F" (li|
000018d0  6e 65 20 36 33 30 29 20  6f 72 20 22 4e 22 0d 28  |ne 630) or "N".(|
000018e0  6c 69 6e 65 20 36 35 30  29 2e 20 54 68 65 72 65  |line 650). There|
000018f0  20 69 73 20 6e 6f 20 6e  65 65 64 20 74 6f 20 72  | is no need to r|
00001900  65 61 64 20 61 6e 64 20  74 65 73 74 20 66 6f 72  |ead and test for|
00001910  20 74 68 65 20 73 65 63  6f 6e 64 20 46 20 6f 66  | the second F of|
00001920  20 4f 46 46 2e 0d 49 66  20 74 68 65 20 73 65 63  | OFF..If the sec|
00001930  6f 6e 64 20 63 68 61 72  61 63 74 65 72 20 6f 66  |ond character of|
00001940  20 74 68 65 20 61 72 67  75 6d 65 6e 74 20 69 73  | the argument is|
00001950  20 22 46 22 20 74 68 65  20 63 75 72 73 6f 72 20  | "F" the cursor |
00001960  69 73 20 73 77 69 74 63  68 65 64 0d 6f 66 66 20  |is switched.off |
00001970  28 6c 69 6e 65 73 20 36  39 30 2d 38 35 30 29 2c  |(lines 690-850),|
00001980  20 69 66 20 69 74 20 69  73 20 22 4e 22 20 74 68  | if it is "N" th|
00001990  65 20 63 75 72 73 6f 72  20 69 73 20 73 77 69 74  |e cursor is swit|
000019a0  63 68 65 64 20 6f 6e 20  28 6c 69 6e 65 73 0d 36  |ched on (lines.6|
000019b0  37 30 2d 38 35 30 29 2e  0d 0d 20 20 57 68 65 6e  |70-850)...  When|
000019c0  20 79 6f 75 20 6c 6f 61  64 20 74 68 65 20 6f 62  | you load the ob|
000019d0  6a 65 63 74 20 63 6f 64  65 20 67 65 6e 65 72 61  |ject code genera|
000019e0  74 65 64 20 62 79 20 43  55 52 53 4f 52 20 69 6e  |ted by CURSOR in|
000019f0  74 6f 20 53 57 52 20 74  6f 20 73 65 65 0d 68 6f  |to SWR to see.ho|
00001a00  77 20 69 74 20 77 6f 72  6b 73 20 69 74 20 69 73  |w it works it is|
00001a10  20 70 6f 73 73 69 62 6c  65 20 74 6f 20 64 65 63  | possible to dec|
00001a20  65 69 76 65 20 79 6f 75  72 73 65 6c 66 20 69 6e  |eive yourself in|
00001a30  74 6f 20 62 65 6c 69 65  76 69 6e 67 20 74 68 61  |to believing tha|
00001a40  74 0d 74 68 65 72 65 20  69 73 20 73 6f 6d 65 74  |t.there is somet|
00001a50  68 69 6e 67 20 77 72 6f  6e 67 20 77 69 74 68 20  |hing wrong with |
00001a60  69 74 2e 20 49 66 20 79  6f 75 20 74 79 70 65 20  |it. If you type |
00001a70  2a 43 55 52 53 4f 52 20  4f 46 46 20 61 6e 64 20  |*CURSOR OFF and |
00001a80  70 72 65 73 73 0d 52 65  74 75 72 6e 20 74 68 65  |press.Return the|
00001a90  20 63 75 72 73 6f 72 20  77 69 6c 6c 20 67 6f 20  | cursor will go |
00001aa0  6f 66 66 20 61 73 20 65  78 70 65 63 74 65 64 2e  |off as expected.|
00001ab0  20 54 79 70 65 20 2a 43  55 52 53 4f 52 20 4f 4e  | Type *CURSOR ON|
00001ac0  20 61 6e 64 20 69 74 20  77 69 6c 6c 0d 63 6f 6d  | and it will.com|
00001ad0  65 20 62 61 63 6b 20 6f  6e 2e 20 45 76 65 72 79  |e back on. Every|
00001ae0  74 68 69 6e 67 20 73 65  65 6d 73 20 4f 4b 2e 20  |thing seems OK. |
00001af0  54 79 70 65 20 2a 43 55  52 53 4f 52 20 4f 46 46  |Type *CURSOR OFF|
00001b00  20 61 6e 64 20 52 65 74  75 72 6e 20 61 6e 64 0d  | and Return and.|
00001b10  74 68 65 6e 20 74 79 70  65 20 2a 43 55 52 53 4f  |then type *CURSO|
00001b20  52 20 61 6e 64 20 52 65  74 75 72 6e 2e 20 54 68  |R and Return. Th|
00001b30  65 20 63 75 72 73 6f 72  20 73 74 61 79 73 20 6f  |e cursor stays o|
00001b40  66 66 20 62 65 63 61 75  73 65 20 79 6f 75 20 68  |ff because you h|
00001b50  61 76 65 0d 6e 6f 74 20  74 79 70 65 64 20 61 6e  |ave.not typed an|
00001b60  20 61 72 67 75 6d 65 6e  74 2e 20 45 76 65 72 79  | argument. Every|
00001b70  74 68 69 6e 67 20 69 73  20 73 74 69 6c 6c 20 4f  |thing is still O|
00001b80  4b 2e 20 4e 6f 77 20 75  73 65 20 74 68 65 20 63  |K. Now use the c|
00001b90  75 72 73 6f 72 20 6b 65  79 73 0d 74 6f 20 63 6f  |ursor keys.to co|
00001ba0  70 79 20 74 68 65 20 2a  43 55 52 53 4f 52 20 63  |py the *CURSOR c|
00001bb0  6f 6d 6d 61 6e 64 20 77  69 74 68 6f 75 74 20 61  |ommand without a|
00001bc0  6e 20 61 72 67 75 6d 65  6e 74 20 61 6e 64 20 70  |n argument and p|
00001bd0  72 65 73 73 20 52 65 74  75 72 6e 2e 20 54 68 65  |ress Return. The|
00001be0  0d 63 75 72 73 6f 72 20  63 6f 6d 65 73 20 62 61  |.cursor comes ba|
00001bf0  63 6b 20 6f 6e 20 77 68  65 6e 20 69 74 20 73 68  |ck on when it sh|
00001c00  6f 75 6c 64 20 68 61 76  65 20 73 74 61 79 65 64  |ould have stayed|
00001c10  20 6f 66 66 2e 20 54 68  69 73 20 77 69 6c 6c 20  | off. This will |
00001c20  68 61 70 70 65 6e 0d 62  65 63 61 75 73 65 20 79  |happen.because y|
00001c30  6f 75 20 77 69 6c 6c 20  72 65 2d 65 6e 61 62 6c  |ou will re-enabl|
00001c40  65 20 74 68 65 20 63 75  72 73 6f 72 20 77 69 74  |e the cursor wit|
00001c50  68 20 74 68 65 20 63 75  72 73 6f 72 20 6b 65 79  |h the cursor key|
00001c60  73 2e 20 54 68 65 72 65  20 69 73 0d 6e 6f 74 68  |s. There is.noth|
00001c70  69 6e 67 20 77 72 6f 6e  67 20 77 69 74 68 20 74  |ing wrong with t|
00001c80  68 65 20 61 72 67 75 6d  65 6e 74 20 72 65 61 64  |he argument read|
00001c90  69 6e 67 20 74 65 63 68  6e 69 71 75 65 20 64 65  |ing technique de|
00001ca0  6d 6f 6e 73 74 72 61 74  65 64 20 69 6e 20 74 68  |monstrated in th|
00001cb0  65 0d 70 72 6f 67 72 61  6d 2e 0d 0d 0d 0d 0d 0d  |e.program.......|
00001cc0  20 20 20 31 30 20 52 45  4d 3a 20 43 55 52 53 4f  |   10 REM: CURSO|
00001cd0  52 0d 20 20 20 32 30 20  4d 4f 44 45 37 0d 20 20  |R.   20 MODE7.  |
00001ce0  20 33 30 20 48 49 4d 45  4d 3d 26 33 43 30 30 0d  | 30 HIMEM=&3C00.|
00001cf0  20 20 20 34 30 20 44 49  4d 20 73 61 76 65 20 35  |   40 DIM save 5|
00001d00  30 0d 20 20 20 35 30 20  64 69 66 66 3d 26 38 30  |0.   50 diff=&80|
00001d10  30 30 2d 48 49 4d 45 4d  0d 20 20 20 36 30 20 63  |00-HIMEM.   60 c|
00001d20  6f 6d 76 65 63 3d 26 46  32 0d 20 20 20 37 30 20  |omvec=&F2.   70 |
00001d30  67 73 69 6e 69 74 3d 26  46 46 43 32 0d 20 20 20  |gsinit=&FFC2.   |
00001d40  38 30 20 67 73 72 65 61  64 3d 26 46 46 43 35 0d  |80 gsread=&FFC5.|
00001d50  20 20 20 39 30 20 6f 73  61 73 63 69 3d 26 46 46  |   90 osasci=&FF|
00001d60  45 33 0d 20 20 31 30 30  20 6f 73 63 6c 69 3d 26  |E3.  100 oscli=&|
00001d70  46 46 46 37 0d 20 20 31  31 30 20 46 4f 52 20 70  |FFF7.  110 FOR p|
00001d80  61 73 73 20 3d 20 30 20  54 4f 20 32 20 53 54 45  |ass = 0 TO 2 STE|
00001d90  50 20 32 0d 20 20 31 00  00 00 00 00 00 00 00 00  |P 2.  1.........|
00001da0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00002130  00 00 00 00 00 00 00 00  41 58 0d 20 20 35 33 30  |........AX.  530|
00002140  20 20 20 20 20 20 20 20  20 50 4c 41 0d 20 20 35  |         PLA.  5|
00002150  34 30 20 20 20 20 20 20  20 20 20 52 54 53 0d 20  |40         RTS. |
00002160  20 35 35 30 20 2e 66 6f  75 6e 64 0d 20 20 35 36  | 550 .found.  56|
00002170  30 20 20 20 20 20 20 20  20 20 53 45 43 20 20 20  |0         SEC   |
00002180  20 20 20 20 20 20 20 20  5c 20 54 65 72 6d 69 6e  |        \ Termin|
00002190  61 74 65 20 77 69 74 68  20 52 65 74 75 72 6e 20  |ate with Return |
000021a0  6f 72 20 22 0d 20 20 35  37 30 20 20 20 20 20 20  |or ".  570      |
000021b0  20 20 20 4a 53 52 20 67  73 69 6e 69 74 0d 20 20  |   JSR gsinit.  |
000021c0  35 38 30 20 20 20 20 20  20 20 20 20 42 45 51 20  |580         BEQ |
000021d0  65 78 69 74 20 20 20 20  20 20 5c 20 42 72 61 6e  |exit      \ Bran|
000021e0  63 68 20 69 66 20 6e 75  6c 6c 20 61 72 67 75 6d  |ch if null argum|
000021f0  65 6e 74 0d 20 20 35 39  30 20 20 20 20 20 20 20  |ent.  590       |
00002200  20 20 49 4e 59 20 20 20  20 20 20 20 20 20 20 20  |  INY           |
00002210  5c 20 46 69 72 73 74 20  63 68 61 72 61 63 74 65  |\ First characte|
00002220  72 20 6d 75 73 74 20 62  65 20 22 4f 22 0d 20 20  |r must be "O".  |
00002230  36 30 30 20 20 20 20 20  20 20 20 20 4a 53 52 20  |600         JSR |
00002240  67 73 72 65 61 64 20 20  20 20 5c 20 53 65 63 6f  |gsread    \ Seco|
00002250  6e 64 20 63 68 61 72 61  63 74 65 72 20 22 46 22  |nd character "F"|
00002260  20 6f 72 20 22 4e 22 0d  20 20 36 31 30 20 20 20  | or "N".  610   |
00002270  20 20 20 20 20 20 42 43  53 20 65 78 69 74 20 20  |      BCS exit  |
00002280  20 20 20 20 5c 20 42 72  61 6e 63 68 20 69 66 20  |    \ Branch if |
00002290  65 6e 64 20 6f 66 20 61  72 67 75 6d 65 6e 74 0d  |end of argument.|
000022a0  20 20 36 32 30 20 20 20  20 20 20 20 20 20 41 4e  |  620         AN|
000022b0  44 20 23 26 44 46 20 20  20 20 20 20 5c 20 55 70  |D #&DF      \ Up|
000022c0  70 65 72 20 63 61 73 65  0d 20 20 36 33 30 20 20  |per case.  630  |
000022d0  20 20 20 20 20 20 20 43  4d 50 20 23 41 53 43 28  |       CMP #ASC(|
000022e0  22 46 22 29 0d 20 20 36  34 30 20 20 20 20 20 20  |"F").  640      |
000022f0  20 20 20 42 45 51 20 63  75 72 73 6f 72 6f 66 66  |   BEQ cursoroff|
00002300  0d 20 20 36 35 30 20 20  20 20 20 20 20 20 20 43  |.  650         C|
00002310  4d 50 20 23 41 53 43 28  22 4e 22 29 0d 20 20 36  |MP #ASC("N").  6|
00002320  36 30 20 20 20 20 20 20  20 20 20 42 4e 45 20 65  |60         BNE e|
00002330  78 69 74 0d 20 20 36 37  30 20 20 20 20 20 20 20  |xit.  670       |
00002340  20 20 53 45 43 0d 20 20  36 38 30 20 20 20 20 20  |  SEC.  680     |
00002350  20 20 20 20 42 43 53 20  63 75 72 73 6f 72 0d 20  |    BCS cursor. |
00002360  20 36 39 30 20 2e 63 75  72 73 6f 72 6f 66 66 0d  | 690 .cursoroff.|
00002370  20 20 37 30 30 20 20 20  20 20 20 20 20 20 43 4c  |  700         CL|
00002380  43 0d 20 20 37 31 30 20  2e 63 75 72 73 6f 72 0d  |C.  710 .cursor.|
00002390  20 20 37 32 30 20 20 20  20 20 20 20 20 20 50 48  |  720         PH|
000023a0  50 0d 20 20 37 33 30 20  20 20 20 20 20 20 20 20  |P.  730         |
000023b0  4c 44 41 20 23 32 33 0d  20 20 37 34 30 20 20 20  |LDA #23.  740   |
000023c0  20 20 20 20 20 20 4a 53  52 20 6f 73 61 73 63 69  |      JSR osasci|
000023d0  0d 20 20 37 35 30 20 20  20 20 20 20 20 20 20 4c  |.  750         L|
000023e0  44 41 20 23 31 0d 20 20  37 36 30 20 20 20 20 20  |DA #1.  760     |
000023f0  20 20 20 20 4a 53 52 20  6f 73 61 73 63 69 0d 20  |    JSR osasci. |
00002400  20 37 37 30 20 20 20 20  20 20 20 20 20 50 4c 41  | 770         PLA|
00002410  0d 20 20 37 38 30 20 20  20 20 20 20 20 20 20 41  |.  780         A|
00002420  4e 44 20 23 31 0d 20 20  37 39 30 20 20 20 20 20  |ND #1.  790     |
00002430  20 20 20 20 4a 53 52 20  6f 73 61 73 63 69 0d 20  |    JSR osasci. |
00002440  20 38 30 30 20 20 20 20  20 20 20 20 20 4c 44 41  | 800         LDA|
00002450  20 23 30 0d 20 20 38 31  30 20 20 20 20 20 20 20  | #0.  810       |
00002460  20 20 4c 44 58 20 23 37  0d 20 20 38 32 30 20 2e  |  LDX #7.  820 .|
00002470  63 75 72 73 6f 72 6c 6f  6f 70 0d 20 20 38 33 30  |cursorloop.  830|
00002480  20 20 20 20 20 20 20 20  20 4a 53 52 20 6f 73 61  |         JSR osa|
00002490  73 63 69 0d 20 20 38 34  30 20 20 20 20 20 20 20  |sci.  840       |
000024a0  20 20 44 45 58 0d 20 20  38 35 30 20 20 20 20 20  |  DEX.  850     |
000024b0  20 20 20 20 42 4e 45 20  63 75 72 73 6f 72 6c 6f  |    BNE cursorlo|
000024c0  6f 70 0d 20 20 38 36 30  20 2e 65 78 69 74 0d 20  |op.  860 .exit. |
000024d0  20 38 37 30 20 20 20 20  20 20 20 20 20 50 4c 41  | 870         PLA|
000024e0  0d 20 20 38 38 30 20 20  20 20 20 20 20 20 20 50  |.  880         P|
000024f0  4c 41 0d 20 20 38 39 30  20 20 20 20 20 20 20 20  |LA.  890        |
00002500  20 50 4c 41 0d 20 20 39  30 30 20 20 20 20 20 20  | PLA.  900      |
00002510  20 20 20 4c 44 41 20 23  30 0d 20 20 39 31 30 20  |   LDA #0.  910 |
00002520  20 20 20 20 20 20 20 20  52 54 53 0d 20 20 39 32  |        RTS.  92|
00002530  30 20 2e 6c 61 73 74 62  79 74 65 0d 20 20 39 33  |0 .lastbyte.  93|
00002540  30 20 5d 0d 20 20 39 34  30 20 4e 45 58 54 0d 20  |0 ].  940 NEXT. |
00002550  20 39 35 30 20 49 4e 50  55 54 27 22 53 61 76 65  | 950 INPUT'"Save|
00002560  20 66 69 6c 65 6e 61 6d  65 20 3d 20 22 66 69 6c  | filename = "fil|
00002570  65 6e 61 6d 65 24 0d 20  20 39 36 30 20 49 46 20  |ename$.  960 IF |
00002580  66 69 6c 65 6e 61 6d 65  24 3d 22 22 20 45 4e 44  |filename$="" END|
00002590  0d 20 20 39 37 30 20 24  73 61 76 65 3d 22 53 41  |.  970 $save="SA|
000025a0  56 45 20 22 2b 66 69 6c  65 6e 61 6d 65 24 2b 22  |VE "+filename$+"|
000025b0  20 22 2b 53 54 52 24 7e  28 48 49 4d 45 4d 29 2b  | "+STR$~(HIMEM)+|
000025c0  22 20 22 2b 53 54 52 24  7e 28 6c 61 73 0d 20 20  |" "+STR$~(las.  |
000025d0  20 20 20 20 74 62 79 74  65 29 2b 22 20 46 46 46  |    tbyte)+" FFF|
000025e0  46 38 30 30 30 20 46 46  46 46 38 30 30 30 22 0d  |F8000 FFFF8000".|
000025f0  20 20 39 38 30 20 58 25  3d 73 61 76 65 20 4d 4f  |  980 X%=save MO|
00002600  44 20 32 35 36 0d 20 20  39 39 30 20 59 25 3d 73  |D 256.  990 Y%=s|
00002610  61 76 65 20 44 49 56 20  32 35 36 0d 20 31 30 30  |ave DIV 256. 100|
00002620  30 20 2a 4f 50 54 31 2c  32 0d 20 31 30 31 30 20  |0 *OPT1,2. 1010 |
00002630  43 41 4c 4c 20 6f 73 63  6c 69 0d 20 31 30 32 30  |CALL oscli. 1020|
00002640  20 2a 4f 50 54 31 2c 30  0d 20 31 30 33 30 20 45  | *OPT1,0. 1030 E|
00002650  4e 44 0d 20 31 30 34 30  20 44 45 46 46 4e 65 71  |ND. 1040 DEFFNeq|
00002660  75 62 28 62 79 74 65 29  0d 20 31 30 35 30 20 3f  |ub(byte). 1050 ?|
00002670  50 25 3d 62 79 74 65 0d  20 31 30 36 30 20 50 25  |P%=byte. 1060 P%|
00002680  3d 50 25 2b 31 0d 20 31  30 37 30 20 3d 70 61 73  |=P%+1. 1070 =pas|
00002690  73 0d 20 31 30 38 30 20  44 45 46 46 4e 65 71 75  |s. 1080 DEFFNequ|
000026a0  77 28 77 6f 72 64 29 0d  20 31 30 39 30 20 3f 50  |w(word). 1090 ?P|
000026b0  25 3d 77 6f 72 64 20 4d  4f 44 20 32 35 36 0d 20  |%=word MOD 256. |
000026c0  31 31 30 30 20 50 25 3f  31 3d 77 6f 72 64 20 44  |1100 P%?1=word D|
000026d0  49 56 20 32 35 36 0d 20  31 31 31 30 20 50 25 3d  |IV 256. 1110 P%=|
000026e0  50 25 2b 32 0d 20 31 31  32 30 20 3d 70 61 73 73  |P%+2. 1120 =pass|
000026f0  0d 20 31 31 33 30 20 44  45 46 46 4e 65 71 75 64  |. 1130 DEFFNequd|
00002700  28 64 6f 75 62 6c 65 29  0d 20 31 31 34 30 20 21  |(double). 1140 !|
00002710  50 25 3d 64 6f 75 62 6c  65 0d 20 31 31 35 30 20  |P%=double. 1150 |
00002720  50 25 3d 50 25 2b 34 0d  20 31 31 36 30 20 3d 70  |P%=P%+4. 1160 =p|
00002730  61 73 73 0d 20 31 31 37  30 20 44 45 46 46 4e 65  |ass. 1170 DEFFNe|
00002740  71 75 73 28 73 74 72 69  6e 67 24 29 0d 20 31 31  |qus(string$). 11|
00002750  38 30 20 24 50 25 3d 73  74 72 69 6e 67 24 0d 20  |80 $P%=string$. |
00002760  31 31 39 30 20 50 25 3d  50 25 2b 4c 45 4e 28 73  |1190 P%=P%+LEN(s|
00002770  74 72 69 6e 67 24 29 0d  20 31 32 30 30 20 3d 70  |tring$). 1200 =p|
00002780  61 73 73 0d                                       |ass.|
00002784
05-08-88/T\SWR_OLD.m0
05-08-88/T\SWR_OLD.m1
05-08-88/T\SWR_OLD.m2
05-08-88/T\SWR_OLD.m4
05-08-88/T\SWR_OLD.m5