Home » CEEFAX disks » telesoftware5.adl » 20-02-88/T\SWR17

20-02-88/T\SWR17

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » CEEFAX disks » telesoftware5.adl
Filename: 20-02-88/T\SWR17
Read OK:
File size: 3619 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 17 - Language Roms
--------------------------------------------------------

  The first 16 modules of this course have dealt almost exclusively
with the design of service roms. The rest of the course will be
dealing with the design of roms that use both language and service
entry points.

  A new language does not need the complexity of a new dialect of
BASIC. It simply needs to be a self contained machine code program
which is totally independant of any other language. Language roms have
access to memory from &00 to &8F as zero page workspace, from &0400 to
&07FF as main language workspace and from Oshwm to the bottom of
screen memory as program space.

  The program NOBASIC is a good example of an extremely simple
language. Unlike BASIC it has no keywords and only processes *
commands. It uses an Osword call to read input from the keyboard into
a buffer in page &07 and passes that input to the command line
interpreter (CLI) for further processing. The return from the CLI goes
back for more input which is passed to the CLI, and so on and on until
another language is selected to replace it. Although NOBASIC has no
keywords it meets all the requirements for a language. It is self
contained and completely independant of any other language.

  To use the language load the object code generated by NOBASIC into
SWR and press the Break key. Type *NOBASIC and press Return. The
language title and a "*" prompt will be printed. The language will
only allow you to use operating system, filing system and service rom
commands. There is no need to type the * prefix for these commands.
If, for example, you want to return to BASIC just type BASIC.

  When starting up a language the MOS does the following:

1. Records the number of the rom so that it can reselect the language
when a BRK instruction is executed and when the Break key is pressed
(a "soft" break).

2. Displays the rom title string to indicate the particular language
is in use.

3. Points the error message vector to the copyright message, or the
version string if present.

4. If a second processor is active, copies the language across the
Tube and executes it there. The service code is not copied across the
Tube.

5. Enters the language at its language entry point with the
accumulator containing the value &01 to indicate a normal startup.

  As well as providing a language entry point, a language rom must
provide a service entry point which gives access to a simple one
command interpreter to recognise the language name as a command. Upon
recognising the language name the rom must load the X register with
its rom number and call Osbyte &8E to start up the language. Languages
other than BASIC can only be started up using Osbyte &8E with the rom
number of the language in the X register. The service entry point must
also provide a help service which responds to *HELP by printing the
language title string.

  When a language rom is entered at its language entry point it must
do the following:

a. Enable interupts, otherwise the operating system will fail to work.

b. Reset the stack pointer. The stack is undefined on entry.

c. Set up the error handling routine.

  Even a simple language such as NOBASIC requires error handling. The
operating system automatically switches to the current language rom on
a BRK. When a BRK occurs, the currently active rom number is stored
and can be read using Osbyte &BA. The NOBASIC error handler does not
use Osbyte &BA. It prints the error message pointed to by the error
vector and resets the language by jumping back to the language entry
point.

  The rom header of a language rom has to be configured appropriately
in order that the MOS can recognise the rom image as a language rom.
The difference between service rom and language rom headers is that
the latter has a jump to the language entry point in the first three
bytes of the header and the rom type byte at &8006 usually stores the
number &C2 to indicate that language and service entry points are
available. The rom header for NOBASIC is shown in figure 17.1. Rom
headers were described in detail in Module 3 of the course. You may
need to look again at Module 3 if you have forgotten about rom headers
and rom type bytes.





8000 4C 82 80 JMP language           \ jump to language entry point
8003 4C 2D 80 JMP service            \ jump to service entry point
8006 C2       EQUB &C2               \ rom type bute (1100 0010)
8007 11       EQUB copyright MOD 256 \ copyright offset
8008 00       BRK                    \ binary version number (zero)
8009          .title                 \ rom title string
8009 4E 4F 42 
     41 53 49 
     43       EQUS "NOBASIC"
8010 00       BRK
8011          .copyright             \ copyright string
8011 00       BRK                    \ must start with zero
8012 28 43 29 
     20 47 6F 
     72 64 6F 
     6E 20 48 
     6F 72 73 
     69 6E 67 
     74 6F 6E 
     20 31 39 
     38 37    EQUS "(C) Gordon Horsington 1987"
802C 00       BRK                    \ and end with zero
802D          .service               \ service entry point
                  .
                  .
                  .
8082          .language              \ language entry point
                  .
                  .
                  .

Figure 17.1  The NOBASIC rom header.
-----------  -----------------------



  The service entry point of NOBASIC gives access to an unrecognised *
command interpreter and a simple help service. The registers are
pushed on the stack (lines 350-390). The original content of the
accumulator is read from the stack (lines 400-410) and compared with
the unrecognised command and help service request numbers (lines
420-450). If neither service call 4 nor service call 9 is intercepted
the registers are restored (lines 470-510) and control is returned to
the MOS (line 520).

  The familiar one command interpreter (lines 530-660) is used to
compare the unrecognised command with the title string of the rom. If
a match is found control passes to the label ".found" (line 670). If
it is not the registers are restored (line 660 and lines 470-510) and
control passed back to the MOS (line 520). When the command *NOBASIC
is intercepted the accumulator is loaded with &8E (line 680) and the X
register is loaded with the rom number stored in &F4 (line 690) and a
jump is made to Osbyte (line 700) to enter the rom at its language
entry point. There is no return from Osbyte &8E.

  The simple help routine (line 710-840) is used to print the rom
title in response to the *HELP command. The argument is initialised
(line 720) and, if an argumemt has been typed, the zero flag will be
clear on return from Gsinit. The zero flag is tested (line 730) and if
clear extended help has been requested. Extended help is not usually
provided by language roms and so the registers are restored (line 730
and lines 470-510) and control is passed back to the MOS (line 520).
If simple help is requested the rom title is printed (lines 740-830),
the registers are restored (line 850 and lines 460-510) and control is
passed back to the MOS (line 520).

  Following the Osbyte &8E call (lines 680-700) the rom will be
entered at its language entry point (line 850) via the jump
instruction in the rom header (line 220). The language must enable
interupt requests (line 860), reset the stack (lines 870-880) and
re-vector the BREAKV at &202 and &203 (lines 890-920) to point to its
own error handling routine starting at the label ".error" (line 1180).

  Error handling in language roms is different to that in service
roms. In a service rom you copy the error message, preceded and
followed by a BRK instruction, into the error buffer and then jump to
the first BRK instruction of the error message, (see Module 8). When
the MOS processes the BRK instruction it passes the error to the
current active language via the break vector. The error message is
pointed to by the error vector at &FD and &FE. The language error
handler must use the error vector to print out the error message, then
re-initialise the stack and pass control back to some well defined
part of the language, such as the input prompt. NOBASIC jumps back to
the language entry point after printing the error message. A more
complex language would probably not use this shortcut.

  The error handler in NOBASIC is in lines 1180 to 1290. The MOS
processes a BRK instruction by passing control, via the break vector,
to the label ".error" (line 1180). The error vector points to the byte
following the BRK instruction. This is the error number and it is not
printed. The error routine prints every byte of the error message
(lines 1200-1260) until it reads the zero byte at the end (line 1240)
when it prints a new line to make the printed message look neat (line
1280). It then passes control back to the language initialisation
routine (line 1290 and lines 850-920) to reset the stack and issue the
input prompt.

  The coding that implements the language is in lines 930 to 1040.
This must be one of the smallest languages possible. The input prompt
"*" is printed (line 940-950) and an Osword buffer in page &07 is used
to input a string of characters from the keyboard (lines 960-990). The
address of the Osword buffer is stored in the first two bytes of the
Osword parameter block (lines 1050-1100) and this address is sent to
the command line interpreter to process the input (lines 1010-1030).
After returning from the CLI (1040) control is passed back to the
input prompt routine (line 940) for more input.

  The only error that can be easily generated within the language can
be made by pressing the Escape key when inputing text at the keyboard.
This error is trapped (line 1000) when Osword returns with the carry
flag set. If an escape is flaged it is acknowledged (lines 1120-1130)
and a BRK instruction is executed to signal the error (line 1140). The
BRK instruction is followed by an error number (line 1150), an error
message (line 1160), and an end of message zero byte (line 1170). The
error will be dealt with as described above.



   10 REM: NOBASIC
   20 MODE7
   30 HIMEM=&3C00
   40 DIM save 50
   50 diff=&8000-HIMEM
   60 comvec=&F2
   70 romnumber=&F4
   80 errvec=&FD
   90 stack=&103
  100 breakv=&202
  110 buffer=&700
  120 gsinit=&FFC2
  130 gsread=&FFC5
  140 osasci=&FFE3
  150 osnewl=&FFE7
  160 osword=&FFF1
  170 osbyte=&FFF4
  180 oscli=&FFF7
  190 FOR pass = 0 TO 2 STEP 2
  200 P%=HIMEM
  210 [       OPT pass
  220         JMP language+diff
  230         JMP service+diff
  240         OPT FNequb(&C2)
  250         OPT FNequb((copyright+diff) MOD 256)
  260         BRK
  270 .title
  280         OPT FNequs("NOBASIC")
  290         BRK
  300 .copyright
  310         BRK
  320         OPT FNequs("(C) Gordon Horsington 1987")
  330         BRK
  340 .service
  350         PHA
  360         TXA
  370         PHA
  380         TYA
  390         PHA
  400         TSX
  410         LDA stack,X
  420         CMP #4
  430         BEQ unrecognised
  440         CMP #9
  450         BEQ help
  460 .finish
  470         PLA
  480         TAY
  490         PLA
  500         TAX
  510         PLA
  520         RTS
  530 .unrecognised
  540         LDX #&FF
  550 .comloop
  560         INX
  570         LDA title+diff,X
  580         BEQ found
  590         LDA (comvec),Y
  600         INY
  610         CMP #ASC(".")
  620         BEQ found
  630         AND #&DF
  640         CMP title+diff,X
  650         BEQ comloop
  660         BNE finish
  670 .found
  680         LDA #&8E
  690         LDX romnumber
  700         JMP osbyte    \ Enter this ROM
  710 .help
  720         JSR gsinit
  730         BNE finish    \ No extended help available
  740         JSR osnewl
  750         LDX #&FF
  760 .helploop
  770         INX
  780         LDA title+diff,X
  790         BEQ endtitle
  800         JSR osasci
  810         BNE helploop
  820 .endtitle
  830         JSR osnewl
  840         JMP finish+diff
  850 .language
  860         CLI           \ Enable interupt requests
  870         LDX #&FF
  880         TXS           \ Reset stack
  890         LDA #(error+diff) MOD 256
  900         STA breakv
  910         LDA #(error+diff) DIV 256
  920         STA breakv+1
  930 .continue
  940         LDA #ASC("*")
  950         JSR osasci
  960         LDA #0
  970         LDX #(block+diff) MOD 256
  980         LDY #(block+diff) DIV 256
  990         JSR osword
 1000         BCS escape
 1010         LDX block+diff
 1020         LDY block+diff+1
 1030         JSR oscli
 1040         JMP continue+diff
 1050 .block
 1060         OPT FNequb(buffer MOD 256)
 1070         OPT FNequb(buffer DIV 256)
 1080         OPT FNequb(&FE)
 1090         OPT FNequb(&20)
 1100         OPT FNequb(&7F)
 1110 .escape
 1120         LDA #&7E
 1130         JSR osbyte    \ Acknowledge Escape
 1140         BRK
 1150         BRK
 1160         OPT FNequs("Escape")
 1170         BRK
 1180 .error
 1190         JSR osnewl
 1200         LDY #0
 1210 .errorloop
 1220         INY
 1230         LDA (errvec),Y
 1240         BEQ newline
 1250         JSR osasci
 1260         BNE errorloop
 1270 .newline
 1280         JSR osnewl
 1290         JMP language+diff
 1300 .lastbyte
 1310 ]
 1320 NEXT
 1330 INPUT'"Save filename = "filename$
 1340 IF filename$="" END
 1350 $save="SAVE "+filename$+" "+STR$~(HIMEM)+" "+STR$~(las
      tbyte)+" FFFF8000 FFFF8000"
 1360 X%=save MOD 256
 1370 Y%=save DIV 256
 1380 *OPT1,2
 1390 CALL oscli
 1400 *OPT1,0
 1410 END
 1420 DEFFNequb(byte)
 1430 ?P%=byte
 1440 P%=P%+1
 1450 =pass
 1460 DEFFNequw(word)
 1470 ?P%=word MOD 256
 1480 P%?1=word DIV 256
 1490 P%=P%+2
 1500 =pass
 1510 DEFFNequd(double)
 1520 !P%=double
 1530 P%=P%+4
 1540 =pass
 1550 DEFFNequs(string$)
 1560 $P%=string$
 1570 P%=P%+LEN(string$)
 1580 =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 31 37  20 2d 20 4c 61 6e 67 75  |odule 17 - Langu|
