Home » CEEFAX disks » telesoftware2.adl » OS\BITS/T\OSB24

OS\BITS/T\OSB24

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 » telesoftware2.adl
Filename: OS\BITS/T\OSB24
Read OK:
File size: 668D bytes
Load address: 0000
Exec address: 0000
File contents
OSBITS - An Exploration of the BBC Micro at Machine Level

By Programmer

.........................................................


Part 24: Sideways ROMs


One of the more unusual, and powerful, parts of the BBC
Micro operating system is the use of sideways ROMs.  They
are called sideways because several of them can exist, side
by side, in the same address space in the memory map.

The space between &8000 and &BFFF in the micro's memory is
given over to these sideways ROMs.  The operating system can
select which one out of a possible sixteen is actually in
the memory map at any particular moment.  The selection is
done by a device with the magic number 74LS161 which
contains a four bit register.  This register appears in the
area of memory known as Sheila, at &FE30 up to &FE3F.  The
address normally used is &FE30, the other addresses give
identical results.  This register can only be written to,
not read.

The four bit register allows ROMs to be selected by numbers
from 0 to 15, hence the maximum of 16.  Since the process of
selecting one is known as 'paging it into the memory map',
these ROMS are sometimes known as paged ROMs.  On an
unexpanded BBC B there are four sockets on the main printed
circuit board, but many people have added extra sockets to
bring the total up to 16.  The paged memory can be RAM as
well as ROM, the OS doesn't care which.  With sideways RAM
you can load in what is called a 'ROM Image' from disc and
the RAM will then behave as if it was a sideways ROM.  More
on ROM images in a moment.

Usually these sideways ROMs contain machine code programs. 
They have the advantage that, apart from memory requirements
for workspace, variables and the like, they use up no user
memory.  This is unlike a BASIC program, or a machine code
program you write yourself and then put into user memory
where the program also occupies part of user RAM.

There are basically two types of sideways ROM:

Languages:    These are any program that takes over control
of the micro.  BASIC is the most obvious, but word
processors, spread sheets, databases and even machine code
monitors generally operate as languages.

Service ROMs:    These usually contain programs that carry
out some useful function, or service, and will be called
from within a language, or direct from the OS.  Filing
systems like the DFS or ADFS, and toolkit type ROMs
generally are service ROMs.

You might consider a ROM to be half-and-half if its language
functions were on a par with its service ones.  The BBC Soft
ATS ROM is like this.  The teletext display part of the
program is a language, while the page grabbing functions
operate as service calls.

It is possible for a language ROM to have some service
elements in it.  Every ROM except BASIC must respond to
calls for service even if only to select themselves. 
Selection of BASIC, with *BASIC, is an exception because the
code to select it is within the OS.  Although you can
operate a BBC Micro without BASIC, it is unusual to do so.

The operation of sideways ROMs is both complicated and
simple.  The simple part is that, with a few provisos, it is
as easy to write machine code for a sideways ROM as for main
memory.  The complicated bit is explaining how the OS keeps
track of the ROMs and knows which one to page into memory at
the appropriate time.

The housekeeping for ROMs is carried out by a series of
service calls.  At certain times, such as on power up or
reset, or when an unknown *command is sent to the command
line interpreter, a service call is sent.  The first few
bytes of every sideways ROM have to follow a format laid
down by Acorn.  This is part of the ROM image I referred to
earlier.  It looks like this.

    &8000       JMP <language entry point>
    &8003       JMP <service entry point>
    &8006       ROM type flag
    &8007       Offset to start of copyright string
    &8008       Version number (in binary)
    &8009       Title string

The ROM type flag is made up of the following bits:

   bit 7 is set when the ROM has a service entry point, all
   ROMs except BASIC will have this bit set.

   bit 6 is set if the ROM is a language.

   bit 5 is set if the ROM is a language which relocates to
   an address other than &8000 when in a second processor.

   bit 4 is not used in the BBC micro, it fulfils some
   purpose in an Electron.

   bits 3 to 0 denote the type of machine code in the ROM. 
   There are arrangements of these bits specified for 6502
   code, 68000 code, Z80 code, 32016 code, 80186 and 80286
   code in the BBC Master handbook.  If you have a ROM that
   contains 6502 machine code and is a service ROM only,
   then this byte would be &82.

The ROM type flag is copied, by the OS, into a 16 byte ROM
information table whenever a reset occurs, such as on a
BREAK.  OSBYTE 170 (and 171) are used to read the start
address for this table, and the byte for socket X is found X
bytes above that start address.  If no ROM is present in a
socket then that socket's position in the ROM information
table holds zero.  You can fool the OS into ignoring a ROM
by writing a zero into its position in the ROM information
table; but, as I have already said, this table is rewritten
on a BREAK (reset).  In a MASTER micro you can 'unplug' a
ROM in software with an OS command.  You might want to
remove a ROM from the machine in order to stop clashes with
commands or over workspace.  (More on this in the next
module.)

The copyright string has to start with (C) and is then
usually followed by the name of the copyright holder and the
date.  It usually follows the title string in the header. 
The title string is the string printed out if the ROM is
selected as a language.  Both title and copyright strings
are terminated with nulls (0).

I have written a ROM for this module.  The source code for
the ROM is in the program B/osb24 and you need BASIC 2 or
higher (such as HiBASIC) to assemble it.  Besides the
ability to assemble code to run at a different address to
the RAM it's assembled in (of which more later), the extra
facilities of later BASICs include some EQU pseudo op-codes
which are as follows:

    EQUB - put a byte into memory here
    EQUW - put a word (2 bytes) into memory here
    EQUD - put a double word (4 bytes) into memory here
    EQUS - put a string into memory here

EQUW and EQUD put in numbers such that the most significant
byte is in the highest address.  So if EQUD &12345678
appears in your code at address label 'here' you will find
the number in memory like this:

             here           &78
             here+1         &56
             here+2         &34
             here+3         &12

If you look at lines 380 to 490 of B/osb24 you will find the
code that assembles into the ROM header.  These are the
relevant parts

    EQUW 0
    EQUB 0
 
    JMP service_entry_point
 
There is no language entry so the first three bytes are
zeros.

    EQUB &82

This is the ROM type flag

    EQUB copyright - code%
 
Then we have the copyright offset byte that holds the offset
of the copyright string from the start of the code.

    EQUB 0
 
The version byte is zero and is followed by the ROM title
and copyright strings.  I have incorporated a version string
into the ROM title.  The format of the copyright string is
always a zero (null) byte followed by (C).  The format has
to be exactly that, otherwise the OS will not recognise that
there is a ROM in the socket.  Try deleting the null and
see.

  .rom_title        EQUS "OSbits Demo ROM "+Version$
 
  .copyright        EQUS CHR$0+"(C)BBC "+Date$+CHR$0
 
  .service_entry_point
 
The service entry point comes next.  This is where execution
of the code goes when the operating system sends a service
call.  It starts by offering the service to ROM number 15
and then works its way down the ROMS.  This is why the ROM
in a high numbered socket has priority over ROMS in lower
numbered sockets.  Priority means that, in the case of two
ROMS having the same command in them, the higher numbered
one will actually be executed.  Also the code in a higher
numbered ROM will be executed a little faster because the
service call reaches it quicker.  This is why AMS suggest
that you put your AMX mouse ROM in the highest possible
socket.

A service call is a jump to the service entry point, and the
numbers in the Accumulator and the X and Y registers carry
the call's parameters.

I'll deal with the X first, since that always holds the
number of the ROM currently being used.  Since your code in
a ROM does not know where it is in the machine, and many
actions you will want to carry out will depend on you
knowing the socket number in which your ROM is, you will get
this vital information from the X register at the entry into
your service routine.

The accumulator carries the number of the service call, and
the Y register may carry some parameter for the call.  I
will list some of the service calls that the OS is likely to
originate.  (Note that, with OSBYTE 143, any program can
originate a service call.)  Note that any references to
memory locations are always in the I/O processor (the main
micro) and never in a second processor, should one be
connected.

Service call 0 actually means that the particular service
has been carried out and the original call has been claimed. 
A ROM is not usually offered service call zero, but the OS
knows if it detects a zero in the accumulator after a ROM
has been serviced that the operation has been carried out. 
You can send a service call 0 with OSBYTE 143 but I can't
think why you might want to since it wouldn't get any
further than the first ROM.

Service call 1 - on a reset ROMS must reserve absolute
static workspace (starting always at &E00 on a B or B+ and
usually for filing systems) on this call.  Each ROM that
wants this kind of workspace will compare the number in Y,
which will be the higher byte of the current upper limit of
the workspace , with the value it needs and increase Y if
necessary before exiting.  This call must not be claimed,
i.e. the value in the accumulator is to be preserved from
entry to exit.

Service call 2 - on a reset, private dynamic workspace is
reserved with this call.  Whereas absolute workspace can be
used by another ROM, subject to housekeeping rules, this
workspace is only for your ROM.  You claim it by storing the
value of Y in the ROM workspace table,  and then raising Y
by the number of pages of this workspace you need.  When you
need to find out where your private workspace starts you can
look in that table, which starts at &DF0, offset by your ROM
number (found from the X register).

Service call 3 is an auto-boot call.  When this is detected,
a ROM that wishes to initialise itself on reset looks at the
keyboard (using OSBYTE 120) to see if 'its' key is pressed. 
If that is the case, or no key is pressed, then the ROM
should initialise.  If another key is pressed it should
ignore the call and pass on the registers unchanged.  In
this way you can start in DFS on BREAK by holding down D and
start ADFS by holding down A (or F).  If the Y register is
zero then the ROM that claims the call should action the
relevant !BOOT file.

Many ROMS (including the one with this module) use service
call 3 to print out a little message about themselves. This
call is claimed by any filing system that starts up, which
is why your messages on BREAK depend on the socket in which
you put your DFS chip.

Service call 4 - any *command that the OS does not recognise
is offered to the sideways ROMs with this call.  Each ROM
looks at the command, which is held at (&F2), Y and
terminated with a carriage return, and if it recognises it
then it should execute the relevant code and claim the
service call.  If no ROMs claim the call then the command is
offered to the current filing system.  The DFS, for example,
will then try to *RUN a file of that name.

Service call 5 means that an unknown interrupt has occurred. 
It will be offered to the ROMS before being passed to the
USER down IRQ2.

Service call 6 means that a BRK (i.e. a software interrupt,
as distinct from pressing the BREAK key) has been detected. 
If a ROM wishes to take action it can.  This call should not
be claimed.

Service call 7 means that an OSBYTE call not known to the OS
has occurred.  The A, X and Y registers of the call can be
found at &EF, &F0 and &F1 respectively.

Service call 8 means that an unknown OSWORD call has
occurred.  The A, X and Y registers of the call can be found
at &EF, &F0 and &F1 respectively.

Service call 9 means that *HELP has been detected by the
command line interpreter and ROMS can give whatever helpful
messages they possess.  The part of the *HELP string that
follows the *HELP or *H. itself will be pointed to by the
contents of &F2 and &F3 plus the contents of Y.  This call
should not be claimed in case two ROMS respond to the same
keyword.

Service call &A (10) is issued when a ROM wants to use the
static workspace.  It should issue this call to warn other
ROMs to save their valuable data in their own workspace.

Service calls &B (11) and &C (12) relinquish and claim the
NMI workspace.

Service calls &D (13) and &E (14) relate to the ROM filing
system, or to a Speech Filing System.

Service call &F (15) is issued by a filing system when it
has initialised and sorted out its vectors.  Any ROMS that
wish to intercept filing system vectors have to change their
intercepts after this call.

Service call &10 (16) occurs on a reset, and also when
OSBYTE 119 is called.  It means that all *SPOOL or *EXEC
files should be closed.

Service call &11 (17) is used on the BBC A, B and B+ to warn
of a font implosion or explosion, which could affect
workspace kept just above the operating system high water
mark.  This call is unused on a Master.

Service call &12 (18) is used by filing systems for
initialisation if files are being transferred between
filing systems.

Service call &15 on a Master is a polling call, made every
centisecond if this facility is enabled with OSBYTE 22.

Service call &21 on a Master is like service call 1 but
offers workspace in private filing system RAM.  Ditto for
calls &22 and service call 2.  Calls &23 to &26 also relate
to filing systems on the Master.

The Master does not offer service calls 1 and 2 on a soft
reset, instead it offers call &27.  Calls &28 and &29 are
used on the Master for CMOS RAM configuration and status.

Service call &2A on a Master informs ROMS of a change of
language.

Service call &2B is a mystery, it is described as 'reserved'
in Acorn's literature but my machine (a B with 1770 DFS)
sends it whereas a normal B (with 8271 DFS) does not.

Finally (at last) calls &FE and &FF are sent at
initialisation of the tube on a reset. With a second
processor present both are sent, but only the former if no
second processor is detected.

One of the things that the OSBITS ROM does is to print out
the service calls as they happen.  The calls generated in my
machine are as follows:

Without second processor:

10  0F  01  2B  07  07  02  FE  03  10  0F  0A

With second processor:

10  0F  FF  01  2B  07  07  02  FE  11  03  10  0F  0A

Don't worry if you don't understand all those service calls. 
I certainly don't understand any of the ones relating to
filing systems, they were never my strong suit.  The main
thing is to understand the few you are likely to use if you
write a ROM.  These will be mainly numbers 2, 3, 4 and 9.

Language entry is much simpler.  If, through service call 4,
a ROM detects its own language name then it simply calls
OSBYTE 142 with its ROM number in the X register.  The OS
will then enter the language through the language entry
point and off you go.  The OS does not expect a return from
a language.

The ROM assembly code in B/osb24 is intended to give you
some idea of how to write for a service ROM.  I don't intend
it to be definitive and there are some good books around and
many magazine articles.  Sideways ROMs are a study in
themselves.

I think the best way to proceed is for me to walk you
through the program in this module, section by section, with
an explanation of what is happening.  Then I hope you will
feel up to some experimenting.  But first a caveat ....

B/osb24 will not run with BASIC 1.  I made that decision
partly because of the lack of EQU functions (although these
can be simulated as you well know).  More importantly, it is
almost impossible, and not recommended, to assemble code
directly into sideways RAM, particularly if the RAM is in
socket 15.  Any faults and your machine will lock out and
you will have to switch it off to cure the fault, losing all
your code.  By far the best way is to generate the assembled
code to run in the required space but to be assembled in
another part of the memory.  In BASIC 2 et al you can do
this by using values of OPT from 4 to 7 instead of 0 to 3. 
Line 310 of this program shows this.

You will then have a program you can save to disc from which
you can load into sideways RAM or, if you have the
technology, blow yourself an EPROM.  My machine
configuration has 16K of RAM in ROM socket 15 as part of my
ROM extension board and I can simple *LOAD into that memory. 
If you have a B+ or a Master you will probably have sideways
RAM built in and use *SRLOAD to load into it.

If you really want to assemble direct into sideways RAM then
you should change line 310 to read

     FOR pass% = 0 TO 2 STEP 2

and the code will be put directly into memory at &8000. 
(This will not work on a Master or B+128.)  But bear in mind
the possible problems if you should abort the assembly.  The
service call JUMP instruction at the start of your ROM image
code might end up pointing to some spurious RAM and your
machine will crash.  Because the RAM has highest priority if
it is in socket 15 even a CONTROL/BREAK will not help, you
will have to switch off.

And so to the program.

System variables are set in the first few lines.  I have
allocated some workspace in zero page starting at &A8.  This
memory is reserved for OS commands during execution, but I
am still preserving the contents of these locations as I use
them.  At least you shouldn't find somebody putting their
interrupt code here.

I have defined more OS routine addresses than I have used to
help you if you add any code of your own to this here.

After the ROM header, which I explained earlier, is the
service entry point.  Now since I want this ROM to display
the service calls it receives the first thing that happens
is a JSR to a subroutine called 'show_service_calls'.  This
is at line 3400 in the listing.

I am using a byte of the OS workspace that is unused by the
OS on a B although there is a OSBYTE call to access it.  It
is at &28A and is held as a variable called 'service_flag'
defined in line 250.  If this flag is set (anything other
than zero) then the values in the accumulator and in X and Y
are printed out in hex as they go through the ROM.  If the
flag is clear (zero) they are not.  The default value of the
flag is zero and it can be set by entering *FX 250,1.  The
ROM provides a clearer way, which I'll come on to when I
talk about the built-in commands.  I think the subroutine is
self-explanatory, but note that it is important to balance
the pushes to and pulls from the stack, which is why there
is a PLA and a PHA together in lines 3460 and 3470.

After going through the service call routine the ROM checks
to see which call it is, and to respond accordingly.  This
ROM responds to calls 2 (although I have disabled that
section of the assembler with comments), 3, 4 and 9.

Call 2 allows you to reserve private dynamic workspace. 
This is why ROMs sometimes raise the value of PAGE.  In this
particular case I have blocked off the relevant bits of the
assembly code using comment back-slashes, if you want some
workspace then remove the back-slashes.  The start of your
workspace (a page in this case) is held in &DF0, X where X
is your ROM socket number, passed in X by any service call.

I use service call 3 to print a message in the banner after
a BREAK.  This would be a good time to clear some of your
workspace if you needed it reset on a BREAK.  Those lines of
the code are again blocked off in the assembler listing in
case you need them.  The reason I've blocked those sections
off is that I didn't want to raise PAGE unless it was
needed, and in its present form the ROM doesn't use any
workspace except that in zero page.

Using call 3 for banner messages is not really an approved
idea.  There is no real harm in it, but a filing system ROM
that claims this call will obviously also stop the banner
message being printed.  With the OSBROM (as I have called
it) in socket 15, this is not a problem.  You could use call
1 but your message would then appear above the Acorn banner. 
You can modify line 650 to read CMP #1 if you want to see
the effect, assuming you leave the comment back-slashes in
place.

Service call 4 is the one for unrecognised commands. 
Whenever a *command passes through the command line
interpreter it is passed for action to:

      1:  The operating system
      2:  Sideways ROMS with service call 4
      3:  The current filing system (except for cassette)

in that order.  When service call 4 reaches the ROM,
execution jumps to 'commands' at line 2280.  After workspace
housekeeping (some of these should perhaps also be blanked
off but no commands actually use the private workspace so,
for the moment, let them stand) we store Y-1 on the stack
for later.  (Y-1 so that we can start the loops with an
INY.)  Y points to the first letter of the *command which is
held from  (&F2),Y  onwards, terminated by a carriage
return.

Commands are recognised by being compared with a table of
commands held in the ROM.  Each command in the table is
terminated with a null byte.  We compare each letter of the
unknown command with each one in the list in turn.  If a
match fails then we move on to the next word in the list and
finally we exit altogether with all registers returned to
their entry states.  If, during the match, we reach the null
then we have a match.  Execution jumps to the address stored
in the two bytes following the relevant null.

Note in line 2580 that I have ANDed the byte in the input
string with &DF.  This will make it upper case no matter
what, although this procedure means that the words in the
ROM's list MUST be in upper case and they cannot contain
anything but the letters A-Z.

The commands recognised by this ROM are:

*BEEP - a trivial piece of code which does a VDU7

*SEND <string> prints out the string.  This code uses the OS
routines GSINIT and GSREAD to prepare the string and to read
it.  GSINIT will cope with quotation marks, spaces before
the word and with escape sequences such as |M in exactly the
same way it does for *KEY programming.  By setting the carry
flag on entry to GSINIT we tell it that the string will
terminate either with second quotes or with a carriage
return.  If carry was clear then a space would also
terminate.  On exit GSINIT sets the zero flag if the string
is null, i.e. of zero length or just a carriage return, and
GSREAD sets the carry flag if we have reached the end of the
string.

*SERVICE enables the service call display.  This is
equivalent to a *FX 250,1 and is not reset on BREAK.

*NOSERVICE turns off the service call display and is
equivalent to a *FX 250,0.

You can add any machine code of your own to the ROM by
extending my list.  I have left another dummy command,
*WHATSYOURS which just beeps.  You can easily change its
name at line 3140 and put your code starting at line 4280.
All command code must return with a JMP exit.

The command list is held from line 3020.  The format is
command name first as a string terminated by a null and then
a two byte word holding the address of that particular
routine.

Finally service call 9 is *HELP.  It works in two ways of
course.  The ROM will respond to both *HELP and to *HELP
OSBITS.  When we receive call 9 the character following the
*HELP (or *H.) is at  (&F2),Y.  If it is a carriage return
then this is a straightforward general HELP call and we
respond by printing out our title and the word we respond
to.

If that character is not a CR then the *HELP has an argument
and we have to then check that against our HELP response
list, which in this case is only one word, OSBITS.  This
checking is exactly like that for unknown commands.  The
help list is from line 3180.

It is important that service call 9 is not claimed and that
Y is restored to its entry value on exit.  It is possible
for more than one ROM to respond to a HELP argument (UTILS
is a common one) and also our ROM must not respond with
anything if the HELP argument does not apply.  View 2.1 does
not appear to work properly in this respect as (on my
machine anyway) it announces itself to any help call.

That then is the 'London to Brighton in 4 Minutes' guide to
sideways ROMS.  There is much more to them that I can cover
in a module and they are worthy of further study, although
the principles involved are very machine specific.

Finally a couple of programming hints about writing for
Service ROMS.  Firstly remember that you will not be able to
write into your address space, so you will have to use
zero-page and main memory workspace a lot.  With main memory
you will use a lot of indirect addressing.

To give an error message in a service ROM, you have to copy
your error code - from the BRK right through to the message
and its terminating null - into the bottom of the stack
(from &100 onwards since the stack is upside down), and JMP
to your BRK at &100.  You have to do this because the error
code in the language you are calling from will automatically
look in that language's ROM if you execute the BRK in your
ROM.  You have to execute the BRK in main memory, and the
stack is a safe place to do so.

From a Service ROM you can address I/O memory reasonably
safely since your code will never execute in a second
processor.  Often speed is important, and you can take
advantage of your place in the I/O processor.

