Home » CEEFAX disks » telesoftware6.adl » T\OSB24

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 » telesoftware6.adl
Filename: T\OSB24
Read OK:
File size: 664A bytes
Load address: 0000
Exec address: FFFFFFFF
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 pageing 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 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 numbererd
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 raising the
value in Y by the number of pages of this you need and then
storing this value in a ROM workspace table.  When you need
to find out where your private workspace starts you can look
in that table what 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 interrup 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
follow 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 imposible, and not recommended, to asssemble 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 build-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 strightforward 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 reponse
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 worth 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 maim 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 reasonable
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 70 61  |e is known as pa|
00000430  67 65 69 6e 67 20 69 74  20 69 6e 74 6f 20 74 68  |geing it into th|
00000440  65 20 6d 65 6d 6f 72 79  20 6d 61 70 0d 74 68 65  |e memory map.the|
00000450  73 65 20 52 4f 4d 53 20  61 72 65 20 73 6f 6d 65  |se ROMS are some|
00000460  74 69 6d 65 73 20 6b 6e  6f 77 6e 20 61 73 20 70  |times known as p|
00000470  61 67 65 64 20 52 4f 4d  73 2e 20 20 4f 6e 20 61  |aged ROMs.  On a|
00000480  6e 0d 75 6e 65 78 70 61  6e 64 65 64 20 42 42 43  |n.unexpanded BBC|
00000490  20 42 20 74 68 65 72 65  20 61 72 65 20 66 6f 75  | B there are fou|
000004a0  72 20 73 6f 63 6b 65 74  73 20 6f 6e 20 74 68 65  |r sockets on the|
000004b0  20 6d 61 69 6e 20 70 72  69 6e 74 65 64 0d 63 69  | main printed.ci|
000004c0  72 63 75 69 74 20 62 6f  61 72 64 2c 20 62 75 74  |rcuit board, but|
000004d0  20 6d 61 6e 79 20 70 65  6f 70 6c 65 20 68 61 76  | many people hav|
000004e0  65 20 61 64 64 65 64 20  65 78 74 72 61 20 73 6f  |e added extra so|
000004f0  63 6b 65 74 73 20 74 6f  0d 62 72 69 6e 67 20 74  |ckets to.bring t|
00000500  68 65 20 74 6f 74 61 6c  20 75 70 20 74 6f 20 31  |he total up to 1|
00000510  36 2e 20 20 54 68 65 20  70 61 67 65 64 20 6d 65  |6.  The paged me|
00000520  6d 6f 72 79 20 63 61 6e  20 62 65 20 52 41 4d 20  |mory can be RAM |
00000530  61 73 0d 77 65 6c 6c 20  61 73 20 52 4f 4d 2c 20  |as.well as ROM, |
00000540  74 68 65 20 4f 53 20 64  6f 65 73 6e 27 74 20 63  |the OS doesn't c|
00000550  61 72 65 20 77 68 69 63  68 2e 20 20 57 69 74 68  |are which.  With|
00000560  20 73 69 64 65 77 61 79  73 20 52 41 4d 0d 79 6f  | sideways RAM.yo|
00000570  75 20 63 61 6e 20 6c 6f  61 64 20 69 6e 20 77 68  |u can load in wh|
00000580  61 74 20 69 73 20 63 61  6c 6c 65 64 20 61 20 27  |at is called a '|
00000590  52 4f 4d 20 49 6d 61 67  65 27 20 66 72 6f 6d 20  |ROM Image' from |
000005a0  64 69 73 63 20 61 6e 64  0d 74 68 65 20 52 41 4d  |disc and.the RAM|
000005b0  20 77 69 6c 6c 20 74 68  65 6e 20 62 65 68 61 76  | will then behav|
000005c0  65 20 61 73 20 69 66 20  69 74 20 77 61 73 20 61  |e as if it was a|
000005d0  20 73 69 64 65 77 61 79  73 20 52 4f 4d 2e 20 20  | sideways ROM.  |
000005e0  4d 6f 72 65 0d 6f 6e 20  52 4f 4d 20 69 6d 61 67  |More.on ROM imag|
000005f0  65 73 20 69 6e 20 61 20  6d 6f 6d 65 6e 74 2e 0d  |es in a moment..|
00000600  0d 55 73 75 61 6c 6c 79  20 74 68 65 73 65 20 73  |.Usually these s|
00000610  69 64 65 77 61 79 73 20  52 4f 4d 73 20 63 6f 6e  |ideways ROMs con|
00000620  74 61 69 6e 20 6d 61 63  68 69 6e 65 20 63 6f 64  |tain machine cod|
00000630  65 20 70 72 6f 67 72 61  6d 73 2e 20 0d 54 68 65  |e programs. .The|
00000640  79 20 68 61 76 65 20 74  68 65 20 61 64 76 61 6e  |y have the advan|
00000650  74 61 67 65 20 74 68 61  74 2c 20 61 70 61 72 74  |tage that, apart|
00000660  20 66 72 6f 6d 20 6d 65  6d 6f 72 79 20 72 65 71  | from memory req|
00000670  75 69 72 65 6d 65 6e 74  73 0d 66 6f 72 20 77 6f  |uirements.for wo|
00000680  72 6b 73 70 61 63 65 2c  20 76 61 72 69 61 62 6c  |rkspace, variabl|
00000690  65 73 20 61 6e 64 20 74  68 65 20 6c 69 6b 65 2c  |es and the like,|
000006a0  20 74 68 65 79 20 75 73  65 20 75 70 20 6e 6f 20  | they use up no |
000006b0  75 73 65 72 0d 6d 65 6d  6f 72 79 2e 20 20 54 68  |user.memory.  Th|
000006c0  69 73 20 69 73 20 75 6e  6c 69 6b 65 20 61 20 42  |is is unlike a B|
000006d0  41 53 49 43 20 70 72 6f  67 72 61 6d 2c 20 6f 72  |ASIC program, or|
000006e0  20 61 20 6d 61 63 68 69  6e 65 20 63 6f 64 65 0d  | a machine code.|
000006f0  70 72 6f 67 72 61 6d 20  79 6f 75 20 77 72 69 74  |program you writ|
00000700  65 20 79 6f 75 72 73 65  6c 66 20 61 6e 64 20 74  |e yourself and t|
00000710  68 65 6e 20 70 75 74 20  69 6e 74 6f 20 75 73 65  |hen put into use|
00000720  72 20 6d 65 6d 6f 72 79  0d 77 68 65 72 65 20 74  |r memory.where t|
00000730  68 65 20 70 72 6f 67 72  61 6d 20 61 6c 73 6f 20  |he program also |
00000740  6f 63 63 75 70 69 65 73  20 70 61 72 74 20 6f 66  |occupies part of|
00000750  20 75 73 65 72 20 52 41  4d 2e 0d 0d 54 68 65 72  | user RAM...Ther|
00000760  65 20 61 72 65 20 62 61  73 69 63 61 6c 6c 79 20  |e are basically |
00000770  74 77 6f 20 74 79 70 65  73 20 6f 66 20 73 69 64  |two types of sid|
00000780  65 77 61 79 73 20 52 4f  4d 3a 0d 0d 4c 61 6e 67  |eways ROM:..Lang|
00000790  75 61 67 65 73 3a 20 20  20 20 54 68 65 73 65 20  |uages:    These |
000007a0  61 72 65 20 61 6e 79 20  70 72 6f 67 72 61 6d 20  |are any program |
000007b0  74 68 61 74 20 74 61 6b  65 73 20 6f 76 65 72 20  |that takes over |
000007c0  63 6f 6e 74 72 6f 6c 0d  6f 66 20 74 68 65 20 6d  |control.of the m|
000007d0  69 63 72 6f 2e 20 20 42  41 53 49 43 20 69 73 20  |icro.  BASIC is |
000007e0  74 68 65 20 6d 6f 73 74  20 6f 62 76 69 6f 75 73  |the most obvious|
000007f0  2c 20 62 75 74 20 77 6f  72 64 0d 70 72 6f 63 65  |, but word.proce|
00000800  73 73 6f 72 73 2c 20 73  70 72 65 61 64 20 73 68  |ssors, spread sh|
00000810  65 65 74 73 2c 20 64 61  74 61 62 61 73 65 73 20  |eets, databases |
00000820  61 6e 64 20 65 76 65 6e  20 6d 61 63 68 69 6e 65  |and even machine|
00000830  20 63 6f 64 65 0d 6d 6f  6e 69 74 6f 72 73 20 67  | code.monitors g|
00000840  65 6e 65 72 61 6c 6c 79  20 6f 70 65 72 61 74 65  |enerally operate|
00000850  20 61 73 20 6c 61 6e 67  75 61 67 65 73 2e 0d 0d  | as languages...|
00000860  53 65 72 76 69 63 65 20  52 4f 4d 73 3a 20 20 20  |Service ROMs:   |
00000870  20 54 68 65 73 65 20 75  73 75 61 6c 6c 79 20 63  | These usually c|
00000880  6f 6e 74 61 69 6e 20 70  72 6f 67 72 61 6d 73 20  |ontain programs |
00000890  74 68 61 74 20 63 61 72  72 79 0d 6f 75 74 20 73  |that carry.out s|
000008a0  6f 6d 65 20 75 73 65 66  75 6c 20 66 75 6e 63 74  |ome useful funct|
000008b0  69 6f 6e 20 2c 20 6f 72  20 73 65 72 76 69 63 65  |ion , or service|
000008c0  2c 20 61 6e 64 20 77 69  6c 6c 20 62 65 20 63 61  |, and will be ca|
000008d0  6c 6c 65 64 0d 66 72 6f  6d 20 77 69 74 68 69 6e  |lled.from within|
000008e0  20 61 20 6c 61 6e 67 75  61 67 65 2c 20 6f 72 20  | a language, or |
000008f0  64 69 72 65 63 74 20 66  72 6f 6d 20 74 68 65 20  |direct from the |
00000900  4f 53 2e 20 20 46 69 6c  69 6e 67 0d 73 79 73 74  |OS.  Filing.syst|
00000910  65 6d 73 20 6c 69 6b 65  20 74 68 65 20 44 46 53  |ems like the DFS|
00000920  20 6f 72 20 41 44 46 53  2c 20 61 6e 64 20 74 6f  | or ADFS, and to|
00000930  6f 6c 6b 69 74 20 74 79  70 65 20 52 4f 4d 73 0d  |olkit type ROMs.|
00000940  67 65 6e 65 72 61 6c 6c  79 20 61 72 65 20 73 65  |generally are se|
00000950  72 76 69 63 65 20 52 4f  4d 73 2e 0d 0d 59 6f 75  |rvice ROMs...You|
00000960  20 6d 69 67 68 74 20 63  6f 6e 73 69 64 65 72 20  | might consider |
00000970  61 20 52 4f 4d 20 74 6f  20 62 65 20 68 61 6c 66  |a ROM to be half|
00000980  2d 61 6e 64 2d 68 61 6c  66 20 69 66 20 69 74 73  |-and-half if its|
00000990  20 6c 61 6e 67 75 61 67  65 0d 66 75 6e 63 74 69  | language.functi|
000009a0  6f 6e 73 20 77 65 72 65  20 6f 6e 20 61 20 70 61  |ons were on a pa|
000009b0  72 20 77 69 74 68 20 69  74 73 20 73 65 72 76 69  |r with its servi|
000009c0  63 65 20 6f 6e 65 73 2e  20 20 54 68 65 20 42 42  |ce ones.  The BB|
000009d0  43 20 53 6f 66 74 0d 41  54 53 20 52 4f 4d 20 69  |C Soft.ATS ROM i|
000009e0  73 20 6c 69 6b 65 20 74  68 69 73 2e 20 20 54 68  |s like this.  Th|
000009f0  65 20 74 65 6c 65 74 65  78 74 20 64 69 73 70 6c  |e teletext displ|
00000a00  61 79 20 70 61 72 74 20  6f 66 20 74 68 65 0d 70  |ay part of the.p|
00000a10  72 6f 67 72 61 6d 20 69  73 20 61 20 6c 61 6e 67  |rogram is a lang|
00000a20  75 61 67 65 20 77 68 69  6c 65 20 74 68 65 20 70  |uage while the p|
00000a30  61 67 65 20 67 72 61 62  62 69 6e 67 20 66 75 6e  |age grabbing fun|
00000a40  63 74 69 6f 6e 73 0d 6f  70 65 72 61 74 65 20 61  |ctions.operate a|
00000a50  73 20 73 65 72 76 69 63  65 20 63 61 6c 6c 73 2e  |s service calls.|
00000a60  0d 0d 49 74 20 69 73 20  70 6f 73 73 69 62 6c 65  |..It is possible|
00000a70  20 66 6f 72 20 61 20 6c  61 6e 67 75 61 67 65 20  | for a language |
00000a80  52 4f 4d 20 74 6f 20 68  61 76 65 20 73 6f 6d 65  |ROM to have some|
00000a90  20 73 65 72 76 69 63 65  0d 65 6c 65 6d 65 6e 74  | service.element|
00000aa0  73 20 69 6e 20 69 74 2e  20 20 45 76 65 72 79 20  |s in it.  Every |
00000ab0  52 4f 4d 20 65 78 63 65  70 74 20 42 41 53 49 43  |ROM except BASIC|
00000ac0  20 6d 75 73 74 20 72 65  73 70 6f 6e 64 20 74 6f  | must respond to|
00000ad0  0d 63 61 6c 6c 73 20 66  6f 72 20 73 65 72 76 69  |.calls for servi|
00000ae0  63 65 20 65 76 65 6e 20  69 66 20 6f 6e 6c 79 20  |ce even if only |
00000af0  74 6f 20 73 65 6c 65 63  74 20 74 68 65 6d 73 65  |to select themse|
00000b00  6c 76 65 73 2e 20 0d 53  65 6c 65 63 74 69 6f 6e  |lves. .Selection|
00000b10  20 6f 66 20 42 41 53 49  43 2c 20 77 69 74 68 20  | of BASIC, with |
00000b20  2a 42 41 53 49 43 2c 20  69 73 20 61 6e 20 65 78  |*BASIC, is an ex|
00000b30  63 65 70 74 69 6f 6e 20  62 65 63 61 75 73 65 20  |ception because |
00000b40  74 68 65 0d 63 6f 64 65  20 74 6f 20 73 65 6c 65  |the.code to sele|
00000b50  63 74 20 69 74 20 69 73  20 77 69 74 68 69 6e 20  |ct it is within |
00000b60  74 68 65 20 4f 53 2e 20  20 41 6c 74 68 6f 75 67  |the OS.  Althoug|
00000b70  68 20 79 6f 75 20 63 61  6e 0d 6f 70 65 72 61 74  |h you can.operat|
00000b80  65 20 61 20 42 42 43 20  4d 69 63 72 6f 20 77 69  |e a BBC Micro wi|
00000b90  74 68 6f 75 74 20 42 41  53 49 43 20 69 74 20 69  |thout BASIC it i|
00000ba0  73 20 75 6e 75 73 75 61  6c 20 74 6f 20 64 6f 20  |s unusual to do |
00000bb0  73 6f 2e 0d 0d 54 68 65  20 6f 70 65 72 61 74 69  |so...The operati|
00000bc0  6f 6e 20 6f 66 20 73 69  64 65 77 61 79 73 20 52  |on of sideways R|
00000bd0  4f 4d 73 20 69 73 20 62  6f 74 68 20 63 6f 6d 70  |OMs is both comp|
00000be0  6c 69 63 61 74 65 64 20  61 6e 64 0d 73 69 6d 70  |licated and.simp|
00000bf0  6c 65 2e 20 20 54 68 65  20 73 69 6d 70 6c 65 20  |le.  The simple |
00000c00  70 61 72 74 20 69 73 20  74 68 61 74 2c 20 77 69  |part is that, wi|
00000c10  74 68 20 61 20 66 65 77  20 70 72 6f 76 69 73 6f  |th a few proviso|
00000c20  73 2c 20 69 74 20 69 73  0d 61 73 20 65 61 73 79  |s, it is.as easy|
00000c30  20 74 6f 20 77 72 69 74  65 20 6d 61 63 68 69 6e  | to write machin|
00000c40  65 20 63 6f 64 65 20 66  6f 72 20 61 20 73 69 64  |e code for a sid|
00000c50  65 77 61 79 73 20 52 4f  4d 20 61 73 20 66 6f 72  |eways ROM as for|
00000c60  20 6d 61 69 6e 0d 6d 65  6d 6f 72 79 2e 20 20 54  | main.memory.  T|
00000c70  68 65 20 63 6f 6d 70 6c  69 63 61 74 65 64 20 62  |he complicated b|
00000c80  69 74 20 69 73 20 65 78  70 6c 61 69 6e 69 6e 67  |it is explaining|
00000c90  20 68 6f 77 20 74 68 65  20 4f 53 20 6b 65 65 70  | how the OS keep|
00000ca0  73 0d 74 72 61 63 6b 20  6f 66 20 74 68 65 20 52  |s.track of the R|
00000cb0  4f 4d 73 20 61 6e 64 20  6b 6e 6f 77 73 20 77 68  |OMs and knows wh|
00000cc0  69 63 68 20 6f 6e 65 20  74 6f 20 70 61 67 65 20  |ich one to page |
00000cd0  69 6e 74 6f 20 6d 65 6d  6f 72 79 20 61 74 0d 74  |into memory at.t|
00000ce0  68 65 20 61 70 70 72 6f  70 72 69 61 74 65 20 74  |he appropriate t|
00000cf0  69 6d 65 2e 0d 0d 54 68  65 20 68 6f 75 73 65 6b  |ime...The housek|
00000d00  65 65 70 69 6e 67 20 66  6f 72 20 52 4f 4d 73 20  |eeping for ROMs |
00000d10  69 73 20 63 61 72 72 69  65 64 20 6f 75 74 20 62  |is carried out b|
00000d20  79 20 61 20 73 65 72 69  65 73 20 6f 66 0d 73 65  |y a series of.se|
00000d30  72 76 69 63 65 20 63 61  6c 6c 73 2e 20 20 41 74  |rvice calls.  At|
00000d40  20 63 65 72 74 61 69 6e  20 74 69 6d 65 73 2c 20  | certain times, |
00000d50  73 75 63 68 20 61 73 20  6f 6e 20 70 6f 77 65 72  |such as on power|
00000d60  20 75 70 20 6f 72 0d 72  65 73 65 74 2c 20 6f 72  | up or.reset, or|
00000d70  20 77 68 65 6e 20 61 6e  20 75 6e 6b 6e 6f 77 6e  | when an unknown|
00000d80  20 2a 63 6f 6d 6d 61 6e  64 20 69 73 20 73 65 6e  | *command is sen|
00000d90  74 20 74 6f 20 74 68 65  20 63 6f 6d 6d 61 6e 64  |t to the command|
00000da0  0d 6c 69 6e 65 20 69 6e  74 65 72 70 72 65 74 65  |.line interprete|
00000db0  72 2c 20 61 20 73 65 72  76 69 63 65 20 63 61 6c  |r, a service cal|
00000dc0  6c 20 69 73 20 73 65 6e  74 2e 20 20 54 68 65 20  |l is sent.  The |
00000dd0  66 69 72 73 74 20 66 65  77 0d 62 79 74 65 73 20  |first few.bytes |
00000de0  6f 66 20 65 76 65 72 79  20 73 69 64 65 77 61 79  |of every sideway|
00000df0  73 20 52 4f 4d 20 68 61  76 65 20 74 6f 20 66 6f  |s ROM have to fo|
00000e00  6c 6c 6f 77 20 61 20 66  6f 72 6d 61 74 20 6c 61  |llow a format la|
00000e10  69 64 0d 64 6f 77 6e 20  62 79 20 41 63 6f 72 6e  |id.down by Acorn|
00000e20  2e 20 20 54 68 69 73 20  69 73 20 70 61 72 74 20  |.  This is part |
00000e30  6f 66 20 74 68 65 20 52  4f 4d 20 69 6d 61 67 65  |of the ROM image|
00000e40  20 49 20 72 65 66 65 72  72 65 64 20 74 6f 0d 65  | I referred to.e|
00000e50  61 72 6c 69 65 72 2e 20  20 49 74 20 6c 6f 6f 6b  |arlier.  It look|
00000e60  73 20 6c 69 6b 65 20 74  68 69 73 2e 0d 0d 20 20  |s like this...  |
00000e70  20 20 26 38 30 30 30 20  20 20 20 20 20 20 4a 4d  |  &8000       JM|
00000e80  50 20 3c 6c 61 6e 67 75  61 67 65 20 65 6e 74 72  |P <language entr|
00000e90  79 20 70 6f 69 6e 74 3e  0d 20 20 20 20 26 38 30  |y point>.    &80|
00000ea0  30 33 20 20 20 20 20 20  20 4a 4d 50 20 3c 73 65  |03       JMP <se|
00000eb0  72 76 69 63 65 20 65 6e  74 72 79 20 70 6f 69 6e  |rvice entry poin|
00000ec0  74 3e 0d 20 20 20 20 26  38 30 30 36 20 20 20 20  |t>.    &8006    |
00000ed0  20 20 20 52 4f 4d 20 74  79 70 65 20 66 6c 61 67  |   ROM type flag|
00000ee0  0d 20 20 20 20 26 38 30  30 37 20 20 20 20 20 20  |.    &8007      |
00000ef0  20 4f 66 66 73 65 74 20  74 6f 20 73 74 61 72 74  | Offset to start|
00000f00  20 6f 66 20 63 6f 70 79  72 69 67 68 74 20 73 74  | of copyright st|
00000f10  72 69 6e 67 0d 20 20 20  20 26 38 30 30 38 20 20  |ring.    &8008  |
00000f20  20 20 20 20 20 56 65 72  73 69 6f 6e 20 6e 75 6d  |     Version num|
00000f30  62 65 72 20 28 69 6e 20  62 69 6e 61 72 79 29 0d  |ber (in binary).|
00000f40  20 20 20 20 26 38 30 30  39 20 20 20 20 20 20 20  |    &8009       |
00000f50  54 69 74 6c 65 20 73 74  72 69 6e 67 0d 0d 54 68  |Title string..Th|
00000f60  65 20 52 4f 4d 20 74 79  70 65 20 66 6c 61 67 20  |e ROM type flag |
00000f70  69 73 20 6d 61 64 65 20  75 70 20 6f 66 20 74 68  |is made up of th|
00000f80  65 20 66 6f 6c 6c 6f 77  69 6e 67 20 62 69 74 73  |e following bits|
00000f90  3a 0d 0d 62 69 74 20 37  20 69 73 20 73 65 74 20  |:..bit 7 is set |
00000fa0  77 68 65 6e 20 74 68 65  20 52 4f 4d 20 68 61 73  |when the ROM has|
00000fb0  20 61 20 73 65 72 76 69  63 65 20 65 6e 74 72 79  | a service entry|
00000fc0  20 70 6f 69 6e 74 2c 20  61 6c 6c 0d 52 4f 4d 73  | point, all.ROMs|
00000fd0  20 65 78 63 65 70 74 20  42 41 53 49 43 20 77 69  | except BASIC wi|
00000fe0  6c 6c 20 68 61 76 65 20  74 68 69 73 20 62 69 74  |ll have this bit|
00000ff0  20 73 65 74 0d 0d 62 69  74 20 36 20 69 73 20 73  | set..bit 6 is s|
00001000  65 74 20 69 66 20 74 68  65 20 52 4f 4d 20 69 73  |et if the ROM is|
00001010  20 61 20 6c 61 6e 67 75  61 67 65 0d 0d 62 69 74  | a language..bit|
00001020  20 35 20 69 73 20 73 65  74 20 69 66 20 74 68 65  | 5 is set if the|
00001030  20 52 4f 4d 20 69 73 20  61 20 6c 61 6e 67 75 61  | ROM is a langua|
00001040  67 65 20 77 68 69 63 68  20 72 65 6c 6f 63 61 74  |ge which relocat|
00001050  65 73 20 74 6f 20 61 6e  0d 61 64 64 72 65 73 73  |es to an.address|
00001060  20 6f 74 68 65 72 20 74  68 61 6e 20 26 38 30 30  | other than &800|
00001070  30 20 77 68 65 6e 20 69  6e 20 61 20 73 65 63 6f  |0 when in a seco|
00001080  6e 64 20 70 72 6f 63 65  73 73 6f 72 0d 0d 62 69  |nd processor..bi|
00001090  74 20 34 20 69 73 20 6e  6f 74 20 75 73 65 64 20  |t 4 is not used |
000010a0  69 6e 20 74 68 65 20 42  42 43 20 6d 69 63 72 6f  |in the BBC micro|
000010b0  2c 20 69 74 20 66 75 6c  66 69 6c 73 20 73 6f 6d  |, it fulfils som|
000010c0  65 20 70 75 72 70 6f 73  65 0d 69 6e 20 61 6e 20  |e purpose.in an |
000010d0  45 6c 65 63 74 72 6f 6e  0d 0d 62 69 74 73 20 33  |Electron..bits 3|
000010e0  20 74 6f 20 30 20 64 65  6e 6f 74 65 20 74 68 65  | to 0 denote the|
000010f0  20 74 79 70 65 20 6f 66  20 6d 61 63 68 69 6e 65  | type of machine|
00001100  20 63 6f 64 65 20 69 6e  20 74 68 65 20 52 4f 4d  | code in the ROM|
00001110  2e 20 0d 54 68 65 72 65  20 61 72 65 20 61 72 72  |. .There are arr|
00001120  61 6e 67 65 6d 65 6e 74  73 20 6f 66 20 74 68 65  |angements of the|
00001130  73 65 20 62 69 74 73 20  73 70 65 63 69 66 69 65  |se bits specifie|
00001140  64 20 66 6f 72 20 36 35  30 32 0d 63 6f 64 65 2c  |d for 6502.code,|
00001150  20 36 38 30 30 30 20 63  6f 64 65 2c 20 5a 38 30  | 68000 code, Z80|
00001160  20 63 6f 64 65 2c 20 33  32 30 31 36 20 63 6f 64  | code, 32016 cod|
00001170  65 2c 20 38 30 31 38 36  20 61 6e 64 20 38 30 32  |e, 80186 and 802|
00001180  38 36 20 63 6f 64 65 0d  69 6e 20 74 68 65 20 42  |86 code.in the B|
00001190  42 43 20 4d 61 73 74 65  72 20 68 61 6e 64 62 6f  |BC Master handbo|
000011a0  6f 6b 2e 20 20 49 66 20  79 6f 75 20 68 61 76 65  |ok.  If you have|
000011b0  20 61 20 52 4f 4d 20 74  68 61 74 20 63 6f 6e 74  | a ROM that cont|
000011c0  61 69 6e 73 0d 36 35 30  32 20 6d 61 63 68 69 6e  |ains.6502 machin|
000011d0  65 20 63 6f 64 65 20 61  6e 64 20 69 73 20 61 20  |e code and is a |
000011e0  73 65 72 76 69 63 65 20  52 4f 4d 20 6f 6e 6c 79  |service ROM only|
000011f0  2c 20 74 68 65 6e 20 74  68 69 73 20 62 79 74 65  |, then this byte|
00001200  0d 77 6f 75 6c 64 20 62  65 20 26 38 32 2e 0d 0d  |.would be &82...|
00001210  54 68 65 20 52 4f 4d 20  74 79 70 65 20 66 6c 61  |The ROM type fla|
00001220  67 20 69 73 20 63 6f 70  69 65 64 2c 20 62 79 20  |g is copied, by |
00001230  74 68 65 20 4f 53 2c 20  69 6e 74 6f 20 61 20 31  |the OS, into a 1|
00001240  36 20 62 79 74 65 20 52  4f 4d 0d 69 6e 66 6f 72  |6 byte ROM.infor|
00001250  6d 61 74 69 6f 6e 20 74  61 62 6c 65 20 77 68 65  |mation table whe|
00001260  6e 65 76 65 72 20 61 20  72 65 73 65 74 20 6f 63  |never a reset oc|
00001270  63 75 72 73 2c 20 73 75  63 68 20 61 73 20 6f 6e  |curs, such as on|
00001280  20 61 0d 42 52 45 41 4b  2e 20 20 4f 53 42 59 54  | a.BREAK.  OSBYT|
00001290  45 20 31 37 30 20 28 61  6e 64 20 31 37 31 29 20  |E 170 (and 171) |
000012a0  61 72 65 20 75 73 65 64  20 74 6f 20 72 65 61 64  |are used to read|
000012b0  20 74 68 65 20 73 74 61  72 74 0d 61 64 64 72 65  | the start.addre|
000012c0  73 73 20 66 6f 72 20 74  68 69 73 20 74 61 62 6c  |ss for this tabl|
000012d0  65 2c 20 61 6e 64 20 74  68 65 20 62 79 74 65 20  |e, and the byte |
000012e0  66 6f 72 20 73 6f 63 6b  65 74 20 58 20 69 73 20  |for socket X is |
000012f0  66 6f 75 6e 64 20 58 0d  62 79 74 65 73 20 61 62  |found X.bytes ab|
00001300  6f 76 65 20 74 68 61 74  20 73 74 61 72 74 20 61  |ove that start a|
00001310  64 64 72 65 73 73 2e 20  20 49 66 20 6e 6f 20 52  |ddress.  If no R|
00001320  4f 4d 20 69 73 20 70 72  65 73 65 6e 74 20 69 6e  |OM is present in|
00001330  20 61 0d 73 6f 63 6b 65  74 20 74 68 65 6e 20 74  | a.socket then t|
00001340  68 61 74 20 73 6f 63 6b  65 74 27 73 20 70 6f 73  |hat socket's pos|
00001350  69 74 69 6f 6e 20 69 6e  20 74 68 65 20 52 4f 4d  |ition in the ROM|
00001360  20 69 6e 66 6f 72 6d 61  74 69 6f 6e 0d 74 61 62  | information.tab|
00001370  6c 65 20 68 6f 6c 64 73  20 7a 65 72 6f 2e 20 20  |le holds zero.  |
00001380  59 6f 75 20 63 61 6e 20  66 6f 6f 6c 20 74 68 65  |You can fool the|
00001390  20 4f 53 20 69 6e 74 6f  20 69 67 6e 6f 72 69 6e  | OS into ignorin|
000013a0  67 20 61 20 52 4f 4d 0d  62 79 20 77 72 69 74 69  |g a ROM.by writi|
000013b0  6e 67 20 61 20 7a 65 72  6f 20 69 6e 74 6f 20 69  |ng a zero into i|
000013c0  74 73 20 70 6f 73 69 74  69 6f 6e 20 69 6e 20 74  |ts position in t|
000013d0  68 65 20 52 4f 4d 20 69  6e 66 6f 72 6d 61 74 69  |he ROM informati|
000013e0  6f 6e 0d 74 61 62 6c 65  3b 20 62 75 74 2c 20 61  |on.table; but, a|
000013f0  73 20 49 20 68 61 76 65  20 61 6c 72 65 61 64 79  |s I have already|
00001400  20 73 61 69 64 2c 20 74  68 69 73 20 74 61 62 6c  | said, this tabl|
00001410  65 20 69 73 20 72 65 77  72 69 74 74 65 6e 0d 6f  |e is rewritten.o|
00001420  6e 20 61 20 42 52 45 41  4b 20 28 72 65 73 65 74  |n a BREAK (reset|
00001430  29 2e 20 20 49 6e 20 61  20 4d 41 53 54 45 52 20  |).  In a MASTER |
00001440  6d 69 63 72 6f 20 79 6f  75 20 63 61 6e 20 27 75  |micro you can 'u|
00001450  6e 70 6c 75 67 27 20 61  0d 52 4f 4d 20 69 6e 20  |nplug' a.ROM in |
00001460  73 6f 66 74 77 61 72 65  20 77 69 74 68 20 61 6e  |software with an|
00001470  20 4f 53 20 63 6f 6d 6d  61 6e 64 2e 20 20 59 6f  | OS command.  Yo|
00001480  75 20 6d 69 67 68 74 20  77 61 6e 74 20 74 6f 0d  |u might want to.|
00001490  72 65 6d 6f 76 65 20 61  20 52 4f 4d 20 66 72 6f  |remove a ROM fro|
000014a0  6d 20 74 68 65 20 6d 61  63 68 69 6e 65 20 69 6e  |m the machine in|
000014b0  20 6f 72 64 65 72 20 74  6f 20 73 74 6f 70 20 63  | order to stop c|
000014c0  6c 61 73 68 65 73 20 77  69 74 68 0d 63 6f 6d 6d  |lashes with.comm|
000014d0  61 6e 64 73 20 6f 72 20  6f 76 65 72 20 77 6f 72  |ands or over wor|
000014e0  6b 73 70 61 63 65 2e 20  20 28 4d 6f 72 65 20 6f  |kspace.  (More o|
000014f0  6e 20 74 68 69 73 20 69  6e 20 74 68 65 20 6e 65  |n this in the ne|
00001500  78 74 0d 6d 6f 64 75 6c  65 2e 29 0d 0d 54 68 65  |xt.module.)..The|
00001510  20 63 6f 70 79 72 69 67  68 74 20 73 74 72 69 6e  | copyright strin|
00001520  67 20 68 61 73 20 74 6f  20 73 74 61 72 74 20 77  |g has to start w|
00001530  69 74 68 20 28 43 29 20  61 6e 64 20 69 73 20 74  |ith (C) and is t|
00001540  68 65 6e 0d 75 73 75 61  6c 6c 79 20 66 6f 6c 6c  |hen.usually foll|
00001550  6f 77 65 64 20 62 79 20  74 68 65 20 6e 61 6d 65  |owed by the name|
00001560  20 6f 66 20 74 68 65 20  63 6f 70 79 72 69 67 68  | of the copyrigh|
00001570  74 20 68 6f 6c 64 65 72  20 61 6e 64 20 74 68 65  |t holder and the|
00001580  0d 64 61 74 65 2e 20 20  49 74 20 75 73 75 61 6c  |.date.  It usual|
00001590  6c 79 20 66 6f 6c 6c 6f  77 73 20 74 68 65 20 74  |ly follows the t|
000015a0  69 74 6c 65 20 73 74 72  69 6e 67 20 69 6e 20 74  |itle string in t|
000015b0  68 65 20 68 65 61 64 65  72 2e 20 0d 54 68 65 20  |he header. .The |
000015c0  74 69 74 6c 65 20 73 74  72 69 6e 67 20 69 73 20  |title string is |
000015d0  74 68 65 20 73 74 72 69  6e 67 20 70 72 69 6e 74  |the string print|
000015e0  65 64 20 6f 75 74 20 69  66 20 74 68 65 20 52 4f  |ed out if the RO|
000015f0  4d 20 69 73 0d 73 65 6c  65 63 74 65 64 20 61 73  |M is.selected as|
00001600  20 61 20 6c 61 6e 67 75  61 67 65 2e 20 20 42 6f  | a language.  Bo|
00001610  74 68 20 74 69 74 6c 65  20 61 6e 64 20 63 6f 70  |th title and cop|
00001620  79 72 69 67 68 74 20 73  74 72 69 6e 67 73 0d 61  |yright strings.a|
00001630  72 65 20 74 65 72 6d 69  6e 61 74 65 64 20 77 69  |re terminated wi|
00001640  74 68 20 6e 75 6c 6c 73  20 28 30 29 2e 0d 0d 49  |th nulls (0)...I|
00001650  20 68 61 76 65 20 77 72  69 74 74 65 6e 20 61 20  | have written a |
00001660  52 4f 4d 20 66 6f 72 20  74 68 69 73 20 6d 6f 64  |ROM for this mod|
00001670  75 6c 65 2e 20 20 54 68  65 20 73 6f 75 72 63 65  |ule.  The source|
00001680  20 63 6f 64 65 20 66 6f  72 0d 74 68 65 20 52 4f  | code for.the RO|
00001690  4d 20 69 73 20 69 6e 20  74 68 65 20 70 72 6f 67  |M is in the prog|
000016a0  72 61 6d 20 42 2f 6f 73  62 32 34 20 61 6e 64 20  |ram B/osb24 and |
000016b0  79 6f 75 20 6e 65 65 64  20 42 41 53 49 43 20 32  |you need BASIC 2|
000016c0  20 6f 72 0d 68 69 67 68  65 72 20 28 73 75 63 68  | or.higher (such|
000016d0  20 61 73 20 48 69 42 41  53 49 43 29 20 74 6f 20  | as HiBASIC) to |
000016e0  61 73 73 65 6d 62 6c 65  20 69 74 2e 20 20 42 65  |assemble it.  Be|
000016f0  73 69 64 65 73 20 74 68  65 0d 61 62 69 6c 69 74  |sides the.abilit|
00001700  79 20 74 6f 20 61 73 73  65 6d 62 6c 65 20 63 6f  |y to assemble co|
00001710  64 65 20 74 6f 20 72 75  6e 20 61 74 20 61 20 64  |de to run at a d|
00001720  69 66 66 65 72 65 6e 74  20 61 64 64 72 65 73 73  |ifferent address|
00001730  20 74 6f 0d 74 68 65 20  52 41 4d 20 69 74 27 73  | to.the RAM it's|
00001740  20 61 73 73 65 6d 62 6c  65 64 20 69 6e 20 28 6f  | assembled in (o|
00001750  66 20 77 68 69 63 68 20  6d 6f 72 65 20 6c 61 74  |f which more lat|
00001760  65 72 29 20 74 68 65 20  65 78 74 72 61 0d 66 61  |er) the extra.fa|
00001770  63 69 6c 69 74 69 65 73  20 6f 66 20 6c 61 74 65  |cilities of late|
00001780  72 20 42 41 53 49 43 73  20 69 6e 63 6c 75 64 65  |r BASICs include|
00001790  20 73 6f 6d 65 20 45 51  55 20 70 73 65 75 64 6f  | some EQU pseudo|
000017a0  2d 6f 70 20 63 6f 64 65  73 0d 77 68 69 63 68 20  |-op codes.which |
000017b0  61 72 65 20 61 73 20 66  6f 6c 6c 6f 77 73 3a 0d  |are as follows:.|
000017c0  0d 20 20 20 20 45 51 55  42 20 2d 20 70 75 74 20  |.    EQUB - put |
000017d0  61 20 62 79 74 65 20 69  6e 74 6f 20 6d 65 6d 6f  |a byte into memo|
000017e0  72 79 20 68 65 72 65 0d  20 20 20 20 45 51 55 57  |ry here.    EQUW|
000017f0  20 2d 20 70 75 74 20 61  20 77 6f 72 64 20 28 32  | - put a word (2|
00001800  20 62 79 74 65 73 29 20  69 6e 74 6f 20 6d 65 6d  | bytes) into mem|
00001810  6f 72 79 20 68 65 72 65  0d 20 20 20 20 45 51 55  |ory here.    EQU|
00001820  44 20 2d 20 70 75 74 20  61 20 64 6f 75 62 6c 65  |D - put a double|
00001830  20 77 6f 72 64 20 28 34  20 62 79 74 65 73 29 20  | word (4 bytes) |
00001840  69 6e 74 6f 20 6d 65 6d  6f 72 79 20 68 65 72 65  |into memory here|
00001850  0d 20 20 20 20 45 51 55  53 20 2d 20 70 75 74 20  |.    EQUS - put |
00001860  61 20 73 74 72 69 6e 67  20 69 6e 74 6f 20 6d 65  |a string into me|
00001870  6d 6f 72 79 20 68 65 72  65 0d 0d 45 51 55 57 20  |mory here..EQUW |
00001880  61 6e 64 20 45 51 55 44  20 70 75 74 20 69 6e 20  |and EQUD put in |
00001890  6e 75 6d 62 65 72 73 20  73 75 63 68 20 74 68 61  |numbers such tha|
000018a0  74 20 74 68 65 20 6d 6f  73 74 20 73 69 67 6e 69  |t the most signi|
000018b0  66 69 63 61 6e 74 0d 62  79 74 65 20 69 73 20 69  |ficant.byte is i|
000018c0  6e 20 74 68 65 20 68 69  67 68 65 73 74 20 61 64  |n the highest ad|
000018d0  64 72 65 73 73 2e 20 20  53 6f 20 69 66 20 45 51  |dress.  So if EQ|
000018e0  55 44 20 26 31 32 33 34  35 36 37 38 0d 61 70 70  |UD &12345678.app|
000018f0  65 61 72 73 20 69 6e 20  79 6f 75 72 20 63 6f 64  |ears in your cod|
00001900  65 20 61 74 20 61 64 64  72 65 73 73 20 6c 61 62  |e at address lab|
00001910  65 6c 20 27 68 65 72 65  27 20 79 6f 75 20 77 69  |el 'here' you wi|
00001920  6c 6c 20 66 69 6e 64 0d  74 68 65 20 6e 75 6d 62  |ll find.the numb|
00001930  65 72 20 69 6e 20 6d 65  6d 6f 72 79 20 6c 69 6b  |er in memory lik|
00001940  65 20 74 68 69 73 3a 0d  0d 20 20 20 20 20 20 20  |e this:..       |
00001950  20 20 20 20 20 20 68 65  72 65 20 20 20 20 20 20  |      here      |
00001960  20 20 20 20 20 26 37 38  0d 20 20 20 20 20 20 20  |     &78.       |
00001970  20 20 20 20 20 20 68 65  72 65 2b 31 20 20 20 20  |      here+1    |
00001980  20 20 20 20 20 26 35 36  0d 20 20 20 20 20 20 20  |     &56.       |
00001990  20 20 20 20 20 20 68 65  72 65 2b 32 20 20 20 20  |      here+2    |
000019a0  20 20 20 20 20 26 33 34  0d 20 20 20 20 20 20 20  |     &34.       |
000019b0  20 20 20 20 20 20 68 65  72 65 2b 33 20 20 20 20  |      here+3    |
000019c0  20 20 20 20 20 26 31 32  0d 0d 49 66 20 79 6f 75  |     &12..If you|
000019d0  20 6c 6f 6f 6b 20 61 74  20 6c 69 6e 65 73 20 33  | look at lines 3|
000019e0  38 30 20 74 6f 20 34 39  30 20 6f 66 20 42 2f 6f  |80 to 490 of B/o|
000019f0  73 62 32 34 20 79 6f 75  20 77 69 6c 6c 20 66 69  |sb24 you will fi|
00001a00  6e 64 20 74 68 65 0d 63  6f 64 65 20 74 68 61 74  |nd the.code that|
00001a10  20 61 73 73 65 6d 62 6c  65 73 20 69 6e 74 6f 20  | assembles into |
00001a20  74 68 65 20 52 4f 4d 20  68 65 61 64 65 72 2e 20  |the ROM header. |
00001a30  20 54 68 65 73 65 20 61  72 65 20 74 68 65 0d 72  | These are the.r|
00001a40  65 6c 65 76 61 6e 74 20  70 61 72 74 73 0d 0d 20  |elevant parts.. |
00001a50  20 20 20 45 51 55 57 20  30 0d 20 20 20 20 45 51  |   EQUW 0.    EQ|
00001a60  55 42 20 30 0d 20 0d 20  20 20 20 4a 4d 50 20 73  |UB 0. .    JMP s|
00001a70  65 72 76 69 63 65 5f 65  6e 74 72 79 5f 70 6f 69  |ervice_entry_poi|
00001a80  6e 74 0d 20 0d 54 68 65  72 65 20 69 73 20 6e 6f  |nt. .There is no|
00001a90  20 6c 61 6e 67 75 61 67  65 20 65 6e 74 72 79 20  | language entry |
00001aa0  73 6f 20 74 68 65 20 66  69 72 73 74 20 74 68 72  |so the first thr|
00001ab0  65 65 20 62 79 74 65 73  20 61 72 65 0d 7a 65 72  |ee bytes are.zer|
00001ac0  6f 73 2e 0d 0d 20 20 20  20 45 51 55 42 20 26 38  |os...    EQUB &8|
00001ad0  32 0d 0d 54 68 69 73 20  69 73 20 74 68 65 20 52  |2..This is the R|
00001ae0  4f 4d 20 74 79 70 65 20  66 6c 61 67 0d 0d 20 20  |OM type flag..  |
00001af0  20 20 45 51 55 42 20 63  6f 70 79 72 69 67 68 74  |  EQUB copyright|
00001b00  20 2d 20 63 6f 64 65 25  0d 20 0d 54 68 65 6e 20  | - code%. .Then |
00001b10  77 65 20 68 61 76 65 20  74 68 65 20 63 6f 70 79  |we have the copy|
00001b20  72 69 67 68 74 20 6f 66  66 73 65 74 20 62 79 74  |right offset byt|
00001b30  65 20 74 68 61 74 20 68  6f 6c 64 73 20 74 68 65  |e that holds the|
00001b40  20 6f 66 66 73 65 74 0d  6f 66 20 74 68 65 20 63  | offset.of the c|
00001b50  6f 70 79 72 69 67 68 74  20 73 74 72 69 6e 67 20  |opyright string |
00001b60  66 72 6f 6d 20 74 68 65  20 73 74 61 72 74 20 6f  |from the start o|
00001b70  66 20 74 68 65 20 63 6f  64 65 2e 0d 0d 20 20 20  |f the code...   |
00001b80  20 45 51 55 42 20 30 0d  20 0d 54 68 65 20 76 65  | EQUB 0. .The ve|
00001b90  72 73 69 6f 6e 20 62 79  74 65 20 69 73 20 7a 65  |rsion byte is ze|
00001ba0  72 6f 20 61 6e 64 20 69  73 20 66 6f 6c 6c 6f 77  |ro and is follow|
00001bb0  65 64 20 62 79 20 74 68  65 20 52 4f 4d 20 74 69  |ed by the ROM ti|
00001bc0  74 6c 65 0d 61 6e 64 20  63 6f 70 79 72 69 67 68  |tle.and copyrigh|
00001bd0  74 20 73 74 72 69 6e 67  73 2e 20 20 49 20 68 61  |t strings.  I ha|
00001be0  76 65 20 69 6e 63 6f 72  70 6f 72 61 74 65 64 20  |ve incorporated |
00001bf0  61 20 76 65 72 73 69 6f  6e 20 73 74 72 69 6e 67  |a version string|
00001c00  0d 69 6e 74 6f 20 74 68  65 20 52 4f 4d 20 74 69  |.into the ROM ti|
00001c10  74 6c 65 2e 20 20 54 68  65 20 66 6f 72 6d 61 74  |tle.  The format|
00001c20  20 6f 66 20 74 68 65 20  63 6f 70 79 72 69 67 68  | of the copyrigh|
00001c30  74 20 73 74 72 69 6e 67  20 69 73 0d 61 6c 77 61  |t string is.alwa|
00001c40  79 73 20 61 20 7a 65 72  6f 20 28 6e 75 6c 6c 29  |ys a zero (null)|
00001c50  20 62 79 74 65 20 66 6f  6c 6c 6f 77 65 64 20 62  | byte followed b|
00001c60  79 20 28 43 29 2e 20 20  54 68 65 20 66 6f 72 6d  |y (C).  The form|
00001c70  61 74 20 68 61 73 0d 74  6f 20 65 78 61 63 74 6c  |at has.to exactl|
00001c80  79 20 74 68 61 74 2c 20  6f 74 68 65 72 77 69 73  |y that, otherwis|
00001c90  65 20 74 68 65 20 4f 53  20 77 69 6c 6c 20 6e 6f  |e the OS will no|
00001ca0  74 20 72 65 63 6f 67 6e  69 73 65 20 74 68 61 74  |t recognise that|
00001cb0  0d 74 68 65 72 65 20 69  73 20 61 20 52 4f 4d 20  |.there is a ROM |
00001cc0  69 6e 20 74 68 65 20 73  6f 63 6b 65 74 2e 20 20  |in the socket.  |
00001cd0  54 72 79 20 64 65 6c 65  74 69 6e 67 20 74 68 65  |Try deleting the|
00001ce0  20 6e 75 6c 6c 20 61 6e  64 0d 73 65 65 2e 0d 0d  | null and.see...|
00001cf0  20 20 2e 72 6f 6d 5f 74  69 74 6c 65 20 20 20 20  |  .rom_title    |
00001d00  20 20 20 20 45 51 55 53  20 22 4f 53 62 69 74 73  |    EQUS "OSbits|
00001d10  20 44 65 6d 6f 20 52 4f  4d 20 22 2b 56 65 72 73  | Demo ROM "+Vers|
00001d20  69 6f 6e 24 0d 20 0d 20  20 2e 63 6f 70 79 72 69  |ion$. .  .copyri|
00001d30  67 68 74 20 20 20 20 20  20 20 20 45 51 55 53 20  |ght        EQUS |
00001d40  43 48 52 24 30 2b 22 28  43 29 42 42 43 20 22 2b  |CHR$0+"(C)BBC "+|
00001d50  44 61 74 65 24 2b 43 48  52 24 30 0d 20 0d 20 20  |Date$+CHR$0. .  |
00001d60  2e 73 65 72 76 69 63 65  5f 65 6e 74 72 79 5f 70  |.service_entry_p|
00001d70  6f 69 6e 74 0d 20 0d 54  68 65 20 73 65 72 76 69  |oint. .The servi|
00001d80  63 65 20 65 6e 74 72 79  20 70 6f 69 6e 74 20 63  |ce entry point c|
00001d90  6f 6d 65 73 20 6e 65 78  74 2e 20 20 54 68 69 73  |omes next.  This|
00001da0  20 69 73 20 77 68 65 72  65 20 65 78 65 63 75 74  | is where execut|
00001db0  69 6f 6e 0d 6f 66 20 74  68 65 20 63 6f 64 65 20  |ion.of the code |
00001dc0  67 6f 65 73 20 77 68 65  6e 20 74 68 65 20 6f 70  |goes when the op|
00001dd0  65 72 61 74 69 6e 67 20  73 79 73 74 65 6d 20 73  |erating system s|
00001de0  65 6e 64 73 20 61 20 73  65 72 76 69 63 65 0d 63  |ends a service.c|
00001df0  61 6c 6c 2e 20 20 49 74  20 73 74 61 72 74 73 20  |all.  It starts |
00001e00  62 79 20 6f 66 66 65 72  69 6e 67 20 74 68 65 20  |by offering the |
00001e10  73 65 72 76 69 63 65 20  74 6f 20 52 4f 4d 20 6e  |service to ROM n|
00001e20  75 6d 62 65 72 20 31 35  0d 61 6e 64 20 74 68 65  |umber 15.and the|
00001e30  6e 20 77 6f 72 6b 73 20  69 74 73 20 77 61 79 20  |n works its way |
00001e40  64 6f 77 6e 20 74 68 65  20 52 4f 4d 53 2e 20 20  |down the ROMS.  |
00001e50  54 68 69 73 20 69 73 20  77 68 79 20 74 68 65 20  |This is why the |
00001e60  52 4f 4d 0d 69 6e 20 61  20 68 69 67 68 20 6e 75  |ROM.in a high nu|
00001e70  6d 62 65 72 65 64 20 73  6f 63 6b 65 74 20 68 61  |mbered socket ha|
00001e80  73 20 70 72 69 6f 72 69  74 79 20 6f 76 65 72 20  |s priority over |
00001e90  52 4f 4d 53 20 69 6e 20  6c 6f 77 65 72 0d 6e 75  |ROMS in lower.nu|
00001ea0  6d 62 65 72 65 64 20 73  6f 63 6b 65 74 73 2e 20  |mbered sockets. |
00001eb0  20 50 72 69 6f 72 69 74  79 20 6d 65 61 6e 73 20  | Priority means |
00001ec0  74 68 61 74 2c 20 69 6e  20 74 68 65 20 63 61 73  |that, in the cas|
00001ed0  65 20 6f 66 20 74 77 6f  0d 52 4f 4d 53 20 68 61  |e of two.ROMS ha|
00001ee0  76 69 6e 67 20 74 68 65  20 73 61 6d 65 20 63 6f  |ving the same co|
00001ef0  6d 6d 61 6e 64 20 69 6e  20 74 68 65 6d 2c 20 74  |mmand in them, t|
00001f00  68 65 20 68 69 67 68 65  72 20 6e 75 6d 62 65 72  |he higher number|
00001f10  65 72 64 0d 6f 6e 65 20  77 69 6c 6c 20 61 63 74  |erd.one will act|
00001f20  75 61 6c 6c 79 20 62 65  20 65 78 65 63 75 74 65  |ually be execute|
00001f30  64 2e 20 20 41 6c 73 6f  20 74 68 65 20 63 6f 64  |d.  Also the cod|
00001f40  65 20 69 6e 20 61 20 68  69 67 68 65 72 0d 6e 75  |e in a higher.nu|
00001f50  6d 62 65 72 65 64 20 52  4f 4d 20 77 69 6c 6c 20  |mbered ROM will |
00001f60  62 65 20 65 78 65 63 75  74 65 64 20 61 20 6c 69  |be executed a li|
00001f70  74 74 6c 65 20 66 61 73  74 65 72 20 62 65 63 61  |ttle faster beca|
00001f80  75 73 65 20 74 68 65 0d  73 65 72 76 69 63 65 20  |use the.service |
00001f90  63 61 6c 6c 20 72 65 61  63 68 65 73 20 69 74 20  |call reaches it |
00001fa0  71 75 69 63 6b 65 72 2e  20 20 54 68 69 73 20 69  |quicker.  This i|
00001fb0  73 20 77 68 79 20 41 4d  53 20 73 75 67 67 65 73  |s why AMS sugges|
00001fc0  74 0d 74 68 61 74 20 79  6f 75 20 70 75 74 20 79  |t.that you put y|
00001fd0  6f 75 72 20 41 4d 58 20  6d 6f 75 73 65 20 52 4f  |our AMX mouse RO|
00001fe0  4d 20 69 6e 20 74 68 65  20 68 69 67 68 65 73 74  |M in the highest|
00001ff0  20 70 6f 73 73 69 62 6c  65 0d 73 6f 63 6b 65 74  | possible.socket|
00002000  2e 0d 0d 41 20 73 65 72  76 69 63 65 20 63 61 6c  |...A service cal|
00002010  6c 20 69 73 20 61 20 6a  75 6d 70 20 74 6f 20 74  |l is a jump to t|
00002020  68 65 20 73 65 72 76 69  63 65 20 65 6e 74 72 79  |he service entry|
00002030  20 70 6f 69 6e 74 2c 20  61 6e 64 20 74 68 65 0d  | point, and the.|
00002040  6e 75 6d 62 65 72 73 20  69 6e 20 74 68 65 20 41  |numbers in the A|
00002050  63 63 75 6d 75 6c 61 74  6f 72 20 61 6e 64 20 74  |ccumulator and t|
00002060  68 65 20 58 20 61 6e 64  20 59 20 72 65 67 69 73  |he X and Y regis|
00002070  74 65 72 73 20 63 61 72  72 79 0d 74 68 65 20 63  |ters carry.the c|
00002080  61 6c 6c 27 73 20 70 61  72 61 6d 65 74 65 72 73  |all's parameters|
00002090  2e 0d 0d 49 27 6c 6c 20  64 65 61 6c 20 77 69 74  |...I'll deal wit|
000020a0  68 20 74 68 65 20 58 20  66 69 72 73 74 2c 20 73  |h the X first, s|
000020b0  69 6e 63 65 20 74 68 61  74 20 61 6c 77 61 79 73  |ince that always|
000020c0  20 68 6f 6c 64 73 20 74  68 65 0d 6e 75 6d 62 65  | holds the.numbe|
000020d0  72 20 6f 66 20 74 68 65  20 52 4f 4d 20 63 75 72  |r of the ROM cur|
000020e0  72 65 6e 74 6c 79 20 62  65 69 6e 67 20 75 73 65  |rently being use|
000020f0  64 2e 20 20 53 69 6e 63  65 20 79 6f 75 72 20 63  |d.  Since your c|
00002100  6f 64 65 20 69 6e 0d 61  20 52 4f 4d 20 64 6f 65  |ode in.a ROM doe|
00002110  73 20 6e 6f 74 20 6b 6e  6f 77 20 77 68 65 72 65  |s not know where|
00002120  20 69 74 20 69 73 20 69  6e 20 74 68 65 20 6d 61  | it is in the ma|
00002130  63 68 69 6e 65 2c 20 61  6e 64 20 6d 61 6e 79 0d  |chine, and many.|
00002140  61 63 74 69 6f 6e 73 20  79 6f 75 20 77 69 6c 6c  |actions you will|
00002150  20 77 61 6e 74 20 74 6f  20 63 61 72 72 79 20 6f  | want to carry o|
00002160  75 74 20 77 69 6c 6c 20  64 65 70 65 6e 64 20 6f  |ut will depend o|
00002170  6e 20 79 6f 75 0d 6b 6e  6f 77 69 6e 67 20 74 68  |n you.knowing th|
00002180  65 20 73 6f 63 6b 65 74  20 6e 75 6d 62 65 72 20  |e socket number |
00002190  69 6e 20 77 68 69 63 68  20 79 6f 75 72 20 52 4f  |in which your RO|
000021a0  4d 20 69 73 2c 20 79 6f  75 20 77 69 6c 6c 20 67  |M is, you will g|
000021b0  65 74 0d 74 68 69 73 20  76 69 74 61 6c 20 69 6e  |et.this vital in|
000021c0  66 6f 72 6d 61 74 69 6f  6e 20 66 72 6f 6d 20 74  |formation from t|
000021d0  68 65 20 58 20 72 65 67  69 73 74 65 72 20 61 74  |he X register at|
000021e0  20 74 68 65 20 65 6e 74  72 79 20 69 6e 74 6f 0d  | the entry into.|
000021f0  79 6f 75 72 20 73 65 72  76 69 63 65 20 72 6f 75  |your service rou|
00002200  74 69 6e 65 2e 0d 0d 54  68 65 20 61 63 63 75 6d  |tine...The accum|
00002210  75 6c 61 74 6f 72 20 63  61 72 72 69 65 73 20 74  |ulator carries t|
00002220  68 65 20 6e 75 6d 62 65  72 20 6f 66 20 74 68 65  |he number of the|
00002230  20 73 65 72 76 69 63 65  20 63 61 6c 6c 2c 20 61  | service call, a|
00002240  6e 64 0d 74 68 65 20 59  20 72 65 67 69 73 74 65  |nd.the Y registe|
00002250  72 20 6d 61 79 20 63 61  72 72 79 20 73 6f 6d 65  |r may carry some|
00002260  20 70 61 72 61 6d 65 74  65 72 20 66 6f 72 20 74  | parameter for t|
00002270  68 65 20 63 61 6c 6c 2e  20 20 49 0d 77 69 6c 6c  |he call.  I.will|
00002280  20 6c 69 73 74 20 73 6f  6d 65 20 6f 66 20 74 68  | list some of th|
00002290  65 20 73 65 72 76 69 63  65 20 63 61 6c 6c 73 20  |e service calls |
000022a0  74 68 61 74 20 74 68 65  20 4f 53 20 69 73 20 6c  |that the OS is l|
000022b0  69 6b 65 6c 79 20 74 6f  0d 6f 72 69 67 69 6e 61  |ikely to.origina|
000022c0  74 65 2e 20 20 28 4e 6f  74 65 20 74 68 61 74 2c  |te.  (Note that,|
000022d0  20 77 69 74 68 20 4f 53  42 59 54 45 20 31 34 33  | with OSBYTE 143|
000022e0  2c 20 61 6e 79 20 70 72  6f 67 72 61 6d 20 63 61  |, any program ca|
000022f0  6e 0d 6f 72 69 67 69 6e  61 74 65 20 61 20 73 65  |n.originate a se|
00002300  72 76 69 63 65 20 63 61  6c 6c 2e 29 20 20 4e 6f  |rvice call.)  No|
00002310  74 65 20 74 68 61 74 20  61 6e 79 20 72 65 66 65  |te that any refe|
00002320  72 65 6e 63 65 73 20 74  6f 0d 6d 65 6d 6f 72 79  |rences to.memory|
00002330  20 6c 6f 63 61 74 69 6f  6e 73 20 61 72 65 20 61  | locations are a|
00002340  6c 77 61 79 73 20 69 6e  20 74 68 65 20 49 2f 4f  |lways in the I/O|
00002350  20 70 72 6f 63 65 73 73  6f 72 20 28 74 68 65 20  | processor (the |
00002360  6d 61 69 6e 0d 6d 69 63  72 6f 29 20 61 6e 64 20  |main.micro) and |
00002370  6e 65 76 65 72 20 69 6e  20 61 20 73 65 63 6f 6e  |never in a secon|
00002380  64 20 70 72 6f 63 65 73  73 6f 72 2c 20 73 68 6f  |d processor, sho|
00002390  75 6c 64 20 6f 6e 65 20  62 65 0d 63 6f 6e 6e 65  |uld one be.conne|
000023a0  63 74 65 64 2e 0d 0d 53  65 72 76 69 63 65 20 63  |cted...Service c|
000023b0  61 6c 6c 20 30 20 61 63  74 75 61 6c 6c 79 20 6d  |all 0 actually m|
000023c0  65 61 6e 73 20 74 68 61  74 20 74 68 65 20 70 61  |eans that the pa|
000023d0  72 74 69 63 75 6c 61 72  20 73 65 72 76 69 63 65  |rticular service|
000023e0  0d 68 61 73 20 62 65 65  6e 20 63 61 72 72 69 65  |.has been carrie|
000023f0  64 20 6f 75 74 20 61 6e  64 20 74 68 65 20 6f 72  |d out and the or|
00002400  69 67 69 6e 61 6c 20 63  61 6c 6c 20 68 61 73 20  |iginal call has |
00002410  62 65 65 6e 20 63 6c 61  69 6d 65 64 2e 20 0d 41  |been claimed. .A|
00002420  20 52 4f 4d 20 69 73 20  6e 6f 74 20 75 73 75 61  | ROM is not usua|
00002430  6c 6c 79 20 6f 66 66 65  72 65 64 20 73 65 72 76  |lly offered serv|
00002440  69 63 65 20 63 61 6c 6c  20 7a 65 72 6f 2c 20 62  |ice call zero, b|
00002450  75 74 20 74 68 65 20 4f  53 0d 6b 6e 6f 77 73 20  |ut the OS.knows |
00002460  69 66 20 69 74 20 64 65  74 65 63 74 73 20 61 20  |if it detects a |
00002470  7a 65 72 6f 20 69 6e 20  74 68 65 20 61 63 63 75  |zero in the accu|
00002480  6d 75 6c 61 74 6f 72 20  61 66 74 65 72 20 61 20  |mulator after a |
00002490  52 4f 4d 0d 68 61 73 20  62 65 65 6e 20 73 65 72  |ROM.has been ser|
000024a0  76 69 63 65 64 20 74 68  61 74 20 74 68 65 20 6f  |viced that the o|
000024b0  70 65 72 61 74 69 6f 6e  20 68 61 73 20 62 65 65  |peration has bee|
000024c0  6e 20 63 61 72 72 69 65  64 20 6f 75 74 2e 20 0d  |n carried out. .|
000024d0  59 6f 75 20 63 61 6e 20  73 65 6e 64 20 61 20 73  |You can send a s|
000024e0  65 72 76 69 63 65 20 63  61 6c 6c 20 30 20 77 69  |ervice call 0 wi|
000024f0  74 68 20 4f 53 42 59 54  45 20 31 34 33 20 62 75  |th OSBYTE 143 bu|
00002500  74 20 49 20 63 61 6e 27  74 0d 74 68 69 6e 6b 20  |t I can't.think |
00002510  77 68 79 20 79 6f 75 20  6d 69 67 68 74 20 77 61  |why you might wa|
00002520  6e 74 20 74 6f 20 73 69  6e 63 65 20 69 74 20 77  |nt to since it w|
00002530  6f 75 6c 64 6e 27 74 20  67 65 74 20 61 6e 79 0d  |ouldn't get any.|
00002540  66 75 72 74 68 65 72 20  74 68 61 6e 20 74 68 65  |further than the|
00002550  20 66 69 72 73 74 20 52  4f 4d 2e 0d 0d 53 65 72  | first ROM...Ser|
00002560  76 69 63 65 20 63 61 6c  6c 20 31 20 2d 20 6f 6e  |vice call 1 - on|
00002570  20 61 20 72 65 73 65 74  20 52 4f 4d 53 20 6d 75  | a reset ROMS mu|
00002580  73 74 20 72 65 73 65 72  76 65 20 61 62 73 6f 6c  |st reserve absol|
00002590  75 74 65 0d 73 74 61 74  69 63 20 77 6f 72 6b 73  |ute.static works|
000025a0  70 61 63 65 20 28 73 74  61 72 74 69 6e 67 20 61  |pace (starting a|
000025b0  6c 77 61 79 73 20 61 74  20 26 45 30 30 20 6f 6e  |lways at &E00 on|
000025c0  20 61 20 42 20 6f 72 20  42 2b 20 61 6e 64 0d 75  | a B or B+ and.u|
000025d0  73 75 61 6c 6c 79 20 66  6f 72 20 66 69 6c 69 6e  |sually for filin|
000025e0  67 20 73 79 73 74 65 6d  73 29 20 6f 6e 20 74 68  |g systems) on th|
000025f0  69 73 20 63 61 6c 6c 2e  20 20 45 61 63 68 20 52  |is call.  Each R|
00002600  4f 4d 20 74 68 61 74 0d  77 61 6e 74 73 20 74 68  |OM that.wants th|
00002610  69 73 20 6b 69 6e 64 20  6f 66 20 77 6f 72 6b 73  |is kind of works|
00002620  70 61 63 65 20 77 69 6c  6c 20 63 6f 6d 70 61 72  |pace will compar|
00002630  65 20 74 68 65 20 6e 75  6d 62 65 72 20 69 6e 20  |e the number in |
00002640  59 2c 0d 77 68 69 63 68  20 77 69 6c 6c 20 62 65  |Y,.which will be|
00002650  20 74 68 65 20 68 69 67  68 65 72 20 62 79 74 65  | the higher byte|
00002660  20 6f 66 20 74 68 65 20  63 75 72 72 65 6e 74 20  | of the current |
00002670  75 70 70 65 72 20 6c 69  6d 69 74 20 6f 66 0d 74  |upper limit of.t|
00002680  68 65 20 77 6f 72 6b 73  70 61 63 65 20 2c 20 77  |he workspace , w|
00002690  69 74 68 20 74 68 65 20  76 61 6c 75 65 20 69 74  |ith the value it|
000026a0  20 6e 65 65 64 73 20 61  6e 64 20 69 6e 63 72 65  | needs and incre|
000026b0  61 73 65 20 59 20 69 66  0d 6e 65 63 65 73 73 61  |ase Y if.necessa|
000026c0  72 79 20 62 65 66 6f 72  65 20 65 78 69 74 69 6e  |ry before exitin|
000026d0  67 2e 20 20 54 68 69 73  20 63 61 6c 6c 20 6d 75  |g.  This call mu|
000026e0  73 74 20 6e 6f 74 20 62  65 20 63 6c 61 69 6d 65  |st not be claime|
000026f0  64 2c 0d 69 2e 65 2e 20  74 68 65 20 76 61 6c 75  |d,.i.e. the valu|
00002700  65 20 69 6e 20 74 68 65  20 61 63 63 75 6d 75 6c  |e in the accumul|
00002710  61 74 6f 72 20 69 73 20  74 6f 20 62 65 20 70 72  |ator is to be pr|
00002720  65 73 65 72 76 65 64 20  66 72 6f 6d 0d 65 6e 74  |eserved from.ent|
00002730  72 79 20 74 6f 20 65 78  69 74 2e 0d 0d 53 65 72  |ry to exit...Ser|
00002740  76 69 63 65 20 63 61 6c  6c 20 32 20 2d 20 6f 6e  |vice call 2 - on|
00002750  20 61 20 72 65 73 65 74  20 70 72 69 76 61 74 65  | a reset private|
00002760  20 64 79 6e 61 6d 69 63  20 77 6f 72 6b 73 70 61  | dynamic workspa|
00002770  63 65 20 69 73 0d 72 65  73 65 72 76 65 64 20 77  |ce is.reserved w|
00002780  69 74 68 20 74 68 69 73  20 63 61 6c 6c 2e 20 20  |ith this call.  |
00002790  57 68 65 72 65 61 73 20  61 62 73 6f 6c 75 74 65  |Whereas absolute|
000027a0  20 77 6f 72 6b 73 70 61  63 65 20 63 61 6e 20 62  | workspace can b|
000027b0  65 0d 75 73 65 64 20 62  79 20 61 6e 6f 74 68 65  |e.used by anothe|
000027c0  72 20 52 4f 4d 2c 20 73  75 62 6a 65 63 74 20 74  |r ROM, subject t|
000027d0  6f 20 68 6f 75 73 65 6b  65 65 70 69 6e 67 20 72  |o housekeeping r|
000027e0  75 6c 65 73 2c 20 74 68  69 73 0d 77 6f 72 6b 73  |ules, this.works|
000027f0  70 61 63 65 20 69 73 20  6f 6e 6c 79 20 66 6f 72  |pace is only for|
00002800  20 79 6f 75 72 20 52 4f  4d 2e 20 20 59 6f 75 20  | your ROM.  You |
00002810  63 6c 61 69 6d 20 69 74  20 62 79 20 72 61 69 73  |claim it by rais|
00002820  69 6e 67 20 74 68 65 0d  76 61 6c 75 65 20 69 6e  |ing the.value in|
00002830  20 59 20 62 79 20 74 68  65 20 6e 75 6d 62 65 72  | Y by the number|
00002840  20 6f 66 20 70 61 67 65  73 20 6f 66 20 74 68 69  | of pages of thi|
00002850  73 20 79 6f 75 20 6e 65  65 64 20 61 6e 64 20 74  |s you need and t|
00002860  68 65 6e 0d 73 74 6f 72  69 6e 67 20 74 68 69 73  |hen.storing this|
00002870  20 76 61 6c 75 65 20 69  6e 20 61 20 52 4f 4d 20  | value in a ROM |
00002880  77 6f 72 6b 73 70 61 63  65 20 74 61 62 6c 65 2e  |workspace table.|
00002890  20 20 57 68 65 6e 20 79  6f 75 20 6e 65 65 64 0d  |  When you need.|
000028a0  74 6f 20 66 69 6e 64 20  6f 75 74 20 77 68 65 72  |to find out wher|
000028b0  65 20 79 6f 75 72 20 70  72 69 76 61 74 65 20 77  |e your private w|
000028c0  6f 72 6b 73 70 61 63 65  20 73 74 61 72 74 73 20  |orkspace starts |
000028d0  79 6f 75 20 63 61 6e 20  6c 6f 6f 6b 0d 69 6e 20  |you can look.in |
000028e0  74 68 61 74 20 74 61 62  6c 65 20 77 68 61 74 20  |that table what |
000028f0  73 74 61 72 74 73 20 61  74 20 26 44 46 30 2c 20  |starts at &DF0, |
00002900  6f 66 66 73 65 74 20 62  79 20 79 6f 75 72 20 52  |offset by your R|
00002910  4f 4d 20 6e 75 6d 62 65  72 0d 28 66 6f 75 6e 64  |OM number.(found|
00002920  20 66 72 6f 6d 20 74 68  65 20 58 20 72 65 67 69  | from the X regi|
00002930  73 74 65 72 29 2e 0d 0d  53 65 72 76 69 63 65 20  |ster)...Service |
00002940  63 61 6c 6c 20 33 20 69  73 20 61 6e 20 61 75 74  |call 3 is an aut|
00002950  6f 2d 62 6f 6f 74 20 63  61 6c 6c 2e 20 20 57 68  |o-boot call.  Wh|
00002960  65 6e 20 74 68 69 73 20  69 73 20 64 65 74 65 63  |en this is detec|
00002970  74 65 64 2c 0d 61 20 52  4f 4d 20 74 68 61 74 20  |ted,.a ROM that |
00002980  77 69 73 68 65 73 20 74  6f 20 69 6e 69 74 69 61  |wishes to initia|
00002990  6c 69 73 65 20 69 74 73  65 6c 66 20 6f 6e 20 72  |lise itself on r|
000029a0  65 73 65 74 20 6c 6f 6f  6b 73 20 61 74 20 74 68  |eset looks at th|
000029b0  65 0d 6b 65 79 62 6f 61  72 64 20 28 75 73 69 6e  |e.keyboard (usin|
000029c0  67 20 4f 53 42 59 54 45  20 31 32 30 29 20 74 6f  |g OSBYTE 120) to|
000029d0  20 73 65 65 20 69 66 20  27 69 74 73 27 20 6b 65  | see if 'its' ke|
000029e0  79 20 69 73 20 70 72 65  73 73 65 64 2e 20 0d 49  |y is pressed. .I|
000029f0  66 20 74 68 61 74 20 69  73 20 74 68 65 20 63 61  |f that is the ca|
00002a00  73 65 2c 20 6f 72 20 6e  6f 20 6b 65 79 20 69 73  |se, or no key is|
00002a10  20 70 72 65 73 73 65 64  2c 20 74 68 65 6e 20 74  | pressed, then t|
00002a20  68 65 20 52 4f 4d 0d 73  68 6f 75 6c 64 20 69 6e  |he ROM.should in|
00002a30  69 74 69 61 6c 69 73 65  2e 20 20 49 66 20 61 6e  |itialise.  If an|
00002a40  6f 74 68 65 72 20 6b 65  79 20 69 73 20 70 72 65  |other key is pre|
00002a50  73 73 65 64 20 69 74 20  73 68 6f 75 6c 64 0d 69  |ssed it should.i|
00002a60  67 6e 6f 72 65 20 74 68  65 20 63 61 6c 6c 20 61  |gnore the call a|
00002a70  6e 64 20 70 61 73 73 20  6f 6e 20 74 68 65 20 72  |nd pass on the r|
00002a80  65 67 69 73 74 65 72 73  20 75 6e 63 68 61 6e 67  |egisters unchang|
00002a90  65 64 2e 20 20 49 6e 0d  74 68 69 73 20 77 61 79  |ed.  In.this way|
00002aa0  20 79 6f 75 20 63 61 6e  20 73 74 61 72 74 20 69  | you can start i|
00002ab0  6e 20 44 46 53 20 6f 6e  20 42 52 45 41 4b 20 62  |n DFS on BREAK b|
00002ac0  79 20 68 6f 6c 64 69 6e  67 20 64 6f 77 6e 20 44  |y holding down D|
00002ad0  20 61 6e 64 0d 73 74 61  72 74 20 41 44 46 53 20  | and.start ADFS |
00002ae0  62 79 20 68 6f 6c 64 69  6e 67 20 64 6f 77 6e 20  |by holding down |
00002af0  41 20 28 6f 72 20 46 29  2e 20 20 49 66 20 74 68  |A (or F).  If th|
00002b00  65 20 59 20 72 65 67 69  73 74 65 72 20 69 73 0d  |e Y register is.|
00002b10  7a 65 72 6f 20 74 68 65  6e 20 74 68 65 20 52 4f  |zero then the RO|
00002b20  4d 20 74 68 61 74 20 63  6c 61 69 6d 73 20 74 68  |M that claims th|
00002b30  65 20 63 61 6c 6c 20 73  68 6f 75 6c 64 20 61 63  |e call should ac|
00002b40  74 69 6f 6e 20 74 68 65  0d 72 65 6c 65 76 61 6e  |tion the.relevan|
00002b50  74 20 21 42 4f 4f 54 20  66 69 6c 65 2e 0d 0d 4d  |t !BOOT file...M|
00002b60  61 6e 79 20 52 4f 4d 53  20 28 69 6e 63 6c 75 64  |any ROMS (includ|
00002b70  69 6e 67 20 74 68 65 20  6f 6e 65 20 77 69 74 68  |ing the one with|
00002b80  20 74 68 69 73 20 6d 6f  64 75 6c 65 29 20 75 73  | this module) us|
00002b90  65 20 73 65 72 76 69 63  65 0d 63 61 6c 6c 20 33  |e service.call 3|
00002ba0  20 74 6f 20 70 72 69 6e  74 20 6f 75 74 20 61 20  | to print out a |
00002bb0  6c 69 74 74 6c 65 20 6d  65 73 73 61 67 65 20 61  |little message a|
00002bc0  62 6f 75 74 20 74 68 65  6d 73 65 6c 76 65 73 2e  |bout themselves.|
00002bd0  20 54 68 69 73 0d 63 61  6c 6c 20 69 73 20 63 6c  | This.call is cl|
00002be0  61 69 6d 65 64 20 62 79  20 61 6e 79 20 66 69 6c  |aimed by any fil|
00002bf0  69 6e 67 20 73 79 73 74  65 6d 20 74 68 61 74 20  |ing system that |
00002c00  73 74 61 72 74 73 20 75  70 2c 20 77 68 69 63 68  |starts up, which|
00002c10  0d 69 73 20 77 68 79 20  79 6f 75 72 20 6d 65 73  |.is why your mes|
00002c20  73 61 67 65 73 20 6f 6e  20 42 52 45 41 4b 20 64  |sages on BREAK d|
00002c30  65 70 65 6e 64 20 6f 6e  20 74 68 65 20 73 6f 63  |epend on the soc|
00002c40  6b 65 74 20 69 6e 20 77  68 69 63 68 0d 79 6f 75  |ket in which.you|
00002c50  20 70 75 74 20 79 6f 75  72 20 44 46 53 20 63 68  | put your DFS ch|
00002c60  69 70 2e 0d 0d 53 65 72  76 69 63 65 20 63 61 6c  |ip...Service cal|
00002c70  6c 20 34 20 2d 20 61 6e  79 20 2a 63 6f 6d 6d 61  |l 4 - any *comma|
00002c80  6e 64 20 74 68 61 74 20  74 68 65 20 4f 53 20 64  |nd that the OS d|
00002c90  6f 65 73 20 6e 6f 74 20  72 65 63 6f 67 6e 69 73  |oes not recognis|
00002ca0  65 0d 69 73 20 6f 66 66  65 72 65 64 20 74 6f 20  |e.is offered to |
00002cb0  74 68 65 20 73 69 64 65  77 61 79 73 20 52 4f 4d  |the sideways ROM|
00002cc0  73 20 77 69 74 68 20 74  68 69 73 20 63 61 6c 6c  |s with this call|
00002cd0  2e 20 20 45 61 63 68 20  52 4f 4d 0d 6c 6f 6f 6b  |.  Each ROM.look|
00002ce0  73 20 61 74 20 74 68 65  20 63 6f 6d 6d 61 6e 64  |s at the command|
00002cf0  2c 20 77 68 69 63 68 20  69 73 20 68 65 6c 64 20  |, which is held |
00002d00  61 74 20 28 26 46 32 29  2c 20 59 20 61 6e 64 0d  |at (&F2), Y and.|
00002d10  74 65 72 6d 69 6e 61 74  65 64 20 77 69 74 68 20  |terminated with |
00002d20  61 20 63 61 72 72 69 61  67 65 20 72 65 74 75 72  |a carriage retur|
00002d30  6e 2c 20 61 6e 64 20 69  66 20 69 74 20 72 65 63  |n, and if it rec|
00002d40  6f 67 6e 69 73 65 73 20  69 74 0d 74 68 65 6e 20  |ognises it.then |
00002d50  69 74 20 73 68 6f 75 6c  64 20 65 78 65 63 75 74  |it should execut|
00002d60  65 20 74 68 65 20 72 65  6c 65 76 61 6e 74 20 63  |e the relevant c|
00002d70  6f 64 65 20 61 6e 64 20  63 6c 61 69 6d 20 74 68  |ode and claim th|
00002d80  65 0d 73 65 72 76 69 63  65 20 63 61 6c 6c 2e 20  |e.service call. |
00002d90  20 49 66 20 6e 6f 20 52  4f 4d 73 20 63 6c 61 69  | If no ROMs clai|
00002da0  6d 20 74 68 65 20 63 61  6c 6c 20 74 68 65 6e 20  |m the call then |
00002db0  74 68 65 20 63 6f 6d 6d  61 6e 64 20 69 73 0d 6f  |the command is.o|
00002dc0  66 66 65 72 65 64 20 74  6f 20 74 68 65 20 63 75  |ffered to the cu|
00002dd0  72 72 65 6e 74 20 66 69  6c 69 6e 67 20 73 79 73  |rrent filing sys|
00002de0  74 65 6d 2e 20 20 54 68  65 20 44 46 53 2c 20 66  |tem.  The DFS, f|
00002df0  6f 72 20 65 78 61 6d 70  6c 65 2c 0d 77 69 6c 6c  |or example,.will|
00002e00  20 74 68 65 6e 20 74 72  79 20 74 6f 20 2a 52 55  | then try to *RU|
00002e10  4e 20 61 20 66 69 6c 65  20 6f 66 20 74 68 61 74  |N a file of that|
00002e20  20 6e 61 6d 65 2e 0d 0d  53 65 72 76 69 63 65 20  | name...Service |
00002e30  63 61 6c 6c 20 35 20 6d  65 61 6e 73 20 74 68 61  |call 5 means tha|
00002e40  74 20 61 6e 20 75 6e 6b  6e 6f 77 6e 20 69 6e 74  |t an unknown int|
00002e50  65 72 72 75 70 74 20 68  61 73 20 6f 63 63 75 72  |errupt has occur|
00002e60  72 65 64 2e 20 0d 49 74  20 77 69 6c 6c 20 62 65  |red. .It will be|
00002e70  20 6f 66 66 65 72 65 64  20 74 6f 20 74 68 65 20  | offered to the |
00002e80  52 4f 4d 53 20 62 65 66  6f 72 65 20 62 65 69 6e  |ROMS before bein|
00002e90  67 20 70 61 73 73 65 64  20 74 6f 20 74 68 65 0d  |g passed to the.|
00002ea0  55 53 45 52 20 64 6f 77  6e 20 49 52 51 32 2e 0d  |USER down IRQ2..|
00002eb0  0d 53 65 72 76 69 63 65  20 63 61 6c 6c 20 36 20  |.Service call 6 |
00002ec0  6d 65 61 6e 73 20 74 68  61 74 20 61 20 42 52 4b  |means that a BRK|
00002ed0  20 28 69 2e 65 2e 20 61  20 73 6f 66 74 77 61 72  | (i.e. a softwar|
00002ee0  65 20 69 6e 74 65 72 72  75 70 20 61 73 0d 64 69  |e interrup as.di|
00002ef0  73 74 69 6e 63 74 20 66  72 6f 6d 20 70 72 65 73  |stinct from pres|
00002f00  73 69 6e 67 20 74 68 65  20 42 52 45 41 4b 20 6b  |sing the BREAK k|
00002f10  65 79 29 20 68 61 73 20  62 65 65 6e 20 64 65 74  |ey) has been det|
00002f20  65 63 74 65 64 2e 20 20  49 66 0d 61 20 52 4f 4d  |ected.  If.a ROM|
00002f30  20 77 69 73 68 65 73 20  74 6f 20 74 61 6b 65 20  | wishes to take |
00002f40  61 63 74 69 6f 6e 20 69  74 20 63 61 6e 2e 20 20  |action it can.  |
00002f50  54 68 69 73 20 63 61 6c  6c 20 73 68 6f 75 6c 64  |This call should|
00002f60  20 6e 6f 74 20 62 65 0d  63 6c 61 69 6d 65 64 2e  | not be.claimed.|
00002f70  0d 0d 53 65 72 76 69 63  65 20 63 61 6c 6c 20 37  |..Service call 7|
00002f80  20 6d 65 61 6e 73 20 74  68 61 74 20 61 6e 20 4f  | means that an O|
00002f90  53 42 59 54 45 20 63 61  6c 6c 20 6e 6f 74 20 6b  |SBYTE call not k|
00002fa0  6e 6f 77 6e 20 74 6f 20  74 68 65 20 4f 53 0d 68  |nown to the OS.h|
00002fb0  61 73 20 6f 63 63 75 72  72 65 64 2e 20 20 54 68  |as occurred.  Th|
00002fc0  65 20 41 2c 20 58 20 61  6e 64 20 59 20 72 65 67  |e A, X and Y reg|
00002fd0  69 73 74 65 72 73 20 6f  66 20 74 68 65 20 63 61  |isters of the ca|
00002fe0  6c 6c 20 63 61 6e 20 62  65 0d 66 6f 75 6e 64 20  |ll can be.found |
00002ff0  61 74 20 26 45 46 2c 20  26 46 30 20 61 6e 64 20  |at &EF, &F0 and |
00003000  26 46 31 20 72 65 73 70  65 63 74 69 76 65 6c 79  |&F1 respectively|
00003010  2e 0d 0d 53 65 72 76 69  63 65 20 63 61 6c 6c 20  |...Service call |
00003020  38 20 6d 65 61 6e 73 20  74 68 61 74 20 61 6e 20  |8 means that an |
00003030  75 6e 6b 6e 6f 77 6e 20  4f 53 57 4f 52 44 20 63  |unknown OSWORD c|
00003040  61 6c 6c 20 68 61 73 0d  6f 63 63 75 72 72 65 64  |all has.occurred|
00003050  2e 20 20 54 68 65 20 41  2c 20 58 20 61 6e 64 20  |.  The A, X and |
00003060  59 20 72 65 67 69 73 74  65 72 73 20 6f 66 20 74  |Y registers of t|
00003070  68 65 20 63 61 6c 6c 20  63 61 6e 20 62 65 20 66  |he call can be f|
00003080  6f 75 6e 64 0d 61 74 20  26 45 46 2c 20 26 46 30  |ound.at &EF, &F0|
00003090  20 61 6e 64 20 26 46 31  20 72 65 73 70 65 63 74  | and &F1 respect|
000030a0  69 76 65 6c 79 2e 0d 0d  53 65 72 76 69 63 65 20  |ively...Service |
000030b0  63 61 6c 6c 20 39 20 6d  65 61 6e 73 20 74 68 61  |call 9 means tha|
000030c0  74 20 2a 48 45 4c 50 20  68 61 73 20 62 65 65 6e  |t *HELP has been|
000030d0  20 64 65 74 65 63 74 65  64 20 62 79 20 74 68 65  | detected by the|
000030e0  0d 63 6f 6d 6d 61 6e 64  20 6c 69 6e 65 20 69 6e  |.command line in|
000030f0  74 65 72 70 72 65 74 65  72 20 61 6e 64 20 52 4f  |terpreter and RO|
00003100  4d 53 20 63 61 6e 20 67  69 76 65 20 77 68 61 74  |MS can give what|
00003110  65 76 65 72 20 68 65 6c  70 66 75 6c 0d 6d 65 73  |ever helpful.mes|
00003120  73 61 67 65 73 20 74 68  65 79 20 70 6f 73 73 65  |sages they posse|
00003130  73 73 2e 20 20 54 68 65  20 70 61 72 74 20 6f 66  |ss.  The part of|
00003140  20 74 68 65 20 2a 48 45  4c 50 20 73 74 72 69 6e  | the *HELP strin|
00003150  67 20 74 68 61 74 0d 66  6f 6c 6c 6f 77 20 74 68  |g that.follow th|
00003160  65 20 2a 48 45 4c 50 20  6f 72 20 2a 48 2e 20 69  |e *HELP or *H. i|
00003170  74 73 65 6c 66 20 77 69  6c 6c 20 62 65 20 70 6f  |tself will be po|
00003180  69 6e 74 65 64 20 74 6f  20 62 79 20 74 68 65 0d  |inted to by the.|
00003190  63 6f 6e 74 65 6e 74 73  20 6f 66 20 26 46 32 20  |contents of &F2 |
000031a0  61 6e 64 20 26 46 33 20  70 6c 75 73 20 74 68 65  |and &F3 plus the|
000031b0  20 63 6f 6e 74 65 6e 74  73 20 6f 66 20 59 2e 20  | contents of Y. |
000031c0  20 54 68 69 73 20 63 61  6c 6c 0d 73 68 6f 75 6c  | This call.shoul|
000031d0  64 20 6e 6f 74 20 62 65  20 63 6c 61 69 6d 65 64  |d not be claimed|
000031e0  20 69 6e 20 63 61 73 65  20 74 77 6f 20 52 4f 4d  | in case two ROM|
000031f0  53 20 72 65 73 70 6f 6e  64 20 74 6f 20 74 68 65  |S respond to the|
00003200  20 73 61 6d 65 0d 6b 65  79 77 6f 72 64 2e 0d 0d  | same.keyword...|
00003210  53 65 72 76 69 63 65 20  63 61 6c 6c 20 26 41 20  |Service call &A |
00003220  28 31 30 29 20 69 73 20  69 73 73 75 65 64 20 77  |(10) is issued w|
00003230  68 65 6e 20 61 20 52 4f  4d 20 77 61 6e 74 73 20  |hen a ROM wants |
00003240  74 6f 20 75 73 65 20 74  68 65 0d 73 74 61 74 69  |to use the.stati|
00003250  63 20 77 6f 72 6b 73 70  61 63 65 2e 20 20 49 74  |c workspace.  It|
00003260  20 73 68 6f 75 6c 64 20  69 73 73 75 65 20 74 68  | should issue th|
00003270  69 73 20 63 61 6c 6c 20  74 6f 20 77 61 72 6e 20  |is call to warn |
00003280  6f 74 68 65 72 0d 52 4f  4d 73 20 74 6f 20 73 61  |other.ROMs to sa|
00003290  76 65 20 74 68 65 69 72  20 76 61 6c 75 61 62 6c  |ve their valuabl|
000032a0  65 20 64 61 74 61 20 69  6e 20 74 68 65 69 72 20  |e data in their |
000032b0  6f 77 6e 20 77 6f 72 6b  73 70 61 63 65 2e 0d 0d  |own workspace...|
000032c0  53 65 72 76 69 63 65 20  63 61 6c 6c 73 20 26 42  |Service calls &B|
000032d0  20 28 31 31 29 20 61 6e  64 20 26 43 20 28 31 32  | (11) and &C (12|
000032e0  29 20 72 65 6c 69 6e 71  75 69 73 68 20 61 6e 64  |) relinquish and|
000032f0  20 63 6c 61 69 6d 20 74  68 65 0d 4e 4d 49 20 77  | claim the.NMI w|
00003300  6f 72 6b 73 70 61 63 65  2e 0d 0d 53 65 72 76 69  |orkspace...Servi|
00003310  63 65 20 63 61 6c 6c 73  20 26 44 20 28 31 33 29  |ce calls &D (13)|
00003320  20 61 6e 64 20 26 45 20  28 31 34 29 20 72 65 6c  | and &E (14) rel|
00003330  61 74 65 20 74 6f 20 74  68 65 20 52 4f 4d 20 66  |ate to the ROM f|
00003340  69 6c 69 6e 67 0d 73 79  73 74 65 6d 2c 20 6f 72  |iling.system, or|
00003350  20 74 6f 20 61 20 53 70  65 65 63 68 20 46 69 6c  | to a Speech Fil|
00003360  69 6e 67 20 53 79 73 74  65 6d 2e 0d 0d 53 65 72  |ing System...Ser|
00003370  76 69 63 65 20 63 61 6c  6c 20 26 46 20 28 31 35  |vice call &F (15|
00003380  29 20 69 73 20 69 73 73  75 65 64 20 62 79 20 61  |) is issued by a|
00003390  20 66 69 6c 69 6e 67 20  73 79 73 74 65 6d 20 77  | filing system w|
000033a0  68 65 6e 20 69 74 0d 68  61 73 20 69 6e 69 74 69  |hen it.has initi|
000033b0  61 6c 69 73 65 64 20 61  6e 64 20 73 6f 72 74 65  |alised and sorte|
000033c0  64 20 6f 75 74 20 69 74  73 20 76 65 63 74 6f 72  |d out its vector|
000033d0  73 2e 20 20 41 6e 79 20  52 4f 4d 53 20 74 68 61  |s.  Any ROMS tha|
000033e0  74 0d 77 69 73 68 20 74  6f 20 69 6e 74 65 72 63  |t.wish to interc|
000033f0  65 70 74 20 66 69 6c 69  6e 67 20 73 79 73 74 65  |ept filing syste|
00003400  6d 20 76 65 63 74 6f 72  73 20 68 61 76 65 20 74  |m vectors have t|
00003410  6f 20 63 68 61 6e 67 65  20 74 68 65 69 72 0d 69  |o change their.i|
00003420  6e 74 65 72 63 65 70 74  73 20 61 66 74 65 72 20  |ntercepts after |
00003430  74 68 69 73 20 63 61 6c  6c 2e 0d 0d 53 65 72 76  |this call...Serv|
00003440  69 63 65 20 63 61 6c 6c  20 26 31 30 20 28 31 36  |ice call &10 (16|
00003450  29 20 6f 63 63 75 72 73  20 6f 6e 20 61 20 72 65  |) occurs on a re|
00003460  73 65 74 2c 20 61 6e 64  20 61 6c 73 6f 20 77 68  |set, and also wh|
00003470  65 6e 0d 4f 53 42 59 54  45 20 31 31 39 20 69 73  |en.OSBYTE 119 is|
00003480  20 63 61 6c 6c 65 64 2e  20 20 49 74 20 6d 65 61  | called.  It mea|
00003490  6e 73 20 74 68 61 74 20  61 6c 6c 20 2a 53 50 4f  |ns that all *SPO|
000034a0  4f 4c 20 6f 72 20 2a 45  58 45 43 0d 66 69 6c 65  |OL or *EXEC.file|
000034b0  73 20 73 68 6f 75 6c 64  20 62 65 20 63 6c 6f 73  |s should be clos|
000034c0  65 64 2e 0d 0d 53 65 72  76 69 63 65 20 63 61 6c  |ed...Service cal|
000034d0  6c 20 26 31 31 20 28 31  37 29 20 69 73 20 75 73  |l &11 (17) is us|
000034e0  65 64 20 6f 6e 20 74 68  65 20 42 42 43 20 41 2c  |ed on the BBC A,|
000034f0  20 42 20 61 6e 64 20 42  2b 20 74 6f 20 77 61 72  | B and B+ to war|
00003500  6e 0d 6f 66 20 61 20 66  6f 6e 74 20 69 6d 70 6c  |n.of a font impl|
00003510  6f 73 69 6f 6e 20 6f 72  20 65 78 70 6c 6f 73 69  |osion or explosi|
00003520  6f 6e 2c 20 77 68 69 63  68 20 63 6f 75 6c 64 20  |on, which could |
00003530  61 66 66 65 63 74 0d 77  6f 72 6b 73 70 61 63 65  |affect.workspace|
00003540  20 6b 65 70 74 20 6a 75  73 74 20 61 62 6f 76 65  | kept just above|
00003550  20 74 68 65 20 6f 70 65  72 61 74 69 6e 67 20 73  | the operating s|
00003560  79 73 74 65 6d 20 68 69  67 68 20 77 61 74 65 72  |ystem high water|
00003570  0d 6d 61 72 6b 2e 20 20  54 68 69 73 20 63 61 6c  |.mark.  This cal|
00003580  6c 20 69 73 20 75 6e 75  73 65 64 20 6f 6e 20 61  |l is unused on a|
00003590  20 4d 61 73 74 65 72 2e  0d 0d 53 65 72 76 69 63  | Master...Servic|
000035a0  65 20 63 61 6c 6c 20 26  31 32 20 28 31 38 29 20  |e call &12 (18) |
000035b0  69 73 20 75 73 65 64 20  62 79 20 66 69 6c 69 6e  |is used by filin|
000035c0  67 20 73 79 73 74 65 6d  73 20 66 6f 72 0d 69 6e  |g systems for.in|
000035d0  69 74 69 61 6c 69 73 61  74 69 6f 6e 20 69 66 20  |itialisation if |
000035e0  66 69 6c 65 73 20 61 72  65 20 62 65 69 6e 67 20  |files are being |
000035f0  74 72 61 6e 73 66 65 72  72 65 64 20 62 65 74 77  |transferred betw|
00003600  65 65 6e 0d 66 69 6c 69  6e 67 20 73 79 73 74 65  |een.filing syste|
00003610  6d 73 2e 0d 0d 53 65 72  76 69 63 65 20 63 61 6c  |ms...Service cal|
00003620  6c 20 26 31 35 20 6f 6e  20 61 20 4d 61 73 74 65  |l &15 on a Maste|
00003630  72 20 69 73 20 61 20 70  6f 6c 6c 69 6e 67 20 63  |r is a polling c|
00003640  61 6c 6c 2c 20 6d 61 64  65 20 65 76 65 72 79 0d  |all, made every.|
00003650  63 65 6e 74 69 73 65 63  6f 6e 64 20 69 66 20 74  |centisecond if t|
00003660  68 69 73 20 66 61 63 69  6c 69 74 79 20 69 73 20  |his facility is |
00003670  65 6e 61 62 6c 65 64 20  77 69 74 68 20 4f 53 42  |enabled with OSB|
00003680  59 54 45 20 32 32 2e 0d  0d 53 65 72 76 69 63 65  |YTE 22...Service|
00003690  20 63 61 6c 6c 20 26 32  31 20 6f 6e 20 61 20 4d  | call &21 on a M|
000036a0  61 73 74 65 72 20 69 73  20 6c 69 6b 65 20 73 65  |aster is like se|
000036b0  72 76 69 63 65 20 63 61  6c 6c 20 31 20 62 75 74  |rvice call 1 but|
000036c0  0d 6f 66 66 65 72 73 20  77 6f 72 6b 73 70 61 63  |.offers workspac|
000036d0  65 20 69 6e 20 70 72 69  76 61 74 65 20 66 69 6c  |e in private fil|
000036e0  69 6e 67 20 73 79 73 74  65 6d 20 52 41 4d 2e 20  |ing system RAM. |
000036f0  20 44 69 74 74 6f 20 66  6f 72 0d 63 61 6c 6c 73  | Ditto for.calls|
00003700  20 26 32 32 20 61 6e 64  20 73 65 72 76 69 63 65  | &22 and service|
00003710  20 63 61 6c 6c 20 32 2e  20 20 43 61 6c 6c 73 20  | call 2.  Calls |
00003720  26 32 33 20 74 6f 20 26  32 36 20 61 6c 73 6f 20  |&23 to &26 also |
00003730  72 65 6c 61 74 65 0d 74  6f 20 66 69 6c 69 6e 67  |relate.to filing|
00003740  20 73 79 73 74 65 6d 73  20 6f 6e 20 74 68 65 20  | systems on the |
00003750  4d 61 73 74 65 72 2e 0d  0d 54 68 65 20 4d 61 73  |Master...The Mas|
00003760  74 65 72 20 64 6f 65 73  20 6e 6f 74 20 6f 66 66  |ter does not off|
00003770  65 72 20 73 65 72 76 69  63 65 20 63 61 6c 6c 73  |er service calls|
00003780  20 31 20 61 6e 64 20 32  20 6f 6e 20 61 20 73 6f  | 1 and 2 on a so|
00003790  66 74 0d 72 65 73 65 74  2c 20 69 6e 73 74 65 61  |ft.reset, instea|
000037a0  64 20 69 74 20 6f 66 66  65 72 73 20 63 61 6c 6c  |d it offers call|
000037b0  20 26 32 37 2e 20 20 43  61 6c 6c 73 20 26 32 38  | &27.  Calls &28|
000037c0  20 61 6e 64 20 26 32 39  20 61 72 65 0d 75 73 65  | and &29 are.use|
000037d0  64 20 6f 6e 20 74 68 65  20 4d 61 73 74 65 72 20  |d on the Master |
000037e0  66 6f 72 20 43 4d 4f 53  20 52 41 4d 20 63 6f 6e  |for CMOS RAM con|
000037f0  66 69 67 75 72 61 74 69  6f 6e 20 61 6e 64 20 73  |figuration and s|
00003800  74 61 74 75 73 2e 0d 0d  53 65 72 76 69 63 65 20  |tatus...Service |
00003810  63 61 6c 6c 20 26 32 41  20 6f 6e 20 61 20 4d 61  |call &2A on a Ma|
00003820  73 74 65 72 20 69 6e 66  6f 72 6d 73 20 52 4f 4d  |ster informs ROM|
00003830  53 20 6f 66 20 61 20 63  68 61 6e 67 65 20 6f 66  |S of a change of|
00003840  0d 6c 61 6e 67 75 61 67  65 2e 0d 0d 53 65 72 76  |.language...Serv|
00003850  69 63 65 20 63 61 6c 6c  20 26 32 42 20 69 73 20  |ice call &2B is |
00003860  61 20 6d 79 73 74 65 72  79 2c 20 69 74 20 69 73  |a mystery, it is|
00003870  20 64 65 73 63 72 69 62  65 64 20 61 73 20 27 72  | described as 'r|
00003880  65 73 65 72 76 65 64 27  0d 69 6e 20 41 63 6f 72  |eserved'.in Acor|
00003890  6e 27 73 20 6c 69 74 65  72 61 74 75 72 65 20 62  |n's literature b|
000038a0  75 74 20 6d 79 20 6d 61  63 68 69 6e 65 20 28 61  |ut my machine (a|
000038b0  20 42 20 77 69 74 68 20  31 37 37 30 20 44 46 53  | B with 1770 DFS|
000038c0  29 0d 73 65 6e 64 73 20  69 74 20 77 68 65 72 65  |).sends it where|
000038d0  61 73 20 61 20 6e 6f 72  6d 61 6c 20 42 20 28 77  |as a normal B (w|
000038e0  69 74 68 20 38 32 37 31  20 44 46 53 29 20 64 6f  |ith 8271 DFS) do|
000038f0  65 73 20 6e 6f 74 2e 0d  0d 46 69 6e 61 6c 6c 79  |es not...Finally|
00003900  20 28 61 74 20 6c 61 73  74 29 20 63 61 6c 6c 73  | (at last) calls|
00003910  20 26 46 45 20 61 6e 64  20 26 46 46 20 61 72 65  | &FE and &FF are|
00003920  20 73 65 6e 74 20 61 74  0d 69 6e 69 74 69 61 6c  | sent at.initial|
00003930  69 73 61 74 69 6f 6e 20  6f 66 20 74 68 65 20 74  |isation of the t|
00003940  75 62 65 20 6f 6e 20 61  20 72 65 73 65 74 2e 20  |ube on a reset. |
00003950  57 69 74 68 20 61 20 73  65 63 6f 6e 64 0d 70 72  |With a second.pr|
00003960  6f 63 65 73 73 6f 72 20  70 72 65 73 65 6e 74 20  |ocessor present |
00003970  62 6f 74 68 20 61 72 65  20 73 65 6e 74 2c 20 62  |both are sent, b|
00003980  75 74 20 6f 6e 6c 79 20  74 68 65 20 66 6f 72 6d  |ut only the form|
00003990  65 72 20 69 66 20 6e 6f  0d 73 65 63 6f 6e 64 20  |er if no.second |
000039a0  70 72 6f 63 65 73 73 6f  72 20 69 73 20 64 65 74  |processor is det|
000039b0  65 63 74 65 64 2e 0d 0d  4f 6e 65 20 6f 66 20 74  |ected...One of t|
000039c0  68 65 20 74 68 69 6e 67  73 20 74 68 61 74 20 74  |he things that t|
000039d0  68 65 20 4f 53 42 49 54  53 20 52 4f 4d 20 64 6f  |he OSBITS ROM do|
000039e0  65 73 20 69 73 20 74 6f  20 70 72 69 6e 74 20 6f  |es is to print o|
000039f0  75 74 0d 74 68 65 20 73  65 72 76 69 63 65 20 63  |ut.the service c|
00003a00  61 6c 6c 73 20 61 73 20  74 68 65 79 20 68 61 70  |alls as they hap|
00003a10  70 65 6e 2e 20 20 54 68  65 20 63 61 6c 6c 73 20  |pen.  The calls |
00003a20  67 65 6e 65 72 61 74 65  64 20 69 6e 20 6d 79 0d  |generated in my.|
00003a30  6d 61 63 68 69 6e 65 20  61 72 65 20 61 73 20 66  |machine are as f|
00003a40  6f 6c 6c 6f 77 73 3a 0d  0d 57 69 74 68 6f 75 74  |ollows:..Without|
00003a50  20 73 65 63 6f 6e 64 20  70 72 6f 63 65 73 73 6f  | second processo|
00003a60  72 3a 0d 0d 31 30 20 20  30 46 20 20 30 31 20 20  |r:..10  0F  01  |
00003a70  32 42 20 20 30 37 20 20  30 37 20 20 30 32 20 20  |2B  07  07  02  |
00003a80  46 45 20 20 30 33 20 20  31 30 20 20 30 46 20 20  |FE  03  10  0F  |
00003a90  30 41 0d 0d 57 69 74 68  20 73 65 63 6f 6e 64 20  |0A..With second |
00003aa0  70 72 6f 63 65 73 73 6f  72 3a 0d 0d 31 30 20 20  |processor:..10  |
00003ab0  30 46 20 20 46 46 20 20  30 31 20 20 32 42 20 20  |0F  FF  01  2B  |
00003ac0  30 37 20 20 30 37 20 20  30 32 20 20 46 45 20 20  |07  07  02  FE  |
00003ad0  31 31 20 20 30 33 20 20  31 30 20 20 30 46 20 20  |11  03  10  0F  |
00003ae0  30 41 0d 0d 44 6f 6e 27  74 20 77 6f 72 72 79 20  |0A..Don't worry |
00003af0  69 66 20 79 6f 75 20 64  6f 6e 27 74 20 75 6e 64  |if you don't und|
00003b00  65 72 73 74 61 6e 64 20  61 6c 6c 20 74 68 6f 73  |erstand all thos|
00003b10  65 20 73 65 72 76 69 63  65 20 63 61 6c 6c 73 2e  |e service calls.|
00003b20  20 0d 49 20 63 65 72 74  61 69 6e 6c 79 20 64 6f  | .I certainly do|
00003b30  6e 27 74 20 75 6e 64 65  72 73 74 61 6e 64 20 61  |n't understand a|
00003b40  6e 79 20 6f 66 20 74 68  65 20 6f 6e 65 73 20 72  |ny of the ones r|
00003b50  65 6c 61 74 69 6e 67 20  74 6f 0d 66 69 6c 69 6e  |elating to.filin|
00003b60  67 20 73 79 73 74 65 6d  73 2c 20 74 68 65 79 20  |g systems, they |
00003b70  77 65 72 65 20 6e 65 76  65 72 20 6d 79 20 73 74  |were never my st|
00003b80  72 6f 6e 67 20 73 75 69  74 2e 20 20 54 68 65 20  |rong suit.  The |
00003b90  6d 61 69 6e 0d 74 68 69  6e 67 20 69 73 20 74 6f  |main.thing is to|
00003ba0  20 75 6e 64 65 72 73 74  61 6e 64 20 74 68 65 20  | understand the |
00003bb0  66 65 77 20 79 6f 75 20  61 72 65 20 6c 69 6b 65  |few you are like|
00003bc0  6c 79 20 74 6f 20 75 73  65 20 69 66 20 79 6f 75  |ly to use if you|
00003bd0  0d 77 72 69 74 65 20 61  20 52 4f 4d 2e 20 20 54  |.write a ROM.  T|
00003be0  68 65 73 65 20 77 69 6c  6c 20 62 65 20 6d 61 69  |hese will be mai|
00003bf0  6e 6c 79 20 6e 75 6d 62  65 72 73 20 32 2c 20 33  |nly numbers 2, 3|
00003c00  2c 20 34 20 61 6e 64 20  39 2e 0d 0d 4c 61 6e 67  |, 4 and 9...Lang|
00003c10  75 61 67 65 20 65 6e 74  72 79 20 69 73 20 6d 75  |uage entry is mu|
00003c20  63 68 20 73 69 6d 70 6c  65 72 2e 20 20 49 66 2c  |ch simpler.  If,|
00003c30  20 74 68 72 6f 75 67 68  20 73 65 72 76 69 63 65  | through service|
00003c40  20 63 61 6c 6c 20 34 2c  0d 61 20 52 4f 4d 20 64  | call 4,.a ROM d|
00003c50  65 74 65 63 74 73 20 69  74 73 20 6f 77 6e 20 6c  |etects its own l|
00003c60  61 6e 67 75 61 67 65 20  6e 61 6d 65 20 74 68 65  |anguage name the|
00003c70  6e 20 69 74 20 73 69 6d  70 6c 79 20 63 61 6c 6c  |n it simply call|
00003c80  73 0d 4f 53 42 59 54 45  20 31 34 32 20 77 69 74  |s.OSBYTE 142 wit|
00003c90  68 20 69 74 73 20 52 4f  4d 20 6e 75 6d 62 65 72  |h its ROM number|
00003ca0  20 69 6e 20 74 68 65 20  58 20 72 65 67 69 73 74  | in the X regist|
00003cb0  65 72 2e 20 20 54 68 65  20 4f 53 0d 77 69 6c 6c  |er.  The OS.will|
00003cc0  20 74 68 65 6e 20 65 6e  74 65 72 20 74 68 65 20  | then enter the |
00003cd0  6c 61 6e 67 75 61 67 65  20 74 68 72 6f 75 67 68  |language through|
00003ce0  20 74 68 65 20 6c 61 6e  67 75 61 67 65 20 65 6e  | the language en|
00003cf0  74 72 79 0d 70 6f 69 6e  74 20 61 6e 64 20 6f 66  |try.point and of|
00003d00  66 20 79 6f 75 20 67 6f  2e 20 20 54 68 65 20 4f  |f you go.  The O|
00003d10  53 20 64 6f 65 73 20 6e  6f 74 20 65 78 70 65 63  |S does not expec|
00003d20  74 20 61 20 72 65 74 75  72 6e 20 66 72 6f 6d 0d  |t a return from.|
00003d30  61 20 6c 61 6e 67 75 61  67 65 2e 0d 0d 54 68 65  |a language...The|
00003d40  20 52 4f 4d 20 61 73 73  65 6d 62 6c 79 20 63 6f  | ROM assembly co|
00003d50  64 65 20 69 6e 20 42 2f  6f 73 62 32 34 20 69 73  |de in B/osb24 is|
00003d60  20 69 6e 74 65 6e 64 65  64 20 74 6f 20 67 69 76  | intended to giv|
00003d70  65 20 79 6f 75 0d 73 6f  6d 65 20 69 64 65 61 20  |e you.some idea |
00003d80  6f 66 20 68 6f 77 20 74  6f 20 77 72 69 74 65 20  |of how to write |
00003d90  66 6f 72 20 61 20 73 65  72 76 69 63 65 20 52 4f  |for a service RO|
00003da0  4d 2e 20 20 49 20 64 6f  6e 27 74 20 69 6e 74 65  |M.  I don't inte|
00003db0  6e 64 0d 69 74 20 74 6f  20 62 65 20 64 65 66 69  |nd.it to be defi|
00003dc0  6e 69 74 69 76 65 20 61  6e 64 20 74 68 65 72 65  |nitive and there|
00003dd0  20 61 72 65 20 73 6f 6d  65 20 67 6f 6f 64 20 62  | are some good b|
00003de0  6f 6f 6b 73 20 61 72 6f  75 6e 64 20 61 6e 64 0d  |ooks around and.|
00003df0  6d 61 6e 79 20 6d 61 67  61 7a 69 6e 65 20 61 72  |many magazine ar|
00003e00  74 69 63 6c 65 73 2e 20  20 53 69 64 65 77 61 79  |ticles.  Sideway|
00003e10  73 20 52 4f 4d 73 20 61  72 65 20 61 20 73 74 75  |s ROMs are a stu|
00003e20  64 79 20 69 6e 0d 74 68  65 6d 73 65 6c 76 65 73  |dy in.themselves|
00003e30  2e 0d 0d 49 20 74 68 69  6e 6b 20 74 68 65 20 62  |...I think the b|
00003e40  65 73 74 20 77 61 79 20  74 6f 20 70 72 6f 63 65  |est way to proce|
00003e50  65 64 20 69 73 20 66 6f  72 20 6d 65 20 74 6f 20  |ed is for me to |
00003e60  77 61 6c 6b 20 79 6f 75  0d 74 68 72 6f 75 67 68  |walk you.through|
00003e70  20 74 68 65 20 70 72 6f  67 72 61 6d 20 69 6e 20  | the program in |
00003e80  74 68 69 73 20 6d 6f 64  75 6c 65 20 73 65 63 74  |this module sect|
00003e90  69 6f 6e 20 62 79 20 73  65 63 74 69 6f 6e 20 77  |ion by section w|
00003ea0  69 74 68 0d 61 6e 20 65  78 70 6c 61 6e 61 74 69  |ith.an explanati|
00003eb0  6f 6e 20 6f 66 20 77 68  61 74 20 69 73 20 68 61  |on of what is ha|
00003ec0  70 70 65 6e 69 6e 67 2e  20 20 54 68 65 6e 20 49  |ppening.  Then I|
00003ed0  20 68 6f 70 65 20 79 6f  75 20 77 69 6c 6c 0d 66  | hope you will.f|
00003ee0  65 65 6c 20 75 70 20 74  6f 20 73 6f 6d 65 20 65  |eel up to some e|
00003ef0  78 70 65 72 69 6d 65 6e  74 69 6e 67 2e 20 20 42  |xperimenting.  B|
00003f00  75 74 20 66 69 72 73 74  20 61 20 63 61 76 65 61  |ut first a cavea|
00003f10  74 20 2e 2e 2e 2e 0d 0d  42 2f 6f 73 62 32 34 20  |t ......B/osb24 |
00003f20  77 69 6c 6c 20 6e 6f 74  20 72 75 6e 20 77 69 74  |will not run wit|
00003f30  68 20 42 41 53 49 43 20  31 2e 20 20 49 20 6d 61  |h BASIC 1.  I ma|
00003f40  64 65 20 74 68 61 74 20  64 65 63 69 73 69 6f 6e  |de that decision|
00003f50  0d 70 61 72 74 6c 79 20  62 65 63 61 75 73 65 20  |.partly because |
00003f60  6f 66 20 74 68 65 20 6c  61 63 6b 20 6f 66 20 45  |of the lack of E|
00003f70  51 55 20 66 75 6e 63 74  69 6f 6e 73 20 28 61 6c  |QU functions (al|
00003f80  74 68 6f 75 67 68 20 74  68 65 73 65 0d 63 61 6e  |though these.can|
00003f90  20 62 65 20 73 69 6d 75  6c 61 74 65 64 20 61 73  | be simulated as|
00003fa0  20 79 6f 75 20 77 65 6c  6c 20 6b 6e 6f 77 29 2e  | you well know).|
00003fb0  20 20 4d 6f 72 65 20 69  6d 70 6f 72 74 61 6e 74  |  More important|
00003fc0  6c 79 2c 20 69 74 20 69  73 0d 61 6c 6d 6f 73 74  |ly, it is.almost|
00003fd0  20 69 6d 70 6f 73 69 62  6c 65 2c 20 61 6e 64 20  | imposible, and |
00003fe0  6e 6f 74 20 72 65 63 6f  6d 6d 65 6e 64 65 64 2c  |not recommended,|
00003ff0  20 74 6f 20 61 73 73 73  65 6d 62 6c 65 20 63 6f  | to asssemble co|
00004000  64 65 0d 64 69 72 65 63  74 6c 79 20 69 6e 74 6f  |de.directly into|
00004010  20 73 69 64 65 77 61 79  73 20 52 41 4d 2c 20 70  | sideways RAM, p|
00004020  61 72 74 69 63 75 6c 61  72 6c 79 20 69 66 20 74  |articularly if t|
00004030  68 65 20 52 41 4d 20 69  73 20 69 6e 0d 73 6f 63  |he RAM is in.soc|
00004040  6b 65 74 20 31 35 2e 20  20 41 6e 79 20 66 61 75  |ket 15.  Any fau|
00004050  6c 74 73 20 61 6e 64 20  79 6f 75 72 20 6d 61 63  |lts and your mac|
00004060  68 69 6e 65 20 77 69 6c  6c 20 6c 6f 63 6b 20 6f  |hine will lock o|
00004070  75 74 20 61 6e 64 0d 79  6f 75 20 77 69 6c 6c 20  |ut and.you will |
00004080  68 61 76 65 20 74 6f 20  73 77 69 74 63 68 20 69  |have to switch i|
00004090  74 20 6f 66 66 20 74 6f  20 63 75 72 65 20 74 68  |t off to cure th|
000040a0  65 20 66 61 75 6c 74 2c  20 6c 6f 73 69 6e 67 20  |e fault, losing |
000040b0  61 6c 6c 0d 79 6f 75 72  20 63 6f 64 65 2e 20 20  |all.your code.  |
000040c0  42 79 20 66 61 72 20 74  68 65 20 62 65 73 74 20  |By far the best |
000040d0  77 61 79 20 69 73 20 74  6f 20 67 65 6e 65 72 61  |way is to genera|
000040e0  74 65 20 74 68 65 20 61  73 73 65 6d 62 6c 65 64  |te the assembled|
000040f0  0d 63 6f 64 65 20 74 6f  20 72 75 6e 20 69 6e 20  |.code to run in |
00004100  74 68 65 20 72 65 71 75  69 72 65 64 20 73 70 61  |the required spa|
00004110  63 65 20 62 75 74 20 74  6f 20 62 65 20 61 73 73  |ce but to be ass|
00004120  65 6d 62 6c 65 64 20 69  6e 0d 61 6e 6f 74 68 65  |embled in.anothe|
00004130  72 20 70 61 72 74 20 6f  66 20 74 68 65 20 6d 65  |r part of the me|
00004140  6d 6f 72 79 2e 20 20 49  6e 20 42 41 53 49 43 20  |mory.  In BASIC |
00004150  32 20 65 74 20 61 6c 20  79 6f 75 20 63 61 6e 20  |2 et al you can |
00004160  64 6f 0d 74 68 69 73 20  62 79 20 75 73 69 6e 67  |do.this by using|
00004170  20 76 61 6c 75 65 73 20  6f 66 20 4f 50 54 20 66  | values of OPT f|
00004180  72 6f 6d 20 34 20 74 6f  20 37 20 69 6e 73 74 65  |rom 4 to 7 inste|
00004190  61 64 20 6f 66 20 30 20  74 6f 20 33 2e 20 0d 4c  |ad of 0 to 3. .L|
000041a0  69 6e 65 20 33 31 30 20  6f 66 20 74 68 69 73 20  |ine 310 of this |
000041b0  70 72 6f 67 72 61 6d 20  73 68 6f 77 73 20 74 68  |program shows th|
000041c0  69 73 2e 0d 0d 59 6f 75  20 77 69 6c 6c 20 74 68  |is...You will th|
000041d0  65 6e 20 68 61 76 65 20  61 20 70 72 6f 67 72 61  |en have a progra|
000041e0  6d 20 79 6f 75 20 63 61  6e 20 73 61 76 65 20 74  |m you can save t|
000041f0  6f 20 64 69 73 63 20 66  72 6f 6d 20 77 68 69 63  |o disc from whic|
00004200  68 0d 79 6f 75 20 63 61  6e 20 6c 6f 61 64 20 69  |h.you can load i|
00004210  6e 74 6f 20 73 69 64 65  77 61 79 73 20 52 41 4d  |nto sideways RAM|
00004220  20 6f 72 2c 20 69 66 20  79 6f 75 20 68 61 76 65  | or, if you have|
00004230  20 74 68 65 0d 74 65 63  68 6e 6f 6c 6f 67 79 2c  | the.technology,|
00004240  20 62 6c 6f 77 20 79 6f  75 72 73 65 6c 66 20 61  | blow yourself a|
00004250  6e 20 45 50 52 4f 4d 2e  20 20 4d 79 20 6d 61 63  |n EPROM.  My mac|
00004260  68 69 6e 65 0d 63 6f 6e  66 69 67 75 72 61 74 69  |hine.configurati|
00004270  6f 6e 20 68 61 73 20 31  36 4b 20 6f 66 20 52 41  |on has 16K of RA|
00004280  4d 20 69 6e 20 52 4f 4d  20 73 6f 63 6b 65 74 20  |M in ROM socket |
00004290  31 35 20 61 73 20 70 61  72 74 20 6f 66 20 6d 79  |15 as part of my|
000042a0  0d 52 4f 4d 20 65 78 74  65 6e 73 69 6f 6e 20 62  |.ROM extension b|
000042b0  6f 61 72 64 20 61 6e 64  20 49 20 63 61 6e 20 73  |oard and I can s|
000042c0  69 6d 70 6c 65 20 2a 4c  4f 41 44 20 69 6e 74 6f  |imple *LOAD into|
000042d0  20 74 68 61 74 20 6d 65  6d 6f 72 79 2e 20 0d 49  | that memory. .I|
000042e0  66 20 79 6f 75 20 68 61  76 65 20 61 20 42 2b 20  |f you have a B+ |
000042f0  6f 72 20 61 20 4d 61 73  74 65 72 20 79 6f 75 20  |or a Master you |
00004300  77 69 6c 6c 20 70 72 6f  62 61 62 6c 79 20 68 61  |will probably ha|
00004310  76 65 20 73 69 64 65 77  61 79 73 0d 52 41 4d 20  |ve sideways.RAM |
00004320  62 75 69 6c 74 20 69 6e  20 61 6e 64 20 75 73 65  |built in and use|
00004330  20 2a 53 52 4c 4f 41 44  20 74 6f 20 6c 6f 61 64  | *SRLOAD to load|
00004340  20 69 6e 74 6f 20 69 74  2e 0d 0d 49 66 20 79 6f  | into it...If yo|
00004350  75 20 72 65 61 6c 6c 79  20 77 61 6e 74 20 74 6f  |u really want to|
00004360  20 61 73 73 65 6d 62 6c  65 20 64 69 72 65 63 74  | assemble direct|
00004370  20 69 6e 74 6f 20 73 69  64 65 77 61 79 73 20 52  | into sideways R|
00004380  41 4d 20 74 68 65 6e 0d  79 6f 75 20 73 68 6f 75  |AM then.you shou|
00004390  6c 64 20 63 68 61 6e 67  65 20 6c 69 6e 65 20 33  |ld change line 3|
000043a0  31 30 20 74 6f 20 72 65  61 64 0d 0d 20 20 20 20  |10 to read..    |
000043b0  20 46 4f 52 20 70 61 73  73 25 20 3d 20 30 20 54  | FOR pass% = 0 T|
000043c0  4f 20 32 20 53 54 45 50  20 32 0d 0d 61 6e 64 20  |O 2 STEP 2..and |
000043d0  74 68 65 20 63 6f 64 65  20 77 69 6c 6c 20 62 65  |the code will be|
000043e0  20 70 75 74 20 64 69 72  65 63 74 6c 79 20 69 6e  | put directly in|
000043f0  74 6f 20 6d 65 6d 6f 72  79 20 61 74 20 26 38 30  |to memory at &80|
00004400  30 30 2e 20 0d 28 54 68  69 73 20 77 69 6c 6c 20  |00. .(This will |
00004410  6e 6f 74 20 77 6f 72 6b  20 6f 6e 20 61 20 4d 61  |not work on a Ma|
00004420  73 74 65 72 20 6f 72 20  42 2b 31 32 38 2e 29 20  |ster or B+128.) |
00004430  20 42 75 74 20 62 65 61  72 20 69 6e 20 6d 69 6e  | But bear in min|
00004440  64 0d 74 68 65 20 70 6f  73 73 69 62 6c 65 20 70  |d.the possible p|
00004450  72 6f 62 6c 65 6d 73 20  69 66 20 79 6f 75 20 73  |roblems if you s|
00004460  68 6f 75 6c 64 20 61 62  6f 72 74 20 74 68 65 20  |hould abort the |
00004470  61 73 73 65 6d 62 6c 79  2e 20 20 54 68 65 0d 73  |assembly.  The.s|
00004480  65 72 76 69 63 65 20 63  61 6c 6c 20 4a 55 4d 50  |ervice call JUMP|
00004490  20 69 6e 73 74 72 75 63  74 69 6f 6e 20 61 74 20  | instruction at |
000044a0  74 68 65 20 73 74 61 72  74 20 6f 66 20 79 6f 75  |the start of you|
000044b0  72 20 52 4f 4d 20 69 6d  61 67 65 0d 63 6f 64 65  |r ROM image.code|
000044c0  20 6d 69 67 68 74 20 65  6e 64 20 75 70 20 70 6f  | might end up po|
000044d0  69 6e 74 69 6e 67 20 74  6f 20 73 6f 6d 65 20 73  |inting to some s|
000044e0  70 75 72 69 6f 75 73 20  52 41 4d 20 61 6e 64 20  |purious RAM and |
000044f0  79 6f 75 72 0d 6d 61 63  68 69 6e 65 20 77 69 6c  |your.machine wil|
00004500  6c 20 63 72 61 73 68 2e  20 20 42 65 63 61 75 73  |l crash.  Becaus|
00004510  65 20 74 68 65 20 52 41  4d 20 68 61 73 20 68 69  |e the RAM has hi|
00004520  67 68 65 73 74 20 70 72  69 6f 72 69 74 79 20 69  |ghest priority i|
00004530  66 0d 69 74 20 69 73 20  69 6e 20 73 6f 63 6b 65  |f.it is in socke|
00004540  74 20 31 35 20 65 76 65  6e 20 61 20 43 4f 4e 54  |t 15 even a CONT|
00004550  52 4f 4c 2f 42 52 45 41  4b 20 77 69 6c 6c 20 6e  |ROL/BREAK will n|
00004560  6f 74 20 68 65 6c 70 2c  20 79 6f 75 0d 77 69 6c  |ot help, you.wil|
00004570  6c 20 68 61 76 65 20 74  6f 20 73 77 69 74 63 68  |l have to switch|
00004580  20 6f 66 66 2e 0d 0d 41  6e 64 20 73 6f 20 74 6f  | off...And so to|
00004590  20 74 68 65 20 70 72 6f  67 72 61 6d 2e 0d 0d 53  | the program...S|
000045a0  79 73 74 65 6d 20 76 61  72 69 61 62 6c 65 73 20  |ystem variables |
000045b0  61 72 65 20 73 65 74 20  69 6e 20 74 68 65 20 66  |are set in the f|
000045c0  69 72 73 74 20 66 65 77  20 6c 69 6e 65 73 2e 20  |irst few lines. |
000045d0  20 49 20 68 61 76 65 0d  61 6c 6c 6f 63 61 74 65  | I have.allocate|
000045e0  64 20 73 6f 6d 65 20 77  6f 72 6b 73 70 61 63 65  |d some workspace|
000045f0  20 69 6e 20 7a 65 72 6f  20 70 61 67 65 20 73 74  | in zero page st|
00004600  61 72 74 69 6e 67 20 61  74 20 26 41 38 2e 20 20  |arting at &A8.  |
00004610  54 68 69 73 0d 6d 65 6d  6f 72 79 20 69 73 20 72  |This.memory is r|
00004620  65 73 65 72 76 65 64 20  66 6f 72 20 4f 53 20 63  |eserved for OS c|
00004630  6f 6d 6d 61 6e 64 73 20  64 75 72 69 6e 67 20 65  |ommands during e|
00004640  78 65 63 75 74 69 6f 6e  2c 20 62 75 74 20 49 0d  |xecution, but I.|
00004650  61 6d 20 73 74 69 6c 6c  20 70 72 65 73 65 72 76  |am still preserv|
00004660  69 6e 67 20 74 68 65 20  63 6f 6e 74 65 6e 74 73  |ing the contents|
00004670  20 6f 66 20 74 68 65 73  65 20 6c 6f 63 61 74 69  | of these locati|
00004680  6f 6e 73 20 61 73 20 49  20 75 73 65 0d 74 68 65  |ons as I use.the|
00004690  6d 2e 20 20 41 74 20 6c  65 61 73 74 20 79 6f 75  |m.  At least you|
000046a0  20 73 68 6f 75 6c 64 6e  27 74 20 66 69 6e 64 20  | shouldn't find |
000046b0  73 6f 6d 65 62 6f 64 79  20 70 75 74 74 69 6e 67  |somebody putting|
000046c0  20 74 68 65 69 72 0d 69  6e 74 65 72 72 75 70 74  | their.interrupt|
000046d0  20 63 6f 64 65 20 68 65  72 65 2e 0d 0d 49 20 68  | code here...I h|
000046e0  61 76 65 20 64 65 66 69  6e 65 64 20 6d 6f 72 65  |ave defined more|
000046f0  20 4f 53 20 72 6f 75 74  69 6e 65 20 61 64 64 72  | OS routine addr|
00004700  65 73 73 65 73 20 74 68  61 6e 20 49 20 68 61 76  |esses than I hav|
00004710  65 20 75 73 65 64 20 74  6f 0d 68 65 6c 70 20 79  |e used to.help y|
00004720  6f 75 20 69 66 20 79 6f  75 20 61 64 64 20 61 6e  |ou if you add an|
00004730  79 20 63 6f 64 65 20 6f  66 20 79 6f 75 72 20 6f  |y code of your o|
00004740  77 6e 20 74 6f 20 74 68  69 73 20 68 65 72 65 2e  |wn to this here.|
00004750  0d 0d 41 66 74 65 72 20  74 68 65 20 52 4f 4d 20  |..After the ROM |
00004760  68 65 61 64 65 72 2c 20  77 68 69 63 68 20 49 20  |header, which I |
00004770  65 78 70 6c 61 69 6e 65  64 20 65 61 72 6c 69 65  |explained earlie|
00004780  72 2c 20 69 73 20 74 68  65 0d 73 65 72 76 69 63  |r, is the.servic|
00004790  65 20 65 6e 74 72 79 20  70 6f 69 6e 74 2e 20 20  |e entry point.  |
000047a0  4e 6f 77 20 73 69 6e 63  65 20 49 20 77 61 6e 74  |Now since I want|
000047b0  20 74 68 69 73 20 52 4f  4d 20 74 6f 20 64 69 73  | this ROM to dis|
000047c0  70 6c 61 79 0d 74 68 65  20 73 65 72 76 69 63 65  |play.the service|
000047d0  20 63 61 6c 6c 73 20 69  74 20 72 65 63 65 69 76  | calls it receiv|
000047e0  65 73 20 74 68 65 20 66  69 72 73 74 20 74 68 69  |es the first thi|
000047f0  6e 67 20 74 68 61 74 20  68 61 70 70 65 6e 73 0d  |ng that happens.|
00004800  69 73 20 61 20 4a 53 52  20 74 6f 20 61 20 73 75  |is a JSR to a su|
00004810  62 72 6f 75 74 69 6e 65  20 63 61 6c 6c 65 64 20  |broutine called |
00004820  27 73 68 6f 77 5f 73 65  72 76 69 63 65 5f 63 61  |'show_service_ca|
00004830  6c 6c 73 27 2e 20 20 54  68 69 73 0d 69 73 20 61  |lls'.  This.is a|
00004840  74 20 6c 69 6e 65 20 33  34 30 30 20 69 6e 20 74  |t line 3400 in t|
00004850  68 65 20 6c 69 73 74 69  6e 67 2e 0d 0d 49 20 61  |he listing...I a|
00004860  6d 20 75 73 69 6e 67 20  61 20 62 79 74 65 20 6f  |m using a byte o|
00004870  66 20 74 68 65 20 4f 53  20 77 6f 72 6b 73 70 61  |f the OS workspa|
00004880  63 65 20 74 68 61 74 20  69 73 20 75 6e 75 73 65  |ce that is unuse|
00004890  64 20 62 79 20 74 68 65  0d 4f 53 20 6f 6e 20 61  |d by the.OS on a|
000048a0  20 42 20 61 6c 74 68 6f  75 67 68 20 74 68 65 72  | B although ther|
000048b0  65 20 69 73 20 61 20 4f  53 42 59 54 45 20 63 61  |e is a OSBYTE ca|
000048c0  6c 6c 20 74 6f 20 61 63  63 65 73 73 20 69 74 2e  |ll to access it.|
000048d0  20 20 49 74 0d 69 73 20  61 74 20 26 32 38 41 20  |  It.is at &28A |
000048e0  61 6e 64 20 69 73 20 68  65 6c 64 20 61 73 20 61  |and is held as a|
000048f0  20 76 61 72 69 61 62 6c  65 20 63 61 6c 6c 65 64  | variable called|
00004900  20 27 73 65 72 76 69 63  65 5f 66 6c 61 67 27 0d  | 'service_flag'.|
00004910  64 65 66 69 6e 65 64 20  69 6e 20 6c 69 6e 65 20  |defined in line |
00004920  32 35 30 2e 20 20 49 66  20 74 68 69 73 20 66 6c  |250.  If this fl|
00004930  61 67 20 69 73 20 73 65  74 20 28 61 6e 79 74 68  |ag is set (anyth|
00004940  69 6e 67 20 6f 74 68 65  72 0d 74 68 61 6e 20 7a  |ing other.than z|
00004950  65 72 6f 29 20 74 68 65  6e 20 74 68 65 20 76 61  |ero) then the va|
00004960  6c 75 65 73 20 69 6e 20  74 68 65 20 61 63 63 75  |lues in the accu|
00004970  6d 75 6c 61 74 6f 72 20  61 6e 64 20 69 6e 20 58  |mulator and in X|
00004980  20 61 6e 64 20 59 0d 61  72 65 20 70 72 69 6e 74  | and Y.are print|
00004990  65 64 20 6f 75 74 20 69  6e 20 68 65 78 20 61 73  |ed out in hex as|
000049a0  20 74 68 65 79 20 67 6f  20 74 68 72 6f 75 67 68  | they go through|
000049b0  20 74 68 65 20 52 4f 4d  2e 20 20 49 66 20 74 68  | the ROM.  If th|
000049c0  65 0d 66 6c 61 67 20 69  73 20 63 6c 65 61 72 20  |e.flag is clear |
000049d0  28 7a 65 72 6f 29 20 74  68 65 79 20 61 72 65 20  |(zero) they are |
000049e0  6e 6f 74 2e 20 20 54 68  65 20 64 65 66 61 75 6c  |not.  The defaul|
000049f0  74 20 76 61 6c 75 65 20  6f 66 20 74 68 65 0d 66  |t value of the.f|
00004a00  6c 61 67 20 69 73 20 7a  65 72 6f 20 61 6e 64 20  |lag is zero and |
00004a10  69 74 20 63 61 6e 20 62  65 20 73 65 74 20 62 79  |it can be set by|
00004a20  20 65 6e 74 65 72 69 6e  67 20 2a 46 58 20 32 35  | entering *FX 25|
00004a30  30 2c 31 2e 20 20 54 68  65 0d 52 4f 4d 20 70 72  |0,1.  The.ROM pr|
00004a40  6f 76 69 64 65 73 20 61  20 63 6c 65 61 72 65 72  |ovides a clearer|
00004a50  20 77 61 79 2c 20 77 68  69 63 68 20 49 27 6c 6c  | way, which I'll|
00004a60  20 63 6f 6d 65 20 6f 6e  20 74 6f 20 77 68 65 6e  | come on to when|
00004a70  20 49 0d 74 61 6c 6b 20  61 62 6f 75 74 20 74 68  | I.talk about th|
00004a80  65 20 62 75 69 6c 64 2d  69 6e 20 63 6f 6d 6d 61  |e build-in comma|
00004a90  6e 64 73 2e 20 20 49 20  74 68 69 6e 6b 20 74 68  |nds.  I think th|
00004aa0  65 20 73 75 62 72 6f 75  74 69 6e 65 20 69 73 0d  |e subroutine is.|
00004ab0  73 65 6c 66 2d 65 78 70  6c 61 6e 61 74 6f 72 79  |self-explanatory|
00004ac0  2c 20 62 75 74 20 6e 6f  74 65 20 74 68 61 74 20  |, but note that |
00004ad0  69 74 20 69 73 20 69 6d  70 6f 72 74 61 6e 74 20  |it is important |
00004ae0  74 6f 20 62 61 6c 61 6e  63 65 0d 74 68 65 20 70  |to balance.the p|
00004af0  75 73 68 65 73 20 74 6f  20 61 6e 64 20 70 75 6c  |ushes to and pul|
00004b00  6c 73 20 66 72 6f 6d 20  74 68 65 20 73 74 61 63  |ls from the stac|
00004b10  6b 2c 20 77 68 69 63 68  20 69 73 20 77 68 79 20  |k, which is why |
00004b20  74 68 65 72 65 0d 69 73  20 61 20 50 4c 41 20 61  |there.is a PLA a|
00004b30  6e 64 20 61 20 50 48 41  20 74 6f 67 65 74 68 65  |nd a PHA togethe|
00004b40  72 20 69 6e 20 6c 69 6e  65 73 20 33 34 36 30 20  |r in lines 3460 |
00004b50  61 6e 64 20 33 34 37 30  2e 0d 0d 41 66 74 65 72  |and 3470...After|
00004b60  20 67 6f 69 6e 67 20 74  68 72 6f 75 67 68 20 74  | going through t|
00004b70  68 65 20 73 65 72 76 69  63 65 20 63 61 6c 6c 20  |he service call |
00004b80  72 6f 75 74 69 6e 65 20  74 68 65 20 52 4f 4d 20  |routine the ROM |
00004b90  63 68 65 63 6b 73 0d 74  6f 20 73 65 65 20 77 68  |checks.to see wh|
00004ba0  69 63 68 20 63 61 6c 6c  20 69 74 20 69 73 2c 20  |ich call it is, |
00004bb0  61 6e 64 20 74 6f 20 72  65 73 70 6f 6e 64 20 61  |and to respond a|
00004bc0  63 63 6f 72 64 69 6e 67  6c 79 2e 20 20 54 68 69  |ccordingly.  Thi|
00004bd0  73 0d 52 4f 4d 20 72 65  73 70 6f 6e 64 73 20 74  |s.ROM responds t|
00004be0  6f 20 63 61 6c 6c 73 20  32 20 28 61 6c 74 68 6f  |o calls 2 (altho|
00004bf0  75 67 68 20 49 20 68 61  76 65 20 64 69 73 61 62  |ugh I have disab|
00004c00  6c 65 64 20 74 68 61 74  0d 73 65 63 74 69 6f 6e  |led that.section|
00004c10  20 6f 66 20 74 68 65 20  61 73 73 65 6d 62 6c 65  | of the assemble|
00004c20  72 20 77 69 74 68 20 63  6f 6d 6d 65 6e 74 73 29  |r with comments)|
00004c30  2c 20 33 2c 20 34 20 61  6e 64 20 39 2e 0d 0d 43  |, 3, 4 and 9...C|
00004c40  61 6c 6c 20 32 20 61 6c  6c 6f 77 73 20 79 6f 75  |all 2 allows you|
00004c50  20 74 6f 20 72 65 73 65  72 76 65 20 70 72 69 76  | to reserve priv|
00004c60  61 74 65 20 64 79 6e 61  6d 69 63 20 77 6f 72 6b  |ate dynamic work|
00004c70  73 70 61 63 65 2e 20 0d  54 68 69 73 20 69 73 20  |space. .This is |
00004c80  77 68 79 20 52 4f 4d 73  20 73 6f 6d 65 74 69 6d  |why ROMs sometim|
00004c90  65 73 20 72 61 69 73 65  20 74 68 65 20 76 61 6c  |es raise the val|
00004ca0  75 65 20 6f 66 20 50 41  47 45 2e 20 20 49 6e 20  |ue of PAGE.  In |
00004cb0  74 68 69 73 0d 70 61 72  74 69 63 75 6c 61 72 20  |this.particular |
00004cc0  63 61 73 65 20 49 20 68  61 76 65 20 62 6c 6f 63  |case I have bloc|
00004cd0  6b 65 64 20 6f 66 66 20  74 68 65 20 72 65 6c 65  |ked off the rele|
00004ce0  76 61 6e 74 20 62 69 74  73 20 6f 66 20 74 68 65  |vant bits of the|
00004cf0  0d 61 73 73 65 6d 62 6c  79 20 63 6f 64 65 20 75  |.assembly code u|
00004d00  73 69 6e 67 20 63 6f 6d  6d 65 6e 74 20 62 61 63  |sing comment bac|
00004d10  6b 2d 73 6c 61 73 68 65  73 2c 20 69 66 20 79 6f  |k-slashes, if yo|
00004d20  75 20 77 61 6e 74 20 73  6f 6d 65 0d 77 6f 72 6b  |u want some.work|
00004d30  73 70 61 63 65 20 74 68  65 6e 20 72 65 6d 6f 76  |space then remov|
00004d40  65 20 74 68 65 20 62 61  63 6b 2d 73 6c 61 73 68  |e the back-slash|
00004d50  65 73 2e 20 20 54 68 65  20 73 74 61 72 74 20 6f  |es.  The start o|
00004d60  66 20 79 6f 75 72 0d 77  6f 72 6b 73 70 61 63 65  |f your.workspace|
00004d70  20 28 61 20 70 61 67 65  20 69 6e 20 74 68 69 73  | (a page in this|
00004d80  20 63 61 73 65 29 20 69  73 20 68 65 6c 64 20 69  | case) is held i|
00004d90  6e 20 26 44 46 30 2c 20  58 20 77 68 65 72 65 20  |n &DF0, X where |
00004da0  58 0d 69 73 20 79 6f 75  72 20 52 4f 4d 20 73 6f  |X.is your ROM so|
00004db0  63 6b 65 74 20 6e 75 6d  62 65 72 2c 20 70 61 73  |cket number, pas|
00004dc0  73 65 64 20 69 6e 20 58  20 62 79 20 61 6e 79 20  |sed in X by any |
00004dd0  73 65 72 76 69 63 65 20  63 61 6c 6c 2e 0d 0d 49  |service call...I|
00004de0  20 75 73 65 20 73 65 72  76 69 63 65 20 63 61 6c  | use service cal|
00004df0  6c 20 33 20 74 6f 20 70  72 69 6e 74 20 61 20 6d  |l 3 to print a m|
00004e00  65 73 73 61 67 65 20 69  6e 20 74 68 65 20 62 61  |essage in the ba|
00004e10  6e 6e 65 72 20 61 66 74  65 72 0d 61 20 42 52 45  |nner after.a BRE|
00004e20  41 4b 2e 20 20 54 68 69  73 20 77 6f 75 6c 64 20  |AK.  This would |
00004e30  62 65 20 61 20 67 6f 6f  64 20 74 69 6d 65 20 74  |be a good time t|
00004e40  6f 20 63 6c 65 61 72 20  73 6f 6d 65 20 6f 66 20  |o clear some of |
00004e50  79 6f 75 72 0d 77 6f 72  6b 73 70 61 63 65 20 69  |your.workspace i|
00004e60  66 20 79 6f 75 20 6e 65  65 64 65 64 20 69 74 20  |f you needed it |
00004e70  72 65 73 65 74 20 6f 6e  20 61 20 42 52 45 41 4b  |reset on a BREAK|
00004e80  2e 20 20 54 68 6f 73 65  20 6c 69 6e 65 73 20 6f  |.  Those lines o|
00004e90  66 0d 74 68 65 20 63 6f  64 65 20 61 72 65 20 61  |f.the code are a|
00004ea0  67 61 69 6e 20 62 6c 6f  63 6b 65 64 20 6f 66 66  |gain blocked off|
00004eb0  20 69 6e 20 74 68 65 20  61 73 73 65 6d 62 6c 65  | in the assemble|
00004ec0  72 20 6c 69 73 74 69 6e  67 20 69 6e 0d 63 61 73  |r listing in.cas|
00004ed0  65 20 79 6f 75 20 6e 65  65 64 20 74 68 65 6d 2e  |e you need them.|
00004ee0  20 20 54 68 65 20 72 65  61 73 6f 6e 20 49 27 76  |  The reason I'v|
00004ef0  65 20 62 6c 6f 63 6b 65  64 20 74 68 6f 73 65 20  |e blocked those |
00004f00  73 65 63 74 69 6f 6e 73  0d 6f 66 66 20 69 73 20  |sections.off is |
00004f10  74 68 61 74 20 49 20 64  69 64 6e 27 74 20 77 61  |that I didn't wa|
00004f20  6e 74 20 74 6f 20 72 61  69 73 65 20 50 41 47 45  |nt to raise PAGE|
00004f30  20 75 6e 6c 65 73 73 20  69 74 20 77 61 73 0d 6e  | unless it was.n|
00004f40  65 65 64 65 64 2c 20 61  6e 64 20 69 6e 20 69 74  |eeded, and in it|
00004f50  73 20 70 72 65 73 65 6e  74 20 66 6f 72 6d 20 74  |s present form t|
00004f60  68 65 20 52 4f 4d 20 64  6f 65 73 6e 27 74 20 75  |he ROM doesn't u|
00004f70  73 65 20 61 6e 79 0d 77  6f 72 6b 73 70 61 63 65  |se any.workspace|
00004f80  20 65 78 63 65 70 74 20  74 68 61 74 20 69 6e 20  | except that in |
00004f90  7a 65 72 6f 20 70 61 67  65 2e 0d 0d 55 73 69 6e  |zero page...Usin|
00004fa0  67 20 63 61 6c 6c 20 33  20 66 6f 72 20 62 61 6e  |g call 3 for ban|
00004fb0  6e 65 72 20 6d 65 73 73  61 67 65 73 20 69 73 20  |ner messages is |
00004fc0  6e 6f 74 20 72 65 61 6c  6c 79 20 61 6e 20 61 70  |not really an ap|
00004fd0  70 72 6f 76 65 64 0d 69  64 65 61 2e 20 20 54 68  |proved.idea.  Th|
00004fe0  65 72 65 20 69 73 20 6e  6f 20 72 65 61 6c 20 68  |ere is no real h|
00004ff0  61 72 6d 20 69 6e 20 69  74 2c 20 62 75 74 20 61  |arm in it, but a|
00005000  20 66 69 6c 69 6e 67 20  73 79 73 74 65 6d 20 52  | filing system R|
00005010  4f 4d 0d 74 68 61 74 20  63 6c 61 69 6d 73 20 74  |OM.that claims t|
00005020  68 69 73 20 63 61 6c 6c  20 77 69 6c 6c 20 6f 62  |his call will ob|
00005030  76 69 6f 75 73 6c 79 20  61 6c 73 6f 20 73 74 6f  |viously also sto|
00005040  70 20 74 68 65 20 62 61  6e 6e 65 72 0d 6d 65 73  |p the banner.mes|
00005050  73 61 67 65 20 62 65 69  6e 67 20 70 72 69 6e 74  |sage being print|
00005060  65 64 2e 20 20 57 69 74  68 20 74 68 65 20 4f 53  |ed.  With the OS|
00005070  42 52 4f 4d 20 28 61 73  20 49 20 68 61 76 65 20  |BROM (as I have |
00005080  63 61 6c 6c 65 64 0d 69  74 29 20 69 6e 20 73 6f  |called.it) in so|
00005090  63 6b 65 74 20 31 35 2c  20 74 68 69 73 20 69 73  |cket 15, this is|
000050a0  20 6e 6f 74 20 61 20 70  72 6f 62 6c 65 6d 2e 20  | not a problem. |
000050b0  20 59 6f 75 20 63 6f 75  6c 64 20 75 73 65 20 63  | You could use c|
000050c0  61 6c 6c 0d 31 20 62 75  74 20 79 6f 75 72 20 6d  |all.1 but your m|
000050d0  65 73 73 61 67 65 20 77  6f 75 6c 64 20 74 68 65  |essage would the|
000050e0  6e 20 61 70 70 65 61 72  20 61 62 6f 76 65 20 74  |n appear above t|
000050f0  68 65 20 41 63 6f 72 6e  20 62 61 6e 6e 65 72 2e  |he Acorn banner.|
00005100  20 0d 59 6f 75 20 63 61  6e 20 6d 6f 64 69 66 79  | .You can modify|
00005110  20 6c 69 6e 65 20 36 35  30 20 74 6f 20 72 65 61  | line 650 to rea|
00005120  64 20 43 4d 50 20 23 31  20 69 66 20 79 6f 75 20  |d CMP #1 if you |
00005130  77 61 6e 74 20 74 6f 20  73 65 65 0d 74 68 65 20  |want to see.the |
00005140  65 66 66 65 63 74 2c 20  61 73 73 75 6d 69 6e 67  |effect, assuming|
00005150  20 79 6f 75 20 6c 65 61  76 65 20 74 68 65 20 63  | you leave the c|
00005160  6f 6d 6d 65 6e 74 20 62  61 63 6b 2d 73 6c 61 73  |omment back-slas|
00005170  68 65 73 20 69 6e 0d 70  6c 61 63 65 2e 0d 0d 53  |hes in.place...S|
00005180  65 72 76 69 63 65 20 63  61 6c 6c 20 34 20 69 73  |ervice call 4 is|
00005190  20 74 68 65 20 6f 6e 65  20 66 6f 72 20 75 6e 72  | the one for unr|
000051a0  65 63 6f 67 6e 69 73 65  64 20 63 6f 6d 6d 61 6e  |ecognised comman|
000051b0  64 73 2e 20 0d 57 68 65  6e 65 76 65 72 20 61 20  |ds. .Whenever a |
000051c0  2a 63 6f 6d 6d 61 6e 64  20 70 61 73 73 65 73 20  |*command passes |
000051d0  74 68 72 6f 75 67 68 20  74 68 65 20 63 6f 6d 6d  |through the comm|
000051e0  61 6e 64 20 6c 69 6e 65  0d 69 6e 74 65 72 70 72  |and line.interpr|
000051f0  65 74 65 72 20 69 74 20  69 73 20 70 61 73 73 65  |eter it is passe|
00005200  64 20 66 6f 72 20 61 63  74 69 6f 6e 20 74 6f 3a  |d for action to:|
00005210  0d 0d 20 20 20 20 20 20  31 3a 20 20 54 68 65 20  |..      1:  The |
00005220  6f 70 65 72 61 74 69 6e  67 20 73 79 73 74 65 6d  |operating system|
00005230  0d 20 20 20 20 20 20 32  3a 20 20 53 69 64 65 77  |.      2:  Sidew|
00005240  61 79 73 20 52 4f 4d 53  20 77 69 74 68 20 73 65  |ays ROMS with se|
00005250  72 76 69 63 65 20 63 61  6c 6c 20 34 0d 20 20 20  |rvice call 4.   |
00005260  20 20 20 33 3a 20 20 54  68 65 20 63 75 72 72 65  |   3:  The curre|
00005270  6e 74 20 66 69 6c 69 6e  67 20 73 79 73 74 65 6d  |nt filing system|
00005280  20 28 65 78 63 65 70 74  20 66 6f 72 20 63 61 73  | (except for cas|
00005290  73 65 74 74 65 29 0d 0d  69 6e 20 74 68 61 74 20  |sette)..in that |
000052a0  6f 72 64 65 72 2e 20 20  57 68 65 6e 20 73 65 72  |order.  When ser|
000052b0  76 69 63 65 20 63 61 6c  6c 20 34 20 72 65 61 63  |vice call 4 reac|
000052c0  68 65 73 20 74 68 65 20  52 4f 4d 2c 0d 65 78 65  |hes the ROM,.exe|
000052d0  63 75 74 69 6f 6e 20 6a  75 6d 70 73 20 74 6f 20  |cution jumps to |
000052e0  27 63 6f 6d 6d 61 6e 64  73 27 20 61 74 20 6c 69  |'commands' at li|
000052f0  6e 65 20 32 32 38 30 2e  20 20 41 66 74 65 72 20  |ne 2280.  After |
00005300  77 6f 72 6b 73 70 61 63  65 0d 68 6f 75 73 65 6b  |workspace.housek|
00005310  65 65 70 69 6e 67 20 28  73 6f 6d 65 20 6f 66 20  |eeping (some of |
00005320  74 68 65 73 65 20 73 68  6f 75 6c 64 20 70 65 72  |these should per|
00005330  68 61 70 73 20 61 6c 73  6f 20 62 65 20 62 6c 61  |haps also be bla|
00005340  6e 6b 65 64 0d 6f 66 66  20 62 75 74 20 6e 6f 20  |nked.off but no |
00005350  63 6f 6d 6d 61 6e 64 73  20 61 63 74 75 61 6c 6c  |commands actuall|
00005360  79 20 75 73 65 20 74 68  65 20 70 72 69 76 61 74  |y use the privat|
00005370  65 20 77 6f 72 6b 73 70  61 63 65 20 73 6f 2c 0d  |e workspace so,.|
00005380  66 6f 72 20 74 68 65 20  6d 6f 6d 65 6e 74 2c 20  |for the moment, |
00005390  6c 65 74 20 74 68 65 6d  20 73 74 61 6e 64 29 20  |let them stand) |
000053a0  77 65 20 73 74 6f 72 65  20 59 2d 31 20 6f 6e 20  |we store Y-1 on |
000053b0  74 68 65 20 73 74 61 63  6b 0d 66 6f 72 20 6c 61  |the stack.for la|
000053c0  74 65 72 2e 20 20 28 59  2d 31 20 73 6f 20 74 68  |ter.  (Y-1 so th|
000053d0  61 74 20 77 65 20 63 61  6e 20 73 74 61 72 74 20  |at we can start |
000053e0  74 68 65 20 6c 6f 6f 70  73 20 77 69 74 68 20 61  |the loops with a|
000053f0  6e 0d 49 4e 59 2e 29 20  20 59 20 70 6f 69 6e 74  |n.INY.)  Y point|
00005400  73 20 74 6f 20 74 68 65  20 66 69 72 73 74 20 6c  |s to the first l|
00005410  65 74 74 65 72 20 6f 66  20 74 68 65 20 2a 63 6f  |etter of the *co|
00005420  6d 6d 61 6e 64 20 77 68  69 63 68 20 69 73 0d 68  |mmand which is.h|
00005430  65 6c 64 20 66 72 6f 6d  20 20 28 26 46 32 29 2c  |eld from  (&F2),|
00005440  59 20 20 6f 6e 77 61 72  64 73 2c 20 74 65 72 6d  |Y  onwards, term|
00005450  69 6e 61 74 65 64 20 62  79 20 61 20 63 61 72 72  |inated by a carr|
00005460  69 61 67 65 0d 72 65 74  75 72 6e 2e 0d 0d 43 6f  |iage.return...Co|
00005470  6d 6d 61 6e 64 73 20 61  72 65 20 72 65 63 6f 67  |mmands are recog|
00005480  6e 69 73 65 64 20 62 79  20 62 65 69 6e 67 20 63  |nised by being c|
00005490  6f 6d 70 61 72 65 64 20  77 69 74 68 20 61 20 74  |ompared with a t|
000054a0  61 62 6c 65 20 6f 66 0d  63 6f 6d 6d 61 6e 64 73  |able of.commands|
000054b0  20 68 65 6c 64 20 69 6e  20 74 68 65 20 52 4f 4d  | held in the ROM|
000054c0  2e 20 20 45 61 63 68 20  63 6f 6d 6d 61 6e 64 20  |.  Each command |
000054d0  69 6e 20 74 68 65 20 74  61 62 6c 65 20 69 73 0d  |in the table is.|
000054e0  74 65 72 6d 69 6e 61 74  65 64 20 77 69 74 68 20  |terminated with |
000054f0  61 20 6e 75 6c 6c 20 62  79 74 65 2e 20 20 57 65  |a null byte.  We|
00005500  20 63 6f 6d 70 61 72 65  20 65 61 63 68 20 6c 65  | compare each le|
00005510  74 74 65 72 20 6f 66 20  74 68 65 0d 75 6e 6b 6e  |tter of the.unkn|
00005520  6f 77 6e 20 63 6f 6d 6d  61 6e 64 20 77 69 74 68  |own command with|
00005530  20 65 61 63 68 20 6f 6e  65 20 69 6e 20 74 68 65  | each one in the|
00005540  20 6c 69 73 74 20 69 6e  20 74 75 72 6e 2e 20 20  | list in turn.  |
00005550  49 66 20 61 0d 6d 61 74  63 68 20 66 61 69 6c 73  |If a.match fails|
00005560  20 74 68 65 6e 20 77 65  20 6d 6f 76 65 20 6f 6e  | then we move on|
00005570  20 74 6f 20 74 68 65 20  6e 65 78 74 20 77 6f 72  | to the next wor|
00005580  64 20 69 6e 20 74 68 65  20 6c 69 73 74 20 61 6e  |d in the list an|
00005590  64 0d 66 69 6e 61 6c 6c  79 20 77 65 20 65 78 69  |d.finally we exi|
000055a0  74 20 61 6c 74 6f 67 65  74 68 65 72 20 77 69 74  |t altogether wit|
000055b0  68 20 61 6c 6c 20 72 65  67 69 73 74 65 72 73 20  |h all registers |
000055c0  72 65 74 75 72 6e 65 64  20 74 6f 0d 74 68 65 69  |returned to.thei|
000055d0  72 20 65 6e 74 72 79 20  73 74 61 74 65 73 2e 20  |r entry states. |
000055e0  20 49 66 2c 20 64 75 72  69 6e 67 20 74 68 65 20  | If, during the |
000055f0  6d 61 74 63 68 2c 20 77  65 20 72 65 61 63 68 20  |match, we reach |
00005600  74 68 65 20 6e 75 6c 6c  0d 74 68 65 6e 20 77 65  |the null.then we|
00005610  20 68 61 76 65 20 61 20  6d 61 74 63 68 2e 20 20  | have a match.  |
00005620  45 78 65 63 75 74 69 6f  6e 20 6a 75 6d 70 73 20  |Execution jumps |
00005630  74 6f 20 74 68 65 20 61  64 64 72 65 73 73 20 73  |to the address s|
00005640  74 6f 72 65 64 0d 69 6e  20 74 68 65 20 74 77 6f  |tored.in the two|
00005650  20 62 79 74 65 73 20 66  6f 6c 6c 6f 77 69 6e 67  | bytes following|
00005660  20 74 68 65 20 72 65 6c  65 76 61 6e 74 20 6e 75  | the relevant nu|
00005670  6c 6c 2e 0d 0d 4e 6f 74  65 20 69 6e 20 6c 69 6e  |ll...Note in lin|
00005680  65 20 32 35 38 30 20 74  68 61 74 20 49 20 68 61  |e 2580 that I ha|
00005690  76 65 20 41 4e 44 65 64  20 74 68 65 20 62 79 74  |ve ANDed the byt|
000056a0  65 20 69 6e 20 74 68 65  20 69 6e 70 75 74 0d 73  |e in the input.s|
000056b0  74 72 69 6e 67 20 77 69  74 68 20 26 44 46 2e 20  |tring with &DF. |
000056c0  20 54 68 69 73 20 77 69  6c 6c 20 6d 61 6b 65 20  | This will make |
000056d0  69 74 20 75 70 70 65 72  20 63 61 73 65 20 6e 6f  |it upper case no|
000056e0  20 6d 61 74 74 65 72 0d  77 68 61 74 2c 20 61 6c  | matter.what, al|
000056f0  74 68 6f 75 67 68 20 74  68 69 73 20 70 72 6f 63  |though this proc|
00005700  65 64 75 72 65 20 6d 65  61 6e 73 20 74 68 61 74  |edure means that|
00005710  20 74 68 65 20 77 6f 72  64 73 20 69 6e 20 74 68  | the words in th|
00005720  65 0d 52 4f 4d 27 73 20  6c 69 73 74 20 4d 55 53  |e.ROM's list MUS|
00005730  54 20 62 65 20 69 6e 20  75 70 70 65 72 20 63 61  |T be in upper ca|
00005740  73 65 20 61 6e 64 20 74  68 65 79 20 63 61 6e 6e  |se and they cann|
00005750  6f 74 20 63 6f 6e 74 61  69 6e 0d 61 6e 79 74 68  |ot contain.anyth|
00005760  69 6e 67 20 62 75 74 20  74 68 65 20 6c 65 74 74  |ing but the lett|
00005770  65 72 73 20 41 2d 5a 2e  0d 0d 54 68 65 20 63 6f  |ers A-Z...The co|
00005780  6d 6d 61 6e 64 73 20 72  65 63 6f 67 6e 69 73 65  |mmands recognise|
00005790  64 20 62 79 20 74 68 69  73 20 52 4f 4d 20 61 72  |d by this ROM ar|
000057a0  65 3a 0d 0d 2a 42 45 45  50 20 2d 20 61 20 74 72  |e:..*BEEP - a tr|
000057b0  69 76 69 61 6c 20 70 69  65 63 65 20 6f 66 20 63  |ivial piece of c|
000057c0  6f 64 65 20 77 68 69 63  68 20 64 6f 65 73 20 61  |ode which does a|
000057d0  20 56 44 55 37 0d 0d 2a  53 45 4e 44 20 3c 73 74  | VDU7..*SEND <st|
000057e0  72 69 6e 67 3e 20 70 72  69 6e 74 73 20 6f 75 74  |ring> prints out|
000057f0  20 74 68 65 20 73 74 72  69 6e 67 2e 20 20 54 68  | the string.  Th|
00005800  69 73 20 63 6f 64 65 20  75 73 65 73 20 74 68 65  |is code uses the|
00005810  20 4f 53 0d 72 6f 75 74  69 6e 65 73 20 47 53 49  | OS.routines GSI|
00005820  4e 49 54 20 61 6e 64 20  47 53 52 45 41 44 20 74  |NIT and GSREAD t|
00005830  6f 20 70 72 65 70 61 72  65 20 74 68 65 20 73 74  |o prepare the st|
00005840  72 69 6e 67 20 61 6e 64  20 74 6f 20 72 65 61 64  |ring and to read|
00005850  0d 69 74 2e 20 20 47 53  49 4e 49 54 20 77 69 6c  |.it.  GSINIT wil|
00005860  6c 20 63 6f 70 65 20 77  69 74 68 20 71 75 6f 74  |l cope with quot|
00005870  61 74 69 6f 6e 20 6d 61  72 6b 73 2c 20 73 70 61  |ation marks, spa|
00005880  63 65 73 20 62 65 66 6f  72 65 0d 74 68 65 20 77  |ces before.the w|
00005890  6f 72 64 20 61 6e 64 20  77 69 74 68 20 65 73 63  |ord and with esc|
000058a0  61 70 65 20 73 65 71 75  65 6e 63 65 73 20 73 75  |ape sequences su|
000058b0  63 68 20 61 73 20 7c 4d  20 69 6e 20 65 78 61 63  |ch as |M in exac|
000058c0  74 6c 79 20 74 68 65 0d  73 61 6d 65 20 77 61 79  |tly the.same way|
000058d0  20 69 74 20 64 6f 65 73  20 66 6f 72 20 2a 4b 45  | it does for *KE|
000058e0  59 20 70 72 6f 67 72 61  6d 6d 69 6e 67 2e 20 20  |Y programming.  |
000058f0  42 79 20 73 65 74 74 69  6e 67 20 74 68 65 20 63  |By setting the c|
00005900  61 72 72 79 0d 66 6c 61  67 20 6f 6e 20 65 6e 74  |arry.flag on ent|
00005910  72 79 20 74 6f 20 47 53  49 4e 49 54 20 77 65 20  |ry to GSINIT we |
00005920  74 65 6c 6c 20 69 74 20  74 68 61 74 20 74 68 65  |tell it that the|
00005930  20 73 74 72 69 6e 67 20  77 69 6c 6c 0d 74 65 72  | string will.ter|
00005940  6d 69 6e 61 74 65 20 65  69 74 68 65 72 20 77 69  |minate either wi|
00005950  74 68 20 73 65 63 6f 6e  64 20 71 75 6f 74 65 73  |th second quotes|
00005960  20 6f 72 20 77 69 74 68  20 61 20 63 61 72 72 69  | or with a carri|
00005970  61 67 65 0d 72 65 74 75  72 6e 2e 20 20 49 66 20  |age.return.  If |
00005980  63 61 72 72 79 20 77 61  73 20 63 6c 65 61 72 20  |carry was clear |
00005990  74 68 65 6e 20 61 20 73  70 61 63 65 20 77 6f 75  |then a space wou|
000059a0  6c 64 20 61 6c 73 6f 0d  74 65 72 6d 69 6e 61 74  |ld also.terminat|
000059b0  65 2e 20 20 4f 6e 20 65  78 69 74 20 47 53 49 4e  |e.  On exit GSIN|
000059c0  49 54 20 73 65 74 73 20  74 68 65 20 7a 65 72 6f  |IT sets the zero|
000059d0  20 66 6c 61 67 20 69 66  20 74 68 65 20 73 74 72  | flag if the str|
000059e0  69 6e 67 0d 69 73 20 6e  75 6c 6c 2c 20 69 2e 65  |ing.is null, i.e|
000059f0  2e 20 6f 66 20 7a 65 72  6f 20 6c 65 6e 67 74 68  |. of zero length|
00005a00  20 6f 72 20 6a 75 73 74  20 61 20 63 61 72 72 69  | or just a carri|
00005a10  61 67 65 20 72 65 74 75  72 6e 2c 20 61 6e 64 0d  |age return, and.|
00005a20  47 53 52 45 41 44 20 73  65 74 73 20 74 68 65 20  |GSREAD sets the |
00005a30  63 61 72 72 79 20 66 6c  61 67 20 69 66 20 77 65  |carry flag if we|
00005a40  20 68 61 76 65 20 72 65  61 63 68 65 64 20 74 68  | have reached th|
00005a50  65 20 65 6e 64 20 6f 66  20 74 68 65 0d 73 74 72  |e end of the.str|
00005a60  69 6e 67 2e 0d 0d 2a 53  45 52 56 49 43 45 20 65  |ing...*SERVICE e|
00005a70  6e 61 62 6c 65 73 20 74  68 65 20 73 65 72 76 69  |nables the servi|
00005a80  63 65 20 63 61 6c 6c 20  64 69 73 70 6c 61 79 2e  |ce call display.|
00005a90  20 20 54 68 69 73 20 69  73 0d 65 71 75 69 76 61  |  This is.equiva|
00005aa0  6c 65 6e 74 20 74 6f 20  61 20 2a 46 58 20 32 35  |lent to a *FX 25|
00005ab0  30 2c 31 20 61 6e 64 20  69 73 20 6e 6f 74 20 72  |0,1 and is not r|
00005ac0  65 73 65 74 20 6f 6e 20  42 52 45 41 4b 2e 0d 0d  |eset on BREAK...|
00005ad0  2a 4e 4f 53 45 52 56 49  43 45 20 74 75 72 6e 73  |*NOSERVICE turns|
00005ae0  20 6f 66 66 20 74 68 65  20 73 65 72 76 69 63 65  | off the service|
00005af0  20 63 61 6c 6c 20 64 69  73 70 6c 61 79 20 61 6e  | call display an|
00005b00  64 20 69 73 0d 65 71 75  69 76 61 6c 65 6e 74 20  |d is.equivalent |
00005b10  74 6f 20 61 20 2a 46 58  20 32 35 30 2c 30 2e 0d  |to a *FX 250,0..|
00005b20  0d 59 6f 75 20 63 61 6e  20 61 64 64 20 61 6e 79  |.You can add any|
00005b30  20 6d 61 63 68 69 6e 65  20 63 6f 64 65 20 6f 66  | machine code of|
00005b40  20 79 6f 75 72 20 6f 77  6e 20 74 6f 20 74 68 65  | your own to the|
00005b50  20 52 4f 4d 20 62 79 0d  65 78 74 65 6e 64 69 6e  | ROM by.extendin|
00005b60  67 20 6d 79 20 6c 69 73  74 2e 20 20 49 20 68 61  |g my list.  I ha|
00005b70  76 65 20 6c 65 66 74 20  61 6e 6f 74 68 65 72 20  |ve left another |
00005b80  64 75 6d 6d 79 20 63 6f  6d 6d 61 6e 64 2c 0d 2a  |dummy command,.*|
00005b90  57 48 41 54 53 59 4f 55  52 53 20 77 68 69 63 68  |WHATSYOURS which|
00005ba0  20 6a 75 73 74 20 62 65  65 70 73 2e 20 20 59 6f  | just beeps.  Yo|
00005bb0  75 20 63 61 6e 20 65 61  73 69 6c 79 20 63 68 61  |u can easily cha|
00005bc0  6e 67 65 20 69 74 73 0d  6e 61 6d 65 20 61 74 20  |nge its.name at |
00005bd0  6c 69 6e 65 20 33 31 34  30 20 61 6e 64 20 70 75  |line 3140 and pu|
00005be0  74 20 79 6f 75 72 20 63  6f 64 65 20 73 74 61 72  |t your code star|
00005bf0  74 69 6e 67 20 61 74 20  6c 69 6e 65 20 34 32 38  |ting at line 428|
00005c00  30 2e 0d 41 6c 6c 20 63  6f 6d 6d 61 6e 64 20 63  |0..All command c|
00005c10  6f 64 65 20 6d 75 73 74  20 72 65 74 75 72 6e 20  |ode must return |
00005c20  77 69 74 68 20 61 20 4a  4d 50 20 65 78 69 74 2e  |with a JMP exit.|
00005c30  0d 0d 54 68 65 20 63 6f  6d 6d 61 6e 64 20 6c 69  |..The command li|
00005c40  73 74 20 69 73 20 68 65  6c 64 20 66 72 6f 6d 20  |st is held from |
00005c50  6c 69 6e 65 20 33 30 32  30 2e 20 20 54 68 65 20  |line 3020.  The |
00005c60  66 6f 72 6d 61 74 20 69  73 0d 63 6f 6d 6d 61 6e  |format is.comman|
00005c70  64 20 6e 61 6d 65 20 66  69 72 73 74 20 61 73 20  |d name first as |
00005c80  61 20 73 74 72 69 6e 67  20 74 65 72 6d 69 6e 61  |a string termina|
00005c90  74 65 64 20 62 79 20 61  20 6e 75 6c 6c 20 61 6e  |ted by a null an|
00005ca0  64 20 74 68 65 6e 0d 61  20 74 77 6f 20 62 79 74  |d then.a two byt|
00005cb0  65 20 77 6f 72 64 20 68  6f 6c 64 69 6e 67 20 74  |e word holding t|
00005cc0  68 65 20 61 64 64 72 65  73 73 20 6f 66 20 74 68  |he address of th|
00005cd0  61 74 20 70 61 72 74 69  63 75 6c 61 72 0d 72 6f  |at particular.ro|
00005ce0  75 74 69 6e 65 2e 0d 0d  46 69 6e 61 6c 6c 79 20  |utine...Finally |
00005cf0  73 65 72 76 69 63 65 20  63 61 6c 6c 20 39 20 69  |service call 9 i|
00005d00  73 20 2a 48 45 4c 50 2e  20 20 49 74 20 77 6f 72  |s *HELP.  It wor|
00005d10  6b 73 20 69 6e 20 74 77  6f 20 77 61 79 73 20 6f  |ks in two ways o|
00005d20  66 0d 63 6f 75 72 73 65  2e 20 20 54 68 65 20 52  |f.course.  The R|
00005d30  4f 4d 20 77 69 6c 6c 20  72 65 73 70 6f 6e 64 20  |OM will respond |
00005d40  74 6f 20 62 6f 74 68 20  2a 48 45 4c 50 20 61 6e  |to both *HELP an|
00005d50  64 20 74 6f 20 2a 48 45  4c 50 0d 4f 53 42 49 54  |d to *HELP.OSBIT|
00005d60  53 2e 20 20 57 68 65 6e  20 77 65 20 72 65 63 65  |S.  When we rece|
00005d70  69 76 65 20 63 61 6c 6c  20 39 20 74 68 65 20 63  |ive call 9 the c|
00005d80  68 61 72 61 63 74 65 72  20 66 6f 6c 6c 6f 77 69  |haracter followi|
00005d90  6e 67 20 74 68 65 0d 2a  48 45 4c 50 20 28 6f 72  |ng the.*HELP (or|
00005da0  20 2a 48 2e 29 20 69 73  20 61 74 20 20 28 26 46  | *H.) is at  (&F|
00005db0  32 29 2c 59 2e 20 20 49  66 20 69 74 20 69 73 20  |2),Y.  If it is |
00005dc0  61 20 63 61 72 72 69 61  67 65 20 72 65 74 75 72  |a carriage retur|
00005dd0  6e 0d 74 68 65 6e 20 74  68 69 73 20 69 73 20 61  |n.then this is a|
00005de0  20 73 74 72 69 67 68 74  66 6f 72 77 61 72 64 20  | strightforward |
00005df0  67 65 6e 65 72 61 6c 20  48 45 4c 50 20 63 61 6c  |general HELP cal|
00005e00  6c 20 61 6e 64 20 77 65  0d 72 65 73 70 6f 6e 64  |l and we.respond|
00005e10  20 62 79 20 70 72 69 6e  74 69 6e 67 20 6f 75 74  | by printing out|
00005e20  20 6f 75 72 20 74 69 74  6c 65 20 61 6e 64 20 74  | our title and t|
00005e30  68 65 20 77 6f 72 64 20  77 65 20 72 65 73 70 6f  |he word we respo|
00005e40  6e 64 0d 74 6f 2e 0d 0d  49 66 20 74 68 61 74 20  |nd.to...If that |
00005e50  63 68 61 72 61 63 74 65  72 20 69 73 20 6e 6f 74  |character is not|
00005e60  20 61 20 43 52 20 74 68  65 6e 20 74 68 65 20 2a  | a CR then the *|
00005e70  48 45 4c 50 20 68 61 73  20 61 6e 20 61 72 67 75  |HELP has an argu|
00005e80  6d 65 6e 74 0d 61 6e 64  20 77 65 20 68 61 76 65  |ment.and we have|
00005e90  20 74 6f 20 74 68 65 6e  20 63 68 65 63 6b 20 74  | to then check t|
00005ea0  68 61 74 20 61 67 61 69  6e 73 74 20 6f 75 72 20  |hat against our |
00005eb0  48 45 4c 50 20 72 65 70  6f 6e 73 65 0d 6c 69 73  |HELP reponse.lis|
00005ec0  74 2c 20 77 68 69 63 68  20 69 6e 20 74 68 69 73  |t, which in this|
00005ed0  20 63 61 73 65 20 69 73  20 6f 6e 6c 79 20 6f 6e  | case is only on|
00005ee0  65 20 77 6f 72 64 2c 20  4f 53 42 49 54 53 2e 20  |e word, OSBITS. |
00005ef0  20 54 68 69 73 0d 63 68  65 63 6b 69 6e 67 20 69  | This.checking i|
00005f00  73 20 65 78 61 63 74 6c  79 20 6c 69 6b 65 20 74  |s exactly like t|
00005f10  68 61 74 20 66 6f 72 20  75 6e 6b 6e 6f 77 6e 20  |hat for unknown |
00005f20  63 6f 6d 6d 61 6e 64 73  2e 20 20 54 68 65 0d 68  |commands.  The.h|
00005f30  65 6c 70 20 6c 69 73 74  20 69 73 20 66 72 6f 6d  |elp list is from|
00005f40  20 6c 69 6e 65 20 33 31  38 30 2e 0d 0d 49 74 20  | line 3180...It |
00005f50  69 73 20 69 6d 70 6f 72  74 61 6e 74 20 74 68 61  |is important tha|
00005f60  74 20 73 65 72 76 69 63  65 20 63 61 6c 6c 20 39  |t service call 9|
00005f70  20 69 73 20 6e 6f 74 20  63 6c 61 69 6d 65 64 20  | is not claimed |
00005f80  61 6e 64 20 74 68 61 74  0d 59 20 69 73 20 72 65  |and that.Y is re|
00005f90  73 74 6f 72 65 64 20 74  6f 20 69 74 73 20 65 6e  |stored to its en|
00005fa0  74 72 79 20 76 61 6c 75  65 20 6f 6e 20 65 78 69  |try value on exi|
00005fb0  74 2e 20 20 49 74 20 69  73 20 70 6f 73 73 69 62  |t.  It is possib|
00005fc0  6c 65 0d 66 6f 72 20 6d  6f 72 65 20 74 68 61 6e  |le.for more than|
00005fd0  20 6f 6e 65 20 52 4f 4d  20 74 6f 20 72 65 73 70  | one ROM to resp|
00005fe0  6f 6e 64 20 74 6f 20 61  20 48 45 4c 50 20 61 72  |ond to a HELP ar|
00005ff0  67 75 6d 65 6e 74 20 28  55 54 49 4c 53 0d 69 73  |gument (UTILS.is|
00006000  20 61 20 63 6f 6d 6d 6f  6e 20 6f 6e 65 29 20 61  | a common one) a|
00006010  6e 64 20 61 6c 73 6f 20  6f 75 72 20 52 4f 4d 20  |nd also our ROM |
00006020  6d 75 73 74 20 6e 6f 74  20 72 65 73 70 6f 6e 64  |must not respond|
00006030  20 77 69 74 68 0d 61 6e  79 74 68 69 6e 67 20 69  | with.anything i|
00006040  66 20 74 68 65 20 48 45  4c 50 20 61 72 67 75 6d  |f the HELP argum|
00006050  65 6e 74 20 64 6f 65 73  20 6e 6f 74 20 61 70 70  |ent does not app|
00006060  6c 79 2e 20 20 56 69 65  77 20 32 2e 31 20 64 6f  |ly.  View 2.1 do|
00006070  65 73 0d 6e 6f 74 20 61  70 70 65 61 72 20 74 6f  |es.not appear to|
00006080  20 77 6f 72 6b 20 70 72  6f 70 65 72 6c 79 20 69  | work properly i|
00006090  6e 20 74 68 69 73 20 72  65 73 70 65 63 74 20 61  |n this respect a|
000060a0  73 20 28 6f 6e 20 6d 79  0d 6d 61 63 68 69 6e 65  |s (on my.machine|
000060b0  20 61 6e 79 77 61 79 29  20 69 74 20 61 6e 6e 6f  | anyway) it anno|
000060c0  75 6e 63 65 73 20 69 74  73 65 6c 66 20 74 6f 20  |unces itself to |
000060d0  61 6e 79 20 68 65 6c 70  20 63 61 6c 6c 2e 0d 0d  |any help call...|
000060e0  54 68 61 74 20 74 68 65  6e 20 69 73 20 74 68 65  |That then is the|
000060f0  20 27 4c 6f 6e 64 6f 6e  20 74 6f 20 42 72 69 67  | 'London to Brig|
00006100  68 74 6f 6e 20 69 6e 20  34 20 4d 69 6e 75 74 65  |hton in 4 Minute|
00006110  73 27 20 67 75 69 64 65  20 74 6f 0d 73 69 64 65  |s' guide to.side|
00006120  77 61 79 73 20 52 4f 4d  53 2e 20 20 54 68 65 72  |ways ROMS.  Ther|
00006130  65 20 69 73 20 6d 75 63  68 20 6d 6f 72 65 20 74  |e is much more t|
00006140  6f 20 74 68 65 6d 20 74  68 61 74 20 49 20 63 61  |o them that I ca|
00006150  6e 20 63 6f 76 65 72 0d  69 6e 20 61 20 6d 6f 64  |n cover.in a mod|
00006160  75 6c 65 20 61 6e 64 20  74 68 65 79 20 61 72 65  |ule and they are|
00006170  20 77 6f 72 74 68 20 6f  66 20 66 75 72 74 68 65  | worth of furthe|
00006180  72 20 73 74 75 64 79 2c  20 61 6c 74 68 6f 75 67  |r study, althoug|
00006190  68 0d 74 68 65 20 70 72  69 6e 63 69 70 6c 65 73  |h.the principles|
000061a0  20 69 6e 76 6f 6c 76 65  64 20 61 72 65 20 76 65  | involved are ve|
000061b0  72 79 20 6d 61 63 68 69  6e 65 20 73 70 65 63 69  |ry machine speci|
000061c0  66 69 63 2e 0d 0d 46 69  6e 61 6c 6c 79 20 61 20  |fic...Finally a |
000061d0  63 6f 75 70 6c 65 20 6f  66 20 70 72 6f 67 72 61  |couple of progra|
000061e0  6d 6d 69 6e 67 20 68 69  6e 74 73 20 61 62 6f 75  |mming hints abou|
000061f0  74 20 77 72 69 74 69 6e  67 20 66 6f 72 0d 53 65  |t writing for.Se|
00006200  72 76 69 63 65 20 52 4f  4d 53 2e 20 20 46 69 72  |rvice ROMS.  Fir|
00006210  73 74 6c 79 20 72 65 6d  65 6d 62 65 72 20 74 68  |stly remember th|
00006220  61 74 20 79 6f 75 20 77  69 6c 6c 20 6e 6f 74 20  |at you will not |
00006230  62 65 20 61 62 6c 65 20  74 6f 0d 77 72 69 74 65  |be able to.write|
00006240  20 69 6e 74 6f 20 79 6f  75 72 20 61 64 64 72 65  | into your addre|
00006250  73 73 20 73 70 61 63 65  2c 20 73 6f 20 79 6f 75  |ss space, so you|
00006260  20 77 69 6c 6c 20 68 61  76 65 20 74 6f 20 75 73  | will have to us|
00006270  65 0d 7a 65 72 6f 2d 70  61 67 65 20 61 6e 64 20  |e.zero-page and |
00006280  6d 61 69 6d 20 6d 65 6d  6f 72 79 20 77 6f 72 6b  |maim memory work|
00006290  73 70 61 63 65 20 61 20  6c 6f 74 2e 20 20 57 69  |space a lot.  Wi|
000062a0  74 68 20 6d 61 69 6e 20  6d 65 6d 6f 72 79 0d 79  |th main memory.y|
000062b0  6f 75 20 77 69 6c 6c 20  75 73 65 20 61 20 6c 6f  |ou will use a lo|
000062c0  74 20 6f 66 20 69 6e 64  69 72 65 63 74 20 61 64  |t of indirect ad|
000062d0  64 72 65 73 73 69 6e 67  2e 0d 0d 54 6f 20 67 69  |dressing...To gi|
000062e0  76 65 20 61 6e 20 65 72  72 6f 72 20 6d 65 73 73  |ve an error mess|
000062f0  61 67 65 20 69 6e 20 61  20 73 65 72 76 69 63 65  |age in a service|
00006300  20 52 4f 4d 20 79 6f 75  20 68 61 76 65 20 74 6f  | ROM you have to|
00006310  20 63 6f 70 79 0d 79 6f  75 72 20 65 72 72 6f 72  | copy.your error|
00006320  20 63 6f 64 65 20 2d 20  66 72 6f 6d 20 74 68 65  | code - from the|
00006330  20 42 52 4b 20 72 69 67  68 74 20 74 68 72 6f 75  | BRK right throu|
00006340  67 68 20 74 6f 20 74 68  65 20 6d 65 73 73 61 67  |gh to the messag|
00006350  65 0d 61 6e 64 20 69 74  73 20 74 65 72 6d 69 6e  |e.and its termin|
00006360  61 74 69 6e 67 20 6e 75  6c 6c 20 2d 20 69 6e 74  |ating null - int|
00006370  6f 20 74 68 65 20 62 6f  74 74 6f 6d 20 6f 66 20  |o the bottom of |
00006380  74 68 65 20 73 74 61 63  6b 0d 28 66 72 6f 6d 20  |the stack.(from |
00006390  26 31 30 30 20 6f 6e 77  61 72 64 73 20 73 69 6e  |&100 onwards sin|
000063a0  63 65 20 74 68 65 20 73  74 61 63 6b 20 69 73 20  |ce the stack is |
000063b0  75 70 73 69 64 65 20 64  6f 77 6e 29 2c 20 61 6e  |upside down), an|
000063c0  64 20 4a 4d 50 0d 74 6f  20 79 6f 75 72 20 42 52  |d JMP.to your BR|
000063d0  4b 20 61 74 20 26 31 30  30 2e 20 20 59 6f 75 20  |K at &100.  You |
000063e0  68 61 76 65 20 74 6f 20  64 6f 20 74 68 69 73 20  |have to do this |
000063f0  62 65 63 61 75 73 65 20  74 68 65 20 65 72 72 6f  |because the erro|
00006400  72 0d 63 6f 64 65 20 69  6e 20 74 68 65 20 6c 61  |r.code in the la|
00006410  6e 67 75 61 67 65 20 79  6f 75 20 61 72 65 20 63  |nguage you are c|
00006420  61 6c 6c 69 6e 67 20 66  72 6f 6d 20 77 69 6c 6c  |alling from will|
00006430  20 61 75 74 6f 6d 61 74  69 63 61 6c 6c 79 0d 6c  | automatically.l|
00006440  6f 6f 6b 20 69 6e 20 74  68 61 74 20 6c 61 6e 67  |ook in that lang|
00006450  75 61 67 65 27 73 20 52  4f 4d 20 69 66 20 79 6f  |uage's ROM if yo|
00006460  75 20 65 78 65 63 75 74  65 20 74 68 65 20 42 52  |u execute the BR|
00006470  4b 20 69 6e 20 79 6f 75  72 0d 52 4f 4d 2e 20 20  |K in your.ROM.  |
00006480  59 6f 75 20 68 61 76 65  20 74 6f 20 65 78 65 63  |You have to exec|
00006490  75 74 65 20 74 68 65 20  42 52 4b 20 69 6e 20 6d  |ute the BRK in m|
000064a0  61 69 6e 20 6d 65 6d 6f  72 79 2c 20 61 6e 64 20  |ain memory, and |
000064b0  74 68 65 0d 73 74 61 63  6b 20 69 73 20 61 20 73  |the.stack is a s|
000064c0  61 66 65 20 70 6c 61 63  65 20 74 6f 20 64 6f 20  |afe place to do |
000064d0  73 6f 2e 0d 0d 46 72 6f  6d 20 61 20 53 65 72 76  |so...From a Serv|
000064e0  69 63 65 20 52 4f 4d 20  79 6f 75 20 63 61 6e 20  |ice ROM you can |
000064f0  61 64 64 72 65 73 73 20  49 2f 4f 20 6d 65 6d 6f  |address I/O memo|
00006500  72 79 20 72 65 61 73 6f  6e 61 62 6c 65 0d 73 61  |ry reasonable.sa|
00006510  66 65 6c 79 20 73 69 6e  63 65 20 79 6f 75 72 20  |fely since your |
00006520  63 6f 64 65 20 77 69 6c  6c 20 6e 65 76 65 72 20  |code will never |
00006530  65 78 65 63 75 74 65 20  69 6e 20 61 20 73 65 63  |execute in a sec|
00006540  6f 6e 64 0d 70 72 6f 63  65 73 73 6f 72 2e 20 20  |ond.processor.  |
00006550  4f 66 74 65 6e 20 73 70  65 65 64 20 69 73 20 69  |Often speed is i|
00006560  6d 70 6f 72 74 61 6e 74  20 61 6e 64 20 79 6f 75  |mportant and you|
00006570  20 63 61 6e 20 74 61 6b  65 0d 61 64 76 61 6e 74  | can take.advant|
00006580  61 67 65 20 6f 66 20 79  6f 75 72 20 70 6c 61 63  |age of your plac|
00006590  65 20 69 6e 20 74 68 65  20 49 2f 4f 20 70 72 6f  |e in the I/O pro|
000065a0  63 65 73 73 6f 72 2e 0d  0d 54 68 61 74 20 6c 65  |cessor...That le|
000065b0  61 64 73 20 6d 65 20 61  6c 6d 6f 73 74 20 6e 65  |ads me almost ne|
000065c0  61 74 6c 79 20 6f 6e 74  6f 20 74 68 65 20 74 6f  |atly onto the to|
000065d0  70 69 63 20 66 6f 72 20  74 68 65 20 6e 65 78 74  |pic for the next|
000065e0  0d 6d 6f 64 75 6c 65 2e  20 20 41 63 6f 72 6e 20  |.module.  Acorn |
000065f0  6f 66 74 65 6e 20 74 65  6c 6c 20 75 73 20 77 68  |often tell us wh|
00006600  61 74 20 69 73 20 6c 65  67 61 6c 20 61 6e 64 20  |at is legal and |
00006610  77 68 61 74 20 69 73 0d  69 6c 6c 65 67 61 6c 2e  |what is.illegal.|
00006620  20 49 20 77 69 6c 6c 20  65 78 70 61 6e 64 20 6f  | I will expand o|
00006630  6e 20 74 68 61 74 20 73  75 62 6a 65 63 74 20 6e  |n that subject n|
00006640  65 78 74 20 74 69 6d 65  2e 0d                    |ext time..|
0000664a
T\OSB24.m0
T\OSB24.m1
T\OSB24.m2
T\OSB24.m4
T\OSB24.m5