00000030  61 67 65 20 52 6f 6d 73  0d 2d 2d 2d 2d 2d 2d 2d  |age Roms.-------|
00000040  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000070  2d 0d 0d 20 20 54 68 65  20 66 69 72 73 74 20 31  |-..  The first 1|
00000080  36 20 6d 6f 64 75 6c 65  73 20 6f 66 20 74 68 69  |6 modules of thi|
00000090  73 20 63 6f 75 72 73 65  20 68 61 76 65 20 64 65  |s course have de|
000000a0  61 6c 74 20 61 6c 6d 6f  73 74 20 65 78 63 6c 75  |alt almost exclu|
000000b0  73 69 76 65 6c 79 0d 77  69 74 68 20 74 68 65 20  |sively.with the |
000000c0  64 65 73 69 67 6e 20 6f  66 20 73 65 72 76 69 63  |design of servic|
000000d0  65 20 72 6f 6d 73 2e 20  54 68 65 20 72 65 73 74  |e roms. The rest|
000000e0  20 6f 66 20 74 68 65 20  63 6f 75 72 73 65 20 77  | of the course w|
000000f0  69 6c 6c 20 62 65 0d 64  65 61 6c 69 6e 67 20 77  |ill be.dealing w|
00000100  69 74 68 20 74 68 65 20  64 65 73 69 67 6e 20 6f  |ith the design o|
00000110  66 20 72 6f 6d 73 20 74  68 61 74 20 75 73 65 20  |f roms that use |
00000120  62 6f 74 68 20 6c 61 6e  67 75 61 67 65 20 61 6e  |both language an|
00000130  64 20 73 65 72 76 69 63  65 0d 65 6e 74 72 79 20  |d service.entry |
00000140  70 6f 69 6e 74 73 2e 0d  0d 20 20 41 20 6e 65 77  |points...  A new|
00000150  20 6c 61 6e 67 75 61 67  65 20 64 6f 65 73 20 6e  | language does n|
00000160  6f 74 20 6e 65 65 64 20  74 68 65 20 63 6f 6d 70  |ot need the comp|
00000170  6c 65 78 69 74 79 20 6f  66 20 61 20 6e 65 77 20  |lexity of a new |
00000180  64 69 61 6c 65 63 74 20  6f 66 0d 42 41 53 49 43  |dialect of.BASIC|
00000190  2e 20 49 74 20 73 69 6d  70 6c 79 20 6e 65 65 64  |. It simply need|
000001a0  73 20 74 6f 20 62 65 20  61 20 73 65 6c 66 20 63  |s to be a self c|
000001b0  6f 6e 74 61 69 6e 65 64  20 6d 61 63 68 69 6e 65  |ontained machine|
000001c0  20 63 6f 64 65 20 70 72  6f 67 72 61 6d 0d 77 68  | code program.wh|
000001d0  69 63 68 20 69 73 20 74  6f 74 61 6c 6c 79 20 69  |ich is totally i|
000001e0  6e 64 65 70 65 6e 64 61  6e 74 20 6f 66 20 61 6e  |ndependant of an|
000001f0  79 20 6f 74 68 65 72 20  6c 61 6e 67 75 61 67 65  |y other language|
00000200  2e 20 4c 61 6e 67 75 61  67 65 20 72 6f 6d 73 20  |. Language roms |
00000210  68 61 76 65 0d 61 63 63  65 73 73 20 74 6f 20 6d  |have.access to m|
00000220  65 6d 6f 72 79 20 66 72  6f 6d 20 26 30 30 20 74  |emory from &00 t|
00000230  6f 20 26 38 46 20 61 73  20 7a 65 72 6f 20 70 61  |o &8F as zero pa|
00000240  67 65 20 77 6f 72 6b 73  70 61 63 65 2c 20 66 72  |ge workspace, fr|
00000250  6f 6d 20 26 30 34 30 30  20 74 6f 0d 26 30 37 46  |om &0400 to.&07F|
00000260  46 20 61 73 20 6d 61 69  6e 20 6c 61 6e 67 75 61  |F as main langua|
00000270  67 65 20 77 6f 72 6b 73  70 61 63 65 20 61 6e 64  |ge workspace and|
00000280  20 66 72 6f 6d 20 4f 73  68 77 6d 20 74 6f 20 74  | from Oshwm to t|
00000290  68 65 20 62 6f 74 74 6f  6d 20 6f 66 0d 73 63 72  |he bottom of.scr|
000002a0  65 65 6e 20 6d 65 6d 6f  72 79 20 61 73 20 70 72  |een memory as pr|
000002b0  6f 67 72 61 6d 20 73 70  61 63 65 2e 0d 0d 20 20  |ogram space...  |
000002c0  54 68 65 20 70 72 6f 67  72 61 6d 20 4e 4f 42 41  |The program NOBA|
000002d0  53 49 43 20 69 73 20 61  20 67 6f 6f 64 20 65 78  |SIC is a good ex|
000002e0  61 6d 70 6c 65 20 6f 66  20 61 6e 20 65 78 74 72  |ample of an extr|
000002f0  65 6d 65 6c 79 20 73 69  6d 70 6c 65 0d 6c 61 6e  |emely simple.lan|
00000300  67 75 61 67 65 2e 20 55  6e 6c 69 6b 65 20 42 41  |guage. Unlike BA|
00000310  53 49 43 20 69 74 20 68  61 73 20 6e 6f 20 6b 65  |SIC it has no ke|
00000320  79 77 6f 72 64 73 20 61  6e 64 20 6f 6e 6c 79 20  |ywords and only |
00000330  70 72 6f 63 65 73 73 65  73 20 2a 0d 63 6f 6d 6d  |processes *.comm|
00000340  61 6e 64 73 2e 20 49 74  20 75 73 65 73 20 61 6e  |ands. It uses an|
00000350  20 4f 73 77 6f 72 64 20  63 61 6c 6c 20 74 6f 20  | Osword call to |
00000360  72 65 61 64 20 69 6e 70  75 74 20 66 72 6f 6d 20  |read input from |
00000370  74 68 65 20 6b 65 79 62  6f 61 72 64 20 69 6e 74  |the keyboard int|
00000380  6f 0d 61 20 62 75 66 66  65 72 20 69 6e 20 70 61  |o.a buffer in pa|
00000390  67 65 20 26 30 37 20 61  6e 64 20 70 61 73 73 65  |ge &07 and passe|
000003a0  73 20 74 68 61 74 20 69  6e 70 75 74 20 74 6f 20  |s that input to |
000003b0  74 68 65 20 63 6f 6d 6d  61 6e 64 20 6c 69 6e 65  |the command line|
000003c0  0d 69 6e 74 65 72 70 72  65 74 65 72 20 28 43 4c  |.interpreter (CL|
000003d0  49 29 20 66 6f 72 20 66  75 72 74 68 65 72 20 70  |I) for further p|
000003e0  72 6f 63 65 73 73 69 6e  67 2e 20 54 68 65 20 72  |rocessing. The r|
000003f0  65 74 75 72 6e 20 66 72  6f 6d 20 74 68 65 20 43  |eturn from the C|
00000400  4c 49 20 67 6f 65 73 0d  62 61 63 6b 20 66 6f 72  |LI goes.back for|
00000410  20 6d 6f 72 65 20 69 6e  70 75 74 20 77 68 69 63  | more input whic|
00000420  68 20 69 73 20 70 61 73  73 65 64 20 74 6f 20 74  |h is passed to t|
00000430  68 65 20 43 4c 49 2c 20  61 6e 64 20 73 6f 20 6f  |he CLI, and so o|
00000440  6e 20 61 6e 64 20 6f 6e  20 75 6e 74 69 6c 0d 61  |n and on until.a|
00000450  6e 6f 74 68 65 72 20 6c  61 6e 67 75 61 67 65 20  |nother language |
00000460  69 73 20 73 65 6c 65 63  74 65 64 20 74 6f 20 72  |is selected to r|
00000470  65 70 6c 61 63 65 20 69  74 2e 20 41 6c 74 68 6f  |eplace it. Altho|
00000480  75 67 68 20 4e 4f 42 41  53 49 43 20 68 61 73 20  |ugh NOBASIC has |
00000490  6e 6f 0d 6b 65 79 77 6f  72 64 73 20 69 74 20 6d  |no.keywords it m|
000004a0  65 65 74 73 20 61 6c 6c  20 74 68 65 20 72 65 71  |eets all the req|
000004b0  75 69 72 65 6d 65 6e 74  73 20 66 6f 72 20 61 20  |uirements for a |
000004c0  6c 61 6e 67 75 61 67 65  2e 20 49 74 20 69 73 20  |language. It is |
000004d0  73 65 6c 66 0d 63 6f 6e  74 61 69 6e 65 64 20 61  |self.contained a|
000004e0  6e 64 20 63 6f 6d 70 6c  65 74 65 6c 79 20 69 6e  |nd completely in|
000004f0  64 65 70 65 6e 64 61 6e  74 20 6f 66 20 61 6e 79  |dependant of any|
00000500  20 6f 74 68 65 72 20 6c  61 6e 67 75 61 67 65 2e  | other language.|
00000510  0d 0d 20 20 54 6f 20 75  73 65 20 74 68 65 20 6c  |..  To use the l|
00000520  61 6e 67 75 61 67 65 20  6c 6f 61 64 20 74 68 65  |anguage load the|
00000530  20 6f 62 6a 65 63 74 20  63 6f 64 65 20 67 65 6e  | object code gen|
00000540  65 72 61 74 65 64 20 62  79 20 4e 4f 42 41 53 49  |erated by NOBASI|
00000550  43 20 69 6e 74 6f 0d 53  57 52 20 61 6e 64 20 70  |C into.SWR and p|
00000560  72 65 73 73 20 74 68 65  20 42 72 65 61 6b 20 6b  |ress the Break k|
00000570  65 79 2e 20 54 79 70 65  20 2a 4e 4f 42 41 53 49  |ey. Type *NOBASI|
00000580  43 20 61 6e 64 20 70 72  65 73 73 20 52 65 74 75  |C and press Retu|
00000590  72 6e 2e 20 54 68 65 0d  6c 61 6e 67 75 61 67 65  |rn. The.language|
000005a0  20 74 69 74 6c 65 20 61  6e 64 20 61 20 22 2a 22  | title and a "*"|
000005b0  20 70 72 6f 6d 70 74 20  77 69 6c 6c 20 62 65 20  | prompt will be |
000005c0  70 72 69 6e 74 65 64 2e  20 54 68 65 20 6c 61 6e  |printed. The lan|
000005d0  67 75 61 67 65 20 77 69  6c 6c 0d 6f 6e 6c 79 20  |guage will.only |
000005e0  61 6c 6c 6f 77 20 79 6f  75 20 74 6f 20 75 73 65  |allow you to use|
000005f0  20 6f 70 65 72 61 74 69  6e 67 20 73 79 73 74 65  | operating syste|
00000600  6d 2c 20 66 69 6c 69 6e  67 20 73 79 73 74 65 6d  |m, filing system|
00000610  20 61 6e 64 20 73 65 72  76 69 63 65 20 72 6f 6d  | and service rom|
00000620  0d 63 6f 6d 6d 61 6e 64  73 2e 20 54 68 65 72 65  |.commands. There|
00000630  20 69 73 20 6e 6f 20 6e  65 65 64 20 74 6f 20 74  | is no need to t|
00000640  79 70 65 20 74 68 65 20  2a 20 70 72 65 66 69 78  |ype the * prefix|
00000650  20 66 6f 72 20 74 68 65  73 65 20 63 6f 6d 6d 61  | for these comma|
00000660  6e 64 73 2e 0d 49 66 2c  20 66 6f 72 20 65 78 61  |nds..If, for exa|
00000670  6d 70 6c 65 2c 20 79 6f  75 20 77 61 6e 74 20 74  |mple, you want t|
00000680  6f 20 72 65 74 75 72 6e  20 74 6f 20 42 41 53 49  |o return to BASI|
00000690  43 20 6a 75 73 74 20 74  79 70 65 20 42 41 53 49  |C just type BASI|
000006a0  43 2e 0d 0d 20 20 57 68  65 6e 20 73 74 61 72 74  |C...  When start|
000006b0  69 6e 67 20 75 70 20 61  20 6c 61 6e 67 75 61 67  |ing up a languag|
000006c0  65 20 74 68 65 20 4d 4f  53 20 64 6f 65 73 20 74  |e the MOS does t|
000006d0  68 65 20 66 6f 6c 6c 6f  77 69 6e 67 3a 0d 0d 31  |he following:..1|
000006e0  2e 20 52 65 63 6f 72 64  73 20 74 68 65 20 6e 75  |. Records the nu|
000006f0  6d 62 65 72 20 6f 66 20  74 68 65 20 72 6f 6d 20  |mber of the rom |
00000700  73 6f 20 74 68 61 74 20  69 74 20 63 61 6e 20 72  |so that it can r|
00000710  65 73 65 6c 65 63 74 20  74 68 65 20 6c 61 6e 67  |eselect the lang|
00000720  75 61 67 65 0d 77 68 65  6e 20 61 20 42 52 4b 20  |uage.when a BRK |
00000730  69 6e 73 74 72 75 63 74  69 6f 6e 20 69 73 20 65  |instruction is e|
00000740  78 65 63 75 74 65 64 20  61 6e 64 20 77 68 65 6e  |xecuted and when|
00000750  20 74 68 65 20 42 72 65  61 6b 20 6b 65 79 20 69  | the Break key i|
00000760  73 20 70 72 65 73 73 65  64 0d 28 61 20 22 73 6f  |s pressed.(a "so|
00000770  66 74 22 20 62 72 65 61  6b 29 2e 0d 0d 32 2e 20  |ft" break)...2. |
00000780  44 69 73 70 6c 61 79 73  20 74 68 65 20 72 6f 6d  |Displays the rom|
00000790  20 74 69 74 6c 65 20 73  74 72 69 6e 67 20 74 6f  | title string to|
000007a0  20 69 6e 64 69 63 61 74  65 20 74 68 65 20 70 61  | indicate the pa|
000007b0  72 74 69 63 75 6c 61 72  20 6c 61 6e 67 75 61 67  |rticular languag|
000007c0  65 0d 69 73 20 69 6e 20  75 73 65 2e 0d 0d 33 2e  |e.is in use...3.|
000007d0  20 50 6f 69 6e 74 73 20  74 68 65 20 65 72 72 6f  | Points the erro|
000007e0  72 20 6d 65 73 73 61 67  65 20 76 65 63 74 6f 72  |r message vector|
000007f0  20 74 6f 20 74 68 65 20  63 6f 70 79 72 69 67 68  | to the copyrigh|
00000800  74 20 6d 65 73 73 61 67  65 2c 20 6f 72 20 74 68  |t message, or th|
00000810  65 0d 76 65 72 73 69 6f  6e 20 73 74 72 69 6e 67  |e.version string|
00000820  20 69 66 20 70 72 65 73  65 6e 74 2e 0d 0d 34 2e  | if present...4.|
00000830  20 49 66 20 61 20 73 65  63 6f 6e 64 20 70 72 6f  | If a second pro|
00000840  63 65 73 73 6f 72 20 69  73 20 61 63 74 69 76 65  |cessor is active|
00000850  2c 20 63 6f 70 69 65 73  20 74 68 65 20 6c 61 6e  |, copies the lan|
00000860  67 75 61 67 65 20 61 63  72 6f 73 73 20 74 68 65  |guage across the|
00000870  0d 54 75 62 65 20 61 6e  64 20 65 78 65 63 75 74  |.Tube and execut|
00000880  65 73 20 69 74 20 74 68  65 72 65 2e 20 54 68 65  |es it there. The|
00000890  20 73 65 72 76 69 63 65  20 63 6f 64 65 20 69 73  | service code is|
000008a0  20 6e 6f 74 20 63 6f 70  69 65 64 20 61 63 72 6f  | not copied acro|
000008b0  73 73 20 74 68 65 0d 54  75 62 65 2e 0d 0d 35 2e  |ss the.Tube...5.|
000008c0  20 45 6e 74 65 72 73 20  74 68 65 20 6c 61 6e 67  | Enters the lang|
000008d0  75 61 67 65 20 61 74 20  69 74 73 20 6c 61 6e 67  |uage at its lang|
000008e0  75 61 67 65 20 65 6e 74  72 79 20 70 6f 69 6e 74  |uage entry point|
000008f0  20 77 69 74 68 20 74 68  65 0d 61 63 63 75 6d 75  | with the.accumu|
00000900  6c 61 74 6f 72 20 63 6f  6e 74 61 69 6e 69 6e 67  |lator containing|
00000910  20 74 68 65 20 76 61 6c  75 65 20 26 30 31 20 74  | the value &01 t|
00000920  6f 20 69 6e 64 69 63 61  74 65 20 61 20 6e 6f 72  |o indicate a nor|
00000930  6d 61 6c 20 73 74 61 72  74 75 70 2e 0d 0d 20 20  |mal startup...  |
00000940  41 73 20 77 65 6c 6c 20  61 73 20 70 72 6f 76 69  |As well as provi|
00000950  64 69 6e 67 20 61 20 6c  61 6e 67 75 61 67 65 20  |ding a language |
00000960  65 6e 74 72 79 20 70 6f  69 6e 74 2c 20 61 20 6c  |entry point, a l|
00000970  61 6e 67 75 61 67 65 20  72 6f 6d 20 6d 75 73 74  |anguage rom must|
00000980  0d 70 72 6f 76 69 64 65  20 61 20 73 65 72 76 69  |.provide a servi|
00000990  63 65 20 65 6e 74 72 79  20 70 6f 69 6e 74 20 77  |ce entry point w|
000009a0  68 69 63 68 20 67 69 76  65 73 20 61 63 63 65 73  |hich gives acces|
000009b0  73 20 74 6f 20 61 20 73  69 6d 70 6c 65 20 6f 6e  |s to a simple on|
000009c0  65 0d 63 6f 6d 6d 61 6e  64 20 69 6e 74 65 72 70  |e.command interp|
000009d0  72 65 74 65 72 20 74 6f  20 72 65 63 6f 67 6e 69  |reter to recogni|
000009e0  73 65 20 74 68 65 20 6c  61 6e 67 75 61 67 65 20  |se the language |
000009f0  6e 61 6d 65 20 61 73 20  61 20 63 6f 6d 6d 61 6e  |name as a comman|
00000a00  64 2e 20 55 70 6f 6e 0d  72 65 63 6f 67 6e 69 73  |d. Upon.recognis|
00000a10  69 6e 67 20 74 68 65 20  6c 61 6e 67 75 61 67 65  |ing the language|
00000a20  20 6e 61 6d 65 20 74 68  65 20 72 6f 6d 20 6d 75  | name the rom mu|
00000a30  73 74 20 6c 6f 61 64 20  74 68 65 20 58 20 72 65  |st load the X re|
00000a40  67 69 73 74 65 72 20 77  69 74 68 0d 69 74 73 20  |gister with.its |
00000a50  72 6f 6d 20 6e 75 6d 62  65 72 20 61 6e 64 20 63  |rom number and c|
00000a60  61 6c 6c 20 4f 73 62 79  74 65 20 26 38 45 20 74  |all Osbyte &8E t|
00000a70  6f 20 73 74 61 72 74 20  75 70 20 74 68 65 20 6c  |o start up the l|
00000a80  61 6e 67 75 61 67 65 2e  20 4c 61 6e 67 75 61 67  |anguage. Languag|
00000a90  65 73 0d 6f 74 68 65 72  20 74 68 61 6e 20 42 41  |es.other than BA|
00000aa0  53 49 43 20 63 61 6e 20  6f 6e 6c 79 20 62 65 20  |SIC can only be |
00000ab0  73 74 61 72 74 65 64 20  75 70 20 75 73 69 6e 67  |started up using|
00000ac0  20 4f 73 62 79 74 65 20  26 38 45 20 77 69 74 68  | Osbyte &8E with|
00000ad0  20 74 68 65 20 72 6f 6d  0d 6e 75 6d 62 65 72 20  | the rom.number |
00000ae0  6f 66 20 74 68 65 20 6c  61 6e 67 75 61 67 65 20  |of the language |
00000af0  69 6e 20 74 68 65 20 58  20 72 65 67 69 73 74 65  |in the X registe|
00000b00  72 2e 20 54 68 65 20 73  65 72 76 69 63 65 20 65  |r. The service e|
00000b10  6e 74 72 79 20 70 6f 69  6e 74 20 6d 75 73 74 0d  |ntry point must.|
00000b20  61 6c 73 6f 20 70 72 6f  76 69 64 65 20 61 20 68  |also provide a h|
00000b30  65 6c 70 20 73 65 72 76  69 63 65 20 77 68 69 63  |elp service whic|
00000b40  68 20 72 65 73 70 6f 6e  64 73 20 74 6f 20 2a 48  |h responds to *H|
00000b50  45 4c 50 20 62 79 20 70  72 69 6e 74 69 6e 67 20  |ELP by printing |
00000b60  74 68 65 0d 6c 61 6e 67  75 61 67 65 20 74 69 74  |the.language tit|
00000b70  6c 65 20 73 74 72 69 6e  67 2e 0d 0d 20 20 57 68  |le string...  Wh|
00000b80  65 6e 20 61 20 6c 61 6e  67 75 61 67 65 20 72 6f  |en a language ro|
00000b90  6d 20 69 73 20 65 6e 74  65 72 65 64 20 61 74 20  |m is entered at |
00000ba0  69 74 73 20 6c 61 6e 67  75 61 67 65 20 65 6e 74  |its language ent|
00000bb0  72 79 20 70 6f 69 6e 74  20 69 74 20 6d 75 73 74  |ry point it must|
00000bc0  0d 64 6f 20 74 68 65 20  66 6f 6c 6c 6f 77 69 6e  |.do the followin|
00000bd0  67 3a 0d 0d 61 2e 20 45  6e 61 62 6c 65 20 69 6e  |g:..a. Enable in|
00000be0  74 65 72 75 70 74 73 2c  20 6f 74 68 65 72 77 69  |terupts, otherwi|
00000bf0  73 65 20 74 68 65 20 6f  70 65 72 61 74 69 6e 67  |se the operating|
00000c00  20 73 79 73 74 65 6d 20  77 69 6c 6c 20 66 61 69  | system will fai|
00000c10  6c 20 74 6f 20 77 6f 72  6b 2e 0d 0d 62 2e 20 52  |l to work...b. R|
00000c20  65 73 65 74 20 74 68 65  20 73 74 61 63 6b 20 70  |eset the stack p|
00000c30  6f 69 6e 74 65 72 2e 20  54 68 65 20 73 74 61 63  |ointer. The stac|
00000c40  6b 20 69 73 20 75 6e 64  65 66 69 6e 65 64 20 6f  |k is undefined o|
00000c50  6e 20 65 6e 74 72 79 2e  0d 0d 63 2e 20 53 65 74  |n entry...c. Set|
00000c60  20 75 70 20 74 68 65 20  65 72 72 6f 72 20 68 61  | up the error ha|
00000c70  6e 64 6c 69 6e 67 20 72  6f 75 74 69 6e 65 2e 0d  |ndling routine..|
00000c80  0d 20 20 45 76 65 6e 20  61 20 73 69 6d 70 6c 65  |.  Even a simple|
00000c90  20 6c 61 6e 67 75 61 67  65 20 73 75 63 68 20 61  | language such a|
00000ca0  73 20 4e 4f 42 41 53 49  43 20 72 65 71 75 69 72  |s NOBASIC requir|
00000cb0  65 73 20 65 72 72 6f 72  20 68 61 6e 64 6c 69 6e  |es error handlin|
00000cc0  67 2e 20 54 68 65 0d 6f  70 65 72 61 74 69 6e 67  |g. The.operating|
00000cd0  20 73 79 73 74 65 6d 20  61 75 74 6f 6d 61 74 69  | system automati|
00000ce0  63 61 6c 6c 79 20 73 77  69 74 63 68 65 73 20 74  |cally switches t|
00000cf0  6f 20 74 68 65 20 63 75  72 72 65 6e 74 20 6c 61  |o the current la|
00000d00  6e 67 75 61 67 65 20 72  6f 6d 20 6f 6e 0d 61 20  |nguage rom on.a |
00000d10  42 52 4b 2e 20 57 68 65  6e 20 61 20 42 52 4b 20  |BRK. When a BRK |
00000d20  6f 63 63 75 72 73 2c 20  74 68 65 20 63 75 72 72  |occurs, the curr|
00000d30  65 6e 74 6c 79 20 61 63  74 69 76 65 20 72 6f 6d  |ently active rom|
00000d40  20 6e 75 6d 62 65 72 20  69 73 20 73 74 6f 72 65  | number is store|
00000d50  64 0d 61 6e 64 20 63 61  6e 20 62 65 20 72 65 61  |d.and can be rea|
00000d60  64 20 75 73 69 6e 67 20  4f 73 62 79 74 65 20 26  |d using Osbyte &|
00000d70  42 41 2e 20 54 68 65 20  4e 4f 42 41 53 49 43 20  |BA. The NOBASIC |
00000d80  65 72 72 6f 72 20 68 61  6e 64 6c 65 72 20 64 6f  |error handler do|
00000d90  65 73 20 6e 6f 74 0d 75  73 65 20 4f 73 62 79 74  |es not.use Osbyt|
00000da0  65 20 26 42 41 2e 20 49  74 20 70 72 69 6e 74 73  |e &BA. It prints|
00000db0  20 74 68 65 20 65 72 72  6f 72 20 6d 65 73 73 61  | the error messa|
00000dc0  67 65 20 70 6f 69 6e 74  65 64 20 74 6f 20 62 79  |ge pointed to by|
00000dd0  20 74 68 65 20 65 72 72  6f 72 0d 76 65 63 74 6f  | the error.vecto|
00000de0  72 20 61 6e 64 20 72 65  73 65 74 73 20 74 68 65  |r and resets the|
00000df0  20 6c 61 6e 67 75 61 67  65 20 62 79 20 6a 75 6d  | language by jum|
00000e00  70 69 6e 67 20 62 61 63  6b 20 74 6f 20 74 68 65  |ping back to the|
00000e10  20 6c 61 6e 67 75 61 67  65 20 65 6e 74 72 79 0d  | language entry.|
00000e20  70 6f 69 6e 74 2e 0d 0d  20 20 54 68 65 20 72 6f  |point...  The ro|
00000e30  6d 20 68 65 61 64 65 72  20 6f 66 20 61 20 6c 61  |m header of a la|
00000e40  6e 67 75 61 67 65 20 72  6f 6d 20 68 61 73 20 74  |nguage rom has t|
00000e50  6f 20 62 65 20 63 6f 6e  66 69 67 75 72 65 64 20  |o be configured |
00000e60  61 70 70 72 6f 70 72 69  61 74 65 6c 79 0d 69 6e  |appropriately.in|
00000e70  20 6f 72 64 65 72 20 74  68 61 74 20 74 68 65 20  | order that the |
00000e80  4d 4f 53 20 63 61 6e 20  72 65 63 6f 67 6e 69 73  |MOS can recognis|
00000e90  65 20 74 68 65 20 72 6f  6d 20 69 6d 61 67 65 20  |e the rom image |
00000ea0  61 73 20 61 20 6c 61 6e  67 75 61 67 65 20 72 6f  |as a language ro|
00000eb0  6d 2e 0d 54 68 65 20 64  69 66 66 65 72 65 6e 63  |m..The differenc|
00000ec0  65 20 62 65 74 77 65 65  6e 20 73 65 72 76 69 63  |e between servic|
00000ed0  65 20 72 6f 6d 20 61 6e  64 20 6c 61 6e 67 75 61  |e rom and langua|
00000ee0  67 65 20 72 6f 6d 20 68  65 61 64 65 72 73 20 69  |ge rom headers i|
00000ef0  73 20 74 68 61 74 0d 74  68 65 20 6c 61 74 74 65  |s that.the latte|
00000f00  72 20 68 61 73 20 61 20  6a 75 6d 70 20 74 6f 20  |r has a jump to |
00000f10  74 68 65 20 6c 61 6e 67  75 61 67 65 20 65 6e 74  |the language ent|
00000f20  72 79 20 70 6f 69 6e 74  20 69 6e 20 74 68 65 20  |ry point in the |
00000f30  66 69 72 73 74 20 74 68  72 65 65 0d 62 79 74 65  |first three.byte|
00000f40  73 20 6f 66 20 74 68 65  20 68 65 61 64 65 72 20  |s of the header |
00000f50  61 6e 64 20 74 68 65 20  72 6f 6d 20 74 79 70 65  |and the rom type|
00000f60  20 62 79 74 65 20 61 74  20 26 38 30 30 36 20 75  | byte at &8006 u|
00000f70  73 75 61 6c 6c 79 20 73  74 6f 72 65 73 20 74 68  |sually stores th|
00000f80  65 0d 6e 75 6d 62 65 72  20 26 43 32 20 74 6f 20  |e.number &C2 to |
00000f90  69 6e 64 69 63 61 74 65  20 74 68 61 74 20 6c 61  |indicate that la|
00000fa0  6e 67 75 61 67 65 20 61  6e 64 20 73 65 72 76 69  |nguage and servi|
00000fb0  63 65 20 65 6e 74 72 79  20 70 6f 69 6e 74 73 20  |ce entry points |
00000fc0  61 72 65 0d 61 76 61 69  6c 61 62 6c 65 2e 20 54  |are.available. T|
00000fd0  68 65 20 72 6f 6d 20 68  65 61 64 65 72 20 66 6f  |he rom header fo|
00000fe0  72 20 4e 4f 42 41 53 49  43 20 69 73 20 73 68 6f  |r NOBASIC is sho|
00000ff0  77 6e 20 69 6e 20 66 69  67 75 72 65 20 31 37 2e  |wn in figure 17.|
00001000  31 2e 20 52 6f 6d 0d 68  65 61 64 65 72 73 20 77  |1. Rom.headers w|
00001010  65 72 65 20 64 65 73 63  72 69 62 65 64 20 69 6e  |ere described in|
00001020  20 64 65 74 61 69 6c 20  69 6e 20 4d 6f 64 75 6c  | detail in Modul|
00001030  65 20 33 20 6f 66 20 74  68 65 20 63 6f 75 72 73  |e 3 of the cours|
00001040  65 2e 20 59 6f 75 20 6d  61 79 0d 6e 65 65 64 20  |e. You may.need |
00001050  74 6f 20 6c 6f 6f 6b 20  61 67 61 69 6e 20 61 74  |to look again at|
00001060  20 4d 6f 64 75 6c 65 20  33 20 69 66 20 79 6f 75  | Module 3 if you|
00001070  20 68 61 76 65 20 66 6f  72 67 6f 74 74 65 6e 20  | have forgotten |
00001080  61 62 6f 75 74 20 72 6f  6d 20 68 65 61 64 65 72  |about rom header|
00001090  73 0d 61 6e 64 20 72 6f  6d 20 74 79 70 65 20 62  |s.and rom type b|
000010a0  79 74 65 73 2e 0d 0d 0d  0d 0d 0d 38 30 30 30 20  |ytes.......8000 |
000010b0  34 43 20 38 32 20 38 30  20 4a 4d 50 20 6c 61 6e  |4C 82 80 JMP lan|
000010c0  67 75 61 67 65 20 20 20  20 20 20 20 20 20 20 20  |guage           |
000010d0  5c 20 6a 75 6d 70 20 74  6f 20 6c 61 6e 67 75 61  |\ jump to langua|
000010e0  67 65 20 65 6e 74 72 79  20 70 6f 69 6e 74 0d 38  |ge entry point.8|
000010f0  30 30 33 20 34 43 20 32  44 20 38 30 20 4a 4d 50  |003 4C 2D 80 JMP|
00001100  20 73 65 72 76 69 63 65  20 20 20 20 20 20 20 20  | service        |
00001110  20 20 20 20 5c 20 6a 75  6d 70 20 74 6f 20 73 65  |    \ jump to se|
00001120  72 76 69 63 65 20 65 6e  74 72 79 20 70 6f 69 6e  |rvice entry poin|
00001130  74 0d 38 30 30 36 20 43  32 20 20 20 20 20 20 20  |t.8006 C2       |
00001140  45 51 55 42 20 26 43 32  20 20 20 20 20 20 20 20  |EQUB &C2        |
00001150  20 20 20 20 20 20 20 5c  20 72 6f 6d 20 74 79 70  |       \ rom typ|
00001160  65 20 62 75 74 65 20 28  31 31 30 30 20 30 30 31  |e bute (1100 001|
00001170  30 29 0d 38 30 30 37 20  31 31 20 20 20 20 20 20  |0).8007 11      |
00001180  20 45 51 55 42 20 63 6f  70 79 72 69 67 68 74 20  | EQUB copyright |
00001190  4d 4f 44 20 32 35 36 20  5c 20 63 6f 70 79 72 69  |MOD 256 \ copyri|
000011a0  67 68 74 20 6f 66 66 73  65 74 0d 38 30 30 38 20  |ght offset.8008 |
000011b0  30 30 20 20 20 20 20 20  20 42 52 4b 20 20 20 20  |00       BRK    |
000011c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000011d0  5c 20 62 69 6e 61 72 79  20 76 65 72 73 69 6f 6e  |\ binary version|
000011e0  20 6e 75 6d 62 65 72 20  28 7a 65 72 6f 29 0d 38  | number (zero).8|
000011f0  30 30 39 20 20 20 20 20  20 20 20 20 20 2e 74 69  |009          .ti|
00001200  74 6c 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |tle             |
00001210  20 20 20 20 5c 20 72 6f  6d 20 74 69 74 6c 65 20  |    \ rom title |
00001220  73 74 72 69 6e 67 0d 38  30 30 39 20 34 45 20 34  |string.8009 4E 4|
00001230  46 20 34 32 20 0d 20 20  20 20 20 34 31 20 35 33  |F 42 .     41 53|
00001240  20 34 39 20 0d 20 20 20  20 20 34 33 20 20 20 20  | 49 .     43    |
00001250  20 20 20 45 51 55 53 20  22 4e 4f 42 41 53 49 43  |   EQUS "NOBASIC|
00001260  22 0d 38 30 31 30 20 30  30 20 20 20 20 20 20 20  |".8010 00       |
00001270  42 52 4b 0d 38 30 31 31  20 20 20 20 20 20 20 20  |BRK.8011        |
00001280  20 20 2e 63 6f 70 79 72  69 67 68 74 20 20 20 20  |  .copyright    |
00001290  20 20 20 20 20 20 20 20  20 5c 20 63 6f 70 79 72  |         \ copyr|
000012a0  69 67 68 74 20 73 74 72  69 6e 67 0d 38 30 31 31  |ight string.8011|
000012b0  20 30 30 20 20 20 20 20  20 20 42 52 4b 20 20 20  | 00       BRK   |
000012c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000012d0  20 5c 20 6d 75 73 74 20  73 74 61 72 74 20 77 69  | \ must start wi|
000012e0  74 68 20 7a 65 72 6f 0d  38 30 31 32 20 32 38 20  |th zero.8012 28 |
000012f0  34 33 20 32 39 20 0d 20  20 20 20 20 32 30 20 34  |43 29 .     20 4|
00001300  37 20 36 46 20 0d 20 20  20 20 20 37 32 20 36 34  |7 6F .     72 64|
00001310  20 36 46 20 0d 20 20 20  20 20 36 45 20 32 30 20  | 6F .     6E 20 |
00001320  34 38 20 0d 20 20 20 20  20 36 46 20 37 32 20 37  |48 .     6F 72 7|
00001330  33 20 0d 20 20 20 20 20  36 39 20 36 45 20 36 37  |3 .     69 6E 67|
00001340  20 0d 20 20 20 20 20 37  34 20 36 46 20 36 45 20  | .     74 6F 6E |
00001350  0d 20 20 20 20 20 32 30  20 33 31 20 33 39 20 0d  |.     20 31 39 .|
00001360  20 20 20 20 20 33 38 20  33 37 20 20 20 20 45 51  |     38 37    EQ|
00001370  55 53 20 22 28 43 29 20  47 6f 72 64 6f 6e 20 48  |US "(C) Gordon H|
00001380  6f 72 73 69 6e 67 74 6f  6e 20 31 39 38 37 22 0d  |orsington 1987".|
00001390  38 30 32 43 20 30 30 20  20 20 20 20 20 20 42 52  |802C 00       BR|
000013a0  4b 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |K               |
000013b0  20 20 20 20 20 5c 20 61  6e 64 20 65 6e 64 20 77  |     \ and end w|
000013c0  69 74 68 20 7a 65 72 6f  0d 38 30 32 44 20 20 20  |ith zero.802D   |
000013d0  20 20 20 20 20 20 20 2e  73 65 72 76 69 63 65 20  |       .service |
000013e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
000013f0  73 65 72 76 69 63 65 20  65 6e 74 72 79 20 70 6f  |service entry po|
00001400  69 6e 74 0d 20 20 20 20  20 20 20 20 20 20 20 20  |int.            |
00001410  20 20 20 20 20 20 2e 0d  20 20 20 20 20 20 20 20  |      ..        |
00001420  20 20 20 20 20 20 20 20  20 20 2e 0d 20 20 20 20  |          ..    |
00001430  20 20 20 20 20 20 20 20  20 20 20 20 20 20 2e 0d  |              ..|
00001440  38 30 38 32 20 20 20 20  20 20 20 20 20 20 2e 6c  |8082          .l|
00001450  61 6e 67 75 61 67 65 20  20 20 20 20 20 20 20 20  |anguage         |
00001460  20 20 20 20 20 5c 20 6c  61 6e 67 75 61 67 65 20  |     \ language |
00001470  65 6e 74 72 79 20 70 6f  69 6e 74 0d 20 20 20 20  |entry point.    |
00001480  20 20 20 20 20 20 20 20  20 20 20 20 20 20 2e 0d  |              ..|
00001490  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000014a0  20 20 2e 0d 20 20 20 20  20 20 20 20 20 20 20 20  |  ..            |
000014b0  20 20 20 20 20 20 2e 0d  0d 46 69 67 75 72 65 20  |      ...Figure |
000014c0  31 37 2e 31 20 20 54 68  65 20 4e 4f 42 41 53 49  |17.1  The NOBASI|
000014d0  43 20 72 6f 6d 20 68 65  61 64 65 72 2e 0d 2d 2d  |C rom header..--|
000014e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 20 20 2d 2d 2d 2d 2d  |---------  -----|
000014f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001500  2d 2d 0d 0d 0d 0d 20 20  54 68 65 20 73 65 72 76  |--....  The serv|
00001510  69 63 65 20 65 6e 74 72  79 20 70 6f 69 6e 74 20  |ice entry point |
00001520  6f 66 20 4e 4f 42 41 53  49 43 20 67 69 76 65 73  |of NOBASIC gives|
00001530  20 61 63 63 65 73 73 20  74 6f 20 61 6e 20 75 6e  | access to an un|
00001540  72 65 63 6f 67 6e 69 73  65 64 20 2a 0d 63 6f 6d  |recognised *.com|
00001550  6d 61 6e 64 20 69 6e 74  65 72 70 72 65 74 65 72  |mand interpreter|
00001560  20 61 6e 64 20 61 20 73  69 6d 70 6c 65 20 68 65  | and a simple he|
00001570  6c 70 20 73 65 72 76 69  63 65 2e 20 54 68 65 20  |lp service. The |
00001580  72 65 67 69 73 74 65 72  73 20 61 72 65 0d 70 75  |registers are.pu|
00001590  73 68 65 64 20 6f 6e 20  74 68 65 20 73 74 61 63  |shed on the stac|
000015a0  6b 20 28 6c 69 6e 65 73  20 33 35 30 2d 33 39 30  |k (lines 350-390|
000015b0  29 2e 20 54 68 65 20 6f  72 69 67 69 6e 61 6c 20  |). The original |
000015c0  63 6f 6e 74 65 6e 74 20  6f 66 20 74 68 65 0d 61  |content of the.a|
000015d0  63 63 75 6d 75 6c 61 74  6f 72 20 69 73 20 72 65  |ccumulator is re|
000015e0  61 64 20 66 72 6f 6d 20  74 68 65 20 73 74 61 63  |ad from the stac|
000015f0  6b 20 28 6c 69 6e 65 73  20 34 30 30 2d 34 31 30  |k (lines 400-410|
00001600  29 20 61 6e 64 20 63 6f  6d 70 61 72 65 64 20 77  |) and compared w|
00001610  69 74 68 0d 74 68 65 20  75 6e 72 65 63 6f 67 6e  |ith.the unrecogn|
00001620  69 73 65 64 20 63 6f 6d  6d 61 6e 64 20 61 6e 64  |ised command and|
00001630  20 68 65 6c 70 20 73 65  72 76 69 63 65 20 72 65  | help service re|
00001640  71 75 65 73 74 20 6e 75  6d 62 65 72 73 20 28 6c  |quest numbers (l|
00001650  69 6e 65 73 0d 34 32 30  2d 34 35 30 29 2e 20 49  |ines.420-450). I|
00001660  66 20 6e 65 69 74 68 65  72 20 73 65 72 76 69 63  |f neither servic|
00001670  65 20 63 61 6c 6c 20 34  20 6e 6f 72 20 73 65 72  |e call 4 nor ser|
00001680  76 69 63 65 20 63 61 6c  6c 20 39 20 69 73 20 69  |vice call 9 is i|
00001690  6e 74 65 72 63 65 70 74  65 64 0d 74 68 65 20 72  |ntercepted.the r|
000016a0  65 67 69 73 74 65 72 73  20 61 72 65 20 72 65 73  |egisters are res|
000016b0  74 6f 72 65 64 20 28 6c  69 6e 65 73 20 34 37 30  |tored (lines 470|
000016c0  2d 35 31 30 29 20 61 6e  64 20 63 6f 6e 74 72 6f  |-510) and contro|
000016d0  6c 20 69 73 20 72 65 74  75 72 6e 65 64 20 74 6f  |l is returned to|
000016e0  0d 74 68 65 20 4d 4f 53  20 28 6c 69 6e 65 20 35  |.the MOS (line 5|
000016f0  32 30 29 2e 0d 0d 20 20  54 68 65 20 66 61 6d 69  |20)...  The fami|
00001700  6c 69 61 72 20 6f 6e 65  20 63 6f 6d 6d 61 6e 64  |liar one command|
00001710  20 69 6e 74 65 72 70 72  65 74 65 72 20 28 6c 69  | interpreter (li|
00001720  6e 65 73 20 35 33 30 2d  36 36 30 29 20 69 73 20  |nes 530-660) is |
00001730  75 73 65 64 20 74 6f 0d  63 6f 6d 70 61 72 65 20  |used to.compare |
00001740  74 68 65 20 75 6e 72 65  63 6f 67 6e 69 73 65 64  |the unrecognised|
00001750  20 63 6f 6d 6d 61 6e 64  20 77 69 74 68 20 74 68  | command with th|
00001760  65 20 74 69 74 6c 65 20  73 74 72 69 6e 67 20 6f  |e title string o|
00001770  66 20 74 68 65 20 72 6f  6d 2e 20 49 66 0d 61 20  |f the rom. If.a |
00001780  6d 61 74 63 68 20 69 73  20 66 6f 75 6e 64 20 63  |match is found c|
00001790  6f 6e 74 72 6f 6c 20 70  61 73 73 65 73 20 74 6f  |ontrol passes to|
000017a0  20 74 68 65 20 6c 61 62  65 6c 20 22 2e 66 6f 75  | the label ".fou|
000017b0  6e 64 22 20 28 6c 69 6e  65 20 36 37 30 29 2e 20  |nd" (line 670). |
000017c0  49 66 0d 69 74 20 69 73  20 6e 6f 74 20 74 68 65  |If.it is not the|
000017d0  20 72 65 67 69 73 74 65  72 73 20 61 72 65 20 72  | registers are r|
000017e0  65 73 74 6f 72 65 64 20  28 6c 69 6e 65 20 36 36  |estored (line 66|
000017f0  30 20 61 6e 64 20 6c 69  6e 65 73 20 34 37 30 2d  |0 and lines 470-|
00001800  35 31 30 29 20 61 6e 64  0d 63 6f 6e 74 72 6f 6c  |510) and.control|
00001810  20 70 61 73 73 65 64 20  62 61 63 6b 20 74 6f 20  | passed back to |
00001820  74 68 65 20 4d 4f 53 20  28 6c 69 6e 65 20 35 32  |the MOS (line 52|
00001830  30 29 2e 20 57 68 65 6e  20 74 68 65 20 63 6f 6d  |0). When the com|
00001840  6d 61 6e 64 20 2a 4e 4f  42 41 53 49 43 0d 69 73  |mand *NOBASIC.is|
00001850  20 69 6e 74 65 72 63 65  70 74 65 64 20 74 68 65  | intercepted the|
00001860  20 61 63 63 75 6d 75 6c  61 74 6f 72 20 69 73 20  | accumulator is |
00001870  6c 6f 61 64 65 64 20 77  69 74 68 20 26 38 45 20  |loaded with &8E |
00001880  28 6c 69 6e 65 20 36 38  30 29 20 61 6e 64 20 74  |(line 680) and t|
00001890  68 65 20 58 0d 72 65 67  69 73 74 65 72 20 69 73  |he X.register is|
000018a0  20 6c 6f 61 64 65 64 20  77 69 74 68 20 74 68 65  | loaded with the|
000018b0  20 72 6f 6d 20 6e 75 6d  62 65 72 20 73 74 6f 72  | rom number stor|
000018c0  65 64 20 69 6e 20 26 46  34 20 28 6c 69 6e 65 20  |ed in &F4 (line |
000018d0  36 39 30 29 20 61 6e 64  20 61 0d 6a 75 6d 70 20  |690) and a.jump |
000018e0  69 73 20 6d 61 64 65 20  74 6f 20 4f 73 62 79 74  |is made to Osbyt|
000018f0  65 20 28 6c 69 6e 65 20  37 30 30 29 20 74 6f 20  |e (line 700) to |
00001900  65 6e 74 65 72 20 74 68  65 20 72 6f 6d 20 61 74  |enter the rom at|
00001910  20 69 74 73 20 6c 61 6e  67 75 61 67 65 0d 65 6e  | its language.en|
00001920  74 72 79 20 70 6f 69 6e  74 2e 20 54 68 65 72 65  |try point. There|
00001930  20 69 73 20 6e 6f 20 72  65 74 75 72 6e 20 66 72  | is no return fr|
00001940  6f 6d 20 4f 73 62 79 74  65 20 26 38 45 2e 0d 0d  |om Osbyte &8E...|
00001950  20 20 54 68 65 20 73 69  6d 70 6c 65 20 68 65 6c  |  The simple hel|
00001960  70 20 72 6f 75 74 69 6e  65 20 28 6c 69 6e 65 20  |p routine (line |
00001970  37 31 30 2d 38 34 30 29  20 69 73 20 75 73 65 64  |710-840) is used|
00001980  20 74 6f 20 70 72 69 6e  74 20 74 68 65 20 72 6f  | to print the ro|
00001990  6d 0d 74 69 74 6c 65 20  69 6e 20 72 65 73 70 6f  |m.title in respo|
000019a0  6e 73 65 20 74 6f 20 74  68 65 20 2a 48 45 4c 50  |nse to the *HELP|
000019b0  20 63 6f 6d 6d 61 6e 64  2e 20 54 68 65 20 61 72  | command. The ar|
000019c0  67 75 6d 65 6e 74 20 69  73 20 69 6e 69 74 69 61  |gument is initia|
000019d0  6c 69 73 65 64 0d 28 6c  69 6e 65 20 37 32 30 29  |lised.(line 720)|
000019e0  20 61 6e 64 2c 20 69 66  20 61 6e 20 61 72 67 75  | and, if an argu|
000019f0  6d 65 6d 74 20 68 61 73  20 62 65 65 6e 20 74 79  |memt has been ty|
00001a00  70 65 64 2c 20 74 68 65  20 7a 65 72 6f 20 66 6c  |ped, the zero fl|
00001a10  61 67 20 77 69 6c 6c 20  62 65 0d 63 6c 65 61 72  |ag will be.clear|
00001a20  20 6f 6e 20 72 65 74 75  72 6e 20 66 72 6f 6d 20  | on return from |
00001a30  47 73 69 6e 69 74 2e 20  54 68 65 20 7a 65 72 6f  |Gsinit. The zero|
00001a40  20 66 6c 61 67 20 69 73  20 74 65 73 74 65 64 20  | flag is tested |
00001a50  28 6c 69 6e 65 20 37 33  30 29 20 61 6e 64 20 69  |(line 730) and i|
00001a60  66 0d 63 6c 65 61 72 20  65 78 74 65 6e 64 65 64  |f.clear extended|
00001a70  20 68 65 6c 70 20 68 61  73 20 62 65 65 6e 20 72  | help has been r|
00001a80  65 71 75 65 73 74 65 64  2e 20 45 78 74 65 6e 64  |equested. Extend|
00001a90  65 64 20 68 65 6c 70 20  69 73 20 6e 6f 74 20 75  |ed help is not u|
00001aa0  73 75 61 6c 6c 79 0d 70  72 6f 76 69 64 65 64 20  |sually.provided |
00001ab0  62 79 20 6c 61 6e 67 75  61 67 65 20 72 6f 6d 73  |by language roms|
00001ac0  20 61 6e 64 20 73 6f 20  74 68 65 20 72 65 67 69  | and so the regi|
00001ad0  73 74 65 72 73 20 61 72  65 20 72 65 73 74 6f 72  |sters are restor|
00001ae0  65 64 20 28 6c 69 6e 65  20 37 33 30 0d 61 6e 64  |ed (line 730.and|
00001af0  20 6c 69 6e 65 73 20 34  37 30 2d 35 31 30 29 20  | lines 470-510) |
00001b00  61 6e 64 20 63 6f 6e 74  72 6f 6c 20 69 73 20 70  |and control is p|
00001b10  61 73 73 65 64 20 62 61  63 6b 20 74 6f 20 74 68  |assed back to th|
00001b20  65 20 4d 4f 53 20 28 6c  69 6e 65 20 35 32 30 29  |e MOS (line 520)|
00001b30  2e 0d 49 66 20 73 69 6d  70 6c 65 20 68 65 6c 70  |..If simple help|
00001b40  20 69 73 20 72 65 71 75  65 73 74 65 64 20 74 68  | is requested th|
00001b50  65 20 72 6f 6d 20 74 69  74 6c 65 20 69 73 20 70  |e rom title is p|
00001b60  72 69 6e 74 65 64 20 28  6c 69 6e 65 73 20 37 34  |rinted (lines 74|
00001b70  30 2d 38 33 30 29 2c 0d  74 68 65 20 72 65 67 69  |0-830),.the regi|
00001b80  73 74 65 72 73 20 61 72  65 20 72 65 73 74 6f 72  |sters are restor|
00001b90  65 64 20 28 6c 69 6e 65  20 38 35 30 20 61 6e 64  |ed (line 850 and|
00001ba0  20 6c 69 6e 65 73 20 34  36 30 2d 35 31 30 29 20  | lines 460-510) |
00001bb0  61 6e 64 20 63 6f 6e 74  72 6f 6c 20 69 73 0d 70  |and control is.p|
00001bc0  61 73 73 65 64 20 62 61  63 6b 20 74 6f 20 74 68  |assed back to th|
00001bd0  65 20 4d 4f 53 20 28 6c  69 6e 65 20 35 32 30 29  |e MOS (line 520)|
00001be0  2e 0d 0d 20 20 46 6f 6c  6c 6f 77 69 6e 67 20 74  |...  Following t|
00001bf0  68 65 20 4f 73 62 79 74  65 20 26 38 45 20 63 61  |he Osbyte &8E ca|
00001c00  6c 6c 20 28 6c 69 6e 65  73 20 36 38 30 2d 37 30  |ll (lines 680-70|
00001c10  30 29 20 74 68 65 20 72  6f 6d 20 77 69 6c 6c 20  |0) the rom will |
00001c20  62 65 0d 65 6e 74 65 72  65 64 20 61 74 20 69 74  |be.entered at it|
00001c30  73 20 6c 61 6e 67 75 61  67 65 20 65 6e 74 72 79  |s language entry|
00001c40  20 70 6f 69 6e 74 20 28  6c 69 6e 65 20 38 35 30  | point (line 850|
00001c50  29 20 76 69 61 20 74 68  65 20 6a 75 6d 70 0d 69  |) via the jump.i|
00001c60  6e 73 74 72 75 63 74 69  6f 6e 20 69 6e 20 74 68  |nstruction in th|
00001c70  65 20 72 6f 6d 20 68 65  61 64 65 72 20 28 6c 69  |e rom header (li|
00001c80  6e 65 20 32 32 30 29 2e  20 54 68 65 20 6c 61 6e  |ne 220). The lan|
00001c90  67 75 61 67 65 20 6d 75  73 74 20 65 6e 61 62 6c  |guage must enabl|
00001ca0  65 0d 69 6e 74 65 72 75  70 74 20 72 65 71 75 65  |e.interupt reque|
00001cb0  73 74 73 20 28 6c 69 6e  65 20 38 36 30 29 2c 20  |sts (line 860), |
00001cc0  72 65 73 65 74 20 74 68  65 20 73 74 61 63 6b 20  |reset the stack |
00001cd0  28 6c 69 6e 65 73 20 38  37 30 2d 38 38 30 29 20  |(lines 870-880) |
00001ce0  61 6e 64 0d 72 65 2d 76  65 63 74 6f 72 20 74 68  |and.re-vector th|
00001cf0  65 20 42 52 45 41 4b 56  20 61 74 20 26 32 30 32  |e BREAKV at &202|
00001d00  20 61 6e 64 20 26 32 30  33 20 28 6c 69 6e 65 73  | and &203 (lines|
00001d10  20 38 39 30 2d 39 32 30  29 20 74 6f 20 70 6f 69  | 890-920) to poi|
00001d20  6e 74 20 74 6f 20 69 74  73 0d 6f 77 6e 20 65 72  |nt to its.own er|
00001d30  72 6f 72 20 68 61 6e 64  6c 69 6e 67 20 72 6f 75  |ror handling rou|
00001d40  74 69 6e 65 20 73 74 61  72 74 69 6e 67 20 61 74  |tine starting at|
00001d50  20 74 68 65 20 6c 61 62  65 6c 20 22 2e 65 72 72  | the label ".err|
00001d60  6f 72 22 20 28 6c 69 6e  65 20 31 31 38 30 29 2e  |or" (line 1180).|
00001d70  0d 0d 20 20 45 72 72 6f  72 20 68 61 6e 64 6c 69  |..  Error handli|
00001d80  6e 67 20 69 6e 20 6c 61  6e 67 75 61 67 65 20 72  |ng in language r|
00001d90  6f 6d 73 20 69 73 20 64  69 66 66 65 72 65 6e 74  |oms is different|
00001da0  20 74 6f 20 74 68 61 74  20 69 6e 20 73 65 72 76  | to that in serv|
00001db0  69 63 65 0d 72 6f 6d 73  2e 20 49 6e 20 61 20 73  |ice.roms. In a s|
00001dc0  65 72 76 69 63 65 20 72  6f 6d 20 79 6f 75 20 63  |ervice rom you c|
00001dd0  6f 70 79 20 74 68 65 20  65 72 72 6f 72 20 6d 65  |opy the error me|
00001de0  73 73 61 67 65 2c 20 70  72 65 63 65 64 65 64 20  |ssage, preceded |
00001df0  61 6e 64 0d 66 6f 6c 6c  6f 77 65 64 20 62 79 20  |and.followed by |
00001e00  61 20 42 52 4b 20 69 6e  73 74 72 75 63 74 69 6f  |a BRK instructio|
00001e10  6e 2c 20 69 6e 74 6f 20  74 68 65 20 65 72 72 6f  |n, into the erro|
00001e20  72 20 62 75 66 66 65 72  20 61 6e 64 20 74 68 65  |r buffer and the|
00001e30  6e 20 6a 75 6d 70 20 74  6f 0d 74 68 65 20 66 69  |n jump to.the fi|
00001e40  72 73 74 20 42 52 4b 20  69 6e 73 74 72 75 63 74  |rst BRK instruct|
00001e50  69 6f 6e 20 6f 66 20 74  68 65 20 65 72 72 6f 72  |ion of the error|
00001e60  20 6d 65 73 73 61 67 65  2c 20 28 73 65 65 20 4d  | message, (see M|
00001e70  6f 64 75 6c 65 20 38 29  2e 20 57 68 65 6e 0d 74  |odule 8). When.t|
00001e80  68 65 20 4d 4f 53 20 70  72 6f 63 65 73 73 65 73  |he MOS processes|
00001e90  20 74 68 65 20 42 52 4b  20 69 6e 73 74 72 75 63  | the BRK instruc|
00001ea0  74 69 6f 6e 20 69 74 20  70 61 73 73 65 73 20 74  |tion it passes t|
00001eb0  68 65 20 65 72 72 6f 72  20 74 6f 20 74 68 65 0d  |he error to the.|
00001ec0  63 75 72 72 65 6e 74 20  61 63 74 69 76 65 20 6c  |current active l|
00001ed0  61 6e 67 75 61 67 65 20  76 69 61 20 74 68 65 20  |anguage via the |
00001ee0  62 72 65 61 6b 20 76 65  63 74 6f 72 2e 20 54 68  |break vector. Th|
00001ef0  65 20 65 72 72 6f 72 20  6d 65 73 73 61 67 65 20  |e error message |
00001f00  69 73 0d 70 6f 69 6e 74  65 64 20 74 6f 20 62 79  |is.pointed to by|
00001f10  20 74 68 65 20 65 72 72  6f 72 20 76 65 63 74 6f  | the error vecto|
00001f20  72 20 61 74 20 26 46 44  20 61 6e 64 20 26 46 45  |r at &FD and &FE|
00001f30  2e 20 54 68 65 20 6c 61  6e 67 75 61 67 65 20 65  |. The language e|
00001f40  72 72 6f 72 0d 68 61 6e  64 6c 65 72 20 6d 75 73  |rror.handler mus|
00001f50  74 20 75 73 65 20 74 68  65 20 65 72 72 6f 72 20  |t use the error |
00001f60  76 65 63 74 6f 72 20 74  6f 20 70 72 69 6e 74 20  |vector to print |
00001f70  6f 75 74 20 74 68 65 20  65 72 72 6f 72 20 6d 65  |out the error me|
00001f80  73 73 61 67 65 2c 20 74  68 65 6e 0d 72 65 2d 69  |ssage, then.re-i|
00001f90  6e 69 74 69 61 6c 69 73  65 20 74 68 65 20 73 74  |nitialise the st|
00001fa0  61 63 6b 20 61 6e 64 20  70 61 73 73 20 63 6f 6e  |ack and pass con|
00001fb0  74 72 6f 6c 20 62 61 63  6b 20 74 6f 20 73 6f 6d  |trol back to som|
00001fc0  65 20 77 65 6c 6c 20 64  65 66 69 6e 65 64 0d 70  |e well defined.p|
00001fd0  61 72 74 20 6f 66 20 74  68 65 20 6c 61 6e 67 75  |art of the langu|
00001fe0  61 67 65 2c 20 73 75 63  68 20 61 73 20 74 68 65  |age, such as the|
00001ff0  20 69 6e 70 75 74 20 70  72 6f 6d 70 74 2e 20 4e  | input prompt. N|
00002000  4f 42 41 53 49 43 20 6a  75 6d 70 73 20 62 61 63  |OBASIC jumps bac|
00002010  6b 20 74 6f 0d 74 68 65  20 6c 61 6e 67 75 61 67  |k to.the languag|
00002020  65 20 65 6e 74 72 79 20  70 6f 69 6e 74 20 61 66  |e entry point af|
00002030  74 65 72 20 70 72 69 6e  74 69 6e 67 20 74 68 65  |ter printing the|
00002040  20 65 72 72 6f 72 20 6d  65 73 73 61 67 65 2e 20  | error message. |
00002050  41 20 6d 6f 72 65 0d 63  6f 6d 70 6c 65 78 20 6c  |A more.complex l|
00002060  61 6e 67 75 61 67 65 20  77 6f 75 6c 64 20 70 72  |anguage would pr|
00002070  6f 62 61 62 6c 79 20 6e  6f 74 20 75 73 65 20 74  |obably not use t|
00002080  68 69 73 20 73 68 6f 72  74 63 75 74 2e 0d 0d 20  |his shortcut... |
00002090  20 54 68 65 20 65 72 72  6f 72 20 68 61 6e 64 6c  | The error handl|
000020a0  65 72 20 69 6e 20 4e 4f  42 41 53 49 43 20 69 73  |er in NOBASIC is|
000020b0  20 69 6e 20 6c 69 6e 65  73 20 31 31 38 30 20 74  | in lines 1180 t|
000020c0  6f 20 31 32 39 30 2e 20  54 68 65 20 4d 4f 53 0d  |o 1290. The MOS.|
000020d0  70 72 6f 63 65 73 73 65  73 20 61 20 42 52 4b 20  |processes a BRK |
000020e0  69 6e 73 74 72 75 63 74  69 6f 6e 20 62 79 20 70  |instruction by p|
000020f0  61 73 73 69 6e 67 20 63  6f 6e 74 72 6f 6c 2c 20  |assing control, |
00002100  76 69 61 20 74 68 65 20  62 72 65 61 6b 20 76 65  |via the break ve|
00002110  63 74 6f 72 2c 0d 74 6f  20 74 68 65 20 6c 61 62  |ctor,.to the lab|
00002120  65 6c 20 22 2e 65 72 72  6f 72 22 20 28 6c 69 6e  |el ".error" (lin|
00002130  65 20 31 31 38 30 29 2e  20 54 68 65 20 65 72 72  |e 1180). The err|
00002140  6f 72 20 76 65 63 74 6f  72 20 70 6f 69 6e 74 73  |or vector points|
00002150  20 74 6f 20 74 68 65 20  62 79 74 65 0d 66 6f 6c  | to the byte.fol|
00002160  6c 6f 77 69 6e 67 20 74  68 65 20 42 52 4b 20 69  |lowing the BRK i|
00002170  6e 73 74 72 75 63 74 69  6f 6e 2e 20 54 68 69 73  |nstruction. This|
00002180  20 69 73 20 74 68 65 20  65 72 72 6f 72 20 6e 75  | is the error nu|
00002190  6d 62 65 72 20 61 6e 64  20 69 74 20 69 73 20 6e  |mber and it is n|
000021a0  6f 74 0d 70 72 69 6e 74  65 64 2e 20 54 68 65 20  |ot.printed. The |
000021b0  65 72 72 6f 72 20 72 6f  75 74 69 6e 65 20 70 72  |error routine pr|
000021c0  69 6e 74 73 20 65 76 65  72 79 20 62 79 74 65 20  |ints every byte |
000021d0  6f 66 20 74 68 65 20 65  72 72 6f 72 20 6d 65 73  |of the error mes|
000021e0  73 61 67 65 0d 28 6c 69  6e 65 73 20 31 32 30 30  |sage.(lines 1200|
000021f0  2d 31 32 36 30 29 20 75  6e 74 69 6c 20 69 74 20  |-1260) until it |
00002200  72 65 61 64 73 20 74 68  65 20 7a 65 72 6f 20 62  |reads the zero b|
00002210  79 74 65 20 61 74 20 74  68 65 20 65 6e 64 20 28  |yte at the end (|
00002220  6c 69 6e 65 20 31 32 34  30 29 0d 77 68 65 6e 20  |line 1240).when |
00002230  69 74 20 70 72 69 6e 74  73 20 61 20 6e 65 77 20  |it prints a new |
00002240  6c 69 6e 65 20 74 6f 20  6d 61 6b 65 20 74 68 65  |line to make the|
00002250  20 70 72 69 6e 74 65 64  20 6d 65 73 73 61 67 65  | printed message|
00002260  20 6c 6f 6f 6b 20 6e 65  61 74 20 28 6c 69 6e 65  | look neat (line|
00002270  0d 31 32 38 30 29 2e 20  49 74 20 74 68 65 6e 20  |.1280). It then |
00002280  70 61 73 73 65 73 20 63  6f 6e 74 72 6f 6c 20 62  |passes control b|
00002290  61 63 6b 20 74 6f 20 74  68 65 20 6c 61 6e 67 75  |ack to the langu|
000022a0  61 67 65 20 69 6e 69 74  69 61 6c 69 73 61 74 69  |age initialisati|
000022b0  6f 6e 0d 72 6f 75 74 69  6e 65 20 28 6c 69 6e 65  |on.routine (line|
000022c0  20 31 32 39 30 20 61 6e  64 20 6c 69 6e 65 73 20  | 1290 and lines |
000022d0  38 35 30 2d 39 32 30 29  20 74 6f 20 72 65 73 65  |850-920) to rese|
000022e0  74 20 74 68 65 20 73 74  61 63 6b 20 61 6e 64 20  |t the stack and |
000022f0  69 73 73 75 65 20 74 68  65 0d 69 6e 70 75 74 20  |issue the.input |
00002300  70 72 6f 6d 70 74 2e 0d  0d 20 20 54 68 65 20 63  |prompt...  The c|
00002310  6f 64 69 6e 67 20 74 68  61 74 20 69 6d 70 6c 65  |oding that imple|
00002320  6d 65 6e 74 73 20 74 68  65 20 6c 61 6e 67 75 61  |ments the langua|
00002330  67 65 20 69 73 20 69 6e  20 6c 69 6e 65 73 20 39  |ge is in lines 9|
00002340  33 30 20 74 6f 20 31 30  34 30 2e 0d 54 68 69 73  |30 to 1040..This|
00002350  20 6d 75 73 74 20 62 65  20 6f 6e 65 20 6f 66 20  | must be one of |
00002360  74 68 65 20 73 6d 61 6c  6c 65 73 74 20 6c 61 6e  |the smallest lan|
00002370  67 75 61 67 65 73 20 70  6f 73 73 69 62 6c 65 2e  |guages possible.|
00002380  20 54 68 65 20 69 6e 70  75 74 20 70 72 6f 6d 70  | The input promp|
00002390  74 0d 22 2a 22 20 69 73  20 70 72 69 6e 74 65 64  |t."*" is printed|
000023a0  20 28 6c 69 6e 65 20 39  34 30 2d 39 35 30 29 20  | (line 940-950) |
000023b0  61 6e 64 20 61 6e 20 4f  73 77 6f 72 64 20 62 75  |and an Osword bu|
000023c0  66 66 65 72 20 69 6e 20  70 61 67 65 20 26 30 37  |ffer in page &07|
000023d0  20 69 73 20 75 73 65 64  0d 74 6f 20 69 6e 70 75  | is used.to inpu|
000023e0  74 20 61 20 73 74 72 69  6e 67 20 6f 66 20 63 68  |t a string of ch|
000023f0  61 72 61 63 74 65 72 73  20 66 72 6f 6d 20 74 68  |aracters from th|
00002400  65 20 6b 65 79 62 6f 61  72 64 20 28 6c 69 6e 65  |e keyboard (line|
00002410  73 20 39 36 30 2d 39 39  30 29 2e 20 54 68 65 0d  |s 960-990). The.|
00002420  61 64 64 72 65 73 73 20  6f 66 20 74 68 65 20 4f  |address of the O|
00002430  73 77 6f 72 64 20 62 75  66 66 65 72 20 69 73 20  |sword buffer is |
00002440  73 74 6f 72 65 64 20 69  6e 20 74 68 65 20 66 69  |stored in the fi|
00002450  72 73 74 20 74 77 6f 20  62 79 74 65 73 20 6f 66  |rst two bytes of|
00002460  20 74 68 65 0d 4f 73 77  6f 72 64 20 70 61 72 61  | the.Osword para|
00002470  6d 65 74 65 72 20 62 6c  6f 63 6b 20 28 6c 69 6e  |meter block (lin|
00002480  65 73 20 31 30 35 30 2d  31 31 30 30 29 20 61 6e  |es 1050-1100) an|
00002490  64 20 74 68 69 73 20 61  64 64 72 65 73 73 20 69  |d this address i|
000024a0  73 20 73 65 6e 74 20 74  6f 0d 74 68 65 20 63 6f  |s sent to.the co|
000024b0  6d 6d 61 6e 64 20 6c 69  6e 65 20 69 6e 74 65 72  |mmand line inter|
000024c0  70 72 65 74 65 72 20 74  6f 20 70 72 6f 63 65 73  |preter to proces|
000024d0  73 20 74 68 65 20 69 6e  70 75 74 20 28 6c 69 6e  |s the input (lin|
000024e0  65 73 20 31 30 31 30 2d  31 30 33 30 29 2e 0d 41  |es 1010-1030)..A|
000024f0  66 74 65 72 20 72 65 74  75 72 6e 69 6e 67 20 66  |fter returning f|
00002500  72 6f 6d 20 74 68 65 20  43 4c 49 20 28 31 30 34  |rom the CLI (104|
00002510  30 29 20 63 6f 6e 74 72  6f 6c 20 69 73 20 70 61  |0) control is pa|
00002520  73 73 65 64 20 62 61 63  6b 20 74 6f 20 74 68 65  |ssed back to the|
00002530  0d 69 6e 70 75 74 20 70  72 6f 6d 70 74 20 72 6f  |.input prompt ro|
00002540  75 74 69 6e 65 20 28 6c  69 6e 65 20 39 34 30 29  |utine (line 940)|
00002550  20 66 6f 72 20 6d 6f 72  65 20 69 6e 70 75 74 2e  | for more input.|
00002560  0d 0d 20 20 54 68 65 20  6f 6e 6c 79 20 65 72 72  |..  The only err|
00002570  6f 72 20 74 68 61 74 20  63 61 6e 20 62 65 20 65  |or that can be e|
00002580  61 73 69 6c 79 20 67 65  6e 65 72 61 74 65 64 20  |asily generated |
00002590  77 69 74 68 69 6e 20 74  68 65 20 6c 61 6e 67 75  |within the langu|
000025a0  61 67 65 20 63 61 6e 0d  62 65 20 6d 61 64 65 20  |age can.be made |
000025b0  62 79 20 70 72 65 73 73  69 6e 67 20 74 68 65 20  |by pressing the |
000025c0  45 73 63 61 70 65 20 6b  65 79 20 77 68 65 6e 20  |Escape key when |
000025d0  69 6e 70 75 74 69 6e 67  20 74 65 78 74 20 61 74  |inputing text at|
000025e0  20 74 68 65 20 6b 65 79  62 6f 61 72 64 2e 0d 54  | the keyboard..T|
000025f0  68 69 73 20 65 72 72 6f  72 20 69 73 20 74 72 61  |his error is tra|
00002600  70 70 65 64 20 28 6c 69  6e 65 20 31 30 30 30 29  |pped (line 1000)|
00002610  20 77 68 65 6e 20 4f 73  77 6f 72 64 20 72 65 74  | when Osword ret|
00002620  75 72 6e 73 20 77 69 74  68 20 74 68 65 20 63 61  |urns with the ca|
00002630  72 72 79 0d 66 6c 61 67  20 73 65 74 2e 20 49 66  |rry.flag set. If|
00002640  20 61 6e 20 65 73 63 61  70 65 20 69 73 20 66 6c  | an escape is fl|
00002650  61 67 65 64 20 69 74 20  69 73 20 61 63 6b 6e 6f  |aged it is ackno|
00002660  77 6c 65 64 67 65 64 20  28 6c 69 6e 65 73 20 31  |wledged (lines 1|
00002670  31 32 30 2d 31 31 33 30  29 0d 61 6e 64 20 61 20  |120-1130).and a |
00002680  42 52 4b 20 69 6e 73 74  72 75 63 74 69 6f 6e 20  |BRK instruction |
00002690  69 73 20 65 78 65 63 75  74 65 64 20 74 6f 20 73  |is executed to s|
000026a0  69 67 6e 61 6c 20 74 68  65 20 65 72 72 6f 72 20  |ignal the error |
000026b0  28 6c 69 6e 65 20 31 31  34 30 29 2e 20 54 68 65  |(line 1140). The|
000026c0  0d 42 52 4b 20 69 6e 73  74 72 75 63 74 69 6f 6e  |.BRK instruction|
000026d0  20 69 73 20 66 6f 6c 6c  6f 77 65 64 20 62 79 20  | is followed by |
000026e0  61 6e 20 65 72 72 6f 72  20 6e 75 6d 62 65 72 20  |an error number |
000026f0  28 6c 69 6e 65 20 31 31  35 30 29 2c 20 61 6e 20  |(line 1150), an |
00002700  65 72 72 6f 72 0d 6d 65  73 73 61 67 65 20 28 6c  |error.message (l|
00002710  69 6e 65 20 31 31 36 30  29 2c 20 61 6e 64 20 61  |ine 1160), and a|
00002720  6e 20 65 6e 64 20 6f 66  20 6d 65 73 73 61 67 65  |n end of message|
00002730  20 7a 65 72 6f 20 62 79  74 65 20 28 6c 69 6e 65  | zero byte (line|
00002740  20 31 31 37 30 29 2e 20  54 68 65 0d 65 72 72 6f  | 1170). The.erro|
00002750  72 20 77 69 6c 6c 20 62  65 20 64 65 61 6c 74 20  |r will be dealt |
00002760  77 69 74 68 20 61 73 20  64 65 73 63 72 69 62 65  |with as describe|
00002770  64 20 61 62 6f 76 65 2e  0d 0d 0d 0d 20 20 20 31  |d above.....   1|
00002780  30 20 52 45 4d 3a 20 4e  4f 42 41 53 49 43 0d 20  |0 REM: NOBASIC. |
00002790  20 20 32 30 20 4d 4f 44  45 37 0d 20 20 20 33 30  |  20 MODE7.   30|
000027a0  20 48 49 4d 45 4d 3d 26  33 43 30 30 0d 20 20 20  | HIMEM=&3C00.   |
000027b0  34 30 20 44 49 4d 20 73  61 76 65 20 35 30 0d 20  |40 DIM save 50. |
000027c0  20 20 35 30 20 64 69 66  66 3d 26 38 30 30 30 2d  |  50 diff=&8000-|
000027d0  48 49 4d 45 4d 0d 20 20  20 36 30 20 63 6f 6d 76  |HIMEM.   60 comv|
000027e0  65 63 3d 26 46 32 0d 20  20 20 37 30 20 72 6f 6d  |ec=&F2.   70 rom|
000027f0  6e 75 6d 62 65 72 3d 26  46 34 0d 20 20 20 38 30  |number=&F4.   80|
00002800  20 65 72 72 76 65 63 3d  26 46 44 0d 20 20 20 39  | errvec=&FD.   9|
00002810  30 20 73 74 61 63 6b 3d  26 31 30 33 0d 20 20 31  |0 stack=&103.  1|
00002820  30 30 20 62 72 65 61 6b  76 3d 26 32 30 32 0d 20  |00 breakv=&202. |
00002830  20 31 31 30 20 62 75 66  66 65 72 3d 26 37 30 30  | 110 buffer=&700|
00002840  0d 20 20 31 32 30 20 67  73 69 6e 69 74 3d 26 46  |.  120 gsinit=&F|
00002850  46 43 32 0d 20 20 31 33  30 20 67 73 72 65 61 64  |FC2.  130 gsread|
00002860  3d 26 46 46 43 35 0d 20  20 31 34 30 20 6f 73 61  |=&FFC5.  140 osa|
00002870  73 63 69 3d 26 46 46 45  33 0d 20 20 31 35 30 20  |sci=&FFE3.  150 |
00002880  6f 73 6e 65 77 6c 3d 26  46 46 45 37 0d 20 20 31  |osnewl=&FFE7.  1|
00002890  36 30 20 6f 73 77 6f 72  64 3d 26 46 46 46 31 0d  |60 osword=&FFF1.|
000028a0  20 20 31 37 30 20 6f 73  62 79 74 65 3d 26 46 46  |  170 osbyte=&FF|
000028b0  46 34 0d 20 20 31 38 30  20 6f 73 63 6c 69 3d 26  |F4.  180 oscli=&|
000028c0  46 46 46 37 0d 20 20 31  39 30 20 46 4f 52 20 70  |FFF7.  190 FOR p|
000028d0  61 73 73 20 3d 20 30 20  54 4f 20 32 20 53 54 45  |ass = 0 TO 2 STE|
000028e0  50 20 32 0d 20 20 32 30  30 20 50 25 3d 48 49 4d  |P 2.  200 P%=HIM|
000028f0  45 4d 0d 20 20 32 31 30  20 5b 20 20 20 20 20 20  |EM.  210 [      |
00002900  20 4f 50 54 20 70 61 73  73 0d 20 20 32 32 30 20  | OPT pass.  220 |
00002910  20 20 20 20 20 20 20 20  4a 4d 50 20 6c 61 6e 67  |        JMP lang|
00002920  75 61 67 65 2b 64 69 66  66 0d 20 20 32 33 30 20  |uage+diff.  230 |
00002930  20 20 20 20 20 20 20 20  4a 4d 50 20 73 65 72 76  |        JMP serv|
00002940  69 63 65 2b 64 69 66 66  0d 20 20 32 34 30 20 20  |ice+diff.  240  |
00002950  20 20 20 20 20 20 20 4f  50 54 20 46 4e 65 71 75  |       OPT FNequ|
00002960  62 28 26 43 32 29 0d 20  20 32 35 30 20 20 20 20  |b(&C2).  250    |
00002970  20 20 20 20 20 4f 50 54  20 46 4e 65 71 75 62 28  |     OPT FNequb(|
00002980  28 63 6f 70 79 72 69 67  68 74 2b 64 69 66 66 29  |(copyright+diff)|
00002990  20 4d 4f 44 20 32 35 36  29 0d 20 20 32 36 30 20  | MOD 256).  260 |
000029a0  20 20 20 20 20 20 20 20  42 52 4b 0d 20 20 32 37  |        BRK.  27|
000029b0  30 20 2e 74 69 74 6c 65  0d 20 20 32 38 30 20 20  |0 .title.  280  |
000029c0  20 20 20 20 20 20 20 4f  50 54 20 46 4e 65 71 75  |       OPT FNequ|
000029d0  73 28 22 4e 4f 42 41 53  49 43 22 29 0d 20 20 32  |s("NOBASIC").  2|
000029e0  39 30 20 20 20 20 20 20  20 20 20 42 52 4b 0d 20  |90         BRK. |
000029f0  20 33 30 30 20 2e 63 6f  70 79 72 69 67 68 74 0d  | 300 .copyright.|
00002a00  20 20 33 31 30 20 20 20  20 20 20 20 20 20 42 52  |  310         BR|
00002a10  4b 0d 20 20 33 32 30 20  20 20 20 20 20 20 20 20  |K.  320         |
00002a20  4f 50 54 20 46 4e 65 71  75 73 28 22 28 43 29 20  |OPT FNequs("(C) |
00002a30  47 6f 72 64 6f 6e 20 48  6f 72 73 69 6e 67 74 6f  |Gordon Horsingto|
00002a40  6e 20 31 39 38 37 22 29  0d 20 20 33 33 30 20 20  |n 1987").  330  |
00002a50  20 20 20 20 20 20 20 42  52 4b 0d 20 20 33 34 30  |       BRK.  340|
00002a60  20 2e 73 65 72 76 69 63  65 0d 20 20 33 35 30 20  | .service.  350 |
00002a70  20 20 20 20 20 20 20 20  50 48 41 0d 20 20 33 36  |        PHA.  36|
00002a80  30 20 20 20 20 20 20 20  20 20 54 58 41 0d 20 20  |0         TXA.  |
00002a90  33 37 30 20 20 20 20 20  20 20 20 20 50 48 41 0d  |370         PHA.|
00002aa0  20 20 33 38 30 20 20 20  20 20 20 20 20 20 54 59  |  380         TY|
00002ab0  41 0d 20 20 33 39 30 20  20 20 20 20 20 20 20 20  |A.  390         |
00002ac0  50 48 41 0d 20 20 34 30  30 20 20 20 20 20 20 20  |PHA.  400       |
00002ad0  20 20 54 53 58 0d 20 20  34 31 30 20 20 20 20 20  |  TSX.  410     |
00002ae0  20 20 20 20 4c 44 41 20  73 74 61 63 6b 2c 58 0d  |    LDA stack,X.|
00002af0  20 20 34 32 30 20 20 20  20 20 20 20 20 20 43 4d  |  420         CM|
00002b00  50 20 23 34 0d 20 20 34  33 30 20 20 20 20 20 20  |P #4.  430      |
00002b10  20 20 20 42 45 51 20 75  6e 72 65 63 6f 67 6e 69  |   BEQ unrecogni|
00002b20  73 65 64 0d 20 20 34 34  30 20 20 20 20 20 20 20  |sed.  440       |
00002b30  20 20 43 4d 50 20 23 39  0d 20 20 34 35 30 20 20  |  CMP #9.  450  |
00002b40  20 20 20 20 20 20 20 42  45 51 20 68 65 6c 70 0d  |       BEQ help.|
00002b50  20 20 34 36 30 20 2e 66  69 6e 69 73 68 0d 20 20  |  460 .finish.  |
00002b60  34 37 30 20 20 20 20 20  20 20 20 20 50 4c 41 0d  |470         PLA.|
00002b70  20 20 34 38 30 20 20 20  20 20 20 20 20 20 54 41  |  480         TA|
00002b80  59 0d 20 20 34 39 30 20  20 20 20 20 20 20 20 20  |Y.  490         |
00002b90  50 4c 41 0d 20 20 35 30  30 20 20 20 20 20 20 20  |PLA.  500       |
00002ba0  20 20 54 41 58 0d 20 20  35 31 30 20 20 20 20 20  |  TAX.  510     |
00002bb0  20 20 20 20 50 4c 41 0d  20 20 35 32 30 20 20 20  |    PLA.  520   |
00002bc0  20 20 20 20 20 20 52 54  53 0d 20 20 35 33 30 20  |      RTS.  530 |
00002bd0  2e 75 6e 72 65 63 6f 67  6e 69 73 65 64 0d 20 20  |.unrecognised.  |
00002be0  35 34 30 20 20 20 20 20  20 20 20 20 4c 44 58 20  |540         LDX |
00002bf0  23 26 46 46 0d 20 20 35  35 30 20 2e 63 6f 6d 6c  |#&FF.  550 .coml|
00002c00  6f 6f 70 0d 20 20 35 36  30 20 20 20 20 20 20 20  |oop.  560       |
00002c10  20 20 49 4e 58 0d 20 20  35 37 30 20 20 20 20 20  |  INX.  570     |
00002c20  20 20 20 20 4c 44 41 20  74 69 74 6c 65 2b 64 69  |    LDA title+di|
00002c30  66 66 2c 58 0d 20 20 35  38 30 20 20 20 20 20 20  |ff,X.  580      |
00002c40  20 20 20 42 45 51 20 66  6f 75 6e 64 0d 20 20 35  |   BEQ found.  5|
00002c50  39 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 28  |90         LDA (|
00002c60  63 6f 6d 76 65 63 29 2c  59 0d 20 20 36 30 30 20  |comvec),Y.  600 |
00002c70  20 20 20 20 20 20 20 20  49 4e 59 0d 20 20 36 31  |        INY.  61|
00002c80  30 20 20 20 20 20 20 20  20 20 43 4d 50 20 23 41  |0         CMP #A|
00002c90  53 43 28 22 2e 22 29 0d  20 20 36 32 30 20 20 20  |SC(".").  620   |
00002ca0  20 20 20 20 20 20 42 45  51 20 66 6f 75 6e 64 0d  |      BEQ found.|
00002cb0  20 20 36 33 30 20 20 20  20 20 20 20 20 20 41 4e  |  630         AN|
00002cc0  44 20 23 26 44 46 0d 20  20 36 34 30 20 20 20 20  |D #&DF.  640    |
00002cd0  20 20 20 20 20 43 4d 50  20 74 69 74 6c 65 2b 64  |     CMP title+d|
00002ce0  69 66 66 2c 58 0d 20 20  36 35 30 20 20 20 20 20  |iff,X.  650     |
00002cf0  20 20 20 20 42 45 51 20  63 6f 6d 6c 6f 6f 70 0d  |    BEQ comloop.|
00002d00  20 20 36 36 30 20 20 20  20 20 20 20 20 20 42 4e  |  660         BN|
00002d10  45 20 66 69 6e 69 73 68  0d 20 20 36 37 30 20 2e  |E finish.  670 .|
00002d20  66 6f 75 6e 64 0d 20 20  36 38 30 20 20 20 20 20  |found.  680     |
00002d30  20 20 20 20 4c 44 41 20  23 26 38 45 0d 20 20 36  |    LDA #&8E.  6|
00002d40  39 30 20 20 20 20 20 20  20 20 20 4c 44 58 20 72  |90         LDX r|
00002d50  6f 6d 6e 75 6d 62 65 72  0d 20 20 37 30 30 20 20  |omnumber.  700  |
00002d60  20 20 20 20 20 20 20 4a  4d 50 20 6f 73 62 79 74  |       JMP osbyt|
00002d70  65 20 20 20 20 5c 20 45  6e 74 65 72 20 74 68 69  |e    \ Enter thi|
00002d80  73 20 52 4f 4d 0d 20 20  37 31 30 20 2e 68 65 6c  |s ROM.  710 .hel|
00002d90  70 0d 20 20 37 32 30 20  20 20 20 20 20 20 20 20  |p.  720         |
00002da0  4a 53 52 20 67 73 69 6e  69 74 0d 20 20 37 33 30  |JSR gsinit.  730|
00002db0  20 20 20 20 20 20 20 20  20 42 4e 45 20 66 69 6e  |         BNE fin|
00002dc0  69 73 68 20 20 20 20 5c  20 4e 6f 20 65 78 74 65  |ish    \ No exte|
00002dd0  6e 64 65 64 20 68 65 6c  70 20 61 76 61 69 6c 61  |nded help availa|
00002de0  62 6c 65 0d 20 20 37 34  30 20 20 20 20 20 20 20  |ble.  740       |
00002df0  20 20 4a 53 52 20 6f 73  6e 65 77 6c 0d 20 20 37  |  JSR osnewl.  7|
00002e00  35 30 20 20 20 20 20 20  20 20 20 4c 44 58 20 23  |50         LDX #|
00002e10  26 46 46 0d 20 20 37 36  30 20 2e 68 65 6c 70 6c  |&FF.  760 .helpl|
00002e20  6f 6f 70 0d 20 20 37 37  30 20 20 20 20 20 20 20  |oop.  770       |
00002e30  20 20 49 4e 58 0d 20 20  37 38 30 20 20 20 20 20  |  INX.  780     |
00002e40  20 20 20 20 4c 44 41 20  74 69 74 6c 65 2b 64 69  |    LDA title+di|
00002e50  66 66 2c 58 0d 20 20 37  39 30 20 20 20 20 20 20  |ff,X.  790      |
00002e60  20 20 20 42 45 51 20 65  6e 64 74 69 74 6c 65 0d  |   BEQ endtitle.|
00002e70  20 20 38 30 30 20 20 20  20 20 20 20 20 20 4a 53  |  800         JS|
00002e80  52 20 6f 73 61 73 63 69  0d 20 20 38 31 30 20 20  |R osasci.  810  |
00002e90  20 20 20 20 20 20 20 42  4e 45 20 68 65 6c 70 6c  |       BNE helpl|
00002ea0  6f 6f 70 0d 20 20 38 32  30 20 2e 65 6e 64 74 69  |oop.  820 .endti|
00002eb0  74 6c 65 0d 20 20 38 33  30 20 20 20 20 20 20 20  |tle.  830       |
00002ec0  20 20 4a 53 52 20 6f 73  6e 65 77 6c 0d 20 20 38  |  JSR osnewl.  8|
00002ed0  34 30 20 20 20 20 20 20  20 20 20 4a 4d 50 20 66  |40         JMP f|
00002ee0  69 6e 69 73 68 2b 64 69  66 66 0d 20 20 38 35 30  |inish+diff.  850|
00002ef0  20 2e 6c 61 6e 67 75 61  67 65 0d 20 20 38 36 30  | .language.  860|
00002f00  20 20 20 20 20 20 20 20  20 43 4c 49 20 20 20 20  |         CLI    |
00002f10  20 20 20 20 20 20 20 5c  20 45 6e 61 62 6c 65 20  |       \ Enable |
00002f20  69 6e 74 65 72 75 70 74  20 72 65 71 75 65 73 74  |interupt request|
00002f30  73 0d 20 20 38 37 30 20  20 20 20 20 20 20 20 20  |s.  870         |
00002f40  4c 44 58 20 23 26 46 46  0d 20 20 38 38 30 20 20  |LDX #&FF.  880  |
00002f50  20 20 20 20 20 20 20 54  58 53 20 20 20 20 20 20  |       TXS      |
00002f60  20 20 20 20 20 5c 20 52  65 73 65 74 20 73 74 61  |     \ Reset sta|
00002f70  63 6b 0d 20 20 38 39 30  20 20 20 20 20 20 20 20  |ck.  890        |
00002f80  20 4c 44 41 20 23 28 65  72 72 6f 72 2b 64 69 66  | LDA #(error+dif|
00002f90  66 29 20 4d 4f 44 20 32  35 36 0d 20 20 39 30 30  |f) MOD 256.  900|
00002fa0  20 20 20 20 20 20 20 20  20 53 54 41 20 62 72 65  |         STA bre|
00002fb0  61 6b 76 0d 20 20 39 31  30 20 20 20 20 20 20 20  |akv.  910       |
00002fc0  20 20 4c 44 41 20 23 28  65 72 72 6f 72 2b 64 69  |  LDA #(error+di|
00002fd0  66 66 29 20 44 49 56 20  32 35 36 0d 20 20 39 32  |ff) DIV 256.  92|
00002fe0  30 20 20 20 20 20 20 20  20 20 53 54 41 20 62 72  |0         STA br|
00002ff0  65 61 6b 76 2b 31 0d 20  20 39 33 30 20 2e 63 6f  |eakv+1.  930 .co|
00003000  6e 74 69 6e 75 65 0d 20  20 39 34 30 20 20 20 20  |ntinue.  940    |
00003010  20 20 20 20 20 4c 44 41  20 23 41 53 43 28 22 2a  |     LDA #ASC("*|
00003020  22 29 0d 20 20 39 35 30  20 20 20 20 20 20 20 20  |").  950        |
00003030  20 4a 53 52 20 6f 73 61  73 63 69 0d 20 20 39 36  | JSR osasci.  96|
00003040  30 20 20 20 20 20 20 20  20 20 4c 44 41 20 23 30  |0         LDA #0|
00003050  0d 20 20 39 37 30 20 20  20 20 20 20 20 20 20 4c  |.  970         L|
00003060  44 58 20 23 28 62 6c 6f  63 6b 2b 64 69 66 66 29  |DX #(block+diff)|
00003070  20 4d 4f 44 20 32 35 36  0d 20 20 39 38 30 20 20  | MOD 256.  980  |
00003080  20 20 20 20 20 20 20 4c  44 59 20 23 28 62 6c 6f  |       LDY #(blo|
00003090  63 6b 2b 64 69 66 66 29  20 44 49 56 20 32 35 36  |ck+diff) DIV 256|
000030a0  0d 20 20 39 39 30 20 20  20 20 20 20 20 20 20 4a  |.  990         J|
000030b0  53 52 20 6f 73 77 6f 72  64 0d 20 31 30 30 30 20  |SR osword. 1000 |
000030c0  20 20 20 20 20 20 20 20  42 43 53 20 65 73 63 61  |        BCS esca|
000030d0  70 65 0d 20 31 30 31 30  20 20 20 20 20 20 20 20  |pe. 1010        |
000030e0  20 4c 44 58 20 62 6c 6f  63 6b 2b 64 69 66 66 0d  | LDX block+diff.|
000030f0  20 31 30 32 30 20 20 20  20 20 20 20 20 20 4c 44  | 1020         LD|
00003100  59 20 62 6c 6f 63 6b 2b  64 69 66 66 2b 31 0d 20  |Y block+diff+1. |
00003110  31 30 33 30 20 20 20 20  20 20 20 20 20 4a 53 52  |1030         JSR|
00003120  20 6f 73 63 6c 69 0d 20  31 30 34 30 20 20 20 20  | oscli. 1040    |
00003130  20 20 20 20 20 4a 4d 50  20 63 6f 6e 74 69 6e 75  |     JMP continu|
00003140  65 2b 64 69 66 66 0d 20  31 30 35 30 20 2e 62 6c  |e+diff. 1050 .bl|
00003150  6f 63 6b 0d 20 31 30 36  30 20 20 20 20 20 20 20  |ock. 1060       |
00003160  20 20 4f 50 54 20 46 4e  65 71 75 62 28 62 75 66  |  OPT FNequb(buf|
00003170  66 65 72 20 4d 4f 44 20  32 35 36 29 0d 20 31 30  |fer MOD 256). 10|
00003180  37 30 20 20 20 20 20 20  20 20 20 4f 50 54 20 46  |70         OPT F|
00003190  4e 65 71 75 62 28 62 75  66 66 65 72 20 44 49 56  |Nequb(buffer DIV|
000031a0  20 32 35 36 29 0d 20 31  30 38 30 20 20 20 20 20  | 256). 1080     |
000031b0  20 20 20 20 4f 50 54 20  46 4e 65 71 75 62 28 26  |    OPT FNequb(&|
000031c0  46 45 29 0d 20 31 30 39  30 20 20 20 20 20 20 20  |FE). 1090       |
000031d0  20 20 4f 50 54 20 46 4e  65 71 75 62 28 26 32 30  |  OPT FNequb(&20|
000031e0  29 0d 20 31 31 30 30 20  20 20 20 20 20 20 20 20  |). 1100         |
000031f0  4f 50 54 20 46 4e 65 71  75 62 28 26 37 46 29 0d  |OPT FNequb(&7F).|
00003200  20 31 31 31 30 20 2e 65  73 63 61 70 65 0d 20 31  | 1110 .escape. 1|
00003210  31 32 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |120         LDA |
00003220  23 26 37 45 0d 20 31 31  33 30 20 20 20 20 20 20  |#&7E. 1130      |
00003230  20 20 20 4a 53 52 20 6f  73 62 79 74 65 20 20 20  |   JSR osbyte   |
00003240  20 5c 20 41 63 6b 6e 6f  77 6c 65 64 67 65 20 45  | \ Acknowledge E|
00003250  73 63 61 70 65 0d 20 31  31 34 30 20 20 20 20 20  |scape. 1140     |
00003260  20 20 20 20 42 52 4b 0d  20 31 31 35 30 20 20 20  |    BRK. 1150   |
00003270  20 20 20 20 20 20 42 52  4b 0d 20 31 31 36 30 20  |      BRK. 1160 |
00003280  20 20 20 20 20 20 20 20  4f 50 54 20 46 4e 65 71  |        OPT FNeq|
00003290  75 73 28 22 45 73 63 61  70 65 22 29 0d 20 31 31  |us("Escape"). 11|
000032a0  37 30 20 20 20 20 20 20  20 20 20 42 52 4b 0d 20  |70         BRK. |
000032b0  31 31 38 30 20 2e 65 72  72 6f 72 0d 20 31 31 39  |1180 .error. 119|
000032c0  30 20 20 20 20 20 20 20  20 20 4a 53 52 20 6f 73  |0         JSR os|
000032d0  6e 65 77 6c 0d 20 31 32  30 30 20 20 20 20 20 20  |newl. 1200      |
000032e0  20 20 20 4c 44 59 20 23  30 0d 20 31 32 31 30 20  |   LDY #0. 1210 |
000032f0  2e 65 72 72 6f 72 6c 6f  6f 70 0d 20 31 32 32 30  |.errorloop. 1220|
00003300  20 20 20 20 20 20 20 20  20 49 4e 59 0d 20 31 32  |         INY. 12|
00003310  33 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 28  |30         LDA (|
00003320  65 72 72 76 65 63 29 2c  59 0d 20 31 32 34 30 20  |errvec),Y. 1240 |
00003330  20 20 20 20 20 20 20 20  42 45 51 20 6e 65 77 6c  |        BEQ newl|
00003340  69 6e 65 0d 20 31 32 35  30 20 20 20 20 20 20 20  |ine. 1250       |
00003350  20 20 4a 53 52 20 6f 73  61 73 63 69 0d 20 31 32  |  JSR osasci. 12|
00003360  36 30 20 20 20 20 20 20  20 20 20 42 4e 45 20 65  |60         BNE e|
00003370  72 72 6f 72 6c 6f 6f 70  0d 20 31 32 37 30 20 2e  |rrorloop. 1270 .|
00003380  6e 65 77 6c 69 6e 65 0d  20 31 32 38 30 20 20 20  |newline. 1280   |
00003390  20 20 20 20 20 20 4a 53  52 20 6f 73 6e 65 77 6c  |      JSR osnewl|
000033a0  0d 20 31 32 39 30 20 20  20 20 20 20 20 20 20 4a  |. 1290         J|
000033b0  4d 50 20 6c 61 6e 67 75  61 67 65 2b 64 69 66 66  |MP language+diff|
000033c0  0d 20 31 33 30 30 20 2e  6c 61 73 74 62 79 74 65  |. 1300 .lastbyte|
000033d0  0d 20 31 33 31 30 20 5d  0d 20 31 33 32 30 20 4e  |. 1310 ]. 1320 N|
000033e0  45 58 54 0d 20 31 33 33  30 20 49 4e 50 55 54 27  |EXT. 1330 INPUT'|
000033f0  22 53 61 76 65 20 66 69  6c 65 6e 61 6d 65 20 3d  |"Save filename =|
00003400  20 22 66 69 6c 65 6e 61  6d 65 24 0d 20 31 33 34  | "filename$. 134|
00003410  30 20 49 46 20 66 69 6c  65 6e 61 6d 65 24 3d 22  |0 IF filename$="|
00003420  22 20 45 4e 44 0d 20 31  33 35 30 20 24 73 61 76  |" END. 1350 $sav|
00003430  65 3d 22 53 41 56 45 20  22 2b 66 69 6c 65 6e 61  |e="SAVE "+filena|
00003440  6d 65 24 2b 22 20 22 2b  53 54 52 24 7e 28 48 49  |me$+" "+STR$~(HI|
00003450  4d 45 4d 29 2b 22 20 22  2b 53 54 52 24 7e 28 6c  |MEM)+" "+STR$~(l|
00003460  61 73 0d 20 20 20 20 20  20 74 62 79 74 65 29 2b  |as.      tbyte)+|
00003470  22 20 46 46 46 46 38 30  30 30 20 46 46 46 46 38  |" FFFF8000 FFFF8|
00003480  30 30 30 22 0d 20 31 33  36 30 20 58 25 3d 73 61  |000". 1360 X%=sa|
00003490  76 65 20 4d 4f 44 20 32  35 36 0d 20 31 33 37 30  |ve MOD 256. 1370|
000034a0  20 59 25 3d 73 61 76 65  20 44 49 56 20 32 35 36  | Y%=save DIV 256|
000034b0  0d 20 31 33 38 30 20 2a  4f 50 54 31 2c 32 0d 20  |. 1380 *OPT1,2. |
000034c0  31 33 39 30 20 43 41 4c  4c 20 6f 73 63 6c 69 0d  |1390 CALL oscli.|
000034d0  20 31 34 30 30 20 2a 4f  50 54 31 2c 30 0d 20 31  | 1400 *OPT1,0. 1|
000034e0  34 31 30 20 45 4e 44 0d  20 31 34 32 30 20 44 45  |410 END. 1420 DE|
000034f0  46 46 4e 65 71 75 62 28  62 79 74 65 29 0d 20 31  |FFNequb(byte). 1|
00003500  34 33 30 20 3f 50 25 3d  62 79 74 65 0d 20 31 34  |430 ?P%=byte. 14|
00003510  34 30 20 50 25 3d 50 25  2b 31 0d 20 31 34 35 30  |40 P%=P%+1. 1450|
00003520  20 3d 70 61 73 73 0d 20  31 34 36 30 20 44 45 46  | =pass. 1460 DEF|
00003530  46 4e 65 71 75 77 28 77  6f 72 64 29 0d 20 31 34  |FNequw(word). 14|
00003540  37 30 20 3f 50 25 3d 77  6f 72 64 20 4d 4f 44 20  |70 ?P%=word MOD |
00003550  32 35 36 0d 20 31 34 38  30 20 50 25 3f 31 3d 77  |256. 1480 P%?1=w|
00003560  6f 72 64 20 44 49 56 20  32 35 36 0d 20 31 34 39  |ord DIV 256. 149|
00003570  30 20 50 25 3d 50 25 2b  32 0d 20 31 35 30 30 20  |0 P%=P%+2. 1500 |
00003580  3d 70 61 73 73 0d 20 31  35 31 30 20 44 45 46 46  |=pass. 1510 DEFF|
00003590  4e 65 71 75 64 28 64 6f  75 62 6c 65 29 0d 20 31  |Nequd(double). 1|
000035a0  35 32 30 20 21 50 25 3d  64 6f 75 62 6c 65 0d 20  |520 !P%=double. |
000035b0  31 35 33 30 20 50 25 3d  50 25 2b 34 0d 20 31 35  |1530 P%=P%+4. 15|
000035c0  34 30 20 3d 70 61 73 73  0d 20 31 35 35 30 20 44  |40 =pass. 1550 D|
000035d0  45 46 46 4e 65 71 75 73  28 73 74 72 69 6e 67 24  |EFFNequs(string$|
000035e0  29 0d 20 31 35 36 30 20  24 50 25 3d 73 74 72 69  |). 1560 $P%=stri|
000035f0  6e 67 24 0d 20 31 35 37  30 20 50 25 3d 50 25 2b  |ng$. 1570 P%=P%+|
00003600  4c 45 4e 28 73 74 72 69  6e 67 24 29 0d 20 31 35  |LEN(string$). 15|
00003610  38 30 20 3d 70 61 73 73  0d                       |80 =pass.|
00003619
20-02-88/T\SWR17.m0
20-02-88/T\SWR17.m1
20-02-88/T\SWR17.m2
20-02-88/T\SWR17.m4
20-02-88/T\SWR17.m5