That leads me almost neatly onto the topic for the next
module.  Acorn often tell us what is legal and what is
illegal. I will expand on that subject next time.
00000000  4f 53 42 49 54 53 20 2d  20 41 6e 20 45 78 70 6c  |OSBITS - An Expl|
00000010  6f 72 61 74 69 6f 6e 20  6f 66 20 74 68 65 20 42  |oration of the B|
00000020  42 43 20 4d 69 63 72 6f  20 61 74 20 4d 61 63 68  |BC Micro at Mach|
00000030  69 6e 65 20 4c 65 76 65  6c 0d 0d 42 79 20 50 72  |ine Level..By Pr|
00000040  6f 67 72 61 6d 6d 65 72  0d 0d 2e 2e 2e 2e 2e 2e  |ogrammer........|
00000050  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
00000080  2e 2e 2e 0d 0d 0d 50 61  72 74 20 32 34 3a 20 53  |......Part 24: S|
00000090  69 64 65 77 61 79 73 20  52 4f 4d 73 0d 0d 0d 4f  |ideways ROMs...O|
000000a0  6e 65 20 6f 66 20 74 68  65 20 6d 6f 72 65 20 75  |ne of the more u|
000000b0  6e 75 73 75 61 6c 2c 20  61 6e 64 20 70 6f 77 65  |nusual, and powe|
000000c0  72 66 75 6c 2c 20 70 61  72 74 73 20 6f 66 20 74  |rful, parts of t|
000000d0  68 65 20 42 42 43 0d 4d  69 63 72 6f 20 6f 70 65  |he BBC.Micro ope|
000000e0  72 61 74 69 6e 67 20 73  79 73 74 65 6d 20 69 73  |rating system is|
000000f0  20 74 68 65 20 75 73 65  20 6f 66 20 73 69 64 65  | the use of side|
00000100  77 61 79 73 20 52 4f 4d  73 2e 20 20 54 68 65 79  |ways ROMs.  They|
00000110  0d 61 72 65 20 63 61 6c  6c 65 64 20 73 69 64 65  |.are called side|
00000120  77 61 79 73 20 62 65 63  61 75 73 65 20 73 65 76  |ways because sev|
00000130  65 72 61 6c 20 6f 66 20  74 68 65 6d 20 63 61 6e  |eral of them can|
00000140  20 65 78 69 73 74 2c 20  73 69 64 65 0d 62 79 20  | exist, side.by |
00000150  73 69 64 65 2c 20 69 6e  20 74 68 65 20 73 61 6d  |side, in the sam|
00000160  65 20 61 64 64 72 65 73  73 20 73 70 61 63 65 20  |e address space |
00000170  69 6e 20 74 68 65 20 6d  65 6d 6f 72 79 20 6d 61  |in the memory ma|
00000180  70 2e 0d 0d 54 68 65 20  73 70 61 63 65 20 62 65  |p...The space be|
00000190  74 77 65 65 6e 20 26 38  30 30 30 20 61 6e 64 20  |tween &8000 and |
000001a0  26 42 46 46 46 20 69 6e  20 74 68 65 20 6d 69 63  |&BFFF in the mic|
000001b0  72 6f 27 73 20 6d 65 6d  6f 72 79 20 69 73 0d 67  |ro's memory is.g|
000001c0  69 76 65 6e 20 6f 76 65  72 20 74 6f 20 74 68 65  |iven over to the|
000001d0  73 65 20 73 69 64 65 77  61 79 73 20 52 4f 4d 73  |se sideways ROMs|
000001e0  2e 20 20 54 68 65 20 6f  70 65 72 61 74 69 6e 67  |.  The operating|
000001f0  20 73 79 73 74 65 6d 20  63 61 6e 0d 73 65 6c 65  | system can.sele|
00000200  63 74 20 77 68 69 63 68  20 6f 6e 65 20 6f 75 74  |ct which one out|
00000210  20 6f 66 20 61 20 70 6f  73 73 69 62 6c 65 20 73  | of a possible s|
00000220  69 78 74 65 65 6e 20 69  73 20 61 63 74 75 61 6c  |ixteen is actual|
00000230  6c 79 20 69 6e 0d 74 68  65 20 6d 65 6d 6f 72 79  |ly in.the memory|
00000240  20 6d 61 70 20 61 74 20  61 6e 79 20 70 61 72 74  | map at any part|
00000250  69 63 75 6c 61 72 20 6d  6f 6d 65 6e 74 2e 20 20  |icular moment.  |
00000260  54 68 65 20 73 65 6c 65  63 74 69 6f 6e 20 69 73  |The selection is|
00000270  0d 64 6f 6e 65 20 62 79  20 61 20 64 65 76 69 63  |.done by a devic|
00000280  65 20 77 69 74 68 20 74  68 65 20 6d 61 67 69 63  |e with the magic|
00000290  20 6e 75 6d 62 65 72 20  37 34 4c 53 31 36 31 20  | number 74LS161 |
000002a0  77 68 69 63 68 0d 63 6f  6e 74 61 69 6e 73 20 61  |which.contains a|
000002b0  20 66 6f 75 72 20 62 69  74 20 72 65 67 69 73 74  | four bit regist|
000002c0  65 72 2e 20 20 54 68 69  73 20 72 65 67 69 73 74  |er.  This regist|
000002d0  65 72 20 61 70 70 65 61  72 73 20 69 6e 20 74 68  |er appears in th|
000002e0  65 0d 61 72 65 61 20 6f  66 20 6d 65 6d 6f 72 79  |e.area of memory|
000002f0  20 6b 6e 6f 77 6e 20 61  73 20 53 68 65 69 6c 61  | known as Sheila|
00000300  2c 20 61 74 20 26 46 45  33 30 20 75 70 20 74 6f  |, at &FE30 up to|
00000310  20 26 46 45 33 46 2e 20  20 54 68 65 0d 61 64 64  | &FE3F.  The.add|
00000320  72 65 73 73 20 6e 6f 72  6d 61 6c 6c 79 20 75 73  |ress normally us|
00000330  65 64 20 69 73 20 26 46  45 33 30 2c 20 74 68 65  |ed is &FE30, the|
00000340  20 6f 74 68 65 72 20 61  64 64 72 65 73 73 65 73  | other addresses|
00000350  20 67 69 76 65 0d 69 64  65 6e 74 69 63 61 6c 20  | give.identical |
00000360  72 65 73 75 6c 74 73 2e  20 20 54 68 69 73 20 72  |results.  This r|
00000370  65 67 69 73 74 65 72 20  63 61 6e 20 6f 6e 6c 79  |egister can only|
00000380  20 62 65 20 77 72 69 74  74 65 6e 20 74 6f 2c 0d  | be written to,.|
00000390  6e 6f 74 20 72 65 61 64  2e 0d 0d 54 68 65 20 66  |not read...The f|
000003a0  6f 75 72 20 62 69 74 20  72 65 67 69 73 74 65 72  |our bit register|
000003b0  20 61 6c 6c 6f 77 73 20  52 4f 4d 73 20 74 6f 20  | allows ROMs to |
000003c0  62 65 20 73 65 6c 65 63  74 65 64 20 62 79 20 6e  |be selected by n|
000003d0  75 6d 62 65 72 73 0d 66  72 6f 6d 20 30 20 74 6f  |umbers.from 0 to|
000003e0  20 31 35 2c 20 68 65 6e  63 65 20 74 68 65 20 6d  | 15, hence the m|
000003f0  61 78 69 6d 75 6d 20 6f  66 20 31 36 2e 20 20 53  |aximum of 16.  S|
00000400  69 6e 63 65 20 74 68 65  20 70 72 6f 63 65 73 73  |ince the process|
00000410  20 6f 66 0d 73 65 6c 65  63 74 69 6e 67 20 6f 6e  | of.selecting on|
00000420  65 20 69 73 20 6b 6e 6f  77 6e 20 61 73 20 27 70  |e is known as 'p|
00000430  61 67 69 6e 67 20 69 74  20 69 6e 74 6f 20 74 68  |aging it into th|
00000440  65 20 6d 65 6d 6f 72 79  20 6d 61 70 27 2c 0d 74  |e memory map',.t|
00000450  68 65 73 65 20 52 4f 4d  53 20 61 72 65 20 73 6f  |hese ROMS are so|
00000460  6d 65 74 69 6d 65 73 20  6b 6e 6f 77 6e 20 61 73  |metimes known as|
00000470  20 70 61 67 65 64 20 52  4f 4d 73 2e 20 20 4f 6e  | paged ROMs.  On|
00000480  20 61 6e 0d 75 6e 65 78  70 61 6e 64 65 64 20 42  | an.unexpanded B|
00000490  42 43 20 42 20 74 68 65  72 65 20 61 72 65 20 66  |BC B there are f|
000004a0  6f 75 72 20 73 6f 63 6b  65 74 73 20 6f 6e 20 74  |our sockets on t|
000004b0  68 65 20 6d 61 69 6e 20  70 72 69 6e 74 65 64 0d  |he main printed.|
000004c0  63 69 72 63 75 69 74 20  62 6f 61 72 64 2c 20 62  |circuit board, b|
000004d0  75 74 20 6d 61 6e 79 20  70 65 6f 70 6c 65 20 68  |ut many people h|
000004e0  61 76 65 20 61 64 64 65  64 20 65 78 74 72 61 20  |ave added extra |
000004f0  73 6f 63 6b 65 74 73 20  74 6f 0d 62 72 69 6e 67  |sockets to.bring|
00000500  20 74 68 65 20 74 6f 74  61 6c 20 75 70 20 74 6f  | the total up to|
00000510  20 31 36 2e 20 20 54 68  65 20 70 61 67 65 64 20  | 16.  The paged |
00000520  6d 65 6d 6f 72 79 20 63  61 6e 20 62 65 20 52 41  |memory can be RA|
00000530  4d 20 61 73 0d 77 65 6c  6c 20 61 73 20 52 4f 4d  |M as.well as ROM|
00000540  2c 20 74 68 65 20 4f 53  20 64 6f 65 73 6e 27 74  |, the OS doesn't|
00000550  20 63 61 72 65 20 77 68  69 63 68 2e 20 20 57 69  | care which.  Wi|
00000560  74 68 20 73 69 64 65 77  61 79 73 20 52 41 4d 0d  |th sideways RAM.|
00000570  79 6f 75 20 63 61 6e 20  6c 6f 61 64 20 69 6e 20  |you can load in |
00000580  77 68 61 74 20 69 73 20  63 61 6c 6c 65 64 20 61  |what is called a|
00000590  20 27 52 4f 4d 20 49 6d  61 67 65 27 20 66 72 6f  | 'ROM Image' fro|
000005a0  6d 20 64 69 73 63 20 61  6e 64 0d 74 68 65 20 52  |m disc and.the R|
000005b0  41 4d 20 77 69 6c 6c 20  74 68 65 6e 20 62 65 68  |AM will then beh|
000005c0  61 76 65 20 61 73 20 69  66 20 69 74 20 77 61 73  |ave as if it was|
000005d0  20 61 20 73 69 64 65 77  61 79 73 20 52 4f 4d 2e  | a sideways ROM.|
000005e0  20 20 4d 6f 72 65 0d 6f  6e 20 52 4f 4d 20 69 6d  |  More.on ROM im|
000005f0  61 67 65 73 20 69 6e 20  61 20 6d 6f 6d 65 6e 74  |ages in a moment|
00000600  2e 0d 0d 55 73 75 61 6c  6c 79 20 74 68 65 73 65  |...Usually these|
00000610  20 73 69 64 65 77 61 79  73 20 52 4f 4d 73 20 63  | sideways ROMs c|
00000620  6f 6e 74 61 69 6e 20 6d  61 63 68 69 6e 65 20 63  |ontain machine c|
00000630  6f 64 65 20 70 72 6f 67  72 61 6d 73 2e 20 0d 54  |ode programs. .T|
00000640  68 65 79 20 68 61 76 65  20 74 68 65 20 61 64 76  |hey have the adv|
00000650  61 6e 74 61 67 65 20 74  68 61 74 2c 20 61 70 61  |antage that, apa|
00000660  72 74 20 66 72 6f 6d 20  6d 65 6d 6f 72 79 20 72  |rt from memory r|
00000670  65 71 75 69 72 65 6d 65  6e 74 73 0d 66 6f 72 20  |equirements.for |
00000680  77 6f 72 6b 73 70 61 63  65 2c 20 76 61 72 69 61  |workspace, varia|
00000690  62 6c 65 73 20 61 6e 64  20 74 68 65 20 6c 69 6b  |bles and the lik|
000006a0  65 2c 20 74 68 65 79 20  75 73 65 20 75 70 20 6e  |e, they use up n|
000006b0  6f 20 75 73 65 72 0d 6d  65 6d 6f 72 79 2e 20 20  |o user.memory.  |
000006c0  54 68 69 73 20 69 73 20  75 6e 6c 69 6b 65 20 61  |This is unlike a|
000006d0  20 42 41 53 49 43 20 70  72 6f 67 72 61 6d 2c 20  | BASIC program, |
000006e0  6f 72 20 61 20 6d 61 63  68 69 6e 65 20 63 6f 64  |or a machine cod|
000006f0  65 0d 70 72 6f 67 72 61  6d 20 79 6f 75 20 77 72  |e.program you wr|
00000700  69 74 65 20 79 6f 75 72  73 65 6c 66 20 61 6e 64  |ite yourself and|
00000710  20 74 68 65 6e 20 70 75  74 20 69 6e 74 6f 20 75  | then put into u|
00000720  73 65 72 20 6d 65 6d 6f  72 79 0d 77 68 65 72 65  |ser memory.where|
00000730  20 74 68 65 20 70 72 6f  67 72 61 6d 20 61 6c 73  | the program als|
00000740  6f 20 6f 63 63 75 70 69  65 73 20 70 61 72 74 20  |o occupies part |
00000750  6f 66 20 75 73 65 72 20  52 41 4d 2e 0d 0d 54 68  |of user RAM...Th|
00000760  65 72 65 20 61 72 65 20  62 61 73 69 63 61 6c 6c  |ere are basicall|
00000770  79 20 74 77 6f 20 74 79  70 65 73 20 6f 66 20 73  |y two types of s|
00000780  69 64 65 77 61 79 73 20  52 4f 4d 3a 0d 0d 4c 61  |ideways ROM:..La|
00000790  6e 67 75 61 67 65 73 3a  20 20 20 20 54 68 65 73  |nguages:    Thes|
000007a0  65 20 61 72 65 20 61 6e  79 20 70 72 6f 67 72 61  |e are any progra|
000007b0  6d 20 74 68 61 74 20 74  61 6b 65 73 20 6f 76 65  |m that takes ove|
000007c0  72 20 63 6f 6e 74 72 6f  6c 0d 6f 66 20 74 68 65  |r control.of the|
000007d0  20 6d 69 63 72 6f 2e 20  20 42 41 53 49 43 20 69  | micro.  BASIC i|
000007e0  73 20 74 68 65 20 6d 6f  73 74 20 6f 62 76 69 6f  |s the most obvio|
000007f0  75 73 2c 20 62 75 74 20  77 6f 72 64 0d 70 72 6f  |us, but word.pro|
00000800  63 65 73 73 6f 72 73 2c  20 73 70 72 65 61 64 20  |cessors, spread |
00000810  73 68 65 65 74 73 2c 20  64 61 74 61 62 61 73 65  |sheets, database|
00000820  73 20 61 6e 64 20 65 76  65 6e 20 6d 61 63 68 69  |s and even machi|
00000830  6e 65 20 63 6f 64 65 0d  6d 6f 6e 69 74 6f 72 73  |ne code.monitors|
00000840  20 67 65 6e 65 72 61 6c  6c 79 20 6f 70 65 72 61  | generally opera|
00000850  74 65 20 61 73 20 6c 61  6e 67 75 61 67 65 73 2e  |te as languages.|
00000860  0d 0d 53 65 72 76 69 63  65 20 52 4f 4d 73 3a 20  |..Service ROMs: |
00000870  20 20 20 54 68 65 73 65  20 75 73 75 61 6c 6c 79  |   These usually|
00000880  20 63 6f 6e 74 61 69 6e  20 70 72 6f 67 72 61 6d  | contain program|
00000890  73 20 74 68 61 74 20 63  61 72 72 79 0d 6f 75 74  |s that carry.out|
000008a0  20 73 6f 6d 65 20 75 73  65 66 75 6c 20 66 75 6e  | some useful fun|
000008b0  63 74 69 6f 6e 2c 20 6f  72 20 73 65 72 76 69 63  |ction, or servic|
000008c0  65 2c 20 61 6e 64 20 77  69 6c 6c 20 62 65 20 63  |e, and will be c|
000008d0  61 6c 6c 65 64 0d 66 72  6f 6d 20 77 69 74 68 69  |alled.from withi|
000008e0  6e 20 61 20 6c 61 6e 67  75 61 67 65 2c 20 6f 72  |n a language, or|
000008f0  20 64 69 72 65 63 74 20  66 72 6f 6d 20 74 68 65  | direct from the|
00000900  20 4f 53 2e 20 20 46 69  6c 69 6e 67 0d 73 79 73  | OS.  Filing.sys|
00000910  74 65 6d 73 20 6c 69 6b  65 20 74 68 65 20 44 46  |tems like the DF|
00000920  53 20 6f 72 20 41 44 46  53 2c 20 61 6e 64 20 74  |S or ADFS, and t|
00000930  6f 6f 6c 6b 69 74 20 74  79 70 65 20 52 4f 4d 73  |oolkit type ROMs|
00000940  0d 67 65 6e 65 72 61 6c  6c 79 20 61 72 65 20 73  |.generally are s|
00000950  65 72 76 69 63 65 20 52  4f 4d 73 2e 0d 0d 59 6f  |ervice ROMs...Yo|
00000960  75 20 6d 69 67 68 74 20  63 6f 6e 73 69 64 65 72  |u might consider|
00000970  20 61 20 52 4f 4d 20 74  6f 20 62 65 20 68 61 6c  | a ROM to be hal|
00000980  66 2d 61 6e 64 2d 68 61  6c 66 20 69 66 20 69 74  |f-and-half if it|
00000990  73 20 6c 61 6e 67 75 61  67 65 0d 66 75 6e 63 74  |s language.funct|
000009a0  69 6f 6e 73 20 77 65 72  65 20 6f 6e 20 61 20 70  |ions were on a p|
000009b0  61 72 20 77 69 74 68 20  69 74 73 20 73 65 72 76  |ar with its serv|
000009c0  69 63 65 20 6f 6e 65 73  2e 20 20 54 68 65 20 42  |ice ones.  The B|
000009d0  42 43 20 53 6f 66 74 0d  41 54 53 20 52 4f 4d 20  |BC Soft.ATS ROM |
000009e0  69 73 20 6c 69 6b 65 20  74 68 69 73 2e 20 20 54  |is like this.  T|
000009f0  68 65 20 74 65 6c 65 74  65 78 74 20 64 69 73 70  |he teletext disp|
00000a00  6c 61 79 20 70 61 72 74  20 6f 66 20 74 68 65 0d  |lay part of the.|
00000a10  70 72 6f 67 72 61 6d 20  69 73 20 61 20 6c 61 6e  |program is a lan|
00000a20  67 75 61 67 65 2c 20 77  68 69 6c 65 20 74 68 65  |guage, while the|
00000a30  20 70 61 67 65 20 67 72  61 62 62 69 6e 67 20 66  | page grabbing f|
00000a40  75 6e 63 74 69 6f 6e 73  0d 6f 70 65 72 61 74 65  |unctions.operate|
00000a50  20 61 73 20 73 65 72 76  69 63 65 20 63 61 6c 6c  | as service call|
00000a60  73 2e 0d 0d 49 74 20 69  73 20 70 6f 73 73 69 62  |s...It is possib|
00000a70  6c 65 20 66 6f 72 20 61  20 6c 61 6e 67 75 61 67  |le for a languag|
00000a80  65 20 52 4f 4d 20 74 6f  20 68 61 76 65 20 73 6f  |e ROM to have so|
00000a90  6d 65 20 73 65 72 76 69  63 65 0d 65 6c 65 6d 65  |me service.eleme|
00000aa0  6e 74 73 20 69 6e 20 69  74 2e 20 20 45 76 65 72  |nts in it.  Ever|
00000ab0  79 20 52 4f 4d 20 65 78  63 65 70 74 20 42 41 53  |y ROM except BAS|
00000ac0  49 43 20 6d 75 73 74 20  72 65 73 70 6f 6e 64 20  |IC must respond |
00000ad0  74 6f 0d 63 61 6c 6c 73  20 66 6f 72 20 73 65 72  |to.calls for ser|
00000ae0  76 69 63 65 20 65 76 65  6e 20 69 66 20 6f 6e 6c  |vice even if onl|
00000af0  79 20 74 6f 20 73 65 6c  65 63 74 20 74 68 65 6d  |y to select them|
00000b00  73 65 6c 76 65 73 2e 20  0d 53 65 6c 65 63 74 69  |selves. .Selecti|
00000b10  6f 6e 20 6f 66 20 42 41  53 49 43 2c 20 77 69 74  |on of BASIC, wit|
00000b20  68 20 2a 42 41 53 49 43  2c 20 69 73 20 61 6e 20  |h *BASIC, is an |
00000b30  65 78 63 65 70 74 69 6f  6e 20 62 65 63 61 75 73  |exception becaus|
00000b40  65 20 74 68 65 0d 63 6f  64 65 20 74 6f 20 73 65  |e the.code to se|
00000b50  6c 65 63 74 20 69 74 20  69 73 20 77 69 74 68 69  |lect it is withi|
00000b60  6e 20 74 68 65 20 4f 53  2e 20 20 41 6c 74 68 6f  |n the OS.  Altho|
00000b70  75 67 68 20 79 6f 75 20  63 61 6e 0d 6f 70 65 72  |ugh you can.oper|
00000b80  61 74 65 20 61 20 42 42  43 20 4d 69 63 72 6f 20  |ate a BBC Micro |
00000b90  77 69 74 68 6f 75 74 20  42 41 53 49 43 2c 20 69  |without BASIC, i|
00000ba0  74 20 69 73 20 75 6e 75  73 75 61 6c 20 74 6f 20  |t is unusual to |
00000bb0  64 6f 20 73 6f 2e 0d 0d  54 68 65 20 6f 70 65 72  |do so...The oper|
00000bc0  61 74 69 6f 6e 20 6f 66  20 73 69 64 65 77 61 79  |ation of sideway|
00000bd0  73 20 52 4f 4d 73 20 69  73 20 62 6f 74 68 20 63  |s ROMs is both c|
00000be0  6f 6d 70 6c 69 63 61 74  65 64 20 61 6e 64 0d 73  |omplicated and.s|
00000bf0  69 6d 70 6c 65 2e 20 20  54 68 65 20 73 69 6d 70  |imple.  The simp|
00000c00  6c 65 20 70 61 72 74 20  69 73 20 74 68 61 74 2c  |le part is that,|
00000c10  20 77 69 74 68 20 61 20  66 65 77 20 70 72 6f 76  | with a few prov|
00000c20  69 73 6f 73 2c 20 69 74  20 69 73 0d 61 73 20 65  |isos, it is.as e|
00000c30  61 73 79 20 74 6f 20 77  72 69 74 65 20 6d 61 63  |asy to write mac|
00000c40  68 69 6e 65 20 63 6f 64  65 20 66 6f 72 20 61 20  |hine code for a |
00000c50  73 69 64 65 77 61 79 73  20 52 4f 4d 20 61 73 20  |sideways ROM as |
00000c60  66 6f 72 20 6d 61 69 6e  0d 6d 65 6d 6f 72 79 2e  |for main.memory.|
00000c70  20 20 54 68 65 20 63 6f  6d 70 6c 69 63 61 74 65  |  The complicate|
00000c80  64 20 62 69 74 20 69 73  20 65 78 70 6c 61 69 6e  |d bit is explain|
00000c90  69 6e 67 20 68 6f 77 20  74 68 65 20 4f 53 20 6b  |ing how the OS k|
00000ca0  65 65 70 73 0d 74 72 61  63 6b 20 6f 66 20 74 68  |eeps.track of th|
00000cb0  65 20 52 4f 4d 73 20 61  6e 64 20 6b 6e 6f 77 73  |e ROMs and knows|
00000cc0  20 77 68 69 63 68 20 6f  6e 65 20 74 6f 20 70 61  | which one to pa|
00000cd0  67 65 20 69 6e 74 6f 20  6d 65 6d 6f 72 79 20 61  |ge into memory a|
00000ce0  74 0d 74 68 65 20 61 70  70 72 6f 70 72 69 61 74  |t.the appropriat|
00000cf0  65 20 74 69 6d 65 2e 0d  0d 54 68 65 20 68 6f 75  |e time...The hou|
00000d00  73 65 6b 65 65 70 69 6e  67 20 66 6f 72 20 52 4f  |sekeeping for RO|
00000d10  4d 73 20 69 73 20 63 61  72 72 69 65 64 20 6f 75  |Ms is carried ou|
00000d20  74 20 62 79 20 61 20 73  65 72 69 65 73 20 6f 66  |t by a series of|
00000d30  0d 73 65 72 76 69 63 65  20 63 61 6c 6c 73 2e 20  |.service calls. |
00000d40  20 41 74 20 63 65 72 74  61 69 6e 20 74 69 6d 65  | At certain time|
00000d50  73 2c 20 73 75 63 68 20  61 73 20 6f 6e 20 70 6f  |s, such as on po|
00000d60  77 65 72 20 75 70 20 6f  72 0d 72 65 73 65 74 2c  |wer up or.reset,|
00000d70  20 6f 72 20 77 68 65 6e  20 61 6e 20 75 6e 6b 6e  | or when an unkn|
00000d80  6f 77 6e 20 2a 63 6f 6d  6d 61 6e 64 20 69 73 20  |own *command is |
00000d90  73 65 6e 74 20 74 6f 20  74 68 65 20 63 6f 6d 6d  |sent to the comm|
00000da0  61 6e 64 0d 6c 69 6e 65  20 69 6e 74 65 72 70 72  |and.line interpr|
00000db0  65 74 65 72 2c 20 61 20  73 65 72 76 69 63 65 20  |eter, a service |
00000dc0  63 61 6c 6c 20 69 73 20  73 65 6e 74 2e 20 20 54  |call is sent.  T|
00000dd0  68 65 20 66 69 72 73 74  20 66 65 77 0d 62 79 74  |he first few.byt|
00000de0  65 73 20 6f 66 20 65 76  65 72 79 20 73 69 64 65  |es of every side|
00000df0  77 61 79 73 20 52 4f 4d  20 68 61 76 65 20 74 6f  |ways ROM have to|
00000e00  20 66 6f 6c 6c 6f 77 20  61 20 66 6f 72 6d 61 74  | follow a format|
00000e10  20 6c 61 69 64 0d 64 6f  77 6e 20 62 79 20 41 63  | laid.down by Ac|
00000e20  6f 72 6e 2e 20 20 54 68  69 73 20 69 73 20 70 61  |orn.  This is pa|
00000e30  72 74 20 6f 66 20 74 68  65 20 52 4f 4d 20 69 6d  |rt of the ROM im|
00000e40  61 67 65 20 49 20 72 65  66 65 72 72 65 64 20 74  |age I referred t|
00000e50  6f 0d 65 61 72 6c 69 65  72 2e 20 20 49 74 20 6c  |o.earlier.  It l|
00000e60  6f 6f 6b 73 20 6c 69 6b  65 20 74 68 69 73 2e 0d  |ooks like this..|
00000e70  0d 20 20 20 20 26 38 30  30 30 20 20 20 20 20 20  |.    &8000      |
00000e80  20 4a 4d 50 20 3c 6c 61  6e 67 75 61 67 65 20 65  | JMP <language e|
00000e90  6e 74 72 79 20 70 6f 69  6e 74 3e 0d 20 20 20 20  |ntry point>.    |
00000ea0  26 38 30 30 33 20 20 20  20 20 20 20 4a 4d 50 20  |&8003       JMP |
00000eb0  3c 73 65 72 76 69 63 65  20 65 6e 74 72 79 20 70  |<service entry p|
00000ec0  6f 69 6e 74 3e 0d 20 20  20 20 26 38 30 30 36 20  |oint>.    &8006 |
00000ed0  20 20 20 20 20 20 52 4f  4d 20 74 79 70 65 20 66  |      ROM type f|
00000ee0  6c 61 67 0d 20 20 20 20  26 38 30 30 37 20 20 20  |lag.    &8007   |
00000ef0  20 20 20 20 4f 66 66 73  65 74 20 74 6f 20 73 74  |    Offset to st|
00000f00  61 72 74 20 6f 66 20 63  6f 70 79 72 69 67 68 74  |art of copyright|
00000f10  20 73 74 72 69 6e 67 0d  20 20 20 20 26 38 30 30  | string.    &800|
00000f20  38 20 20 20 20 20 20 20  56 65 72 73 69 6f 6e 20  |8       Version |
00000f30  6e 75 6d 62 65 72 20 28  69 6e 20 62 69 6e 61 72  |number (in binar|
00000f40  79 29 0d 20 20 20 20 26  38 30 30 39 20 20 20 20  |y).    &8009    |
00000f50  20 20 20 54 69 74 6c 65  20 73 74 72 69 6e 67 0d  |   Title string.|
00000f60  0d 54 68 65 20 52 4f 4d  20 74 79 70 65 20 66 6c  |.The ROM type fl|
00000f70  61 67 20 69 73 20 6d 61  64 65 20 75 70 20 6f 66  |ag is made up of|
00000f80  20 74 68 65 20 66 6f 6c  6c 6f 77 69 6e 67 20 62  | the following b|
00000f90  69 74 73 3a 0d 0d 20 20  20 62 69 74 20 37 20 69  |its:..   bit 7 i|
00000fa0  73 20 73 65 74 20 77 68  65 6e 20 74 68 65 20 52  |s set when the R|
00000fb0  4f 4d 20 68 61 73 20 61  20 73 65 72 76 69 63 65  |OM has a service|
00000fc0  20 65 6e 74 72 79 20 70  6f 69 6e 74 2c 20 61 6c  | entry point, al|
00000fd0  6c 0d 20 20 20 52 4f 4d  73 20 65 78 63 65 70 74  |l.   ROMs except|
00000fe0  20 42 41 53 49 43 20 77  69 6c 6c 20 68 61 76 65  | BASIC will have|
00000ff0  20 74 68 69 73 20 62 69  74 20 73 65 74 2e 0d 0d  | this bit set...|
00001000  20 20 20 62 69 74 20 36  20 69 73 20 73 65 74 20  |   bit 6 is set |
00001010  69 66 20 74 68 65 20 52  4f 4d 20 69 73 20 61 20  |if the ROM is a |
00001020  6c 61 6e 67 75 61 67 65  2e 0d 0d 20 20 20 62 69  |language...   bi|
00001030  74 20 35 20 69 73 20 73  65 74 20 69 66 20 74 68  |t 5 is set if th|
00001040  65 20 52 4f 4d 20 69 73  20 61 20 6c 61 6e 67 75  |e ROM is a langu|
00001050  61 67 65 20 77 68 69 63  68 20 72 65 6c 6f 63 61  |age which reloca|
00001060  74 65 73 20 74 6f 0d 20  20 20 61 6e 20 61 64 64  |tes to.   an add|
00001070  72 65 73 73 20 6f 74 68  65 72 20 74 68 61 6e 20  |ress other than |
00001080  26 38 30 30 30 20 77 68  65 6e 20 69 6e 20 61 20  |&8000 when in a |
00001090  73 65 63 6f 6e 64 20 70  72 6f 63 65 73 73 6f 72  |second processor|
000010a0  2e 0d 0d 20 20 20 62 69  74 20 34 20 69 73 20 6e  |...   bit 4 is n|
000010b0  6f 74 20 75 73 65 64 20  69 6e 20 74 68 65 20 42  |ot used in the B|
000010c0  42 43 20 6d 69 63 72 6f  2c 20 69 74 20 66 75 6c  |BC micro, it ful|
000010d0  66 69 6c 73 20 73 6f 6d  65 0d 20 20 20 70 75 72  |fils some.   pur|
000010e0  70 6f 73 65 20 69 6e 20  61 6e 20 45 6c 65 63 74  |pose in an Elect|
000010f0  72 6f 6e 2e 0d 0d 20 20  20 62 69 74 73 20 33 20  |ron...   bits 3 |
00001100  74 6f 20 30 20 64 65 6e  6f 74 65 20 74 68 65 20  |to 0 denote the |
00001110  74 79 70 65 20 6f 66 20  6d 61 63 68 69 6e 65 20  |type of machine |
00001120  63 6f 64 65 20 69 6e 20  74 68 65 20 52 4f 4d 2e  |code in the ROM.|
00001130  20 0d 20 20 20 54 68 65  72 65 20 61 72 65 20 61  | .   There are a|
00001140  72 72 61 6e 67 65 6d 65  6e 74 73 20 6f 66 20 74  |rrangements of t|
00001150  68 65 73 65 20 62 69 74  73 20 73 70 65 63 69 66  |hese bits specif|
00001160  69 65 64 20 66 6f 72 20  36 35 30 32 0d 20 20 20  |ied for 6502.   |
00001170  63 6f 64 65 2c 20 36 38  30 30 30 20 63 6f 64 65  |code, 68000 code|
00001180  2c 20 5a 38 30 20 63 6f  64 65 2c 20 33 32 30 31  |, Z80 code, 3201|
00001190  36 20 63 6f 64 65 2c 20  38 30 31 38 36 20 61 6e  |6 code, 80186 an|
000011a0  64 20 38 30 32 38 36 0d  20 20 20 63 6f 64 65 20  |d 80286.   code |
000011b0  69 6e 20 74 68 65 20 42  42 43 20 4d 61 73 74 65  |in the BBC Maste|
000011c0  72 20 68 61 6e 64 62 6f  6f 6b 2e 20 20 49 66 20  |r handbook.  If |
000011d0  79 6f 75 20 68 61 76 65  20 61 20 52 4f 4d 20 74  |you have a ROM t|
000011e0  68 61 74 0d 20 20 20 63  6f 6e 74 61 69 6e 73 20  |hat.   contains |
000011f0  36 35 30 32 20 6d 61 63  68 69 6e 65 20 63 6f 64  |6502 machine cod|
00001200  65 20 61 6e 64 20 69 73  20 61 20 73 65 72 76 69  |e and is a servi|
00001210  63 65 20 52 4f 4d 20 6f  6e 6c 79 2c 0d 20 20 20  |ce ROM only,.   |
00001220  74 68 65 6e 20 74 68 69  73 20 62 79 74 65 20 77  |then this byte w|
00001230  6f 75 6c 64 20 62 65 20  26 38 32 2e 0d 0d 54 68  |ould be &82...Th|
00001240  65 20 52 4f 4d 20 74 79  70 65 20 66 6c 61 67 20  |e ROM type flag |
00001250  69 73 20 63 6f 70 69 65  64 2c 20 62 79 20 74 68  |is copied, by th|
00001260  65 20 4f 53 2c 20 69 6e  74 6f 20 61 20 31 36 20  |e OS, into a 16 |
00001270  62 79 74 65 20 52 4f 4d  0d 69 6e 66 6f 72 6d 61  |byte ROM.informa|
00001280  74 69 6f 6e 20 74 61 62  6c 65 20 77 68 65 6e 65  |tion table whene|
00001290  76 65 72 20 61 20 72 65  73 65 74 20 6f 63 63 75  |ver a reset occu|
000012a0  72 73 2c 20 73 75 63 68  20 61 73 20 6f 6e 20 61  |rs, such as on a|
000012b0  0d 42 52 45 41 4b 2e 20  20 4f 53 42 59 54 45 20  |.BREAK.  OSBYTE |
000012c0  31 37 30 20 28 61 6e 64  20 31 37 31 29 20 61 72  |170 (and 171) ar|
000012d0  65 20 75 73 65 64 20 74  6f 20 72 65 61 64 20 74  |e used to read t|
000012e0  68 65 20 73 74 61 72 74  0d 61 64 64 72 65 73 73  |he start.address|
000012f0  20 66 6f 72 20 74 68 69  73 20 74 61 62 6c 65 2c  | for this table,|
00001300  20 61 6e 64 20 74 68 65  20 62 79 74 65 20 66 6f  | and the byte fo|
00001310  72 20 73 6f 63 6b 65 74  20 58 20 69 73 20 66 6f  |r socket X is fo|
00001320  75 6e 64 20 58 0d 62 79  74 65 73 20 61 62 6f 76  |und X.bytes abov|
00001330  65 20 74 68 61 74 20 73  74 61 72 74 20 61 64 64  |e that start add|
00001340  72 65 73 73 2e 20 20 49  66 20 6e 6f 20 52 4f 4d  |ress.  If no ROM|
00001350  20 69 73 20 70 72 65 73  65 6e 74 20 69 6e 20 61  | is present in a|
00001360  0d 73 6f 63 6b 65 74 20  74 68 65 6e 20 74 68 61  |.socket then tha|
00001370  74 20 73 6f 63 6b 65 74  27 73 20 70 6f 73 69 74  |t socket's posit|
00001380  69 6f 6e 20 69 6e 20 74  68 65 20 52 4f 4d 20 69  |ion in the ROM i|
00001390  6e 66 6f 72 6d 61 74 69  6f 6e 0d 74 61 62 6c 65  |nformation.table|
000013a0  20 68 6f 6c 64 73 20 7a  65 72 6f 2e 20 20 59 6f  | holds zero.  Yo|
000013b0  75 20 63 61 6e 20 66 6f  6f 6c 20 74 68 65 20 4f  |u can fool the O|
000013c0  53 20 69 6e 74 6f 20 69  67 6e 6f 72 69 6e 67 20  |S into ignoring |
000013d0  61 20 52 4f 4d 0d 62 79  20 77 72 69 74 69 6e 67  |a ROM.by writing|
000013e0  20 61 20 7a 65 72 6f 20  69 6e 74 6f 20 69 74 73  | a zero into its|
000013f0  20 70 6f 73 69 74 69 6f  6e 20 69 6e 20 74 68 65  | position in the|
00001400  20 52 4f 4d 20 69 6e 66  6f 72 6d 61 74 69 6f 6e  | ROM information|
00001410  0d 74 61 62 6c 65 3b 20  62 75 74 2c 20 61 73 20  |.table; but, as |
00001420  49 20 68 61 76 65 20 61  6c 72 65 61 64 79 20 73  |I have already s|
00001430  61 69 64 2c 20 74 68 69  73 20 74 61 62 6c 65 20  |aid, this table |
00001440  69 73 20 72 65 77 72 69  74 74 65 6e 0d 6f 6e 20  |is rewritten.on |
00001450  61 20 42 52 45 41 4b 20  28 72 65 73 65 74 29 2e  |a BREAK (reset).|
00001460  20 20 49 6e 20 61 20 4d  41 53 54 45 52 20 6d 69  |  In a MASTER mi|
00001470  63 72 6f 20 79 6f 75 20  63 61 6e 20 27 75 6e 70  |cro you can 'unp|
00001480  6c 75 67 27 20 61 0d 52  4f 4d 20 69 6e 20 73 6f  |lug' a.ROM in so|
00001490  66 74 77 61 72 65 20 77  69 74 68 20 61 6e 20 4f  |ftware with an O|
000014a0  53 20 63 6f 6d 6d 61 6e  64 2e 20 20 59 6f 75 20  |S command.  You |
000014b0  6d 69 67 68 74 20 77 61  6e 74 20 74 6f 0d 72 65  |might want to.re|
000014c0  6d 6f 76 65 20 61 20 52  4f 4d 20 66 72 6f 6d 20  |move a ROM from |
000014d0  74 68 65 20 6d 61 63 68  69 6e 65 20 69 6e 20 6f  |the machine in o|
000014e0  72 64 65 72 20 74 6f 20  73 74 6f 70 20 63 6c 61  |rder to stop cla|
000014f0  73 68 65 73 20 77 69 74  68 0d 63 6f 6d 6d 61 6e  |shes with.comman|
00001500  64 73 20 6f 72 20 6f 76  65 72 20 77 6f 72 6b 73  |ds or over works|
00001510  70 61 63 65 2e 20 20 28  4d 6f 72 65 20 6f 6e 20  |pace.  (More on |
00001520  74 68 69 73 20 69 6e 20  74 68 65 20 6e 65 78 74  |this in the next|
00001530  0d 6d 6f 64 75 6c 65 2e  29 0d 0d 54 68 65 20 63  |.module.)..The c|
00001540  6f 70 79 72 69 67 68 74  20 73 74 72 69 6e 67 20  |opyright string |
00001550  68 61 73 20 74 6f 20 73  74 61 72 74 20 77 69 74  |has to start wit|
00001560  68 20 28 43 29 20 61 6e  64 20 69 73 20 74 68 65  |h (C) and is the|
00001570  6e 0d 75 73 75 61 6c 6c  79 20 66 6f 6c 6c 6f 77  |n.usually follow|
00001580  65 64 20 62 79 20 74 68  65 20 6e 61 6d 65 20 6f  |ed by the name o|
00001590  66 20 74 68 65 20 63 6f  70 79 72 69 67 68 74 20  |f the copyright |
000015a0  68 6f 6c 64 65 72 20 61  6e 64 20 74 68 65 0d 64  |holder and the.d|
000015b0  61 74 65 2e 20 20 49 74  20 75 73 75 61 6c 6c 79  |ate.  It usually|
000015c0  20 66 6f 6c 6c 6f 77 73  20 74 68 65 20 74 69 74  | follows the tit|
000015d0  6c 65 20 73 74 72 69 6e  67 20 69 6e 20 74 68 65  |le string in the|
000015e0  20 68 65 61 64 65 72 2e  20 0d 54 68 65 20 74 69  | header. .The ti|
000015f0  74 6c 65 20 73 74 72 69  6e 67 20 69 73 20 74 68  |tle string is th|
00001600  65 20 73 74 72 69 6e 67  20 70 72 69 6e 74 65 64  |e string printed|
00001610  20 6f 75 74 20 69 66 20  74 68 65 20 52 4f 4d 20  | out if the ROM |
00001620  69 73 0d 73 65 6c 65 63  74 65 64 20 61 73 20 61  |is.selected as a|
00001630  20 6c 61 6e 67 75 61 67  65 2e 20 20 42 6f 74 68  | language.  Both|
00001640  20 74 69 74 6c 65 20 61  6e 64 20 63 6f 70 79 72  | title and copyr|
00001650  69 67 68 74 20 73 74 72  69 6e 67 73 0d 61 72 65  |ight strings.are|
00001660  20 74 65 72 6d 69 6e 61  74 65 64 20 77 69 74 68  | terminated with|
00001670  20 6e 75 6c 6c 73 20 28  30 29 2e 0d 0d 49 20 68  | nulls (0)...I h|
00001680  61 76 65 20 77 72 69 74  74 65 6e 20 61 20 52 4f  |ave written a RO|
00001690  4d 20 66 6f 72 20 74 68  69 73 20 6d 6f 64 75 6c  |M for this modul|
000016a0  65 2e 20 20 54 68 65 20  73 6f 75 72 63 65 20 63  |e.  The source c|
000016b0  6f 64 65 20 66 6f 72 0d  74 68 65 20 52 4f 4d 20  |ode for.the ROM |
000016c0  69 73 20 69 6e 20 74 68  65 20 70 72 6f 67 72 61  |is in the progra|
000016d0  6d 20 42 2f 6f 73 62 32  34 20 61 6e 64 20 79 6f  |m B/osb24 and yo|
000016e0  75 20 6e 65 65 64 20 42  41 53 49 43 20 32 20 6f  |u need BASIC 2 o|
000016f0  72 0d 68 69 67 68 65 72  20 28 73 75 63 68 20 61  |r.higher (such a|
00001700  73 20 48 69 42 41 53 49  43 29 20 74 6f 20 61 73  |s HiBASIC) to as|
00001710  73 65 6d 62 6c 65 20 69  74 2e 20 20 42 65 73 69  |semble it.  Besi|
00001720  64 65 73 20 74 68 65 0d  61 62 69 6c 69 74 79 20  |des the.ability |
00001730  74 6f 20 61 73 73 65 6d  62 6c 65 20 63 6f 64 65  |to assemble code|
00001740  20 74 6f 20 72 75 6e 20  61 74 20 61 20 64 69 66  | to run at a dif|
00001750  66 65 72 65 6e 74 20 61  64 64 72 65 73 73 20 74  |ferent address t|
00001760  6f 0d 74 68 65 20 52 41  4d 20 69 74 27 73 20 61  |o.the RAM it's a|
00001770  73 73 65 6d 62 6c 65 64  20 69 6e 20 28 6f 66 20  |ssembled in (of |
00001780  77 68 69 63 68 20 6d 6f  72 65 20 6c 61 74 65 72  |which more later|
00001790  29 2c 20 74 68 65 20 65  78 74 72 61 0d 66 61 63  |), the extra.fac|
000017a0  69 6c 69 74 69 65 73 20  6f 66 20 6c 61 74 65 72  |ilities of later|
000017b0  20 42 41 53 49 43 73 20  69 6e 63 6c 75 64 65 20  | BASICs include |
000017c0  73 6f 6d 65 20 45 51 55  20 70 73 65 75 64 6f 20  |some EQU pseudo |
000017d0  6f 70 2d 63 6f 64 65 73  0d 77 68 69 63 68 20 61  |op-codes.which a|
000017e0  72 65 20 61 73 20 66 6f  6c 6c 6f 77 73 3a 0d 0d  |re as follows:..|
000017f0  20 20 20 20 45 51 55 42  20 2d 20 70 75 74 20 61  |    EQUB - put a|
00001800  20 62 79 74 65 20 69 6e  74 6f 20 6d 65 6d 6f 72  | byte into memor|
00001810  79 20 68 65 72 65 0d 20  20 20 20 45 51 55 57 20  |y here.    EQUW |
00001820  2d 20 70 75 74 20 61 20  77 6f 72 64 20 28 32 20  |- put a word (2 |
00001830  62 79 74 65 73 29 20 69  6e 74 6f 20 6d 65 6d 6f  |bytes) into memo|
00001840  72 79 20 68 65 72 65 0d  20 20 20 20 45 51 55 44  |ry here.    EQUD|
00001850  20 2d 20 70 75 74 20 61  20 64 6f 75 62 6c 65 20  | - put a double |
00001860  77 6f 72 64 20 28 34 20  62 79 74 65 73 29 20 69  |word (4 bytes) i|
00001870  6e 74 6f 20 6d 65 6d 6f  72 79 20 68 65 72 65 0d  |nto memory here.|
00001880  20 20 20 20 45 51 55 53  20 2d 20 70 75 74 20 61  |    EQUS - put a|
00001890  20 73 74 72 69 6e 67 20  69 6e 74 6f 20 6d 65 6d  | string into mem|
000018a0  6f 72 79 20 68 65 72 65  0d 0d 45 51 55 57 20 61  |ory here..EQUW a|
000018b0  6e 64 20 45 51 55 44 20  70 75 74 20 69 6e 20 6e  |nd EQUD put in n|
000018c0  75 6d 62 65 72 73 20 73  75 63 68 20 74 68 61 74  |umbers such that|
000018d0  20 74 68 65 20 6d 6f 73  74 20 73 69 67 6e 69 66  | the most signif|
000018e0  69 63 61 6e 74 0d 62 79  74 65 20 69 73 20 69 6e  |icant.byte is in|
000018f0  20 74 68 65 20 68 69 67  68 65 73 74 20 61 64 64  | the highest add|
00001900  72 65 73 73 2e 20 20 53  6f 20 69 66 20 45 51 55  |ress.  So if EQU|
00001910  44 20 26 31 32 33 34 35  36 37 38 0d 61 70 70 65  |D &12345678.appe|
00001920  61 72 73 20 69 6e 20 79  6f 75 72 20 63 6f 64 65  |ars in your code|
00001930  20 61 74 20 61 64 64 72  65 73 73 20 6c 61 62 65  | at address labe|
00001940  6c 20 27 68 65 72 65 27  20 79 6f 75 20 77 69 6c  |l 'here' you wil|
00001950  6c 20 66 69 6e 64 0d 74  68 65 20 6e 75 6d 62 65  |l find.the numbe|
00001960  72 20 69 6e 20 6d 65 6d  6f 72 79 20 6c 69 6b 65  |r in memory like|
00001970  20 74 68 69 73 3a 0d 0d  20 20 20 20 20 20 20 20  | this:..        |
00001980  20 20 20 20 20 68 65 72  65 20 20 20 20 20 20 20  |     here       |
00001990  20 20 20 20 26 37 38 0d  20 20 20 20 20 20 20 20  |    &78.        |
000019a0  20 20 20 20 20 68 65 72  65 2b 31 20 20 20 20 20  |     here+1     |
000019b0  20 20 20 20 26 35 36 0d  20 20 20 20 20 20 20 20  |    &56.        |
000019c0  20 20 20 20 20 68 65 72  65 2b 32 20 20 20 20 20  |     here+2     |
000019d0  20 20 20 20 26 33 34 0d  20 20 20 20 20 20 20 20  |    &34.        |
000019e0  20 20 20 20 20 68 65 72  65 2b 33 20 20 20 20 20  |     here+3     |
000019f0  20 20 20 20 26 31 32 0d  0d 49 66 20 79 6f 75 20  |    &12..If you |
00001a00  6c 6f 6f 6b 20 61 74 20  6c 69 6e 65 73 20 33 38  |look at lines 38|
00001a10  30 20 74 6f 20 34 39 30  20 6f 66 20 42 2f 6f 73  |0 to 490 of B/os|
00001a20  62 32 34 20 79 6f 75 20  77 69 6c 6c 20 66 69 6e  |b24 you will fin|
00001a30  64 20 74 68 65 0d 63 6f  64 65 20 74 68 61 74 20  |d the.code that |
00001a40  61 73 73 65 6d 62 6c 65  73 20 69 6e 74 6f 20 74  |assembles into t|
00001a50  68 65 20 52 4f 4d 20 68  65 61 64 65 72 2e 20 20  |he ROM header.  |
00001a60  54 68 65 73 65 20 61 72  65 20 74 68 65 0d 72 65  |These are the.re|
00001a70  6c 65 76 61 6e 74 20 70  61 72 74 73 0d 0d 20 20  |levant parts..  |
00001a80  20 20 45 51 55 57 20 30  0d 20 20 20 20 45 51 55  |  EQUW 0.    EQU|
00001a90  42 20 30 0d 20 0d 20 20  20 20 4a 4d 50 20 73 65  |B 0. .    JMP se|
00001aa0  72 76 69 63 65 5f 65 6e  74 72 79 5f 70 6f 69 6e  |rvice_entry_poin|
00001ab0  74 0d 20 0d 54 68 65 72  65 20 69 73 20 6e 6f 20  |t. .There is no |
00001ac0  6c 61 6e 67 75 61 67 65  20 65 6e 74 72 79 20 73  |language entry s|
00001ad0  6f 20 74 68 65 20 66 69  72 73 74 20 74 68 72 65  |o the first thre|
00001ae0  65 20 62 79 74 65 73 20  61 72 65 0d 7a 65 72 6f  |e bytes are.zero|
00001af0  73 2e 0d 0d 20 20 20 20  45 51 55 42 20 26 38 32  |s...    EQUB &82|
00001b00  0d 0d 54 68 69 73 20 69  73 20 74 68 65 20 52 4f  |..This is the RO|
00001b10  4d 20 74 79 70 65 20 66  6c 61 67 0d 0d 20 20 20  |M type flag..   |
00001b20  20 45 51 55 42 20 63 6f  70 79 72 69 67 68 74 20  | EQUB copyright |
00001b30  2d 20 63 6f 64 65 25 0d  20 0d 54 68 65 6e 20 77  |- code%. .Then w|
00001b40  65 20 68 61 76 65 20 74  68 65 20 63 6f 70 79 72  |e have the copyr|
00001b50  69 67 68 74 20 6f 66 66  73 65 74 20 62 79 74 65  |ight offset byte|
00001b60  20 74 68 61 74 20 68 6f  6c 64 73 20 74 68 65 20  | that holds the |
00001b70  6f 66 66 73 65 74 0d 6f  66 20 74 68 65 20 63 6f  |offset.of the co|
00001b80  70 79 72 69 67 68 74 20  73 74 72 69 6e 67 20 66  |pyright string f|
00001b90  72 6f 6d 20 74 68 65 20  73 74 61 72 74 20 6f 66  |rom the start of|
00001ba0  20 74 68 65 20 63 6f 64  65 2e 0d 0d 20 20 20 20  | the code...    |
00001bb0  45 51 55 42 20 30 0d 20  0d 54 68 65 20 76 65 72  |EQUB 0. .The ver|
00001bc0  73 69 6f 6e 20 62 79 74  65 20 69 73 20 7a 65 72  |sion byte is zer|
00001bd0  6f 20 61 6e 64 20 69 73  20 66 6f 6c 6c 6f 77 65  |o and is followe|
00001be0  64 20 62 79 20 74 68 65  20 52 4f 4d 20 74 69 74  |d by the ROM tit|
00001bf0  6c 65 0d 61 6e 64 20 63  6f 70 79 72 69 67 68 74  |le.and copyright|
00001c00  20 73 74 72 69 6e 67 73  2e 20 20 49 20 68 61 76  | strings.  I hav|
00001c10  65 20 69 6e 63 6f 72 70  6f 72 61 74 65 64 20 61  |e incorporated a|
00001c20  20 76 65 72 73 69 6f 6e  20 73 74 72 69 6e 67 0d  | version string.|
00001c30  69 6e 74 6f 20 74 68 65  20 52 4f 4d 20 74 69 74  |into the ROM tit|
00001c40  6c 65 2e 20 20 54 68 65  20 66 6f 72 6d 61 74 20  |le.  The format |
00001c50  6f 66 20 74 68 65 20 63  6f 70 79 72 69 67 68 74  |of the copyright|
00001c60  20 73 74 72 69 6e 67 20  69 73 0d 61 6c 77 61 79  | string is.alway|
00001c70  73 20 61 20 7a 65 72 6f  20 28 6e 75 6c 6c 29 20  |s a zero (null) |
00001c80  62 79 74 65 20 66 6f 6c  6c 6f 77 65 64 20 62 79  |byte followed by|
00001c90  20 28 43 29 2e 20 20 54  68 65 20 66 6f 72 6d 61  | (C).  The forma|
00001ca0  74 20 68 61 73 0d 74 6f  20 62 65 20 65 78 61 63  |t has.to be exac|
00001cb0  74 6c 79 20 74 68 61 74  2c 20 6f 74 68 65 72 77  |tly that, otherw|
00001cc0  69 73 65 20 74 68 65 20  4f 53 20 77 69 6c 6c 20  |ise the OS will |
00001cd0  6e 6f 74 20 72 65 63 6f  67 6e 69 73 65 20 74 68  |not recognise th|
00001ce0  61 74 0d 74 68 65 72 65  20 69 73 20 61 20 52 4f  |at.there is a RO|
00001cf0  4d 20 69 6e 20 74 68 65  20 73 6f 63 6b 65 74 2e  |M in the socket.|
00001d00  20 20 54 72 79 20 64 65  6c 65 74 69 6e 67 20 74  |  Try deleting t|
00001d10  68 65 20 6e 75 6c 6c 20  61 6e 64 0d 73 65 65 2e  |he null and.see.|
00001d20  0d 0d 20 20 2e 72 6f 6d  5f 74 69 74 6c 65 20 20  |..  .rom_title  |
00001d30  20 20 20 20 20 20 45 51  55 53 20 22 4f 53 62 69  |      EQUS "OSbi|
00001d40  74 73 20 44 65 6d 6f 20  52 4f 4d 20 22 2b 56 65  |ts Demo ROM "+Ve|
00001d50  72 73 69 6f 6e 24 0d 20  0d 20 20 2e 63 6f 70 79  |rsion$. .  .copy|
00001d60  72 69 67 68 74 20 20 20  20 20 20 20 20 45 51 55  |right        EQU|
00001d70  53 20 43 48 52 24 30 2b  22 28 43 29 42 42 43 20  |S CHR$0+"(C)BBC |
00001d80  22 2b 44 61 74 65 24 2b  43 48 52 24 30 0d 20 0d  |"+Date$+CHR$0. .|
00001d90  20 20 2e 73 65 72 76 69  63 65 5f 65 6e 74 72 79  |  .service_entry|
00001da0  5f 70 6f 69 6e 74 0d 20  0d 54 68 65 20 73 65 72  |_point. .The ser|
00001db0  76 69 63 65 20 65 6e 74  72 79 20 70 6f 69 6e 74  |vice entry point|
00001dc0  20 63 6f 6d 65 73 20 6e  65 78 74 2e 20 20 54 68  | comes next.  Th|
00001dd0  69 73 20 69 73 20 77 68  65 72 65 20 65 78 65 63  |is is where exec|
00001de0  75 74 69 6f 6e 0d 6f 66  20 74 68 65 20 63 6f 64  |ution.of the cod|
00001df0  65 20 67 6f 65 73 20 77  68 65 6e 20 74 68 65 20  |e goes when the |
00001e00  6f 70 65 72 61 74 69 6e  67 20 73 79 73 74 65 6d  |operating system|
00001e10  20 73 65 6e 64 73 20 61  20 73 65 72 76 69 63 65  | sends a service|
00001e20  0d 63 61 6c 6c 2e 20 20  49 74 20 73 74 61 72 74  |.call.  It start|
00001e30  73 20 62 79 20 6f 66 66  65 72 69 6e 67 20 74 68  |s by offering th|
00001e40  65 20 73 65 72 76 69 63  65 20 74 6f 20 52 4f 4d  |e service to ROM|
00001e50  20 6e 75 6d 62 65 72 20  31 35 0d 61 6e 64 20 74  | number 15.and t|
00001e60  68 65 6e 20 77 6f 72 6b  73 20 69 74 73 20 77 61  |hen works its wa|
00001e70  79 20 64 6f 77 6e 20 74  68 65 20 52 4f 4d 53 2e  |y down the ROMS.|
00001e80  20 20 54 68 69 73 20 69  73 20 77 68 79 20 74 68  |  This is why th|
00001e90  65 20 52 4f 4d 0d 69 6e  20 61 20 68 69 67 68 20  |e ROM.in a high |
00001ea0  6e 75 6d 62 65 72 65 64  20 73 6f 63 6b 65 74 20  |numbered socket |
00001eb0  68 61 73 20 70 72 69 6f  72 69 74 79 20 6f 76 65  |has priority ove|
00001ec0  72 20 52 4f 4d 53 20 69  6e 20 6c 6f 77 65 72 0d  |r ROMS in lower.|
00001ed0  6e 75 6d 62 65 72 65 64  20 73 6f 63 6b 65 74 73  |numbered sockets|
00001ee0  2e 20 20 50 72 69 6f 72  69 74 79 20 6d 65 61 6e  |.  Priority mean|
00001ef0  73 20 74 68 61 74 2c 20  69 6e 20 74 68 65 20 63  |s that, in the c|
00001f00  61 73 65 20 6f 66 20 74  77 6f 0d 52 4f 4d 53 20  |ase of two.ROMS |
00001f10  68 61 76 69 6e 67 20 74  68 65 20 73 61 6d 65 20  |having the same |
00001f20  63 6f 6d 6d 61 6e 64 20  69 6e 20 74 68 65 6d 2c  |command in them,|
00001f30  20 74 68 65 20 68 69 67  68 65 72 20 6e 75 6d 62  | the higher numb|
00001f40  65 72 65 64 0d 6f 6e 65  20 77 69 6c 6c 20 61 63  |ered.one will ac|
00001f50  74 75 61 6c 6c 79 20 62  65 20 65 78 65 63 75 74  |tually be execut|
00001f60  65 64 2e 20 20 41 6c 73  6f 20 74 68 65 20 63 6f  |ed.  Also the co|
00001f70  64 65 20 69 6e 20 61 20  68 69 67 68 65 72 0d 6e  |de in a higher.n|
00001f80  75 6d 62 65 72 65 64 20  52 4f 4d 20 77 69 6c 6c  |umbered ROM will|
00001f90  20 62 65 20 65 78 65 63  75 74 65 64 20 61 20 6c  | be executed a l|
00001fa0  69 74 74 6c 65 20 66 61  73 74 65 72 20 62 65 63  |ittle faster bec|
00001fb0  61 75 73 65 20 74 68 65  0d 73 65 72 76 69 63 65  |ause the.service|
00001fc0  20 63 61 6c 6c 20 72 65  61 63 68 65 73 20 69 74  | call reaches it|
00001fd0  20 71 75 69 63 6b 65 72  2e 20 20 54 68 69 73 20  | quicker.  This |
00001fe0  69 73 20 77 68 79 20 41  4d 53 20 73 75 67 67 65  |is why AMS sugge|
00001ff0  73 74 0d 74 68 61 74 20  79 6f 75 20 70 75 74 20  |st.that you put |
00002000  79 6f 75 72 20 41 4d 58  20 6d 6f 75 73 65 20 52  |your AMX mouse R|
00002010  4f 4d 20 69 6e 20 74 68  65 20 68 69 67 68 65 73  |OM in the highes|
00002020  74 20 70 6f 73 73 69 62  6c 65 0d 73 6f 63 6b 65  |t possible.socke|
00002030  74 2e 0d 0d 41 20 73 65  72 76 69 63 65 20 63 61  |t...A service ca|
00002040  6c 6c 20 69 73 20 61 20  6a 75 6d 70 20 74 6f 20  |ll is a jump to |
00002050  74 68 65 20 73 65 72 76  69 63 65 20 65 6e 74 72  |the service entr|
00002060  79 20 70 6f 69 6e 74 2c  20 61 6e 64 20 74 68 65  |y point, and the|
00002070  0d 6e 75 6d 62 65 72 73  20 69 6e 20 74 68 65 20  |.numbers in the |
00002080  41 63 63 75 6d 75 6c 61  74 6f 72 20 61 6e 64 20  |Accumulator and |
00002090  74 68 65 20 58 20 61 6e  64 20 59 20 72 65 67 69  |the X and Y regi|
000020a0  73 74 65 72 73 20 63 61  72 72 79 0d 74 68 65 20  |sters carry.the |
000020b0  63 61 6c 6c 27 73 20 70  61 72 61 6d 65 74 65 72  |call's parameter|
000020c0  73 2e 0d 0d 49 27 6c 6c  20 64 65 61 6c 20 77 69  |s...I'll deal wi|
000020d0  74 68 20 74 68 65 20 58  20 66 69 72 73 74 2c 20  |th the X first, |
000020e0  73 69 6e 63 65 20 74 68  61 74 20 61 6c 77 61 79  |since that alway|
000020f0  73 20 68 6f 6c 64 73 20  74 68 65 0d 6e 75 6d 62  |s holds the.numb|
00002100  65 72 20 6f 66 20 74 68  65 20 52 4f 4d 20 63 75  |er of the ROM cu|
00002110  72 72 65 6e 74 6c 79 20  62 65 69 6e 67 20 75 73  |rrently being us|
00002120  65 64 2e 20 20 53 69 6e  63 65 20 79 6f 75 72 20  |ed.  Since your |
00002130  63 6f 64 65 20 69 6e 0d  61 20 52 4f 4d 20 64 6f  |code in.a ROM do|
00002140  65 73 20 6e 6f 74 20 6b  6e 6f 77 20 77 68 65 72  |es not know wher|
00002150  65 20 69 74 20 69 73 20  69 6e 20 74 68 65 20 6d  |e it is in the m|
00002160  61 63 68 69 6e 65 2c 20  61 6e 64 20 6d 61 6e 79  |achine, and many|
00002170  0d 61 63 74 69 6f 6e 73  20 79 6f 75 20 77 69 6c  |.actions you wil|
00002180  6c 20 77 61 6e 74 20 74  6f 20 63 61 72 72 79 20  |l want to carry |
00002190  6f 75 74 20 77 69 6c 6c  20 64 65 70 65 6e 64 20  |out will depend |
000021a0  6f 6e 20 79 6f 75 0d 6b  6e 6f 77 69 6e 67 20 74  |on you.knowing t|
000021b0  68 65 20 73 6f 63 6b 65  74 20 6e 75 6d 62 65 72  |he socket number|
000021c0  20 69 6e 20 77 68 69 63  68 20 79 6f 75 72 20 52  | in which your R|
000021d0  4f 4d 20 69 73 2c 20 79  6f 75 20 77 69 6c 6c 20  |OM is, you will |
000021e0  67 65 74 0d 74 68 69 73  20 76 69 74 61 6c 20 69  |get.this vital i|
000021f0  6e 66 6f 72 6d 61 74 69  6f 6e 20 66 72 6f 6d 20  |nformation from |
00002200  74 68 65 20 58 20 72 65  67 69 73 74 65 72 20 61  |the X register a|
00002210  74 20 74 68 65 20 65 6e  74 72 79 20 69 6e 74 6f  |t the entry into|
00002220  0d 79 6f 75 72 20 73 65  72 76 69 63 65 20 72 6f  |.your service ro|
00002230  75 74 69 6e 65 2e 0d 0d  54 68 65 20 61 63 63 75  |utine...The accu|
00002240  6d 75 6c 61 74 6f 72 20  63 61 72 72 69 65 73 20  |mulator carries |
00002250  74 68 65 20 6e 75 6d 62  65 72 20 6f 66 20 74 68  |the number of th|
00002260  65 20 73 65 72 76 69 63  65 20 63 61 6c 6c 2c 20  |e service call, |
00002270  61 6e 64 0d 74 68 65 20  59 20 72 65 67 69 73 74  |and.the Y regist|
00002280  65 72 20 6d 61 79 20 63  61 72 72 79 20 73 6f 6d  |er may carry som|
00002290  65 20 70 61 72 61 6d 65  74 65 72 20 66 6f 72 20  |e parameter for |
000022a0  74 68 65 20 63 61 6c 6c  2e 20 20 49 0d 77 69 6c  |the call.  I.wil|
000022b0  6c 20 6c 69 73 74 20 73  6f 6d 65 20 6f 66 20 74  |l list some of t|
000022c0  68 65 20 73 65 72 76 69  63 65 20 63 61 6c 6c 73  |he service calls|
000022d0  20 74 68 61 74 20 74 68  65 20 4f 53 20 69 73 20  | that the OS is |
000022e0  6c 69 6b 65 6c 79 20 74  6f 0d 6f 72 69 67 69 6e  |likely to.origin|
000022f0  61 74 65 2e 20 20 28 4e  6f 74 65 20 74 68 61 74  |ate.  (Note that|
00002300  2c 20 77 69 74 68 20 4f  53 42 59 54 45 20 31 34  |, with OSBYTE 14|
00002310  33 2c 20 61 6e 79 20 70  72 6f 67 72 61 6d 20 63  |3, any program c|
00002320  61 6e 0d 6f 72 69 67 69  6e 61 74 65 20 61 20 73  |an.originate a s|
00002330  65 72 76 69 63 65 20 63  61 6c 6c 2e 29 20 20 4e  |ervice call.)  N|
00002340  6f 74 65 20 74 68 61 74  20 61 6e 79 20 72 65 66  |ote that any ref|
00002350  65 72 65 6e 63 65 73 20  74 6f 0d 6d 65 6d 6f 72  |erences to.memor|
00002360  79 20 6c 6f 63 61 74 69  6f 6e 73 20 61 72 65 20  |y locations are |
00002370  61 6c 77 61 79 73 20 69  6e 20 74 68 65 20 49 2f  |always in the I/|
00002380  4f 20 70 72 6f 63 65 73  73 6f 72 20 28 74 68 65  |O processor (the|
00002390  20 6d 61 69 6e 0d 6d 69  63 72 6f 29 20 61 6e 64  | main.micro) and|
000023a0  20 6e 65 76 65 72 20 69  6e 20 61 20 73 65 63 6f  | never in a seco|
000023b0  6e 64 20 70 72 6f 63 65  73 73 6f 72 2c 20 73 68  |nd processor, sh|
000023c0  6f 75 6c 64 20 6f 6e 65  20 62 65 0d 63 6f 6e 6e  |ould one be.conn|
000023d0  65 63 74 65 64 2e 0d 0d  53 65 72 76 69 63 65 20  |ected...Service |
000023e0  63 61 6c 6c 20 30 20 61  63 74 75 61 6c 6c 79 20  |call 0 actually |
000023f0  6d 65 61 6e 73 20 74 68  61 74 20 74 68 65 20 70  |means that the p|
00002400  61 72 74 69 63 75 6c 61  72 20 73 65 72 76 69 63  |articular servic|
00002410  65 0d 68 61 73 20 62 65  65 6e 20 63 61 72 72 69  |e.has been carri|
00002420  65 64 20 6f 75 74 20 61  6e 64 20 74 68 65 20 6f  |ed out and the o|
00002430  72 69 67 69 6e 61 6c 20  63 61 6c 6c 20 68 61 73  |riginal call has|
00002440  20 62 65 65 6e 20 63 6c  61 69 6d 65 64 2e 20 0d  | been claimed. .|
00002450  41 20 52 4f 4d 20 69 73  20 6e 6f 74 20 75 73 75  |A ROM is not usu|
00002460  61 6c 6c 79 20 6f 66 66  65 72 65 64 20 73 65 72  |ally offered ser|
00002470  76 69 63 65 20 63 61 6c  6c 20 7a 65 72 6f 2c 20  |vice call zero, |
00002480  62 75 74 20 74 68 65 20  4f 53 0d 6b 6e 6f 77 73  |but the OS.knows|
00002490  20 69 66 20 69 74 20 64  65 74 65 63 74 73 20 61  | if it detects a|
000024a0  20 7a 65 72 6f 20 69 6e  20 74 68 65 20 61 63 63  | zero in the acc|
000024b0  75 6d 75 6c 61 74 6f 72  20 61 66 74 65 72 20 61  |umulator after a|
000024c0  20 52 4f 4d 0d 68 61 73  20 62 65 65 6e 20 73 65  | ROM.has been se|
000024d0  72 76 69 63 65 64 20 74  68 61 74 20 74 68 65 20  |rviced that the |
000024e0  6f 70 65 72 61 74 69 6f  6e 20 68 61 73 20 62 65  |operation has be|
000024f0  65 6e 20 63 61 72 72 69  65 64 20 6f 75 74 2e 20  |en carried out. |
00002500  0d 59 6f 75 20 63 61 6e  20 73 65 6e 64 20 61 20  |.You can send a |
00002510  73 65 72 76 69 63 65 20  63 61 6c 6c 20 30 20 77  |service call 0 w|
00002520  69 74 68 20 4f 53 42 59  54 45 20 31 34 33 20 62  |ith OSBYTE 143 b|
00002530  75 74 20 49 20 63 61 6e  27 74 0d 74 68 69 6e 6b  |ut I can't.think|
00002540  20 77 68 79 20 79 6f 75  20 6d 69 67 68 74 20 77  | why you might w|
00002550  61 6e 74 20 74 6f 20 73  69 6e 63 65 20 69 74 20  |ant to since it |
00002560  77 6f 75 6c 64 6e 27 74  20 67 65 74 20 61 6e 79  |wouldn't get any|
00002570  0d 66 75 72 74 68 65 72  20 74 68 61 6e 20 74 68  |.further than th|
00002580  65 20 66 69 72 73 74 20  52 4f 4d 2e 0d 0d 53 65  |e first ROM...Se|
00002590  72 76 69 63 65 20 63 61  6c 6c 20 31 20 2d 20 6f  |rvice call 1 - o|
000025a0  6e 20 61 20 72 65 73 65  74 20 52 4f 4d 53 20 6d  |n a reset ROMS m|
000025b0  75 73 74 20 72 65 73 65  72 76 65 20 61 62 73 6f  |ust reserve abso|
000025c0  6c 75 74 65 0d 73 74 61  74 69 63 20 77 6f 72 6b  |lute.static work|
000025d0  73 70 61 63 65 20 28 73  74 61 72 74 69 6e 67 20  |space (starting |
000025e0  61 6c 77 61 79 73 20 61  74 20 26 45 30 30 20 6f  |always at &E00 o|
000025f0  6e 20 61 20 42 20 6f 72  20 42 2b 20 61 6e 64 0d  |n a B or B+ and.|
00002600  75 73 75 61 6c 6c 79 20  66 6f 72 20 66 69 6c 69  |usually for fili|
00002610  6e 67 20 73 79 73 74 65  6d 73 29 20 6f 6e 20 74  |ng systems) on t|
00002620  68 69 73 20 63 61 6c 6c  2e 20 20 45 61 63 68 20  |his call.  Each |
00002630  52 4f 4d 20 74 68 61 74  0d 77 61 6e 74 73 20 74  |ROM that.wants t|
00002640  68 69 73 20 6b 69 6e 64  20 6f 66 20 77 6f 72 6b  |his kind of work|
00002650  73 70 61 63 65 20 77 69  6c 6c 20 63 6f 6d 70 61  |space will compa|
00002660  72 65 20 74 68 65 20 6e  75 6d 62 65 72 20 69 6e  |re the number in|
00002670  20 59 2c 0d 77 68 69 63  68 20 77 69 6c 6c 20 62  | Y,.which will b|
00002680  65 20 74 68 65 20 68 69  67 68 65 72 20 62 79 74  |e the higher byt|
00002690  65 20 6f 66 20 74 68 65  20 63 75 72 72 65 6e 74  |e of the current|
000026a0  20 75 70 70 65 72 20 6c  69 6d 69 74 20 6f 66 0d  | upper limit of.|
000026b0  74 68 65 20 77 6f 72 6b  73 70 61 63 65 20 2c 20  |the workspace , |
000026c0  77 69 74 68 20 74 68 65  20 76 61 6c 75 65 20 69  |with the value i|
000026d0  74 20 6e 65 65 64 73 20  61 6e 64 20 69 6e 63 72  |t needs and incr|
000026e0  65 61 73 65 20 59 20 69  66 0d 6e 65 63 65 73 73  |ease Y if.necess|
000026f0  61 72 79 20 62 65 66 6f  72 65 20 65 78 69 74 69  |ary before exiti|
00002700  6e 67 2e 20 20 54 68 69  73 20 63 61 6c 6c 20 6d  |ng.  This call m|
00002710  75 73 74 20 6e 6f 74 20  62 65 20 63 6c 61 69 6d  |ust not be claim|
00002720  65 64 2c 0d 69 2e 65 2e  20 74 68 65 20 76 61 6c  |ed,.i.e. the val|
00002730  75 65 20 69 6e 20 74 68  65 20 61 63 63 75 6d 75  |ue in the accumu|
00002740  6c 61 74 6f 72 20 69 73  20 74 6f 20 62 65 20 70  |lator is to be p|
00002750  72 65 73 65 72 76 65 64  20 66 72 6f 6d 0d 65 6e  |reserved from.en|
00002760  74 72 79 20 74 6f 20 65  78 69 74 2e 0d 0d 53 65  |try to exit...Se|
00002770  72 76 69 63 65 20 63 61  6c 6c 20 32 20 2d 20 6f  |rvice call 2 - o|
00002780  6e 20 61 20 72 65 73 65  74 2c 20 70 72 69 76 61  |n a reset, priva|
00002790  74 65 20 64 79 6e 61 6d  69 63 20 77 6f 72 6b 73  |te dynamic works|
000027a0  70 61 63 65 20 69 73 0d  72 65 73 65 72 76 65 64  |pace is.reserved|
000027b0  20 77 69 74 68 20 74 68  69 73 20 63 61 6c 6c 2e  | with this call.|
000027c0  20 20 57 68 65 72 65 61  73 20 61 62 73 6f 6c 75  |  Whereas absolu|
000027d0  74 65 20 77 6f 72 6b 73  70 61 63 65 20 63 61 6e  |te workspace can|
000027e0  20 62 65 0d 75 73 65 64  20 62 79 20 61 6e 6f 74  | be.used by anot|
000027f0  68 65 72 20 52 4f 4d 2c  20 73 75 62 6a 65 63 74  |her ROM, subject|
00002800  20 74 6f 20 68 6f 75 73  65 6b 65 65 70 69 6e 67  | to housekeeping|
00002810  20 72 75 6c 65 73 2c 20  74 68 69 73 0d 77 6f 72  | rules, this.wor|
00002820  6b 73 70 61 63 65 20 69  73 20 6f 6e 6c 79 20 66  |kspace is only f|
00002830  6f 72 20 79 6f 75 72 20  52 4f 4d 2e 20 20 59 6f  |or your ROM.  Yo|
00002840  75 20 63 6c 61 69 6d 20  69 74 20 62 79 20 73 74  |u claim it by st|
00002850  6f 72 69 6e 67 20 74 68  65 0d 76 61 6c 75 65 20  |oring the.value |
00002860  6f 66 20 59 20 69 6e 20  74 68 65 20 52 4f 4d 20  |of Y in the ROM |
00002870  77 6f 72 6b 73 70 61 63  65 20 74 61 62 6c 65 2c  |workspace table,|
00002880  20 20 61 6e 64 20 74 68  65 6e 20 72 61 69 73 69  |  and then raisi|
00002890  6e 67 20 59 0d 62 79 20  74 68 65 20 6e 75 6d 62  |ng Y.by the numb|
000028a0  65 72 20 6f 66 20 70 61  67 65 73 20 6f 66 20 74  |er of pages of t|
000028b0  68 69 73 20 77 6f 72 6b  73 70 61 63 65 20 79 6f  |his workspace yo|
000028c0  75 20 6e 65 65 64 2e 20  20 57 68 65 6e 20 79 6f  |u need.  When yo|
000028d0  75 0d 6e 65 65 64 20 74  6f 20 66 69 6e 64 20 6f  |u.need to find o|
000028e0  75 74 20 77 68 65 72 65  20 79 6f 75 72 20 70 72  |ut where your pr|
000028f0  69 76 61 74 65 20 77 6f  72 6b 73 70 61 63 65 20  |ivate workspace |
00002900  73 74 61 72 74 73 20 79  6f 75 20 63 61 6e 0d 6c  |starts you can.l|
00002910  6f 6f 6b 20 69 6e 20 74  68 61 74 20 74 61 62 6c  |ook in that tabl|
00002920  65 2c 20 77 68 69 63 68  20 73 74 61 72 74 73 20  |e, which starts |
00002930  61 74 20 26 44 46 30 2c  20 6f 66 66 73 65 74 20  |at &DF0, offset |
00002940  62 79 20 79 6f 75 72 20  52 4f 4d 0d 6e 75 6d 62  |by your ROM.numb|
00002950  65 72 20 28 66 6f 75 6e  64 20 66 72 6f 6d 20 74  |er (found from t|
00002960  68 65 20 58 20 72 65 67  69 73 74 65 72 29 2e 0d  |he X register)..|
00002970  0d 53 65 72 76 69 63 65  20 63 61 6c 6c 20 33 20  |.Service call 3 |
00002980  69 73 20 61 6e 20 61 75  74 6f 2d 62 6f 6f 74 20  |is an auto-boot |
00002990  63 61 6c 6c 2e 20 20 57  68 65 6e 20 74 68 69 73  |call.  When this|
000029a0  20 69 73 20 64 65 74 65  63 74 65 64 2c 0d 61 20  | is detected,.a |
000029b0  52 4f 4d 20 74 68 61 74  20 77 69 73 68 65 73 20  |ROM that wishes |
000029c0  74 6f 20 69 6e 69 74 69  61 6c 69 73 65 20 69 74  |to initialise it|
000029d0  73 65 6c 66 20 6f 6e 20  72 65 73 65 74 20 6c 6f  |self on reset lo|
000029e0  6f 6b 73 20 61 74 20 74  68 65 0d 6b 65 79 62 6f  |oks at the.keybo|
000029f0  61 72 64 20 28 75 73 69  6e 67 20 4f 53 42 59 54  |ard (using OSBYT|
00002a00  45 20 31 32 30 29 20 74  6f 20 73 65 65 20 69 66  |E 120) to see if|
00002a10  20 27 69 74 73 27 20 6b  65 79 20 69 73 20 70 72  | 'its' key is pr|
00002a20  65 73 73 65 64 2e 20 0d  49 66 20 74 68 61 74 20  |essed. .If that |
00002a30  69 73 20 74 68 65 20 63  61 73 65 2c 20 6f 72 20  |is the case, or |
00002a40  6e 6f 20 6b 65 79 20 69  73 20 70 72 65 73 73 65  |no key is presse|
00002a50  64 2c 20 74 68 65 6e 20  74 68 65 20 52 4f 4d 0d  |d, then the ROM.|
00002a60  73 68 6f 75 6c 64 20 69  6e 69 74 69 61 6c 69 73  |should initialis|
00002a70  65 2e 20 20 49 66 20 61  6e 6f 74 68 65 72 20 6b  |e.  If another k|
00002a80  65 79 20 69 73 20 70 72  65 73 73 65 64 20 69 74  |ey is pressed it|
00002a90  20 73 68 6f 75 6c 64 0d  69 67 6e 6f 72 65 20 74  | should.ignore t|
00002aa0  68 65 20 63 61 6c 6c 20  61 6e 64 20 70 61 73 73  |he call and pass|
00002ab0  20 6f 6e 20 74 68 65 20  72 65 67 69 73 74 65 72  | on the register|
00002ac0  73 20 75 6e 63 68 61 6e  67 65 64 2e 20 20 49 6e  |s unchanged.  In|
00002ad0  0d 74 68 69 73 20 77 61  79 20 79 6f 75 20 63 61  |.this way you ca|
00002ae0  6e 20 73 74 61 72 74 20  69 6e 20 44 46 53 20 6f  |n start in DFS o|
00002af0  6e 20 42 52 45 41 4b 20  62 79 20 68 6f 6c 64 69  |n BREAK by holdi|
00002b00  6e 67 20 64 6f 77 6e 20  44 20 61 6e 64 0d 73 74  |ng down D and.st|
00002b10  61 72 74 20 41 44 46 53  20 62 79 20 68 6f 6c 64  |art ADFS by hold|
00002b20  69 6e 67 20 64 6f 77 6e  20 41 20 28 6f 72 20 46  |ing down A (or F|
00002b30  29 2e 20 20 49 66 20 74  68 65 20 59 20 72 65 67  |).  If the Y reg|
00002b40  69 73 74 65 72 20 69 73  0d 7a 65 72 6f 20 74 68  |ister is.zero th|
00002b50  65 6e 20 74 68 65 20 52  4f 4d 20 74 68 61 74 20  |en the ROM that |
00002b60  63 6c 61 69 6d 73 20 74  68 65 20 63 61 6c 6c 20  |claims the call |
00002b70  73 68 6f 75 6c 64 20 61  63 74 69 6f 6e 20 74 68  |should action th|
00002b80  65 0d 72 65 6c 65 76 61  6e 74 20 21 42 4f 4f 54  |e.relevant !BOOT|
00002b90  20 66 69 6c 65 2e 0d 0d  4d 61 6e 79 20 52 4f 4d  | file...Many ROM|
00002ba0  53 20 28 69 6e 63 6c 75  64 69 6e 67 20 74 68 65  |S (including the|
00002bb0  20 6f 6e 65 20 77 69 74  68 20 74 68 69 73 20 6d  | one with this m|
00002bc0  6f 64 75 6c 65 29 20 75  73 65 20 73 65 72 76 69  |odule) use servi|
00002bd0  63 65 0d 63 61 6c 6c 20  33 20 74 6f 20 70 72 69  |ce.call 3 to pri|
00002be0  6e 74 20 6f 75 74 20 61  20 6c 69 74 74 6c 65 20  |nt out a little |
00002bf0  6d 65 73 73 61 67 65 20  61 62 6f 75 74 20 74 68  |message about th|
00002c00  65 6d 73 65 6c 76 65 73  2e 20 54 68 69 73 0d 63  |emselves. This.c|
00002c10  61 6c 6c 20 69 73 20 63  6c 61 69 6d 65 64 20 62  |all is claimed b|
00002c20  79 20 61 6e 79 20 66 69  6c 69 6e 67 20 73 79 73  |y any filing sys|
00002c30  74 65 6d 20 74 68 61 74  20 73 74 61 72 74 73 20  |tem that starts |
00002c40  75 70 2c 20 77 68 69 63  68 0d 69 73 20 77 68 79  |up, which.is why|
00002c50  20 79 6f 75 72 20 6d 65  73 73 61 67 65 73 20 6f  | your messages o|
00002c60  6e 20 42 52 45 41 4b 20  64 65 70 65 6e 64 20 6f  |n BREAK depend o|
00002c70  6e 20 74 68 65 20 73 6f  63 6b 65 74 20 69 6e 20  |n the socket in |
00002c80  77 68 69 63 68 0d 79 6f  75 20 70 75 74 20 79 6f  |which.you put yo|
00002c90  75 72 20 44 46 53 20 63  68 69 70 2e 0d 0d 53 65  |ur DFS chip...Se|
00002ca0  72 76 69 63 65 20 63 61  6c 6c 20 34 20 2d 20 61  |rvice call 4 - a|
00002cb0  6e 79 20 2a 63 6f 6d 6d  61 6e 64 20 74 68 61 74  |ny *command that|
00002cc0  20 74 68 65 20 4f 53 20  64 6f 65 73 20 6e 6f 74  | the OS does not|
00002cd0  20 72 65 63 6f 67 6e 69  73 65 0d 69 73 20 6f 66  | recognise.is of|
00002ce0  66 65 72 65 64 20 74 6f  20 74 68 65 20 73 69 64  |fered to the sid|
00002cf0  65 77 61 79 73 20 52 4f  4d 73 20 77 69 74 68 20  |eways ROMs with |
00002d00  74 68 69 73 20 63 61 6c  6c 2e 20 20 45 61 63 68  |this call.  Each|
00002d10  20 52 4f 4d 0d 6c 6f 6f  6b 73 20 61 74 20 74 68  | ROM.looks at th|
00002d20  65 20 63 6f 6d 6d 61 6e  64 2c 20 77 68 69 63 68  |e command, which|
00002d30  20 69 73 20 68 65 6c 64  20 61 74 20 28 26 46 32  | is held at (&F2|
00002d40  29 2c 20 59 20 61 6e 64  0d 74 65 72 6d 69 6e 61  |), Y and.termina|
00002d50  74 65 64 20 77 69 74 68  20 61 20 63 61 72 72 69  |ted with a carri|
00002d60  61 67 65 20 72 65 74 75  72 6e 2c 20 61 6e 64 20  |age return, and |
00002d70  69 66 20 69 74 20 72 65  63 6f 67 6e 69 73 65 73  |if it recognises|
00002d80  20 69 74 0d 74 68 65 6e  20 69 74 20 73 68 6f 75  | it.then it shou|
00002d90  6c 64 20 65 78 65 63 75  74 65 20 74 68 65 20 72  |ld execute the r|
00002da0  65 6c 65 76 61 6e 74 20  63 6f 64 65 20 61 6e 64  |elevant code and|
00002db0  20 63 6c 61 69 6d 20 74  68 65 0d 73 65 72 76 69  | claim the.servi|
00002dc0  63 65 20 63 61 6c 6c 2e  20 20 49 66 20 6e 6f 20  |ce call.  If no |
00002dd0  52 4f 4d 73 20 63 6c 61  69 6d 20 74 68 65 20 63  |ROMs claim the c|
00002de0  61 6c 6c 20 74 68 65 6e  20 74 68 65 20 63 6f 6d  |all then the com|
00002df0  6d 61 6e 64 20 69 73 0d  6f 66 66 65 72 65 64 20  |mand is.offered |
00002e00  74 6f 20 74 68 65 20 63  75 72 72 65 6e 74 20 66  |to the current f|
00002e10  69 6c 69 6e 67 20 73 79  73 74 65 6d 2e 20 20 54  |iling system.  T|
00002e20  68 65 20 44 46 53 2c 20  66 6f 72 20 65 78 61 6d  |he DFS, for exam|
00002e30  70 6c 65 2c 0d 77 69 6c  6c 20 74 68 65 6e 20 74  |ple,.will then t|
00002e40  72 79 20 74 6f 20 2a 52  55 4e 20 61 20 66 69 6c  |ry to *RUN a fil|
00002e50  65 20 6f 66 20 74 68 61  74 20 6e 61 6d 65 2e 0d  |e of that name..|
00002e60  0d 53 65 72 76 69 63 65  20 63 61 6c 6c 20 35 20  |.Service call 5 |
00002e70  6d 65 61 6e 73 20 74 68  61 74 20 61 6e 20 75 6e  |means that an un|
00002e80  6b 6e 6f 77 6e 20 69 6e  74 65 72 72 75 70 74 20  |known interrupt |
00002e90  68 61 73 20 6f 63 63 75  72 72 65 64 2e 20 0d 49  |has occurred. .I|
00002ea0  74 20 77 69 6c 6c 20 62  65 20 6f 66 66 65 72 65  |t will be offere|
00002eb0  64 20 74 6f 20 74 68 65  20 52 4f 4d 53 20 62 65  |d to the ROMS be|
00002ec0  66 6f 72 65 20 62 65 69  6e 67 20 70 61 73 73 65  |fore being passe|
00002ed0  64 20 74 6f 20 74 68 65  0d 55 53 45 52 20 64 6f  |d to the.USER do|
00002ee0  77 6e 20 49 52 51 32 2e  0d 0d 53 65 72 76 69 63  |wn IRQ2...Servic|
00002ef0  65 20 63 61 6c 6c 20 36  20 6d 65 61 6e 73 20 74  |e call 6 means t|
00002f00  68 61 74 20 61 20 42 52  4b 20 28 69 2e 65 2e 20  |hat a BRK (i.e. |
00002f10  61 20 73 6f 66 74 77 61  72 65 20 69 6e 74 65 72  |a software inter|
00002f20  72 75 70 74 2c 0d 61 73  20 64 69 73 74 69 6e 63  |rupt,.as distinc|
00002f30  74 20 66 72 6f 6d 20 70  72 65 73 73 69 6e 67 20  |t from pressing |
00002f40  74 68 65 20 42 52 45 41  4b 20 6b 65 79 29 20 68  |the BREAK key) h|
00002f50  61 73 20 62 65 65 6e 20  64 65 74 65 63 74 65 64  |as been detected|
00002f60  2e 20 0d 49 66 20 61 20  52 4f 4d 20 77 69 73 68  |. .If a ROM wish|
00002f70  65 73 20 74 6f 20 74 61  6b 65 20 61 63 74 69 6f  |es to take actio|
00002f80  6e 20 69 74 20 63 61 6e  2e 20 20 54 68 69 73 20  |n it can.  This |
00002f90  63 61 6c 6c 20 73 68 6f  75 6c 64 20 6e 6f 74 0d  |call should not.|
00002fa0  62 65 20 63 6c 61 69 6d  65 64 2e 0d 0d 53 65 72  |be claimed...Ser|
00002fb0  76 69 63 65 20 63 61 6c  6c 20 37 20 6d 65 61 6e  |vice call 7 mean|
00002fc0  73 20 74 68 61 74 20 61  6e 20 4f 53 42 59 54 45  |s that an OSBYTE|
00002fd0  20 63 61 6c 6c 20 6e 6f  74 20 6b 6e 6f 77 6e 20  | call not known |
00002fe0  74 6f 20 74 68 65 20 4f  53 0d 68 61 73 20 6f 63  |to the OS.has oc|
00002ff0  63 75 72 72 65 64 2e 20  20 54 68 65 20 41 2c 20  |curred.  The A, |
00003000  58 20 61 6e 64 20 59 20  72 65 67 69 73 74 65 72  |X and Y register|
00003010  73 20 6f 66 20 74 68 65  20 63 61 6c 6c 20 63 61  |s of the call ca|
00003020  6e 20 62 65 0d 66 6f 75  6e 64 20 61 74 20 26 45  |n be.found at &E|
00003030  46 2c 20 26 46 30 20 61  6e 64 20 26 46 31 20 72  |F, &F0 and &F1 r|
00003040  65 73 70 65 63 74 69 76  65 6c 79 2e 0d 0d 53 65  |espectively...Se|
00003050  72 76 69 63 65 20 63 61  6c 6c 20 38 20 6d 65 61  |rvice call 8 mea|
00003060  6e 73 20 74 68 61 74 20  61 6e 20 75 6e 6b 6e 6f  |ns that an unkno|
00003070  77 6e 20 4f 53 57 4f 52  44 20 63 61 6c 6c 20 68  |wn OSWORD call h|
00003080  61 73 0d 6f 63 63 75 72  72 65 64 2e 20 20 54 68  |as.occurred.  Th|
00003090  65 20 41 2c 20 58 20 61  6e 64 20 59 20 72 65 67  |e A, X and Y reg|
000030a0  69 73 74 65 72 73 20 6f  66 20 74 68 65 20 63 61  |isters of the ca|
000030b0  6c 6c 20 63 61 6e 20 62  65 20 66 6f 75 6e 64 0d  |ll can be found.|
000030c0  61 74 20 26 45 46 2c 20  26 46 30 20 61 6e 64 20  |at &EF, &F0 and |
000030d0  26 46 31 20 72 65 73 70  65 63 74 69 76 65 6c 79  |&F1 respectively|
000030e0  2e 0d 0d 53 65 72 76 69  63 65 20 63 61 6c 6c 20  |...Service call |
000030f0  39 20 6d 65 61 6e 73 20  74 68 61 74 20 2a 48 45  |9 means that *HE|
00003100  4c 50 20 68 61 73 20 62  65 65 6e 20 64 65 74 65  |LP has been dete|
00003110  63 74 65 64 20 62 79 20  74 68 65 0d 63 6f 6d 6d  |cted by the.comm|
00003120  61 6e 64 20 6c 69 6e 65  20 69 6e 74 65 72 70 72  |and line interpr|
00003130  65 74 65 72 20 61 6e 64  20 52 4f 4d 53 20 63 61  |eter and ROMS ca|
00003140  6e 20 67 69 76 65 20 77  68 61 74 65 76 65 72 20  |n give whatever |
00003150  68 65 6c 70 66 75 6c 0d  6d 65 73 73 61 67 65 73  |helpful.messages|
00003160  20 74 68 65 79 20 70 6f  73 73 65 73 73 2e 20 20  | they possess.  |
00003170  54 68 65 20 70 61 72 74  20 6f 66 20 74 68 65 20  |The part of the |
00003180  2a 48 45 4c 50 20 73 74  72 69 6e 67 20 74 68 61  |*HELP string tha|
00003190  74 0d 66 6f 6c 6c 6f 77  73 20 74 68 65 20 2a 48  |t.follows the *H|
000031a0  45 4c 50 20 6f 72 20 2a  48 2e 20 69 74 73 65 6c  |ELP or *H. itsel|
000031b0  66 20 77 69 6c 6c 20 62  65 20 70 6f 69 6e 74 65  |f will be pointe|
000031c0  64 20 74 6f 20 62 79 20  74 68 65 0d 63 6f 6e 74  |d to by the.cont|
000031d0  65 6e 74 73 20 6f 66 20  26 46 32 20 61 6e 64 20  |ents of &F2 and |
000031e0  26 46 33 20 70 6c 75 73  20 74 68 65 20 63 6f 6e  |&F3 plus the con|
000031f0  74 65 6e 74 73 20 6f 66  20 59 2e 20 20 54 68 69  |tents of Y.  Thi|
00003200  73 20 63 61 6c 6c 0d 73  68 6f 75 6c 64 20 6e 6f  |s call.should no|
00003210  74 20 62 65 20 63 6c 61  69 6d 65 64 20 69 6e 20  |t be claimed in |
00003220  63 61 73 65 20 74 77 6f  20 52 4f 4d 53 20 72 65  |case two ROMS re|
00003230  73 70 6f 6e 64 20 74 6f  20 74 68 65 20 73 61 6d  |spond to the sam|
00003240  65 0d 6b 65 79 77 6f 72  64 2e 0d 0d 53 65 72 76  |e.keyword...Serv|
00003250  69 63 65 20 63 61 6c 6c  20 26 41 20 28 31 30 29  |ice call &A (10)|
00003260  20 69 73 20 69 73 73 75  65 64 20 77 68 65 6e 20  | is issued when |
00003270  61 20 52 4f 4d 20 77 61  6e 74 73 20 74 6f 20 75  |a ROM wants to u|
00003280  73 65 20 74 68 65 0d 73  74 61 74 69 63 20 77 6f  |se the.static wo|
00003290  72 6b 73 70 61 63 65 2e  20 20 49 74 20 73 68 6f  |rkspace.  It sho|
000032a0  75 6c 64 20 69 73 73 75  65 20 74 68 69 73 20 63  |uld issue this c|
000032b0  61 6c 6c 20 74 6f 20 77  61 72 6e 20 6f 74 68 65  |all to warn othe|
000032c0  72 0d 52 4f 4d 73 20 74  6f 20 73 61 76 65 20 74  |r.ROMs to save t|
000032d0  68 65 69 72 20 76 61 6c  75 61 62 6c 65 20 64 61  |heir valuable da|
000032e0  74 61 20 69 6e 20 74 68  65 69 72 20 6f 77 6e 20  |ta in their own |
000032f0  77 6f 72 6b 73 70 61 63  65 2e 0d 0d 53 65 72 76  |workspace...Serv|
00003300  69 63 65 20 63 61 6c 6c  73 20 26 42 20 28 31 31  |ice calls &B (11|
00003310  29 20 61 6e 64 20 26 43  20 28 31 32 29 20 72 65  |) and &C (12) re|
00003320  6c 69 6e 71 75 69 73 68  20 61 6e 64 20 63 6c 61  |linquish and cla|
00003330  69 6d 20 74 68 65 0d 4e  4d 49 20 77 6f 72 6b 73  |im the.NMI works|
00003340  70 61 63 65 2e 0d 0d 53  65 72 76 69 63 65 20 63  |pace...Service c|
00003350  61 6c 6c 73 20 26 44 20  28 31 33 29 20 61 6e 64  |alls &D (13) and|
00003360  20 26 45 20 28 31 34 29  20 72 65 6c 61 74 65 20  | &E (14) relate |
00003370  74 6f 20 74 68 65 20 52  4f 4d 20 66 69 6c 69 6e  |to the ROM filin|
00003380  67 0d 73 79 73 74 65 6d  2c 20 6f 72 20 74 6f 20  |g.system, or to |
00003390  61 20 53 70 65 65 63 68  20 46 69 6c 69 6e 67 20  |a Speech Filing |
000033a0  53 79 73 74 65 6d 2e 0d  0d 53 65 72 76 69 63 65  |System...Service|
000033b0  20 63 61 6c 6c 20 26 46  20 28 31 35 29 20 69 73  | call &F (15) is|
000033c0  20 69 73 73 75 65 64 20  62 79 20 61 20 66 69 6c  | issued by a fil|
000033d0  69 6e 67 20 73 79 73 74  65 6d 20 77 68 65 6e 20  |ing system when |
000033e0  69 74 0d 68 61 73 20 69  6e 69 74 69 61 6c 69 73  |it.has initialis|
000033f0  65 64 20 61 6e 64 20 73  6f 72 74 65 64 20 6f 75  |ed and sorted ou|
00003400  74 20 69 74 73 20 76 65  63 74 6f 72 73 2e 20 20  |t its vectors.  |
00003410  41 6e 79 20 52 4f 4d 53  20 74 68 61 74 0d 77 69  |Any ROMS that.wi|
00003420  73 68 20 74 6f 20 69 6e  74 65 72 63 65 70 74 20  |sh to intercept |
00003430  66 69 6c 69 6e 67 20 73  79 73 74 65 6d 20 76 65  |filing system ve|
00003440  63 74 6f 72 73 20 68 61  76 65 20 74 6f 20 63 68  |ctors have to ch|
00003450  61 6e 67 65 20 74 68 65  69 72 0d 69 6e 74 65 72  |ange their.inter|
00003460  63 65 70 74 73 20 61 66  74 65 72 20 74 68 69 73  |cepts after this|
00003470  20 63 61 6c 6c 2e 0d 0d  53 65 72 76 69 63 65 20  | call...Service |
00003480  63 61 6c 6c 20 26 31 30  20 28 31 36 29 20 6f 63  |call &10 (16) oc|
00003490  63 75 72 73 20 6f 6e 20  61 20 72 65 73 65 74 2c  |curs on a reset,|
000034a0  20 61 6e 64 20 61 6c 73  6f 20 77 68 65 6e 0d 4f  | and also when.O|
000034b0  53 42 59 54 45 20 31 31  39 20 69 73 20 63 61 6c  |SBYTE 119 is cal|
000034c0  6c 65 64 2e 20 20 49 74  20 6d 65 61 6e 73 20 74  |led.  It means t|
000034d0  68 61 74 20 61 6c 6c 20  2a 53 50 4f 4f 4c 20 6f  |hat all *SPOOL o|
000034e0  72 20 2a 45 58 45 43 0d  66 69 6c 65 73 20 73 68  |r *EXEC.files sh|
000034f0  6f 75 6c 64 20 62 65 20  63 6c 6f 73 65 64 2e 0d  |ould be closed..|
00003500  0d 53 65 72 76 69 63 65  20 63 61 6c 6c 20 26 31  |.Service call &1|
00003510  31 20 28 31 37 29 20 69  73 20 75 73 65 64 20 6f  |1 (17) is used o|
00003520  6e 20 74 68 65 20 42 42  43 20 41 2c 20 42 20 61  |n the BBC A, B a|
00003530  6e 64 20 42 2b 20 74 6f  20 77 61 72 6e 0d 6f 66  |nd B+ to warn.of|
00003540  20 61 20 66 6f 6e 74 20  69 6d 70 6c 6f 73 69 6f  | a font implosio|
00003550  6e 20 6f 72 20 65 78 70  6c 6f 73 69 6f 6e 2c 20  |n or explosion, |
00003560  77 68 69 63 68 20 63 6f  75 6c 64 20 61 66 66 65  |which could affe|
00003570  63 74 0d 77 6f 72 6b 73  70 61 63 65 20 6b 65 70  |ct.workspace kep|
00003580  74 20 6a 75 73 74 20 61  62 6f 76 65 20 74 68 65  |t just above the|
00003590  20 6f 70 65 72 61 74 69  6e 67 20 73 79 73 74 65  | operating syste|
000035a0  6d 20 68 69 67 68 20 77  61 74 65 72 0d 6d 61 72  |m high water.mar|
000035b0  6b 2e 20 20 54 68 69 73  20 63 61 6c 6c 20 69 73  |k.  This call is|
000035c0  20 75 6e 75 73 65 64 20  6f 6e 20 61 20 4d 61 73  | unused on a Mas|
000035d0  74 65 72 2e 0d 0d 53 65  72 76 69 63 65 20 63 61  |ter...Service ca|
000035e0  6c 6c 20 26 31 32 20 28  31 38 29 20 69 73 20 75  |ll &12 (18) is u|
000035f0  73 65 64 20 62 79 20 66  69 6c 69 6e 67 20 73 79  |sed by filing sy|
00003600  73 74 65 6d 73 20 66 6f  72 0d 69 6e 69 74 69 61  |stems for.initia|
00003610  6c 69 73 61 74 69 6f 6e  20 69 66 20 66 69 6c 65  |lisation if file|
00003620  73 20 61 72 65 20 62 65  69 6e 67 20 74 72 61 6e  |s are being tran|
00003630  73 66 65 72 72 65 64 20  62 65 74 77 65 65 6e 0d  |sferred between.|
00003640  66 69 6c 69 6e 67 20 73  79 73 74 65 6d 73 2e 0d  |filing systems..|
00003650  0d 53 65 72 76 69 63 65  20 63 61 6c 6c 20 26 31  |.Service call &1|
00003660  35 20 6f 6e 20 61 20 4d  61 73 74 65 72 20 69 73  |5 on a Master is|
00003670  20 61 20 70 6f 6c 6c 69  6e 67 20 63 61 6c 6c 2c  | a polling call,|
00003680  20 6d 61 64 65 20 65 76  65 72 79 0d 63 65 6e 74  | made every.cent|
00003690  69 73 65 63 6f 6e 64 20  69 66 20 74 68 69 73 20  |isecond if this |
000036a0  66 61 63 69 6c 69 74 79  20 69 73 20 65 6e 61 62  |facility is enab|
000036b0  6c 65 64 20 77 69 74 68  20 4f 53 42 59 54 45 20  |led with OSBYTE |
000036c0  32 32 2e 0d 0d 53 65 72  76 69 63 65 20 63 61 6c  |22...Service cal|
000036d0  6c 20 26 32 31 20 6f 6e  20 61 20 4d 61 73 74 65  |l &21 on a Maste|
000036e0  72 20 69 73 20 6c 69 6b  65 20 73 65 72 76 69 63  |r is like servic|
000036f0  65 20 63 61 6c 6c 20 31  20 62 75 74 0d 6f 66 66  |e call 1 but.off|
00003700  65 72 73 20 77 6f 72 6b  73 70 61 63 65 20 69 6e  |ers workspace in|
00003710  20 70 72 69 76 61 74 65  20 66 69 6c 69 6e 67 20  | private filing |
00003720  73 79 73 74 65 6d 20 52  41 4d 2e 20 20 44 69 74  |system RAM.  Dit|
00003730  74 6f 20 66 6f 72 0d 63  61 6c 6c 73 20 26 32 32  |to for.calls &22|
00003740  20 61 6e 64 20 73 65 72  76 69 63 65 20 63 61 6c  | and service cal|
00003750  6c 20 32 2e 20 20 43 61  6c 6c 73 20 26 32 33 20  |l 2.  Calls &23 |
00003760  74 6f 20 26 32 36 20 61  6c 73 6f 20 72 65 6c 61  |to &26 also rela|
00003770  74 65 0d 74 6f 20 66 69  6c 69 6e 67 20 73 79 73  |te.to filing sys|
00003780  74 65 6d 73 20 6f 6e 20  74 68 65 20 4d 61 73 74  |tems on the Mast|
00003790  65 72 2e 0d 0d 54 68 65  20 4d 61 73 74 65 72 20  |er...The Master |
000037a0  64 6f 65 73 20 6e 6f 74  20 6f 66 66 65 72 20 73  |does not offer s|
000037b0  65 72 76 69 63 65 20 63  61 6c 6c 73 20 31 20 61  |ervice calls 1 a|
000037c0  6e 64 20 32 20 6f 6e 20  61 20 73 6f 66 74 0d 72  |nd 2 on a soft.r|
000037d0  65 73 65 74 2c 20 69 6e  73 74 65 61 64 20 69 74  |eset, instead it|
000037e0  20 6f 66 66 65 72 73 20  63 61 6c 6c 20 26 32 37  | offers call &27|
000037f0  2e 20 20 43 61 6c 6c 73  20 26 32 38 20 61 6e 64  |.  Calls &28 and|
00003800  20 26 32 39 20 61 72 65  0d 75 73 65 64 20 6f 6e  | &29 are.used on|
00003810  20 74 68 65 20 4d 61 73  74 65 72 20 66 6f 72 20  | the Master for |
00003820  43 4d 4f 53 20 52 41 4d  20 63 6f 6e 66 69 67 75  |CMOS RAM configu|
00003830  72 61 74 69 6f 6e 20 61  6e 64 20 73 74 61 74 75  |ration and statu|
00003840  73 2e 0d 0d 53 65 72 76  69 63 65 20 63 61 6c 6c  |s...Service call|
00003850  20 26 32 41 20 6f 6e 20  61 20 4d 61 73 74 65 72  | &2A on a Master|
00003860  20 69 6e 66 6f 72 6d 73  20 52 4f 4d 53 20 6f 66  | informs ROMS of|
00003870  20 61 20 63 68 61 6e 67  65 20 6f 66 0d 6c 61 6e  | a change of.lan|
00003880  67 75 61 67 65 2e 0d 0d  53 65 72 76 69 63 65 20  |guage...Service |
00003890  63 61 6c 6c 20 26 32 42  20 69 73 20 61 20 6d 79  |call &2B is a my|
000038a0  73 74 65 72 79 2c 20 69  74 20 69 73 20 64 65 73  |stery, it is des|
000038b0  63 72 69 62 65 64 20 61  73 20 27 72 65 73 65 72  |cribed as 'reser|
000038c0  76 65 64 27 0d 69 6e 20  41 63 6f 72 6e 27 73 20  |ved'.in Acorn's |
000038d0  6c 69 74 65 72 61 74 75  72 65 20 62 75 74 20 6d  |literature but m|
000038e0  79 20 6d 61 63 68 69 6e  65 20 28 61 20 42 20 77  |y machine (a B w|
000038f0  69 74 68 20 31 37 37 30  20 44 46 53 29 0d 73 65  |ith 1770 DFS).se|
00003900  6e 64 73 20 69 74 20 77  68 65 72 65 61 73 20 61  |nds it whereas a|
00003910  20 6e 6f 72 6d 61 6c 20  42 20 28 77 69 74 68 20  | normal B (with |
00003920  38 32 37 31 20 44 46 53  29 20 64 6f 65 73 20 6e  |8271 DFS) does n|
00003930  6f 74 2e 0d 0d 46 69 6e  61 6c 6c 79 20 28 61 74  |ot...Finally (at|
00003940  20 6c 61 73 74 29 20 63  61 6c 6c 73 20 26 46 45  | last) calls &FE|
00003950  20 61 6e 64 20 26 46 46  20 61 72 65 20 73 65 6e  | and &FF are sen|
00003960  74 20 61 74 0d 69 6e 69  74 69 61 6c 69 73 61 74  |t at.initialisat|
00003970  69 6f 6e 20 6f 66 20 74  68 65 20 74 75 62 65 20  |ion of the tube |
00003980  6f 6e 20 61 20 72 65 73  65 74 2e 20 57 69 74 68  |on a reset. With|
00003990  20 61 20 73 65 63 6f 6e  64 0d 70 72 6f 63 65 73  | a second.proces|
000039a0  73 6f 72 20 70 72 65 73  65 6e 74 20 62 6f 74 68  |sor present both|
000039b0  20 61 72 65 20 73 65 6e  74 2c 20 62 75 74 20 6f  | are sent, but o|
000039c0  6e 6c 79 20 74 68 65 20  66 6f 72 6d 65 72 20 69  |nly the former i|
000039d0  66 20 6e 6f 0d 73 65 63  6f 6e 64 20 70 72 6f 63  |f no.second proc|
000039e0  65 73 73 6f 72 20 69 73  20 64 65 74 65 63 74 65  |essor is detecte|
000039f0  64 2e 0d 0d 4f 6e 65 20  6f 66 20 74 68 65 20 74  |d...One of the t|
00003a00  68 69 6e 67 73 20 74 68  61 74 20 74 68 65 20 4f  |hings that the O|
00003a10  53 42 49 54 53 20 52 4f  4d 20 64 6f 65 73 20 69  |SBITS ROM does i|
00003a20  73 20 74 6f 20 70 72 69  6e 74 20 6f 75 74 0d 74  |s to print out.t|
00003a30  68 65 20 73 65 72 76 69  63 65 20 63 61 6c 6c 73  |he service calls|
00003a40  20 61 73 20 74 68 65 79  20 68 61 70 70 65 6e 2e  | as they happen.|
00003a50  20 20 54 68 65 20 63 61  6c 6c 73 20 67 65 6e 65  |  The calls gene|
00003a60  72 61 74 65 64 20 69 6e  20 6d 79 0d 6d 61 63 68  |rated in my.mach|
00003a70  69 6e 65 20 61 72 65 20  61 73 20 66 6f 6c 6c 6f  |ine are as follo|
00003a80  77 73 3a 0d 0d 57 69 74  68 6f 75 74 20 73 65 63  |ws:..Without sec|
00003a90  6f 6e 64 20 70 72 6f 63  65 73 73 6f 72 3a 0d 0d  |ond processor:..|
00003aa0  31 30 20 20 30 46 20 20  30 31 20 20 32 42 20 20  |10  0F  01  2B  |
00003ab0  30 37 20 20 30 37 20 20  30 32 20 20 46 45 20 20  |07  07  02  FE  |
00003ac0  30 33 20 20 31 30 20 20  30 46 20 20 30 41 0d 0d  |03  10  0F  0A..|
00003ad0  57 69 74 68 20 73 65 63  6f 6e 64 20 70 72 6f 63  |With second proc|
00003ae0  65 73 73 6f 72 3a 0d 0d  31 30 20 20 30 46 20 20  |essor:..10  0F  |
00003af0  46 46 20 20 30 31 20 20  32 42 20 20 30 37 20 20  |FF  01  2B  07  |
00003b00  30 37 20 20 30 32 20 20  46 45 20 20 31 31 20 20  |07  02  FE  11  |
00003b10  30 33 20 20 31 30 20 20  30 46 20 20 30 41 0d 0d  |03  10  0F  0A..|
00003b20  44 6f 6e 27 74 20 77 6f  72 72 79 20 69 66 20 79  |Don't worry if y|
00003b30  6f 75 20 64 6f 6e 27 74  20 75 6e 64 65 72 73 74  |ou don't underst|
00003b40  61 6e 64 20 61 6c 6c 20  74 68 6f 73 65 20 73 65  |and all those se|
00003b50  72 76 69 63 65 20 63 61  6c 6c 73 2e 20 0d 49 20  |rvice calls. .I |
00003b60  63 65 72 74 61 69 6e 6c  79 20 64 6f 6e 27 74 20  |certainly don't |
00003b70  75 6e 64 65 72 73 74 61  6e 64 20 61 6e 79 20 6f  |understand any o|
00003b80  66 20 74 68 65 20 6f 6e  65 73 20 72 65 6c 61 74  |f the ones relat|
00003b90  69 6e 67 20 74 6f 0d 66  69 6c 69 6e 67 20 73 79  |ing to.filing sy|
00003ba0  73 74 65 6d 73 2c 20 74  68 65 79 20 77 65 72 65  |stems, they were|
00003bb0  20 6e 65 76 65 72 20 6d  79 20 73 74 72 6f 6e 67  | never my strong|
00003bc0  20 73 75 69 74 2e 20 20  54 68 65 20 6d 61 69 6e  | suit.  The main|
00003bd0  0d 74 68 69 6e 67 20 69  73 20 74 6f 20 75 6e 64  |.thing is to und|
00003be0  65 72 73 74 61 6e 64 20  74 68 65 20 66 65 77 20  |erstand the few |
00003bf0  79 6f 75 20 61 72 65 20  6c 69 6b 65 6c 79 20 74  |you are likely t|
00003c00  6f 20 75 73 65 20 69 66  20 79 6f 75 0d 77 72 69  |o use if you.wri|
00003c10  74 65 20 61 20 52 4f 4d  2e 20 20 54 68 65 73 65  |te a ROM.  These|
00003c20  20 77 69 6c 6c 20 62 65  20 6d 61 69 6e 6c 79 20  | will be mainly |
00003c30  6e 75 6d 62 65 72 73 20  32 2c 20 33 2c 20 34 20  |numbers 2, 3, 4 |
00003c40  61 6e 64 20 39 2e 0d 0d  4c 61 6e 67 75 61 67 65  |and 9...Language|
00003c50  20 65 6e 74 72 79 20 69  73 20 6d 75 63 68 20 73  | entry is much s|
00003c60  69 6d 70 6c 65 72 2e 20  20 49 66 2c 20 74 68 72  |impler.  If, thr|
00003c70  6f 75 67 68 20 73 65 72  76 69 63 65 20 63 61 6c  |ough service cal|
00003c80  6c 20 34 2c 0d 61 20 52  4f 4d 20 64 65 74 65 63  |l 4,.a ROM detec|
00003c90  74 73 20 69 74 73 20 6f  77 6e 20 6c 61 6e 67 75  |ts its own langu|
00003ca0  61 67 65 20 6e 61 6d 65  20 74 68 65 6e 20 69 74  |age name then it|
00003cb0  20 73 69 6d 70 6c 79 20  63 61 6c 6c 73 0d 4f 53  | simply calls.OS|
00003cc0  42 59 54 45 20 31 34 32  20 77 69 74 68 20 69 74  |BYTE 142 with it|
00003cd0  73 20 52 4f 4d 20 6e 75  6d 62 65 72 20 69 6e 20  |s ROM number in |
00003ce0  74 68 65 20 58 20 72 65  67 69 73 74 65 72 2e 20  |the X register. |
00003cf0  20 54 68 65 20 4f 53 0d  77 69 6c 6c 20 74 68 65  | The OS.will the|
00003d00  6e 20 65 6e 74 65 72 20  74 68 65 20 6c 61 6e 67  |n enter the lang|
00003d10  75 61 67 65 20 74 68 72  6f 75 67 68 20 74 68 65  |uage through the|
00003d20  20 6c 61 6e 67 75 61 67  65 20 65 6e 74 72 79 0d  | language entry.|
00003d30  70 6f 69 6e 74 20 61 6e  64 20 6f 66 66 20 79 6f  |point and off yo|
00003d40  75 20 67 6f 2e 20 20 54  68 65 20 4f 53 20 64 6f  |u go.  The OS do|
00003d50  65 73 20 6e 6f 74 20 65  78 70 65 63 74 20 61 20  |es not expect a |
00003d60  72 65 74 75 72 6e 20 66  72 6f 6d 0d 61 20 6c 61  |return from.a la|
00003d70  6e 67 75 61 67 65 2e 0d  0d 54 68 65 20 52 4f 4d  |nguage...The ROM|
00003d80  20 61 73 73 65 6d 62 6c  79 20 63 6f 64 65 20 69  | assembly code i|
00003d90  6e 20 42 2f 6f 73 62 32  34 20 69 73 20 69 6e 74  |n B/osb24 is int|
00003da0  65 6e 64 65 64 20 74 6f  20 67 69 76 65 20 79 6f  |ended to give yo|
00003db0  75 0d 73 6f 6d 65 20 69  64 65 61 20 6f 66 20 68  |u.some idea of h|
00003dc0  6f 77 20 74 6f 20 77 72  69 74 65 20 66 6f 72 20  |ow to write for |
00003dd0  61 20 73 65 72 76 69 63  65 20 52 4f 4d 2e 20 20  |a service ROM.  |
00003de0  49 20 64 6f 6e 27 74 20  69 6e 74 65 6e 64 0d 69  |I don't intend.i|
00003df0  74 20 74 6f 20 62 65 20  64 65 66 69 6e 69 74 69  |t to be definiti|
00003e00  76 65 20 61 6e 64 20 74  68 65 72 65 20 61 72 65  |ve and there are|
00003e10  20 73 6f 6d 65 20 67 6f  6f 64 20 62 6f 6f 6b 73  | some good books|
00003e20  20 61 72 6f 75 6e 64 20  61 6e 64 0d 6d 61 6e 79  | around and.many|
00003e30  20 6d 61 67 61 7a 69 6e  65 20 61 72 74 69 63 6c  | magazine articl|
00003e40  65 73 2e 20 20 53 69 64  65 77 61 79 73 20 52 4f  |es.  Sideways RO|
00003e50  4d 73 20 61 72 65 20 61  20 73 74 75 64 79 20 69  |Ms are a study i|
00003e60  6e 0d 74 68 65 6d 73 65  6c 76 65 73 2e 0d 0d 49  |n.themselves...I|
00003e70  20 74 68 69 6e 6b 20 74  68 65 20 62 65 73 74 20  | think the best |
00003e80  77 61 79 20 74 6f 20 70  72 6f 63 65 65 64 20 69  |way to proceed i|
00003e90  73 20 66 6f 72 20 6d 65  20 74 6f 20 77 61 6c 6b  |s for me to walk|
00003ea0  20 79 6f 75 0d 74 68 72  6f 75 67 68 20 74 68 65  | you.through the|
00003eb0  20 70 72 6f 67 72 61 6d  20 69 6e 20 74 68 69 73  | program in this|
00003ec0  20 6d 6f 64 75 6c 65 2c  20 73 65 63 74 69 6f 6e  | module, section|
00003ed0  20 62 79 20 73 65 63 74  69 6f 6e 2c 20 77 69 74  | by section, wit|
00003ee0  68 0d 61 6e 20 65 78 70  6c 61 6e 61 74 69 6f 6e  |h.an explanation|
00003ef0  20 6f 66 20 77 68 61 74  20 69 73 20 68 61 70 70  | of what is happ|
00003f00  65 6e 69 6e 67 2e 20 20  54 68 65 6e 20 49 20 68  |ening.  Then I h|
00003f10  6f 70 65 20 79 6f 75 20  77 69 6c 6c 0d 66 65 65  |ope you will.fee|
00003f20  6c 20 75 70 20 74 6f 20  73 6f 6d 65 20 65 78 70  |l up to some exp|
00003f30  65 72 69 6d 65 6e 74 69  6e 67 2e 20 20 42 75 74  |erimenting.  But|
00003f40  20 66 69 72 73 74 20 61  20 63 61 76 65 61 74 20  | first a caveat |
00003f50  2e 2e 2e 2e 0d 0d 42 2f  6f 73 62 32 34 20 77 69  |......B/osb24 wi|
00003f60  6c 6c 20 6e 6f 74 20 72  75 6e 20 77 69 74 68 20  |ll not run with |
00003f70  42 41 53 49 43 20 31 2e  20 20 49 20 6d 61 64 65  |BASIC 1.  I made|
00003f80  20 74 68 61 74 20 64 65  63 69 73 69 6f 6e 0d 70  | that decision.p|
00003f90  61 72 74 6c 79 20 62 65  63 61 75 73 65 20 6f 66  |artly because of|
00003fa0  20 74 68 65 20 6c 61 63  6b 20 6f 66 20 45 51 55  | the lack of EQU|
00003fb0  20 66 75 6e 63 74 69 6f  6e 73 20 28 61 6c 74 68  | functions (alth|
00003fc0  6f 75 67 68 20 74 68 65  73 65 0d 63 61 6e 20 62  |ough these.can b|
00003fd0  65 20 73 69 6d 75 6c 61  74 65 64 20 61 73 20 79  |e simulated as y|
00003fe0  6f 75 20 77 65 6c 6c 20  6b 6e 6f 77 29 2e 20 20  |ou well know).  |
00003ff0  4d 6f 72 65 20 69 6d 70  6f 72 74 61 6e 74 6c 79  |More importantly|
00004000  2c 20 69 74 20 69 73 0d  61 6c 6d 6f 73 74 20 69  |, it is.almost i|
00004010  6d 70 6f 73 73 69 62 6c  65 2c 20 61 6e 64 20 6e  |mpossible, and n|
00004020  6f 74 20 72 65 63 6f 6d  6d 65 6e 64 65 64 2c 20  |ot recommended, |
00004030  74 6f 20 61 73 73 65 6d  62 6c 65 20 63 6f 64 65  |to assemble code|
00004040  0d 64 69 72 65 63 74 6c  79 20 69 6e 74 6f 20 73  |.directly into s|
00004050  69 64 65 77 61 79 73 20  52 41 4d 2c 20 70 61 72  |ideways RAM, par|
00004060  74 69 63 75 6c 61 72 6c  79 20 69 66 20 74 68 65  |ticularly if the|
00004070  20 52 41 4d 20 69 73 20  69 6e 0d 73 6f 63 6b 65  | RAM is in.socke|
00004080  74 20 31 35 2e 20 20 41  6e 79 20 66 61 75 6c 74  |t 15.  Any fault|
00004090  73 20 61 6e 64 20 79 6f  75 72 20 6d 61 63 68 69  |s and your machi|
000040a0  6e 65 20 77 69 6c 6c 20  6c 6f 63 6b 20 6f 75 74  |ne will lock out|
000040b0  20 61 6e 64 0d 79 6f 75  20 77 69 6c 6c 20 68 61  | and.you will ha|
000040c0  76 65 20 74 6f 20 73 77  69 74 63 68 20 69 74 20  |ve to switch it |
000040d0  6f 66 66 20 74 6f 20 63  75 72 65 20 74 68 65 20  |off to cure the |
000040e0  66 61 75 6c 74 2c 20 6c  6f 73 69 6e 67 20 61 6c  |fault, losing al|
000040f0  6c 0d 79 6f 75 72 20 63  6f 64 65 2e 20 20 42 79  |l.your code.  By|
00004100  20 66 61 72 20 74 68 65  20 62 65 73 74 20 77 61  | far the best wa|
00004110  79 20 69 73 20 74 6f 20  67 65 6e 65 72 61 74 65  |y is to generate|
00004120  20 74 68 65 20 61 73 73  65 6d 62 6c 65 64 0d 63  | the assembled.c|
00004130  6f 64 65 20 74 6f 20 72  75 6e 20 69 6e 20 74 68  |ode to run in th|
00004140  65 20 72 65 71 75 69 72  65 64 20 73 70 61 63 65  |e required space|
00004150  20 62 75 74 20 74 6f 20  62 65 20 61 73 73 65 6d  | but to be assem|
00004160  62 6c 65 64 20 69 6e 0d  61 6e 6f 74 68 65 72 20  |bled in.another |
00004170  70 61 72 74 20 6f 66 20  74 68 65 20 6d 65 6d 6f  |part of the memo|
00004180  72 79 2e 20 20 49 6e 20  42 41 53 49 43 20 32 20  |ry.  In BASIC 2 |
00004190  65 74 20 61 6c 20 79 6f  75 20 63 61 6e 20 64 6f  |et al you can do|
000041a0  0d 74 68 69 73 20 62 79  20 75 73 69 6e 67 20 76  |.this by using v|
000041b0  61 6c 75 65 73 20 6f 66  20 4f 50 54 20 66 72 6f  |alues of OPT fro|
000041c0  6d 20 34 20 74 6f 20 37  20 69 6e 73 74 65 61 64  |m 4 to 7 instead|
000041d0  20 6f 66 20 30 20 74 6f  20 33 2e 20 0d 4c 69 6e  | of 0 to 3. .Lin|
000041e0  65 20 33 31 30 20 6f 66  20 74 68 69 73 20 70 72  |e 310 of this pr|
000041f0  6f 67 72 61 6d 20 73 68  6f 77 73 20 74 68 69 73  |ogram shows this|
00004200  2e 0d 0d 59 6f 75 20 77  69 6c 6c 20 74 68 65 6e  |...You will then|
00004210  20 68 61 76 65 20 61 20  70 72 6f 67 72 61 6d 20  | have a program |
00004220  79 6f 75 20 63 61 6e 20  73 61 76 65 20 74 6f 20  |you can save to |
00004230  64 69 73 63 20 66 72 6f  6d 20 77 68 69 63 68 0d  |disc from which.|
00004240  79 6f 75 20 63 61 6e 20  6c 6f 61 64 20 69 6e 74  |you can load int|
00004250  6f 20 73 69 64 65 77 61  79 73 20 52 41 4d 20 6f  |o sideways RAM o|
00004260  72 2c 20 69 66 20 79 6f  75 20 68 61 76 65 20 74  |r, if you have t|
00004270  68 65 0d 74 65 63 68 6e  6f 6c 6f 67 79 2c 20 62  |he.technology, b|
00004280  6c 6f 77 20 79 6f 75 72  73 65 6c 66 20 61 6e 20  |low yourself an |
00004290  45 50 52 4f 4d 2e 20 20  4d 79 20 6d 61 63 68 69  |EPROM.  My machi|
000042a0  6e 65 0d 63 6f 6e 66 69  67 75 72 61 74 69 6f 6e  |ne.configuration|
000042b0  20 68 61 73 20 31 36 4b  20 6f 66 20 52 41 4d 20  | has 16K of RAM |
000042c0  69 6e 20 52 4f 4d 20 73  6f 63 6b 65 74 20 31 35  |in ROM socket 15|
000042d0  20 61 73 20 70 61 72 74  20 6f 66 20 6d 79 0d 52  | as part of my.R|
000042e0  4f 4d 20 65 78 74 65 6e  73 69 6f 6e 20 62 6f 61  |OM extension boa|
000042f0  72 64 20 61 6e 64 20 49  20 63 61 6e 20 73 69 6d  |rd and I can sim|
00004300  70 6c 65 20 2a 4c 4f 41  44 20 69 6e 74 6f 20 74  |ple *LOAD into t|
00004310  68 61 74 20 6d 65 6d 6f  72 79 2e 20 0d 49 66 20  |hat memory. .If |
00004320  79 6f 75 20 68 61 76 65  20 61 20 42 2b 20 6f 72  |you have a B+ or|
00004330  20 61 20 4d 61 73 74 65  72 20 79 6f 75 20 77 69  | a Master you wi|
00004340  6c 6c 20 70 72 6f 62 61  62 6c 79 20 68 61 76 65  |ll probably have|
00004350  20 73 69 64 65 77 61 79  73 0d 52 41 4d 20 62 75  | sideways.RAM bu|
00004360  69 6c 74 20 69 6e 20 61  6e 64 20 75 73 65 20 2a  |ilt in and use *|
00004370  53 52 4c 4f 41 44 20 74  6f 20 6c 6f 61 64 20 69  |SRLOAD to load i|
00004380  6e 74 6f 20 69 74 2e 0d  0d 49 66 20 79 6f 75 20  |nto it...If you |
00004390  72 65 61 6c 6c 79 20 77  61 6e 74 20 74 6f 20 61  |really want to a|
000043a0  73 73 65 6d 62 6c 65 20  64 69 72 65 63 74 20 69  |ssemble direct i|
000043b0  6e 74 6f 20 73 69 64 65  77 61 79 73 20 52 41 4d  |nto sideways RAM|
000043c0  20 74 68 65 6e 0d 79 6f  75 20 73 68 6f 75 6c 64  | then.you should|
000043d0  20 63 68 61 6e 67 65 20  6c 69 6e 65 20 33 31 30  | change line 310|
000043e0  20 74 6f 20 72 65 61 64  0d 0d 20 20 20 20 20 46  | to read..     F|
000043f0  4f 52 20 70 61 73 73 25  20 3d 20 30 20 54 4f 20  |OR pass% = 0 TO |
00004400  32 20 53 54 45 50 20 32  0d 0d 61 6e 64 20 74 68  |2 STEP 2..and th|
00004410  65 20 63 6f 64 65 20 77  69 6c 6c 20 62 65 20 70  |e code will be p|
00004420  75 74 20 64 69 72 65 63  74 6c 79 20 69 6e 74 6f  |ut directly into|
00004430  20 6d 65 6d 6f 72 79 20  61 74 20 26 38 30 30 30  | memory at &8000|
00004440  2e 20 0d 28 54 68 69 73  20 77 69 6c 6c 20 6e 6f  |. .(This will no|
00004450  74 20 77 6f 72 6b 20 6f  6e 20 61 20 4d 61 73 74  |t work on a Mast|
00004460  65 72 20 6f 72 20 42 2b  31 32 38 2e 29 20 20 42  |er or B+128.)  B|
00004470  75 74 20 62 65 61 72 20  69 6e 20 6d 69 6e 64 0d  |ut bear in mind.|
00004480  74 68 65 20 70 6f 73 73  69 62 6c 65 20 70 72 6f  |the possible pro|
00004490  62 6c 65 6d 73 20 69 66  20 79 6f 75 20 73 68 6f  |blems if you sho|
000044a0  75 6c 64 20 61 62 6f 72  74 20 74 68 65 20 61 73  |uld abort the as|
000044b0  73 65 6d 62 6c 79 2e 20  20 54 68 65 0d 73 65 72  |sembly.  The.ser|
000044c0  76 69 63 65 20 63 61 6c  6c 20 4a 55 4d 50 20 69  |vice call JUMP i|
000044d0  6e 73 74 72 75 63 74 69  6f 6e 20 61 74 20 74 68  |nstruction at th|
000044e0  65 20 73 74 61 72 74 20  6f 66 20 79 6f 75 72 20  |e start of your |
000044f0  52 4f 4d 20 69 6d 61 67  65 0d 63 6f 64 65 20 6d  |ROM image.code m|
00004500  69 67 68 74 20 65 6e 64  20 75 70 20 70 6f 69 6e  |ight end up poin|
00004510  74 69 6e 67 20 74 6f 20  73 6f 6d 65 20 73 70 75  |ting to some spu|
00004520  72 69 6f 75 73 20 52 41  4d 20 61 6e 64 20 79 6f  |rious RAM and yo|
00004530  75 72 0d 6d 61 63 68 69  6e 65 20 77 69 6c 6c 20  |ur.machine will |
00004540  63 72 61 73 68 2e 20 20  42 65 63 61 75 73 65 20  |crash.  Because |
00004550  74 68 65 20 52 41 4d 20  68 61 73 20 68 69 67 68  |the RAM has high|
00004560  65 73 74 20 70 72 69 6f  72 69 74 79 20 69 66 0d  |est priority if.|
00004570  69 74 20 69 73 20 69 6e  20 73 6f 63 6b 65 74 20  |it is in socket |
00004580  31 35 20 65 76 65 6e 20  61 20 43 4f 4e 54 52 4f  |15 even a CONTRO|
00004590  4c 2f 42 52 45 41 4b 20  77 69 6c 6c 20 6e 6f 74  |L/BREAK will not|
000045a0  20 68 65 6c 70 2c 20 79  6f 75 0d 77 69 6c 6c 20  | help, you.will |
000045b0  68 61 76 65 20 74 6f 20  73 77 69 74 63 68 20 6f  |have to switch o|
000045c0  66 66 2e 0d 0d 41 6e 64  20 73 6f 20 74 6f 20 74  |ff...And so to t|
000045d0  68 65 20 70 72 6f 67 72  61 6d 2e 0d 0d 53 79 73  |he program...Sys|
000045e0  74 65 6d 20 76 61 72 69  61 62 6c 65 73 20 61 72  |tem variables ar|
000045f0  65 20 73 65 74 20 69 6e  20 74 68 65 20 66 69 72  |e set in the fir|
00004600  73 74 20 66 65 77 20 6c  69 6e 65 73 2e 20 20 49  |st few lines.  I|
00004610  20 68 61 76 65 0d 61 6c  6c 6f 63 61 74 65 64 20  | have.allocated |
00004620  73 6f 6d 65 20 77 6f 72  6b 73 70 61 63 65 20 69  |some workspace i|
00004630  6e 20 7a 65 72 6f 20 70  61 67 65 20 73 74 61 72  |n zero page star|
00004640  74 69 6e 67 20 61 74 20  26 41 38 2e 20 20 54 68  |ting at &A8.  Th|
00004650  69 73 0d 6d 65 6d 6f 72  79 20 69 73 20 72 65 73  |is.memory is res|
00004660  65 72 76 65 64 20 66 6f  72 20 4f 53 20 63 6f 6d  |erved for OS com|
00004670  6d 61 6e 64 73 20 64 75  72 69 6e 67 20 65 78 65  |mands during exe|
00004680  63 75 74 69 6f 6e 2c 20  62 75 74 20 49 0d 61 6d  |cution, but I.am|
00004690  20 73 74 69 6c 6c 20 70  72 65 73 65 72 76 69 6e  | still preservin|
000046a0  67 20 74 68 65 20 63 6f  6e 74 65 6e 74 73 20 6f  |g the contents o|
000046b0  66 20 74 68 65 73 65 20  6c 6f 63 61 74 69 6f 6e  |f these location|
000046c0  73 20 61 73 20 49 20 75  73 65 0d 74 68 65 6d 2e  |s as I use.them.|
000046d0  20 20 41 74 20 6c 65 61  73 74 20 79 6f 75 20 73  |  At least you s|
000046e0  68 6f 75 6c 64 6e 27 74  20 66 69 6e 64 20 73 6f  |houldn't find so|
000046f0  6d 65 62 6f 64 79 20 70  75 74 74 69 6e 67 20 74  |mebody putting t|
00004700  68 65 69 72 0d 69 6e 74  65 72 72 75 70 74 20 63  |heir.interrupt c|
00004710  6f 64 65 20 68 65 72 65  2e 0d 0d 49 20 68 61 76  |ode here...I hav|
00004720  65 20 64 65 66 69 6e 65  64 20 6d 6f 72 65 20 4f  |e defined more O|
00004730  53 20 72 6f 75 74 69 6e  65 20 61 64 64 72 65 73  |S routine addres|
00004740  73 65 73 20 74 68 61 6e  20 49 20 68 61 76 65 20  |ses than I have |
00004750  75 73 65 64 20 74 6f 0d  68 65 6c 70 20 79 6f 75  |used to.help you|
00004760  20 69 66 20 79 6f 75 20  61 64 64 20 61 6e 79 20  | if you add any |
00004770  63 6f 64 65 20 6f 66 20  79 6f 75 72 20 6f 77 6e  |code of your own|
00004780  20 74 6f 20 74 68 69 73  20 68 65 72 65 2e 0d 0d  | to this here...|
00004790  41 66 74 65 72 20 74 68  65 20 52 4f 4d 20 68 65  |After the ROM he|
000047a0  61 64 65 72 2c 20 77 68  69 63 68 20 49 20 65 78  |ader, which I ex|
000047b0  70 6c 61 69 6e 65 64 20  65 61 72 6c 69 65 72 2c  |plained earlier,|
000047c0  20 69 73 20 74 68 65 0d  73 65 72 76 69 63 65 20  | is the.service |
000047d0  65 6e 74 72 79 20 70 6f  69 6e 74 2e 20 20 4e 6f  |entry point.  No|
000047e0  77 20 73 69 6e 63 65 20  49 20 77 61 6e 74 20 74  |w since I want t|
000047f0  68 69 73 20 52 4f 4d 20  74 6f 20 64 69 73 70 6c  |his ROM to displ|
00004800  61 79 0d 74 68 65 20 73  65 72 76 69 63 65 20 63  |ay.the service c|
00004810  61 6c 6c 73 20 69 74 20  72 65 63 65 69 76 65 73  |alls it receives|
00004820  20 74 68 65 20 66 69 72  73 74 20 74 68 69 6e 67  | the first thing|
00004830  20 74 68 61 74 20 68 61  70 70 65 6e 73 0d 69 73  | that happens.is|
00004840  20 61 20 4a 53 52 20 74  6f 20 61 20 73 75 62 72  | a JSR to a subr|
00004850  6f 75 74 69 6e 65 20 63  61 6c 6c 65 64 20 27 73  |outine called 's|
00004860  68 6f 77 5f 73 65 72 76  69 63 65 5f 63 61 6c 6c  |how_service_call|
00004870  73 27 2e 20 20 54 68 69  73 0d 69 73 20 61 74 20  |s'.  This.is at |
00004880  6c 69 6e 65 20 33 34 30  30 20 69 6e 20 74 68 65  |line 3400 in the|
00004890  20 6c 69 73 74 69 6e 67  2e 0d 0d 49 20 61 6d 20  | listing...I am |
000048a0  75 73 69 6e 67 20 61 20  62 79 74 65 20 6f 66 20  |using a byte of |
000048b0  74 68 65 20 4f 53 20 77  6f 72 6b 73 70 61 63 65  |the OS workspace|
000048c0  20 74 68 61 74 20 69 73  20 75 6e 75 73 65 64 20  | that is unused |
000048d0  62 79 20 74 68 65 0d 4f  53 20 6f 6e 20 61 20 42  |by the.OS on a B|
000048e0  20 61 6c 74 68 6f 75 67  68 20 74 68 65 72 65 20  | although there |
000048f0  69 73 20 61 20 4f 53 42  59 54 45 20 63 61 6c 6c  |is a OSBYTE call|
00004900  20 74 6f 20 61 63 63 65  73 73 20 69 74 2e 20 20  | to access it.  |
00004910  49 74 0d 69 73 20 61 74  20 26 32 38 41 20 61 6e  |It.is at &28A an|
00004920  64 20 69 73 20 68 65 6c  64 20 61 73 20 61 20 76  |d is held as a v|
00004930  61 72 69 61 62 6c 65 20  63 61 6c 6c 65 64 20 27  |ariable called '|
00004940  73 65 72 76 69 63 65 5f  66 6c 61 67 27 0d 64 65  |service_flag'.de|
00004950  66 69 6e 65 64 20 69 6e  20 6c 69 6e 65 20 32 35  |fined in line 25|
00004960  30 2e 20 20 49 66 20 74  68 69 73 20 66 6c 61 67  |0.  If this flag|
00004970  20 69 73 20 73 65 74 20  28 61 6e 79 74 68 69 6e  | is set (anythin|
00004980  67 20 6f 74 68 65 72 0d  74 68 61 6e 20 7a 65 72  |g other.than zer|
00004990  6f 29 20 74 68 65 6e 20  74 68 65 20 76 61 6c 75  |o) then the valu|
000049a0  65 73 20 69 6e 20 74 68  65 20 61 63 63 75 6d 75  |es in the accumu|
000049b0  6c 61 74 6f 72 20 61 6e  64 20 69 6e 20 58 20 61  |lator and in X a|
000049c0  6e 64 20 59 0d 61 72 65  20 70 72 69 6e 74 65 64  |nd Y.are printed|
000049d0  20 6f 75 74 20 69 6e 20  68 65 78 20 61 73 20 74  | out in hex as t|
000049e0  68 65 79 20 67 6f 20 74  68 72 6f 75 67 68 20 74  |hey go through t|
000049f0  68 65 20 52 4f 4d 2e 20  20 49 66 20 74 68 65 0d  |he ROM.  If the.|
00004a00  66 6c 61 67 20 69 73 20  63 6c 65 61 72 20 28 7a  |flag is clear (z|
00004a10  65 72 6f 29 20 74 68 65  79 20 61 72 65 20 6e 6f  |ero) they are no|
00004a20  74 2e 20 20 54 68 65 20  64 65 66 61 75 6c 74 20  |t.  The default |
00004a30  76 61 6c 75 65 20 6f 66  20 74 68 65 0d 66 6c 61  |value of the.fla|
00004a40  67 20 69 73 20 7a 65 72  6f 20 61 6e 64 20 69 74  |g is zero and it|
00004a50  20 63 61 6e 20 62 65 20  73 65 74 20 62 79 20 65  | can be set by e|
00004a60  6e 74 65 72 69 6e 67 20  2a 46 58 20 32 35 30 2c  |ntering *FX 250,|
00004a70  31 2e 20 20 54 68 65 0d  52 4f 4d 20 70 72 6f 76  |1.  The.ROM prov|
00004a80  69 64 65 73 20 61 20 63  6c 65 61 72 65 72 20 77  |ides a clearer w|
00004a90  61 79 2c 20 77 68 69 63  68 20 49 27 6c 6c 20 63  |ay, which I'll c|
00004aa0  6f 6d 65 20 6f 6e 20 74  6f 20 77 68 65 6e 20 49  |ome on to when I|
00004ab0  0d 74 61 6c 6b 20 61 62  6f 75 74 20 74 68 65 20  |.talk about the |
00004ac0  62 75 69 6c 74 2d 69 6e  20 63 6f 6d 6d 61 6e 64  |built-in command|
00004ad0  73 2e 20 20 49 20 74 68  69 6e 6b 20 74 68 65 20  |s.  I think the |
00004ae0  73 75 62 72 6f 75 74 69  6e 65 20 69 73 0d 73 65  |subroutine is.se|
00004af0  6c 66 2d 65 78 70 6c 61  6e 61 74 6f 72 79 2c 20  |lf-explanatory, |
00004b00  62 75 74 20 6e 6f 74 65  20 74 68 61 74 20 69 74  |but note that it|
00004b10  20 69 73 20 69 6d 70 6f  72 74 61 6e 74 20 74 6f  | is important to|
00004b20  20 62 61 6c 61 6e 63 65  0d 74 68 65 20 70 75 73  | balance.the pus|
00004b30  68 65 73 20 74 6f 20 61  6e 64 20 70 75 6c 6c 73  |hes to and pulls|
00004b40  20 66 72 6f 6d 20 74 68  65 20 73 74 61 63 6b 2c  | from the stack,|
00004b50  20 77 68 69 63 68 20 69  73 20 77 68 79 20 74 68  | which is why th|
00004b60  65 72 65 0d 69 73 20 61  20 50 4c 41 20 61 6e 64  |ere.is a PLA and|
00004b70  20 61 20 50 48 41 20 74  6f 67 65 74 68 65 72 20  | a PHA together |
00004b80  69 6e 20 6c 69 6e 65 73  20 33 34 36 30 20 61 6e  |in lines 3460 an|
00004b90  64 20 33 34 37 30 2e 0d  0d 41 66 74 65 72 20 67  |d 3470...After g|
00004ba0  6f 69 6e 67 20 74 68 72  6f 75 67 68 20 74 68 65  |oing through the|
00004bb0  20 73 65 72 76 69 63 65  20 63 61 6c 6c 20 72 6f  | service call ro|
00004bc0  75 74 69 6e 65 20 74 68  65 20 52 4f 4d 20 63 68  |utine the ROM ch|
00004bd0  65 63 6b 73 0d 74 6f 20  73 65 65 20 77 68 69 63  |ecks.to see whic|
00004be0  68 20 63 61 6c 6c 20 69  74 20 69 73 2c 20 61 6e  |h call it is, an|
00004bf0  64 20 74 6f 20 72 65 73  70 6f 6e 64 20 61 63 63  |d to respond acc|
00004c00  6f 72 64 69 6e 67 6c 79  2e 20 20 54 68 69 73 0d  |ordingly.  This.|
00004c10  52 4f 4d 20 72 65 73 70  6f 6e 64 73 20 74 6f 20  |ROM responds to |
00004c20  63 61 6c 6c 73 20 32 20  28 61 6c 74 68 6f 75 67  |calls 2 (althoug|
00004c30  68 20 49 20 68 61 76 65  20 64 69 73 61 62 6c 65  |h I have disable|
00004c40  64 20 74 68 61 74 0d 73  65 63 74 69 6f 6e 20 6f  |d that.section o|
00004c50  66 20 74 68 65 20 61 73  73 65 6d 62 6c 65 72 20  |f the assembler |
00004c60  77 69 74 68 20 63 6f 6d  6d 65 6e 74 73 29 2c 20  |with comments), |
00004c70  33 2c 20 34 20 61 6e 64  20 39 2e 0d 0d 43 61 6c  |3, 4 and 9...Cal|
00004c80  6c 20 32 20 61 6c 6c 6f  77 73 20 79 6f 75 20 74  |l 2 allows you t|
00004c90  6f 20 72 65 73 65 72 76  65 20 70 72 69 76 61 74  |o reserve privat|
00004ca0  65 20 64 79 6e 61 6d 69  63 20 77 6f 72 6b 73 70  |e dynamic worksp|
00004cb0  61 63 65 2e 20 0d 54 68  69 73 20 69 73 20 77 68  |ace. .This is wh|
00004cc0  79 20 52 4f 4d 73 20 73  6f 6d 65 74 69 6d 65 73  |y ROMs sometimes|
00004cd0  20 72 61 69 73 65 20 74  68 65 20 76 61 6c 75 65  | raise the value|
00004ce0  20 6f 66 20 50 41 47 45  2e 20 20 49 6e 20 74 68  | of PAGE.  In th|
00004cf0  69 73 0d 70 61 72 74 69  63 75 6c 61 72 20 63 61  |is.particular ca|
00004d00  73 65 20 49 20 68 61 76  65 20 62 6c 6f 63 6b 65  |se I have blocke|
00004d10  64 20 6f 66 66 20 74 68  65 20 72 65 6c 65 76 61  |d off the releva|
00004d20  6e 74 20 62 69 74 73 20  6f 66 20 74 68 65 0d 61  |nt bits of the.a|
00004d30  73 73 65 6d 62 6c 79 20  63 6f 64 65 20 75 73 69  |ssembly code usi|
00004d40  6e 67 20 63 6f 6d 6d 65  6e 74 20 62 61 63 6b 2d  |ng comment back-|
00004d50  73 6c 61 73 68 65 73 2c  20 69 66 20 79 6f 75 20  |slashes, if you |
00004d60  77 61 6e 74 20 73 6f 6d  65 0d 77 6f 72 6b 73 70  |want some.worksp|
00004d70  61 63 65 20 74 68 65 6e  20 72 65 6d 6f 76 65 20  |ace then remove |
00004d80  74 68 65 20 62 61 63 6b  2d 73 6c 61 73 68 65 73  |the back-slashes|
00004d90  2e 20 20 54 68 65 20 73  74 61 72 74 20 6f 66 20  |.  The start of |
00004da0  79 6f 75 72 0d 77 6f 72  6b 73 70 61 63 65 20 28  |your.workspace (|
00004db0  61 20 70 61 67 65 20 69  6e 20 74 68 69 73 20 63  |a page in this c|
00004dc0  61 73 65 29 20 69 73 20  68 65 6c 64 20 69 6e 20  |ase) is held in |
00004dd0  26 44 46 30 2c 20 58 20  77 68 65 72 65 20 58 0d  |&DF0, X where X.|
00004de0  69 73 20 79 6f 75 72 20  52 4f 4d 20 73 6f 63 6b  |is your ROM sock|
00004df0  65 74 20 6e 75 6d 62 65  72 2c 20 70 61 73 73 65  |et number, passe|
00004e00  64 20 69 6e 20 58 20 62  79 20 61 6e 79 20 73 65  |d in X by any se|
00004e10  72 76 69 63 65 20 63 61  6c 6c 2e 0d 0d 49 20 75  |rvice call...I u|
00004e20  73 65 20 73 65 72 76 69  63 65 20 63 61 6c 6c 20  |se service call |
00004e30  33 20 74 6f 20 70 72 69  6e 74 20 61 20 6d 65 73  |3 to print a mes|
00004e40  73 61 67 65 20 69 6e 20  74 68 65 20 62 61 6e 6e  |sage in the bann|
00004e50  65 72 20 61 66 74 65 72  0d 61 20 42 52 45 41 4b  |er after.a BREAK|
00004e60  2e 20 20 54 68 69 73 20  77 6f 75 6c 64 20 62 65  |.  This would be|
00004e70  20 61 20 67 6f 6f 64 20  74 69 6d 65 20 74 6f 20  | a good time to |
00004e80  63 6c 65 61 72 20 73 6f  6d 65 20 6f 66 20 79 6f  |clear some of yo|
00004e90  75 72 0d 77 6f 72 6b 73  70 61 63 65 20 69 66 20  |ur.workspace if |
00004ea0  79 6f 75 20 6e 65 65 64  65 64 20 69 74 20 72 65  |you needed it re|
00004eb0  73 65 74 20 6f 6e 20 61  20 42 52 45 41 4b 2e 20  |set on a BREAK. |
00004ec0  20 54 68 6f 73 65 20 6c  69 6e 65 73 20 6f 66 0d  | Those lines of.|
00004ed0  74 68 65 20 63 6f 64 65  20 61 72 65 20 61 67 61  |the code are aga|
00004ee0  69 6e 20 62 6c 6f 63 6b  65 64 20 6f 66 66 20 69  |in blocked off i|
00004ef0  6e 20 74 68 65 20 61 73  73 65 6d 62 6c 65 72 20  |n the assembler |
00004f00  6c 69 73 74 69 6e 67 20  69 6e 0d 63 61 73 65 20  |listing in.case |
00004f10  79 6f 75 20 6e 65 65 64  20 74 68 65 6d 2e 20 20  |you need them.  |
00004f20  54 68 65 20 72 65 61 73  6f 6e 20 49 27 76 65 20  |The reason I've |
00004f30  62 6c 6f 63 6b 65 64 20  74 68 6f 73 65 20 73 65  |blocked those se|
00004f40  63 74 69 6f 6e 73 0d 6f  66 66 20 69 73 20 74 68  |ctions.off is th|
00004f50  61 74 20 49 20 64 69 64  6e 27 74 20 77 61 6e 74  |at I didn't want|
00004f60  20 74 6f 20 72 61 69 73  65 20 50 41 47 45 20 75  | to raise PAGE u|
00004f70  6e 6c 65 73 73 20 69 74  20 77 61 73 0d 6e 65 65  |nless it was.nee|
00004f80  64 65 64 2c 20 61 6e 64  20 69 6e 20 69 74 73 20  |ded, and in its |
00004f90  70 72 65 73 65 6e 74 20  66 6f 72 6d 20 74 68 65  |present form the|
00004fa0  20 52 4f 4d 20 64 6f 65  73 6e 27 74 20 75 73 65  | ROM doesn't use|
00004fb0  20 61 6e 79 0d 77 6f 72  6b 73 70 61 63 65 20 65  | any.workspace e|
00004fc0  78 63 65 70 74 20 74 68  61 74 20 69 6e 20 7a 65  |xcept that in ze|
00004fd0  72 6f 20 70 61 67 65 2e  0d 0d 55 73 69 6e 67 20  |ro page...Using |
00004fe0  63 61 6c 6c 20 33 20 66  6f 72 20 62 61 6e 6e 65  |call 3 for banne|
00004ff0  72 20 6d 65 73 73 61 67  65 73 20 69 73 20 6e 6f  |r messages is no|
00005000  74 20 72 65 61 6c 6c 79  20 61 6e 20 61 70 70 72  |t really an appr|
00005010  6f 76 65 64 0d 69 64 65  61 2e 20 20 54 68 65 72  |oved.idea.  Ther|
00005020  65 20 69 73 20 6e 6f 20  72 65 61 6c 20 68 61 72  |e is no real har|
00005030  6d 20 69 6e 20 69 74 2c  20 62 75 74 20 61 20 66  |m in it, but a f|
00005040  69 6c 69 6e 67 20 73 79  73 74 65 6d 20 52 4f 4d  |iling system ROM|
00005050  0d 74 68 61 74 20 63 6c  61 69 6d 73 20 74 68 69  |.that claims thi|
00005060  73 20 63 61 6c 6c 20 77  69 6c 6c 20 6f 62 76 69  |s call will obvi|
00005070  6f 75 73 6c 79 20 61 6c  73 6f 20 73 74 6f 70 20  |ously also stop |
00005080  74 68 65 20 62 61 6e 6e  65 72 0d 6d 65 73 73 61  |the banner.messa|
00005090  67 65 20 62 65 69 6e 67  20 70 72 69 6e 74 65 64  |ge being printed|
000050a0  2e 20 20 57 69 74 68 20  74 68 65 20 4f 53 42 52  |.  With the OSBR|
000050b0  4f 4d 20 28 61 73 20 49  20 68 61 76 65 20 63 61  |OM (as I have ca|
000050c0  6c 6c 65 64 0d 69 74 29  20 69 6e 20 73 6f 63 6b  |lled.it) in sock|
000050d0  65 74 20 31 35 2c 20 74  68 69 73 20 69 73 20 6e  |et 15, this is n|
000050e0  6f 74 20 61 20 70 72 6f  62 6c 65 6d 2e 20 20 59  |ot a problem.  Y|
000050f0  6f 75 20 63 6f 75 6c 64  20 75 73 65 20 63 61 6c  |ou could use cal|
00005100  6c 0d 31 20 62 75 74 20  79 6f 75 72 20 6d 65 73  |l.1 but your mes|
00005110  73 61 67 65 20 77 6f 75  6c 64 20 74 68 65 6e 20  |sage would then |
00005120  61 70 70 65 61 72 20 61  62 6f 76 65 20 74 68 65  |appear above the|
00005130  20 41 63 6f 72 6e 20 62  61 6e 6e 65 72 2e 20 0d  | Acorn banner. .|
00005140  59 6f 75 20 63 61 6e 20  6d 6f 64 69 66 79 20 6c  |You can modify l|
00005150  69 6e 65 20 36 35 30 20  74 6f 20 72 65 61 64 20  |ine 650 to read |
00005160  43 4d 50 20 23 31 20 69  66 20 79 6f 75 20 77 61  |CMP #1 if you wa|
00005170  6e 74 20 74 6f 20 73 65  65 0d 74 68 65 20 65 66  |nt to see.the ef|
00005180  66 65 63 74 2c 20 61 73  73 75 6d 69 6e 67 20 79  |fect, assuming y|
00005190  6f 75 20 6c 65 61 76 65  20 74 68 65 20 63 6f 6d  |ou leave the com|
000051a0  6d 65 6e 74 20 62 61 63  6b 2d 73 6c 61 73 68 65  |ment back-slashe|
000051b0  73 20 69 6e 0d 70 6c 61  63 65 2e 0d 0d 53 65 72  |s in.place...Ser|
000051c0  76 69 63 65 20 63 61 6c  6c 20 34 20 69 73 20 74  |vice call 4 is t|
000051d0  68 65 20 6f 6e 65 20 66  6f 72 20 75 6e 72 65 63  |he one for unrec|
000051e0  6f 67 6e 69 73 65 64 20  63 6f 6d 6d 61 6e 64 73  |ognised commands|
000051f0  2e 20 0d 57 68 65 6e 65  76 65 72 20 61 20 2a 63  |. .Whenever a *c|
00005200  6f 6d 6d 61 6e 64 20 70  61 73 73 65 73 20 74 68  |ommand passes th|
00005210  72 6f 75 67 68 20 74 68  65 20 63 6f 6d 6d 61 6e  |rough the comman|
00005220  64 20 6c 69 6e 65 0d 69  6e 74 65 72 70 72 65 74  |d line.interpret|
00005230  65 72 20 69 74 20 69 73  20 70 61 73 73 65 64 20  |er it is passed |
00005240  66 6f 72 20 61 63 74 69  6f 6e 20 74 6f 3a 0d 0d  |for action to:..|
00005250  20 20 20 20 20 20 31 3a  20 20 54 68 65 20 6f 70  |      1:  The op|
00005260  65 72 61 74 69 6e 67 20  73 79 73 74 65 6d 0d 20  |erating system. |
00005270  20 20 20 20 20 32 3a 20  20 53 69 64 65 77 61 79  |     2:  Sideway|
00005280  73 20 52 4f 4d 53 20 77  69 74 68 20 73 65 72 76  |s ROMS with serv|
00005290  69 63 65 20 63 61 6c 6c  20 34 0d 20 20 20 20 20  |ice call 4.     |
000052a0  20 33 3a 20 20 54 68 65  20 63 75 72 72 65 6e 74  | 3:  The current|
000052b0  20 66 69 6c 69 6e 67 20  73 79 73 74 65 6d 20 28  | filing system (|
000052c0  65 78 63 65 70 74 20 66  6f 72 20 63 61 73 73 65  |except for casse|
000052d0  74 74 65 29 0d 0d 69 6e  20 74 68 61 74 20 6f 72  |tte)..in that or|
000052e0  64 65 72 2e 20 20 57 68  65 6e 20 73 65 72 76 69  |der.  When servi|
000052f0  63 65 20 63 61 6c 6c 20  34 20 72 65 61 63 68 65  |ce call 4 reache|
00005300  73 20 74 68 65 20 52 4f  4d 2c 0d 65 78 65 63 75  |s the ROM,.execu|
00005310  74 69 6f 6e 20 6a 75 6d  70 73 20 74 6f 20 27 63  |tion jumps to 'c|
00005320  6f 6d 6d 61 6e 64 73 27  20 61 74 20 6c 69 6e 65  |ommands' at line|
00005330  20 32 32 38 30 2e 20 20  41 66 74 65 72 20 77 6f  | 2280.  After wo|
00005340  72 6b 73 70 61 63 65 0d  68 6f 75 73 65 6b 65 65  |rkspace.housekee|
00005350  70 69 6e 67 20 28 73 6f  6d 65 20 6f 66 20 74 68  |ping (some of th|
00005360  65 73 65 20 73 68 6f 75  6c 64 20 70 65 72 68 61  |ese should perha|
00005370  70 73 20 61 6c 73 6f 20  62 65 20 62 6c 61 6e 6b  |ps also be blank|
00005380  65 64 0d 6f 66 66 20 62  75 74 20 6e 6f 20 63 6f  |ed.off but no co|
00005390  6d 6d 61 6e 64 73 20 61  63 74 75 61 6c 6c 79 20  |mmands actually |
000053a0  75 73 65 20 74 68 65 20  70 72 69 76 61 74 65 20  |use the private |
000053b0  77 6f 72 6b 73 70 61 63  65 20 73 6f 2c 0d 66 6f  |workspace so,.fo|
000053c0  72 20 74 68 65 20 6d 6f  6d 65 6e 74 2c 20 6c 65  |r the moment, le|
000053d0  74 20 74 68 65 6d 20 73  74 61 6e 64 29 20 77 65  |t them stand) we|
000053e0  20 73 74 6f 72 65 20 59  2d 31 20 6f 6e 20 74 68  | store Y-1 on th|
000053f0  65 20 73 74 61 63 6b 0d  66 6f 72 20 6c 61 74 65  |e stack.for late|
00005400  72 2e 20 20 28 59 2d 31  20 73 6f 20 74 68 61 74  |r.  (Y-1 so that|
00005410  20 77 65 20 63 61 6e 20  73 74 61 72 74 20 74 68  | we can start th|
00005420  65 20 6c 6f 6f 70 73 20  77 69 74 68 20 61 6e 0d  |e loops with an.|
00005430  49 4e 59 2e 29 20 20 59  20 70 6f 69 6e 74 73 20  |INY.)  Y points |
00005440  74 6f 20 74 68 65 20 66  69 72 73 74 20 6c 65 74  |to the first let|
00005450  74 65 72 20 6f 66 20 74  68 65 20 2a 63 6f 6d 6d  |ter of the *comm|
00005460  61 6e 64 20 77 68 69 63  68 20 69 73 0d 68 65 6c  |and which is.hel|
00005470  64 20 66 72 6f 6d 20 20  28 26 46 32 29 2c 59 20  |d from  (&F2),Y |
00005480  20 6f 6e 77 61 72 64 73  2c 20 74 65 72 6d 69 6e  | onwards, termin|
00005490  61 74 65 64 20 62 79 20  61 20 63 61 72 72 69 61  |ated by a carria|
000054a0  67 65 0d 72 65 74 75 72  6e 2e 0d 0d 43 6f 6d 6d  |ge.return...Comm|
000054b0  61 6e 64 73 20 61 72 65  20 72 65 63 6f 67 6e 69  |ands are recogni|
000054c0  73 65 64 20 62 79 20 62  65 69 6e 67 20 63 6f 6d  |sed by being com|
000054d0  70 61 72 65 64 20 77 69  74 68 20 61 20 74 61 62  |pared with a tab|
000054e0  6c 65 20 6f 66 0d 63 6f  6d 6d 61 6e 64 73 20 68  |le of.commands h|
000054f0  65 6c 64 20 69 6e 20 74  68 65 20 52 4f 4d 2e 20  |eld in the ROM. |
00005500  20 45 61 63 68 20 63 6f  6d 6d 61 6e 64 20 69 6e  | Each command in|
00005510  20 74 68 65 20 74 61 62  6c 65 20 69 73 0d 74 65  | the table is.te|
00005520  72 6d 69 6e 61 74 65 64  20 77 69 74 68 20 61 20  |rminated with a |
00005530  6e 75 6c 6c 20 62 79 74  65 2e 20 20 57 65 20 63  |null byte.  We c|
00005540  6f 6d 70 61 72 65 20 65  61 63 68 20 6c 65 74 74  |ompare each lett|
00005550  65 72 20 6f 66 20 74 68  65 0d 75 6e 6b 6e 6f 77  |er of the.unknow|
00005560  6e 20 63 6f 6d 6d 61 6e  64 20 77 69 74 68 20 65  |n command with e|
00005570  61 63 68 20 6f 6e 65 20  69 6e 20 74 68 65 20 6c  |ach one in the l|
00005580  69 73 74 20 69 6e 20 74  75 72 6e 2e 20 20 49 66  |ist in turn.  If|
00005590  20 61 0d 6d 61 74 63 68  20 66 61 69 6c 73 20 74  | a.match fails t|
000055a0  68 65 6e 20 77 65 20 6d  6f 76 65 20 6f 6e 20 74  |hen we move on t|
000055b0  6f 20 74 68 65 20 6e 65  78 74 20 77 6f 72 64 20  |o the next word |
000055c0  69 6e 20 74 68 65 20 6c  69 73 74 20 61 6e 64 0d  |in the list and.|
000055d0  66 69 6e 61 6c 6c 79 20  77 65 20 65 78 69 74 20  |finally we exit |
000055e0  61 6c 74 6f 67 65 74 68  65 72 20 77 69 74 68 20  |altogether with |
000055f0  61 6c 6c 20 72 65 67 69  73 74 65 72 73 20 72 65  |all registers re|
00005600  74 75 72 6e 65 64 20 74  6f 0d 74 68 65 69 72 20  |turned to.their |
00005610  65 6e 74 72 79 20 73 74  61 74 65 73 2e 20 20 49  |entry states.  I|
00005620  66 2c 20 64 75 72 69 6e  67 20 74 68 65 20 6d 61  |f, during the ma|
00005630  74 63 68 2c 20 77 65 20  72 65 61 63 68 20 74 68  |tch, we reach th|
00005640  65 20 6e 75 6c 6c 0d 74  68 65 6e 20 77 65 20 68  |e null.then we h|
00005650  61 76 65 20 61 20 6d 61  74 63 68 2e 20 20 45 78  |ave a match.  Ex|
00005660  65 63 75 74 69 6f 6e 20  6a 75 6d 70 73 20 74 6f  |ecution jumps to|
00005670  20 74 68 65 20 61 64 64  72 65 73 73 20 73 74 6f  | the address sto|
00005680  72 65 64 0d 69 6e 20 74  68 65 20 74 77 6f 20 62  |red.in the two b|
00005690  79 74 65 73 20 66 6f 6c  6c 6f 77 69 6e 67 20 74  |ytes following t|
000056a0  68 65 20 72 65 6c 65 76  61 6e 74 20 6e 75 6c 6c  |he relevant null|
000056b0  2e 0d 0d 4e 6f 74 65 20  69 6e 20 6c 69 6e 65 20  |...Note in line |
000056c0  32 35 38 30 20 74 68 61  74 20 49 20 68 61 76 65  |2580 that I have|
000056d0  20 41 4e 44 65 64 20 74  68 65 20 62 79 74 65 20  | ANDed the byte |
000056e0  69 6e 20 74 68 65 20 69  6e 70 75 74 0d 73 74 72  |in the input.str|
000056f0  69 6e 67 20 77 69 74 68  20 26 44 46 2e 20 20 54  |ing with &DF.  T|
00005700  68 69 73 20 77 69 6c 6c  20 6d 61 6b 65 20 69 74  |his will make it|
00005710  20 75 70 70 65 72 20 63  61 73 65 20 6e 6f 20 6d  | upper case no m|
00005720  61 74 74 65 72 0d 77 68  61 74 2c 20 61 6c 74 68  |atter.what, alth|
00005730  6f 75 67 68 20 74 68 69  73 20 70 72 6f 63 65 64  |ough this proced|
00005740  75 72 65 20 6d 65 61 6e  73 20 74 68 61 74 20 74  |ure means that t|
00005750  68 65 20 77 6f 72 64 73  20 69 6e 20 74 68 65 0d  |he words in the.|
00005760  52 4f 4d 27 73 20 6c 69  73 74 20 4d 55 53 54 20  |ROM's list MUST |
00005770  62 65 20 69 6e 20 75 70  70 65 72 20 63 61 73 65  |be in upper case|
00005780  20 61 6e 64 20 74 68 65  79 20 63 61 6e 6e 6f 74  | and they cannot|
00005790  20 63 6f 6e 74 61 69 6e  0d 61 6e 79 74 68 69 6e  | contain.anythin|
000057a0  67 20 62 75 74 20 74 68  65 20 6c 65 74 74 65 72  |g but the letter|
000057b0  73 20 41 2d 5a 2e 0d 0d  54 68 65 20 63 6f 6d 6d  |s A-Z...The comm|
000057c0  61 6e 64 73 20 72 65 63  6f 67 6e 69 73 65 64 20  |ands recognised |
000057d0  62 79 20 74 68 69 73 20  52 4f 4d 20 61 72 65 3a  |by this ROM are:|
000057e0  0d 0d 2a 42 45 45 50 20  2d 20 61 20 74 72 69 76  |..*BEEP - a triv|
000057f0  69 61 6c 20 70 69 65 63  65 20 6f 66 20 63 6f 64  |ial piece of cod|
00005800  65 20 77 68 69 63 68 20  64 6f 65 73 20 61 20 56  |e which does a V|
00005810  44 55 37 0d 0d 2a 53 45  4e 44 20 3c 73 74 72 69  |DU7..*SEND <stri|
00005820  6e 67 3e 20 70 72 69 6e  74 73 20 6f 75 74 20 74  |ng> prints out t|
00005830  68 65 20 73 74 72 69 6e  67 2e 20 20 54 68 69 73  |he string.  This|
00005840  20 63 6f 64 65 20 75 73  65 73 20 74 68 65 20 4f  | code uses the O|
00005850  53 0d 72 6f 75 74 69 6e  65 73 20 47 53 49 4e 49  |S.routines GSINI|
00005860  54 20 61 6e 64 20 47 53  52 45 41 44 20 74 6f 20  |T and GSREAD to |
00005870  70 72 65 70 61 72 65 20  74 68 65 20 73 74 72 69  |prepare the stri|
00005880  6e 67 20 61 6e 64 20 74  6f 20 72 65 61 64 0d 69  |ng and to read.i|
00005890  74 2e 20 20 47 53 49 4e  49 54 20 77 69 6c 6c 20  |t.  GSINIT will |
000058a0  63 6f 70 65 20 77 69 74  68 20 71 75 6f 74 61 74  |cope with quotat|
000058b0  69 6f 6e 20 6d 61 72 6b  73 2c 20 73 70 61 63 65  |ion marks, space|
000058c0  73 20 62 65 66 6f 72 65  0d 74 68 65 20 77 6f 72  |s before.the wor|
000058d0  64 20 61 6e 64 20 77 69  74 68 20 65 73 63 61 70  |d and with escap|
000058e0  65 20 73 65 71 75 65 6e  63 65 73 20 73 75 63 68  |e sequences such|
000058f0  20 61 73 20 7c 4d 20 69  6e 20 65 78 61 63 74 6c  | as |M in exactl|
00005900  79 20 74 68 65 0d 73 61  6d 65 20 77 61 79 20 69  |y the.same way i|
00005910  74 20 64 6f 65 73 20 66  6f 72 20 2a 4b 45 59 20  |t does for *KEY |
00005920  70 72 6f 67 72 61 6d 6d  69 6e 67 2e 20 20 42 79  |programming.  By|
00005930  20 73 65 74 74 69 6e 67  20 74 68 65 20 63 61 72  | setting the car|
00005940  72 79 0d 66 6c 61 67 20  6f 6e 20 65 6e 74 72 79  |ry.flag on entry|
00005950  20 74 6f 20 47 53 49 4e  49 54 20 77 65 20 74 65  | to GSINIT we te|
00005960  6c 6c 20 69 74 20 74 68  61 74 20 74 68 65 20 73  |ll it that the s|
00005970  74 72 69 6e 67 20 77 69  6c 6c 0d 74 65 72 6d 69  |tring will.termi|
00005980  6e 61 74 65 20 65 69 74  68 65 72 20 77 69 74 68  |nate either with|
00005990  20 73 65 63 6f 6e 64 20  71 75 6f 74 65 73 20 6f  | second quotes o|
000059a0  72 20 77 69 74 68 20 61  20 63 61 72 72 69 61 67  |r with a carriag|
000059b0  65 0d 72 65 74 75 72 6e  2e 20 20 49 66 20 63 61  |e.return.  If ca|
000059c0  72 72 79 20 77 61 73 20  63 6c 65 61 72 20 74 68  |rry was clear th|
000059d0  65 6e 20 61 20 73 70 61  63 65 20 77 6f 75 6c 64  |en a space would|
000059e0  20 61 6c 73 6f 0d 74 65  72 6d 69 6e 61 74 65 2e  | also.terminate.|
000059f0  20 20 4f 6e 20 65 78 69  74 20 47 53 49 4e 49 54  |  On exit GSINIT|
00005a00  20 73 65 74 73 20 74 68  65 20 7a 65 72 6f 20 66  | sets the zero f|
00005a10  6c 61 67 20 69 66 20 74  68 65 20 73 74 72 69 6e  |lag if the strin|
00005a20  67 0d 69 73 20 6e 75 6c  6c 2c 20 69 2e 65 2e 20  |g.is null, i.e. |
00005a30  6f 66 20 7a 65 72 6f 20  6c 65 6e 67 74 68 20 6f  |of zero length o|
00005a40  72 20 6a 75 73 74 20 61  20 63 61 72 72 69 61 67  |r just a carriag|
00005a50  65 20 72 65 74 75 72 6e  2c 20 61 6e 64 0d 47 53  |e return, and.GS|
00005a60  52 45 41 44 20 73 65 74  73 20 74 68 65 20 63 61  |READ sets the ca|
00005a70  72 72 79 20 66 6c 61 67  20 69 66 20 77 65 20 68  |rry flag if we h|
00005a80  61 76 65 20 72 65 61 63  68 65 64 20 74 68 65 20  |ave reached the |
00005a90  65 6e 64 20 6f 66 20 74  68 65 0d 73 74 72 69 6e  |end of the.strin|
00005aa0  67 2e 0d 0d 2a 53 45 52  56 49 43 45 20 65 6e 61  |g...*SERVICE ena|
00005ab0  62 6c 65 73 20 74 68 65  20 73 65 72 76 69 63 65  |bles the service|
00005ac0  20 63 61 6c 6c 20 64 69  73 70 6c 61 79 2e 20 20  | call display.  |
00005ad0  54 68 69 73 20 69 73 0d  65 71 75 69 76 61 6c 65  |This is.equivale|
00005ae0  6e 74 20 74 6f 20 61 20  2a 46 58 20 32 35 30 2c  |nt to a *FX 250,|
00005af0  31 20 61 6e 64 20 69 73  20 6e 6f 74 20 72 65 73  |1 and is not res|
00005b00  65 74 20 6f 6e 20 42 52  45 41 4b 2e 0d 0d 2a 4e  |et on BREAK...*N|
00005b10  4f 53 45 52 56 49 43 45  20 74 75 72 6e 73 20 6f  |OSERVICE turns o|
00005b20  66 66 20 74 68 65 20 73  65 72 76 69 63 65 20 63  |ff the service c|
00005b30  61 6c 6c 20 64 69 73 70  6c 61 79 20 61 6e 64 20  |all display and |
00005b40  69 73 0d 65 71 75 69 76  61 6c 65 6e 74 20 74 6f  |is.equivalent to|
00005b50  20 61 20 2a 46 58 20 32  35 30 2c 30 2e 0d 0d 59  | a *FX 250,0...Y|
00005b60  6f 75 20 63 61 6e 20 61  64 64 20 61 6e 79 20 6d  |ou can add any m|
00005b70  61 63 68 69 6e 65 20 63  6f 64 65 20 6f 66 20 79  |achine code of y|
00005b80  6f 75 72 20 6f 77 6e 20  74 6f 20 74 68 65 20 52  |our own to the R|
00005b90  4f 4d 20 62 79 0d 65 78  74 65 6e 64 69 6e 67 20  |OM by.extending |
00005ba0  6d 79 20 6c 69 73 74 2e  20 20 49 20 68 61 76 65  |my list.  I have|
00005bb0  20 6c 65 66 74 20 61 6e  6f 74 68 65 72 20 64 75  | left another du|
00005bc0  6d 6d 79 20 63 6f 6d 6d  61 6e 64 2c 0d 2a 57 48  |mmy command,.*WH|
00005bd0  41 54 53 59 4f 55 52 53  20 77 68 69 63 68 20 6a  |ATSYOURS which j|
00005be0  75 73 74 20 62 65 65 70  73 2e 20 20 59 6f 75 20  |ust beeps.  You |
00005bf0  63 61 6e 20 65 61 73 69  6c 79 20 63 68 61 6e 67  |can easily chang|
00005c00  65 20 69 74 73 0d 6e 61  6d 65 20 61 74 20 6c 69  |e its.name at li|
00005c10  6e 65 20 33 31 34 30 20  61 6e 64 20 70 75 74 20  |ne 3140 and put |
00005c20  79 6f 75 72 20 63 6f 64  65 20 73 74 61 72 74 69  |your code starti|
00005c30  6e 67 20 61 74 20 6c 69  6e 65 20 34 32 38 30 2e  |ng at line 4280.|
00005c40  0d 41 6c 6c 20 63 6f 6d  6d 61 6e 64 20 63 6f 64  |.All command cod|
00005c50  65 20 6d 75 73 74 20 72  65 74 75 72 6e 20 77 69  |e must return wi|
00005c60  74 68 20 61 20 4a 4d 50  20 65 78 69 74 2e 0d 0d  |th a JMP exit...|
00005c70  54 68 65 20 63 6f 6d 6d  61 6e 64 20 6c 69 73 74  |The command list|
00005c80  20 69 73 20 68 65 6c 64  20 66 72 6f 6d 20 6c 69  | is held from li|
00005c90  6e 65 20 33 30 32 30 2e  20 20 54 68 65 20 66 6f  |ne 3020.  The fo|
00005ca0  72 6d 61 74 20 69 73 0d  63 6f 6d 6d 61 6e 64 20  |rmat is.command |
00005cb0  6e 61 6d 65 20 66 69 72  73 74 20 61 73 20 61 20  |name first as a |
00005cc0  73 74 72 69 6e 67 20 74  65 72 6d 69 6e 61 74 65  |string terminate|
00005cd0  64 20 62 79 20 61 20 6e  75 6c 6c 20 61 6e 64 20  |d by a null and |
00005ce0  74 68 65 6e 0d 61 20 74  77 6f 20 62 79 74 65 20  |then.a two byte |
00005cf0  77 6f 72 64 20 68 6f 6c  64 69 6e 67 20 74 68 65  |word holding the|
00005d00  20 61 64 64 72 65 73 73  20 6f 66 20 74 68 61 74  | address of that|
00005d10  20 70 61 72 74 69 63 75  6c 61 72 0d 72 6f 75 74  | particular.rout|
00005d20  69 6e 65 2e 0d 0d 46 69  6e 61 6c 6c 79 20 73 65  |ine...Finally se|
00005d30  72 76 69 63 65 20 63 61  6c 6c 20 39 20 69 73 20  |rvice call 9 is |
00005d40  2a 48 45 4c 50 2e 20 20  49 74 20 77 6f 72 6b 73  |*HELP.  It works|
00005d50  20 69 6e 20 74 77 6f 20  77 61 79 73 20 6f 66 0d  | in two ways of.|
00005d60  63 6f 75 72 73 65 2e 20  20 54 68 65 20 52 4f 4d  |course.  The ROM|
00005d70  20 77 69 6c 6c 20 72 65  73 70 6f 6e 64 20 74 6f  | will respond to|
00005d80  20 62 6f 74 68 20 2a 48  45 4c 50 20 61 6e 64 20  | both *HELP and |
00005d90  74 6f 20 2a 48 45 4c 50  0d 4f 53 42 49 54 53 2e  |to *HELP.OSBITS.|
00005da0  20 20 57 68 65 6e 20 77  65 20 72 65 63 65 69 76  |  When we receiv|
00005db0  65 20 63 61 6c 6c 20 39  20 74 68 65 20 63 68 61  |e call 9 the cha|
00005dc0  72 61 63 74 65 72 20 66  6f 6c 6c 6f 77 69 6e 67  |racter following|
00005dd0  20 74 68 65 0d 2a 48 45  4c 50 20 28 6f 72 20 2a  | the.*HELP (or *|
00005de0  48 2e 29 20 69 73 20 61  74 20 20 28 26 46 32 29  |H.) is at  (&F2)|
00005df0  2c 59 2e 20 20 49 66 20  69 74 20 69 73 20 61 20  |,Y.  If it is a |
00005e00  63 61 72 72 69 61 67 65  20 72 65 74 75 72 6e 0d  |carriage return.|
00005e10  74 68 65 6e 20 74 68 69  73 20 69 73 20 61 20 73  |then this is a s|
00005e20  74 72 61 69 67 68 74 66  6f 72 77 61 72 64 20 67  |traightforward g|
00005e30  65 6e 65 72 61 6c 20 48  45 4c 50 20 63 61 6c 6c  |eneral HELP call|
00005e40  20 61 6e 64 20 77 65 0d  72 65 73 70 6f 6e 64 20  | and we.respond |
00005e50  62 79 20 70 72 69 6e 74  69 6e 67 20 6f 75 74 20  |by printing out |
00005e60  6f 75 72 20 74 69 74 6c  65 20 61 6e 64 20 74 68  |our title and th|
00005e70  65 20 77 6f 72 64 20 77  65 20 72 65 73 70 6f 6e  |e word we respon|
00005e80  64 0d 74 6f 2e 0d 0d 49  66 20 74 68 61 74 20 63  |d.to...If that c|
00005e90  68 61 72 61 63 74 65 72  20 69 73 20 6e 6f 74 20  |haracter is not |
00005ea0  61 20 43 52 20 74 68 65  6e 20 74 68 65 20 2a 48  |a CR then the *H|
00005eb0  45 4c 50 20 68 61 73 20  61 6e 20 61 72 67 75 6d  |ELP has an argum|
00005ec0  65 6e 74 0d 61 6e 64 20  77 65 20 68 61 76 65 20  |ent.and we have |
00005ed0  74 6f 20 74 68 65 6e 20  63 68 65 63 6b 20 74 68  |to then check th|
00005ee0  61 74 20 61 67 61 69 6e  73 74 20 6f 75 72 20 48  |at against our H|
00005ef0  45 4c 50 20 72 65 73 70  6f 6e 73 65 0d 6c 69 73  |ELP response.lis|
00005f00  74 2c 20 77 68 69 63 68  20 69 6e 20 74 68 69 73  |t, which in this|
00005f10  20 63 61 73 65 20 69 73  20 6f 6e 6c 79 20 6f 6e  | case is only on|
00005f20  65 20 77 6f 72 64 2c 20  4f 53 42 49 54 53 2e 20  |e word, OSBITS. |
00005f30  20 54 68 69 73 0d 63 68  65 63 6b 69 6e 67 20 69  | This.checking i|
00005f40  73 20 65 78 61 63 74 6c  79 20 6c 69 6b 65 20 74  |s exactly like t|
00005f50  68 61 74 20 66 6f 72 20  75 6e 6b 6e 6f 77 6e 20  |hat for unknown |
00005f60  63 6f 6d 6d 61 6e 64 73  2e 20 20 54 68 65 0d 68  |commands.  The.h|
00005f70  65 6c 70 20 6c 69 73 74  20 69 73 20 66 72 6f 6d  |elp list is from|
00005f80  20 6c 69 6e 65 20 33 31  38 30 2e 0d 0d 49 74 20  | line 3180...It |
00005f90  69 73 20 69 6d 70 6f 72  74 61 6e 74 20 74 68 61  |is important tha|
00005fa0  74 20 73 65 72 76 69 63  65 20 63 61 6c 6c 20 39  |t service call 9|
00005fb0  20 69 73 20 6e 6f 74 20  63 6c 61 69 6d 65 64 20  | is not claimed |
00005fc0  61 6e 64 20 74 68 61 74  0d 59 20 69 73 20 72 65  |and that.Y is re|
00005fd0  73 74 6f 72 65 64 20 74  6f 20 69 74 73 20 65 6e  |stored to its en|
00005fe0  74 72 79 20 76 61 6c 75  65 20 6f 6e 20 65 78 69  |try value on exi|
00005ff0  74 2e 20 20 49 74 20 69  73 20 70 6f 73 73 69 62  |t.  It is possib|
00006000  6c 65 0d 66 6f 72 20 6d  6f 72 65 20 74 68 61 6e  |le.for more than|
00006010  20 6f 6e 65 20 52 4f 4d  20 74 6f 20 72 65 73 70  | one ROM to resp|
00006020  6f 6e 64 20 74 6f 20 61  20 48 45 4c 50 20 61 72  |ond to a HELP ar|
00006030  67 75 6d 65 6e 74 20 28  55 54 49 4c 53 0d 69 73  |gument (UTILS.is|
00006040  20 61 20 63 6f 6d 6d 6f  6e 20 6f 6e 65 29 20 61  | a common one) a|
00006050  6e 64 20 61 6c 73 6f 20  6f 75 72 20 52 4f 4d 20  |nd also our ROM |
00006060  6d 75 73 74 20 6e 6f 74  20 72 65 73 70 6f 6e 64  |must not respond|
00006070  20 77 69 74 68 0d 61 6e  79 74 68 69 6e 67 20 69  | with.anything i|
00006080  66 20 74 68 65 20 48 45  4c 50 20 61 72 67 75 6d  |f the HELP argum|
00006090  65 6e 74 20 64 6f 65 73  20 6e 6f 74 20 61 70 70  |ent does not app|
000060a0  6c 79 2e 20 20 56 69 65  77 20 32 2e 31 20 64 6f  |ly.  View 2.1 do|
000060b0  65 73 0d 6e 6f 74 20 61  70 70 65 61 72 20 74 6f  |es.not appear to|
000060c0  20 77 6f 72 6b 20 70 72  6f 70 65 72 6c 79 20 69  | work properly i|
000060d0  6e 20 74 68 69 73 20 72  65 73 70 65 63 74 20 61  |n this respect a|
000060e0  73 20 28 6f 6e 20 6d 79  0d 6d 61 63 68 69 6e 65  |s (on my.machine|
000060f0  20 61 6e 79 77 61 79 29  20 69 74 20 61 6e 6e 6f  | anyway) it anno|
00006100  75 6e 63 65 73 20 69 74  73 65 6c 66 20 74 6f 20  |unces itself to |
00006110  61 6e 79 20 68 65 6c 70  20 63 61 6c 6c 2e 0d 0d  |any help call...|
00006120  54 68 61 74 20 74 68 65  6e 20 69 73 20 74 68 65  |That then is the|
00006130  20 27 4c 6f 6e 64 6f 6e  20 74 6f 20 42 72 69 67  | 'London to Brig|
00006140  68 74 6f 6e 20 69 6e 20  34 20 4d 69 6e 75 74 65  |hton in 4 Minute|
00006150  73 27 20 67 75 69 64 65  20 74 6f 0d 73 69 64 65  |s' guide to.side|
00006160  77 61 79 73 20 52 4f 4d  53 2e 20 20 54 68 65 72  |ways ROMS.  Ther|
00006170  65 20 69 73 20 6d 75 63  68 20 6d 6f 72 65 20 74  |e is much more t|
00006180  6f 20 74 68 65 6d 20 74  68 61 74 20 49 20 63 61  |o them that I ca|
00006190  6e 20 63 6f 76 65 72 0d  69 6e 20 61 20 6d 6f 64  |n cover.in a mod|
000061a0  75 6c 65 20 61 6e 64 20  74 68 65 79 20 61 72 65  |ule and they are|
000061b0  20 77 6f 72 74 68 79 20  6f 66 20 66 75 72 74 68  | worthy of furth|
000061c0  65 72 20 73 74 75 64 79  2c 20 61 6c 74 68 6f 75  |er study, althou|
000061d0  67 68 0d 74 68 65 20 70  72 69 6e 63 69 70 6c 65  |gh.the principle|
000061e0  73 20 69 6e 76 6f 6c 76  65 64 20 61 72 65 20 76  |s involved are v|
000061f0  65 72 79 20 6d 61 63 68  69 6e 65 20 73 70 65 63  |ery machine spec|
00006200  69 66 69 63 2e 0d 0d 46  69 6e 61 6c 6c 79 20 61  |ific...Finally a|
00006210  20 63 6f 75 70 6c 65 20  6f 66 20 70 72 6f 67 72  | couple of progr|
00006220  61 6d 6d 69 6e 67 20 68  69 6e 74 73 20 61 62 6f  |amming hints abo|
00006230  75 74 20 77 72 69 74 69  6e 67 20 66 6f 72 0d 53  |ut writing for.S|
00006240  65 72 76 69 63 65 20 52  4f 4d 53 2e 20 20 46 69  |ervice ROMS.  Fi|
00006250  72 73 74 6c 79 20 72 65  6d 65 6d 62 65 72 20 74  |rstly remember t|
00006260  68 61 74 20 79 6f 75 20  77 69 6c 6c 20 6e 6f 74  |hat you will not|
00006270  20 62 65 20 61 62 6c 65  20 74 6f 0d 77 72 69 74  | be able to.writ|
00006280  65 20 69 6e 74 6f 20 79  6f 75 72 20 61 64 64 72  |e into your addr|
00006290  65 73 73 20 73 70 61 63  65 2c 20 73 6f 20 79 6f  |ess space, so yo|
000062a0  75 20 77 69 6c 6c 20 68  61 76 65 20 74 6f 20 75  |u will have to u|
000062b0  73 65 0d 7a 65 72 6f 2d  70 61 67 65 20 61 6e 64  |se.zero-page and|
000062c0  20 6d 61 69 6e 20 6d 65  6d 6f 72 79 20 77 6f 72  | main memory wor|
000062d0  6b 73 70 61 63 65 20 61  20 6c 6f 74 2e 20 20 57  |kspace a lot.  W|
000062e0  69 74 68 20 6d 61 69 6e  20 6d 65 6d 6f 72 79 0d  |ith main memory.|
000062f0  79 6f 75 20 77 69 6c 6c  20 75 73 65 20 61 20 6c  |you will use a l|
00006300  6f 74 20 6f 66 20 69 6e  64 69 72 65 63 74 20 61  |ot of indirect a|
00006310  64 64 72 65 73 73 69 6e  67 2e 0d 0d 54 6f 20 67  |ddressing...To g|
00006320  69 76 65 20 61 6e 20 65  72 72 6f 72 20 6d 65 73  |ive an error mes|
00006330  73 61 67 65 20 69 6e 20  61 20 73 65 72 76 69 63  |sage in a servic|
00006340  65 20 52 4f 4d 2c 20 79  6f 75 20 68 61 76 65 20  |e ROM, you have |
00006350  74 6f 20 63 6f 70 79 0d  79 6f 75 72 20 65 72 72  |to copy.your err|
00006360  6f 72 20 63 6f 64 65 20  2d 20 66 72 6f 6d 20 74  |or code - from t|
00006370  68 65 20 42 52 4b 20 72  69 67 68 74 20 74 68 72  |he BRK right thr|
00006380  6f 75 67 68 20 74 6f 20  74 68 65 20 6d 65 73 73  |ough to the mess|
00006390  61 67 65 0d 61 6e 64 20  69 74 73 20 74 65 72 6d  |age.and its term|
000063a0  69 6e 61 74 69 6e 67 20  6e 75 6c 6c 20 2d 20 69  |inating null - i|
000063b0  6e 74 6f 20 74 68 65 20  62 6f 74 74 6f 6d 20 6f  |nto the bottom o|
000063c0  66 20 74 68 65 20 73 74  61 63 6b 0d 28 66 72 6f  |f the stack.(fro|
000063d0  6d 20 26 31 30 30 20 6f  6e 77 61 72 64 73 20 73  |m &100 onwards s|
000063e0  69 6e 63 65 20 74 68 65  20 73 74 61 63 6b 20 69  |ince the stack i|
000063f0  73 20 75 70 73 69 64 65  20 64 6f 77 6e 29 2c 20  |s upside down), |
00006400  61 6e 64 20 4a 4d 50 0d  74 6f 20 79 6f 75 72 20  |and JMP.to your |
00006410  42 52 4b 20 61 74 20 26  31 30 30 2e 20 20 59 6f  |BRK at &100.  Yo|
00006420  75 20 68 61 76 65 20 74  6f 20 64 6f 20 74 68 69  |u have to do thi|
00006430  73 20 62 65 63 61 75 73  65 20 74 68 65 20 65 72  |s because the er|
00006440  72 6f 72 0d 63 6f 64 65  20 69 6e 20 74 68 65 20  |ror.code in the |
00006450  6c 61 6e 67 75 61 67 65  20 79 6f 75 20 61 72 65  |language you are|
00006460  20 63 61 6c 6c 69 6e 67  20 66 72 6f 6d 20 77 69  | calling from wi|
00006470  6c 6c 20 61 75 74 6f 6d  61 74 69 63 61 6c 6c 79  |ll automatically|
00006480  0d 6c 6f 6f 6b 20 69 6e  20 74 68 61 74 20 6c 61  |.look in that la|
00006490  6e 67 75 61 67 65 27 73  20 52 4f 4d 20 69 66 20  |nguage's ROM if |
000064a0  79 6f 75 20 65 78 65 63  75 74 65 20 74 68 65 20  |you execute the |
000064b0  42 52 4b 20 69 6e 20 79  6f 75 72 0d 52 4f 4d 2e  |BRK in your.ROM.|
000064c0  20 20 59 6f 75 20 68 61  76 65 20 74 6f 20 65 78  |  You have to ex|
000064d0  65 63 75 74 65 20 74 68  65 20 42 52 4b 20 69 6e  |ecute the BRK in|
000064e0  20 6d 61 69 6e 20 6d 65  6d 6f 72 79 2c 20 61 6e  | main memory, an|
000064f0  64 20 74 68 65 0d 73 74  61 63 6b 20 69 73 20 61  |d the.stack is a|
00006500  20 73 61 66 65 20 70 6c  61 63 65 20 74 6f 20 64  | safe place to d|
00006510  6f 20 73 6f 2e 0d 0d 46  72 6f 6d 20 61 20 53 65  |o so...From a Se|
00006520  72 76 69 63 65 20 52 4f  4d 20 79 6f 75 20 63 61  |rvice ROM you ca|
00006530  6e 20 61 64 64 72 65 73  73 20 49 2f 4f 20 6d 65  |n address I/O me|
00006540  6d 6f 72 79 20 72 65 61  73 6f 6e 61 62 6c 79 0d  |mory reasonably.|
00006550  73 61 66 65 6c 79 20 73  69 6e 63 65 20 79 6f 75  |safely since you|
00006560  72 20 63 6f 64 65 20 77  69 6c 6c 20 6e 65 76 65  |r code will neve|
00006570  72 20 65 78 65 63 75 74  65 20 69 6e 20 61 20 73  |r execute in a s|
00006580  65 63 6f 6e 64 0d 70 72  6f 63 65 73 73 6f 72 2e  |econd.processor.|
00006590  20 20 4f 66 74 65 6e 20  73 70 65 65 64 20 69 73  |  Often speed is|
000065a0  20 69 6d 70 6f 72 74 61  6e 74 2c 20 61 6e 64 20  | important, and |
000065b0  79 6f 75 20 63 61 6e 20  74 61 6b 65 0d 61 64 76  |you can take.adv|
000065c0  61 6e 74 61 67 65 20 6f  66 20 79 6f 75 72 20 70  |antage of your p|
000065d0  6c 61 63 65 20 69 6e 20  74 68 65 20 49 2f 4f 20  |lace in the I/O |
000065e0  70 72 6f 63 65 73 73 6f  72 2e 0d 0d 54 68 61 74  |processor...That|
000065f0  20 6c 65 61 64 73 20 6d  65 20 61 6c 6d 6f 73 74  | leads me almost|
00006600  20 6e 65 61 74 6c 79 20  6f 6e 74 6f 20 74 68 65  | neatly onto the|
00006610  20 74 6f 70 69 63 20 66  6f 72 20 74 68 65 20 6e  | topic for the n|
00006620  65 78 74 0d 6d 6f 64 75  6c 65 2e 20 20 41 63 6f  |ext.module.  Aco|
00006630  72 6e 20 6f 66 74 65 6e  20 74 65 6c 6c 20 75 73  |rn often tell us|
00006640  20 77 68 61 74 20 69 73  20 6c 65 67 61 6c 20 61  | what is legal a|
00006650  6e 64 20 77 68 61 74 20  69 73 0d 69 6c 6c 65 67  |nd what is.illeg|
00006660  61 6c 2e 20 49 20 77 69  6c 6c 20 65 78 70 61 6e  |al. I will expan|
00006670  64 20 6f 6e 20 74 68 61  74 20 73 75 62 6a 65 63  |d on that subjec|
00006680  74 20 6e 65 78 74 20 74  69 6d 65 2e 0d           |t next time..|
0000668d
OS\BITS/T\OSB24.m0
OS\BITS/T\OSB24.m1
OS\BITS/T\OSB24.m2
OS\BITS/T\OSB24.m4
OS\BITS/T\OSB24.m5