Home » CEEFAX disks » telesoftware3.adl » 21_11_87/T\OSB05

21_11_87/T\OSB05

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 » telesoftware3.adl
Filename: 21_11_87/T\OSB05
Read OK:
File size: 27C0 bytes
Load address: 0000
Exec address: 0000
File contents
OSBITS - An Exploration of the BBC Micro at Machine Level

By Programmer

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


Part 5: Operating System Calls (I) - OSBYTE and OSWORD


It's worth taking a break from all the mathematical stuff to
look at some of the operating system calls.  The OS calls
provide an easy access to operations that would otherwise be
quite difficult.  They also help preserve the compatibility
of software as the operating system changes.

OSBYTE first.

OSBYTE is a machine code subroutine that lives in the micro
at address &FFF4.  There are 256 possible OSBYTE calls (not
all of them used) and the one you wish to use is selected by
the value in the accumulator when you enter the subroutine. 
The X and Y registers carry parameters for the particular
call you are using.

In BASIC you call OSBYTE either by using *FXA,X,Y (for
OSBYTE and *FX calls are the same thing) or by using BASIC's
way of setting A,X and Y which is:

                      A%=number_of_OSBYTE_call
                      X%=X
                      Y%=Y
                      CALL &FFF4

It's worth noting that because *FX calls are operating
system calls and not actually pert of the BASIC language you
can use them in command mode with other language ROMS like
VIEW and BCPL.

In BASIC2 and above you can also use OSCLI if there is a
variable you wish to include.  I won't go into detail with
any of these BASIC methods here, we'll stick to assembler.

To enter the OSBYTE subroutine you have to set the A,X and Y
registers, possibly by using LDA, LDX and LDY like this:

                  osbyte=&FFF4

                  LDA #number_of_OSBYTE_call
                  LDX #X_parameter
                  LDY #Y_parameter
                  JSR osbyte

After the JSR you may find that the X and Y registers
contain useful information.  In BASIC you would use the USR
function to obtain this but in machine code the bytes are
just sitting in the registers waiting for you.

There is a list of OSBYTE calls in one of your user guides
but I will list a few useful examples here (with
acknowledgments to Bray, Dickens and Holmes 'Advanced User
Guide'):

OSBYTE 2 selects the source from which input is taken,
called the input stream.  The input stream is selected by X
and if X=0 the keyboard is selected and the RS423 is
disabled (which means that no carrier would be sent from a
modem for example). If X=1 then the RS423 is selected and
enabled, so you can receive from it.  If X=2 then the
keyboard is selected for input but the RS423 is still
enabled.

Once the call has been executed the value in the X register
will be 0 if the previous input was from the keyboard and 1
if the previous input was from the RS423.  This can help you
restore previous conditions after you have changed
something.

Also on exit the value in the Accumulator is the same as it
was before the call, we say it has been preserved.  The
value in the Y register, and the state of the Carry flag are
undefined.

OSBYTE 117 is an information call.  You set the accumulator
to 117 but the values of the X and Y registers are of no
consequence.

After the call the accumulator and Y register have been
preserved and the Carry flag is undefined but the X register
contains useful information about the VDU display status,
bit by bit.

If Bit 0 is set then printer output is enabled by a VDU2
If Bit 1 is set then scrolling is disabled
If Bit 2 is set then paged mode is selected (i.e. CTRL N)
If Bit 3 is set then a text window is in operation
   Bit 4 is not used
If Bit 5 is set then VDU5 has been sent and text is being
   printed at the graphics cursor
If Bit 6 is set then the input and output cursors are
   separated and cursor editing is in progress
If Bit 7 is set then the VDU is disabled following a VDU21

You can test the value held in X bit by bit using the
logical operators AND or BIT which I'll come onto in a later
module.

OSBYTE 129 operates like BASIC's INKEY.  The X and Y
registers hold the time limit for waiting for a key.  X
contains the Lower Significant Byte (time MOD 256) and Y
contains the MSB (time DIV 256) up to a limit of &7FFF. 
This is &7FFF hundredths of a second giving an upper limit
of about 5 and a half minutes.

On exit from the routine the X register will hold the ASCII
value of the key pressed.  Y will hold zero and the Carry
flag will be clear.  If no key was pressed during that time
then Y will contain &FF and the Carry flag will be set.  If
escape was pressed then Y will contain &1B (27) and the
Carry flag will be set.

If the figure held in X and Y is negative then this is the
equivalent to INKEY(-N) where N is a key number.  Here the
routine will tell you if the key with that number was
pressed at the moment the routine scanned the keyboard.

On exit X and Y will both contain &FF if the key is pressed.

The file B/osb05 with this transmission contains a small
program which uses a similar OSBYTE call, number 121, which
scans the keyboard and returns a number corresponding to the
key pressed down at the time.  This is then used to play a
note using an OSWORD call.

OSWORD operates in a similar way to OSBYTE except that here
the parameters you need to pass to and from the routines are
too big to fit into a couple of bytes.  In this case,
instead of using X and Y to hold parameters, you use X and Y
to point to a block of memory in which you put your
parameters.  The accumulator holds the OSWORD number in the
same way it did with OSBYTE.  OSWORD is called at &FFF1.

There are only 14 OSWORD routines in the BBC Model B
operating system, and 16 in the Master.  They are as
follows:

OSWORD 0      - Read a line from input
OSWORD 1/2    - Read/write system clock
OSWORD 3/4    - Read/write interval timer
OSWORD 5/6    - Read/write I/O processor memory
OSWORD 7      - Sound command
OSWORD 8      - Envelope definition
OSWORD 9      - Read value of a pixel on the screen
OSWORD 10     - Read definition of a character
OSWORD 11/12  - Read/write palette
OSWORD 13     - Read the last two graphics cursor positions
OSWORD 14/15  - Read/write CMOS clock in Master

OSWORD calls with other values in the accumulator are passed
to sideways ROMS and you find them applying to filing
systems and the like.  For example:

OSWORD 127 enables you to read/write a sector of a disc in
the disc filing system

OSWORD 122 enables you to work with the Acorn or BBC
telesoftware ROMS

OSWORD 64 accesses the status of the AMX mouse if you have
this software in your machine.

In all cases the OSWORD block is set up like this.  You set
aside the relevant number of bytes for your parameter block
by using, perhaps, the FNEQU or EQU functions in your
assembler program.  Let's say that this block starts at the
address labelled 'osword_block'

             LDA #number_of_OSWORD_call
             LDX #(osword_block MOD 256)
             LDY #(osword_block DIV 256)

so that the X register contains the LSB of the address of
the parameter block and the Y register contains the MSB of
this address.

The parameter block varies in size depending on the OSWORD
call and in many cases, like with the teletext OSWORD call,
the byte held at the start of the block selects different
operations within the one OSWORD call.

Let's look at the SOUND call, OSWORD 7.  The parameter block
for this is as follows:

osword_block + 0  LSB of the channel number
osword_block + 1  MSB of the channel number
osword_block + 2  LSB of the amplitude/envelope number
osword_block + 3  MSB of the amplitude/envelope number
osword_block + 4  LSB of the pitch
osword_block + 5  MSB of the pitch
osword_block + 6  LSB of the duration
osword_block + 7  MSB of the duration

In fact the structure exactly follows the BASIC SOUND
command.  The program B/osb05 in this week's telesoftware
transmission is a program that takes the internal value of a
key pushed (the basis for its value for -INKEY) and uses it
to select the pitch of a note that is then played.  It's not
particularly amazing but it will show you how the OSBYTE and
OSWORD calls are set out in assembler.

I have used OSBYTE 121 which scans the keyboard upwards from
the internal key number held in X.  The internal key number
is the INKEY number of the key with all its bits reversed. 
The posh thing to say is that is has been EORd with &FF. 
More on EOR in another module.  I have started my scan from
16 upwards which means I avoid any problems caused by having
keyboard links set.  In fact OSBYTE 122 does exactly this
but using it would not illustrate the OSBYTE setting up as
much.  In fact I have not used the Y register in these
OSBYTEs but you would LDY with whatever value you wanted
before the JSR.  Y register use in OSBYTES is not as common
as X register use.

For more detailed information on OSWORD and OSBYTE calls I
recommend you consult the advanced user or reference guide
for your particular machine.

Points to note in B/osb05 are that the routine loops
continuously, albeit via BASIC to make it easy to ESCAPE out
of it.  If no key is pressed, i.e. &FF is returned in X,
then the SOUND section of the code is skipped. Also the
sound buffer is flushed using OSBYTE 21 when no key is
pressed, which cuts off the note when you lift your finger
from the key.  In line 440 note that UNTIL0 means exactly
the same as UNTIL FALSE since the value of FALSE is 0 in BBC
BASIC.

To recap on addressing modes, you will see in lines like 140
and 150 that the number is preceded by a hash (#) which
tells the assembler that the actual number following is to
be used.  Without the hash the assembler treats the
following number as an address and reads from that.  It's a
common mistake to forget the hash when you intend immediate
addressing (as this is called).

If you have BASIC2 or later you can replace each occurrence
of OPT FNEQUW(number) with EQUW number and you can, of
course, also drop the function definition from the end of
the program.

In the next module we'll look at how you shift the bits of a
byte about and how to use the stack for temporary storage. 
The program will take a byte entered as a character from the
keyboard and print its value in binary, hexadecimal and
decimal.
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 2e 2e 0d 0d 0d  50 61 72 74 20 35 3a 20  |........Part 5: |
00000090  4f 70 65 72 61 74 69 6e  67 20 53 79 73 74 65 6d  |Operating System|
000000a0  20 43 61 6c 6c 73 20 28  49 29 20 2d 20 4f 53 42  | Calls (I) - OSB|
000000b0  59 54 45 20 61 6e 64 20  4f 53 57 4f 52 44 0d 0d  |YTE and OSWORD..|
000000c0  0d 49 74 27 73 20 77 6f  72 74 68 20 74 61 6b 69  |.It's worth taki|
000000d0  6e 67 20 61 20 62 72 65  61 6b 20 66 72 6f 6d 20  |ng a break from |
000000e0  61 6c 6c 20 74 68 65 20  6d 61 74 68 65 6d 61 74  |all the mathemat|
000000f0  69 63 61 6c 20 73 74 75  66 66 20 74 6f 0d 6c 6f  |ical stuff to.lo|
00000100  6f 6b 20 61 74 20 73 6f  6d 65 20 6f 66 20 74 68  |ok at some of th|
00000110  65 20 6f 70 65 72 61 74  69 6e 67 20 73 79 73 74  |e operating syst|
00000120  65 6d 20 63 61 6c 6c 73  2e 20 20 54 68 65 20 4f  |em calls.  The O|
00000130  53 20 63 61 6c 6c 73 0d  70 72 6f 76 69 64 65 20  |S calls.provide |
00000140  61 6e 20 65 61 73 79 20  61 63 63 65 73 73 20 74  |an easy access t|
00000150  6f 20 6f 70 65 72 61 74  69 6f 6e 73 20 74 68 61  |o operations tha|
00000160  74 20 77 6f 75 6c 64 20  6f 74 68 65 72 77 69 73  |t would otherwis|
00000170  65 20 62 65 0d 71 75 69  74 65 20 64 69 66 66 69  |e be.quite diffi|
00000180  63 75 6c 74 2e 20 20 54  68 65 79 20 61 6c 73 6f  |cult.  They also|
00000190  20 68 65 6c 70 20 70 72  65 73 65 72 76 65 20 74  | help preserve t|
000001a0  68 65 20 63 6f 6d 70 61  74 69 62 69 6c 69 74 79  |he compatibility|
000001b0  0d 6f 66 20 73 6f 66 74  77 61 72 65 20 61 73 20  |.of software as |
000001c0  74 68 65 20 6f 70 65 72  61 74 69 6e 67 20 73 79  |the operating sy|
000001d0  73 74 65 6d 20 63 68 61  6e 67 65 73 2e 0d 0d 4f  |stem changes...O|
000001e0  53 42 59 54 45 20 66 69  72 73 74 2e 0d 0d 4f 53  |SBYTE first...OS|
000001f0  42 59 54 45 20 69 73 20  61 20 6d 61 63 68 69 6e  |BYTE is a machin|
00000200  65 20 63 6f 64 65 20 73  75 62 72 6f 75 74 69 6e  |e code subroutin|
00000210  65 20 74 68 61 74 20 6c  69 76 65 73 20 69 6e 20  |e that lives in |
00000220  74 68 65 20 6d 69 63 72  6f 0d 61 74 20 61 64 64  |the micro.at add|
00000230  72 65 73 73 20 26 46 46  46 34 2e 20 20 54 68 65  |ress &FFF4.  The|
00000240  72 65 20 61 72 65 20 32  35 36 20 70 6f 73 73 69  |re are 256 possi|
00000250  62 6c 65 20 4f 53 42 59  54 45 20 63 61 6c 6c 73  |ble OSBYTE calls|
00000260  20 28 6e 6f 74 0d 61 6c  6c 20 6f 66 20 74 68 65  | (not.all of the|
00000270  6d 20 75 73 65 64 29 20  61 6e 64 20 74 68 65 20  |m used) and the |
00000280  6f 6e 65 20 79 6f 75 20  77 69 73 68 20 74 6f 20  |one you wish to |
00000290  75 73 65 20 69 73 20 73  65 6c 65 63 74 65 64 20  |use is selected |
000002a0  62 79 0d 74 68 65 20 76  61 6c 75 65 20 69 6e 20  |by.the value in |
000002b0  74 68 65 20 61 63 63 75  6d 75 6c 61 74 6f 72 20  |the accumulator |
000002c0  77 68 65 6e 20 79 6f 75  20 65 6e 74 65 72 20 74  |when you enter t|
000002d0  68 65 20 73 75 62 72 6f  75 74 69 6e 65 2e 20 0d  |he subroutine. .|
000002e0  54 68 65 20 58 20 61 6e  64 20 59 20 72 65 67 69  |The X and Y regi|
000002f0  73 74 65 72 73 20 63 61  72 72 79 20 70 61 72 61  |sters carry para|
00000300  6d 65 74 65 72 73 20 66  6f 72 20 74 68 65 20 70  |meters for the p|
00000310  61 72 74 69 63 75 6c 61  72 0d 63 61 6c 6c 20 79  |articular.call y|
00000320  6f 75 20 61 72 65 20 75  73 69 6e 67 2e 0d 0d 49  |ou are using...I|
00000330  6e 20 42 41 53 49 43 20  79 6f 75 20 63 61 6c 6c  |n BASIC you call|
00000340  20 4f 53 42 59 54 45 20  65 69 74 68 65 72 20 62  | OSBYTE either b|
00000350  79 20 75 73 69 6e 67 20  2a 46 58 41 2c 58 2c 59  |y using *FXA,X,Y|
00000360  20 28 66 6f 72 0d 4f 53  42 59 54 45 20 61 6e 64  | (for.OSBYTE and|
00000370  20 2a 46 58 20 63 61 6c  6c 73 20 61 72 65 20 74  | *FX calls are t|
00000380  68 65 20 73 61 6d 65 20  74 68 69 6e 67 29 20 6f  |he same thing) o|
00000390  72 20 62 79 20 75 73 69  6e 67 20 42 41 53 49 43  |r by using BASIC|
000003a0  27 73 0d 77 61 79 20 6f  66 20 73 65 74 74 69 6e  |'s.way of settin|
000003b0  67 20 41 2c 58 20 61 6e  64 20 59 20 77 68 69 63  |g A,X and Y whic|
000003c0  68 20 69 73 3a 0d 0d 20  20 20 20 20 20 20 20 20  |h is:..         |
000003d0  20 20 20 20 20 20 20 20  20 20 20 20 20 41 25 3d  |             A%=|
000003e0  6e 75 6d 62 65 72 5f 6f  66 5f 4f 53 42 59 54 45  |number_of_OSBYTE|
000003f0  5f 63 61 6c 6c 0d 20 20  20 20 20 20 20 20 20 20  |_call.          |
00000400  20 20 20 20 20 20 20 20  20 20 20 20 58 25 3d 58  |            X%=X|
00000410  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000420  20 20 20 20 20 20 20 59  25 3d 59 0d 20 20 20 20  |       Y%=Y.    |
00000430  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000440  20 20 43 41 4c 4c 20 26  46 46 46 34 0d 0d 49 74  |  CALL &FFF4..It|
00000450  27 73 20 77 6f 72 74 68  20 6e 6f 74 69 6e 67 20  |'s worth noting |
00000460  74 68 61 74 20 62 65 63  61 75 73 65 20 2a 46 58  |that because *FX|
00000470  20 63 61 6c 6c 73 20 61  72 65 20 6f 70 65 72 61  | calls are opera|
00000480  74 69 6e 67 0d 73 79 73  74 65 6d 20 63 61 6c 6c  |ting.system call|
00000490  73 20 61 6e 64 20 6e 6f  74 20 61 63 74 75 61 6c  |s and not actual|
000004a0  6c 79 20 70 65 72 74 20  6f 66 20 74 68 65 20 42  |ly pert of the B|
000004b0  41 53 49 43 20 6c 61 6e  67 75 61 67 65 20 79 6f  |ASIC language yo|
000004c0  75 0d 63 61 6e 20 75 73  65 20 74 68 65 6d 20 69  |u.can use them i|
000004d0  6e 20 63 6f 6d 6d 61 6e  64 20 6d 6f 64 65 20 77  |n command mode w|
000004e0  69 74 68 20 6f 74 68 65  72 20 6c 61 6e 67 75 61  |ith other langua|
000004f0  67 65 20 52 4f 4d 53 20  6c 69 6b 65 0d 56 49 45  |ge ROMS like.VIE|
00000500  57 20 61 6e 64 20 42 43  50 4c 2e 0d 0d 49 6e 20  |W and BCPL...In |
00000510  42 41 53 49 43 32 20 61  6e 64 20 61 62 6f 76 65  |BASIC2 and above|
00000520  20 79 6f 75 20 63 61 6e  20 61 6c 73 6f 20 75 73  | you can also us|
00000530  65 20 4f 53 43 4c 49 20  69 66 20 74 68 65 72 65  |e OSCLI if there|
00000540  20 69 73 20 61 0d 76 61  72 69 61 62 6c 65 20 79  | is a.variable y|
00000550  6f 75 20 77 69 73 68 20  74 6f 20 69 6e 63 6c 75  |ou wish to inclu|
00000560  64 65 2e 20 20 49 20 77  6f 6e 27 74 20 67 6f 20  |de.  I won't go |
00000570  69 6e 74 6f 20 64 65 74  61 69 6c 20 77 69 74 68  |into detail with|
00000580  0d 61 6e 79 20 6f 66 20  74 68 65 73 65 20 42 41  |.any of these BA|
00000590  53 49 43 20 6d 65 74 68  6f 64 73 20 68 65 72 65  |SIC methods here|
000005a0  2c 20 77 65 27 6c 6c 20  73 74 69 63 6b 20 74 6f  |, we'll stick to|
000005b0  20 61 73 73 65 6d 62 6c  65 72 2e 0d 0d 54 6f 20  | assembler...To |
000005c0  65 6e 74 65 72 20 74 68  65 20 4f 53 42 59 54 45  |enter the OSBYTE|
000005d0  20 73 75 62 72 6f 75 74  69 6e 65 20 79 6f 75 20  | subroutine you |
000005e0  68 61 76 65 20 74 6f 20  73 65 74 20 74 68 65 20  |have to set the |
000005f0  41 2c 58 20 61 6e 64 20  59 0d 72 65 67 69 73 74  |A,X and Y.regist|
00000600  65 72 73 2c 20 70 6f 73  73 69 62 6c 79 20 62 79  |ers, possibly by|
00000610  20 75 73 69 6e 67 20 4c  44 41 2c 20 4c 44 58 20  | using LDA, LDX |
00000620  61 6e 64 20 4c 44 59 20  6c 69 6b 65 20 74 68 69  |and LDY like thi|
00000630  73 3a 0d 0d 20 20 20 20  20 20 20 20 20 20 20 20  |s:..            |
00000640  20 20 20 20 20 20 6f 73  62 79 74 65 3d 26 46 46  |      osbyte=&FF|
00000650  46 34 0d 0d 20 20 20 20  20 20 20 20 20 20 20 20  |F4..            |
00000660  20 20 20 20 20 20 4c 44  41 20 23 6e 75 6d 62 65  |      LDA #numbe|
00000670  72 5f 6f 66 5f 4f 53 42  59 54 45 5f 63 61 6c 6c  |r_of_OSBYTE_call|
00000680  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000690  20 20 20 4c 44 58 20 23  58 5f 70 61 72 61 6d 65  |   LDX #X_parame|
000006a0  74 65 72 0d 20 20 20 20  20 20 20 20 20 20 20 20  |ter.            |
000006b0  20 20 20 20 20 20 4c 44  59 20 23 59 5f 70 61 72  |      LDY #Y_par|
000006c0  61 6d 65 74 65 72 0d 20  20 20 20 20 20 20 20 20  |ameter.         |
000006d0  20 20 20 20 20 20 20 20  20 4a 53 52 20 6f 73 62  |         JSR osb|
000006e0  79 74 65 0d 0d 41 66 74  65 72 20 74 68 65 20 4a  |yte..After the J|
000006f0  53 52 20 79 6f 75 20 6d  61 79 20 66 69 6e 64 20  |SR you may find |
00000700  74 68 61 74 20 74 68 65  20 58 20 61 6e 64 20 59  |that the X and Y|
00000710  20 72 65 67 69 73 74 65  72 73 0d 63 6f 6e 74 61  | registers.conta|
00000720  69 6e 20 75 73 65 66 75  6c 20 69 6e 66 6f 72 6d  |in useful inform|
00000730  61 74 69 6f 6e 2e 20 20  49 6e 20 42 41 53 49 43  |ation.  In BASIC|
00000740  20 79 6f 75 20 77 6f 75  6c 64 20 75 73 65 20 74  | you would use t|
00000750  68 65 20 55 53 52 0d 66  75 6e 63 74 69 6f 6e 20  |he USR.function |
00000760  74 6f 20 6f 62 74 61 69  6e 20 74 68 69 73 20 62  |to obtain this b|
00000770  75 74 20 69 6e 20 6d 61  63 68 69 6e 65 20 63 6f  |ut in machine co|
00000780  64 65 20 74 68 65 20 62  79 74 65 73 20 61 72 65  |de the bytes are|
00000790  0d 6a 75 73 74 20 73 69  74 74 69 6e 67 20 69 6e  |.just sitting in|
000007a0  20 74 68 65 20 72 65 67  69 73 74 65 72 73 20 77  | the registers w|
000007b0  61 69 74 69 6e 67 20 66  6f 72 20 79 6f 75 2e 0d  |aiting for you..|
000007c0  0d 54 68 65 72 65 20 69  73 20 61 20 6c 69 73 74  |.There is a list|
000007d0  20 6f 66 20 4f 53 42 59  54 45 20 63 61 6c 6c 73  | of OSBYTE calls|
000007e0  20 69 6e 20 6f 6e 65 20  6f 66 20 79 6f 75 72 20  | in one of your |
000007f0  75 73 65 72 20 67 75 69  64 65 73 0d 62 75 74 20  |user guides.but |
00000800  49 20 77 69 6c 6c 20 6c  69 73 74 20 61 20 66 65  |I will list a fe|
00000810  77 20 75 73 65 66 75 6c  20 65 78 61 6d 70 6c 65  |w useful example|
00000820  73 20 68 65 72 65 20 28  77 69 74 68 0d 61 63 6b  |s here (with.ack|
00000830  6e 6f 77 6c 65 64 67 6d  65 6e 74 73 20 74 6f 20  |nowledgments to |
00000840  42 72 61 79 2c 20 44 69  63 6b 65 6e 73 20 61 6e  |Bray, Dickens an|
00000850  64 20 48 6f 6c 6d 65 73  20 27 41 64 76 61 6e 63  |d Holmes 'Advanc|
00000860  65 64 20 55 73 65 72 0d  47 75 69 64 65 27 29 3a  |ed User.Guide'):|
00000870  0d 0d 4f 53 42 59 54 45  20 32 20 73 65 6c 65 63  |..OSBYTE 2 selec|
00000880  74 73 20 74 68 65 20 73  6f 75 72 63 65 20 66 72  |ts the source fr|
00000890  6f 6d 20 77 68 69 63 68  20 69 6e 70 75 74 20 69  |om which input i|
000008a0  73 20 74 61 6b 65 6e 2c  0d 63 61 6c 6c 65 64 20  |s taken,.called |
000008b0  74 68 65 20 69 6e 70 75  74 20 73 74 72 65 61 6d  |the input stream|
000008c0  2e 20 20 54 68 65 20 69  6e 70 75 74 20 73 74 72  |.  The input str|
000008d0  65 61 6d 20 69 73 20 73  65 6c 65 63 74 65 64 20  |eam is selected |
000008e0  62 79 20 58 0d 61 6e 64  20 69 66 20 58 3d 30 20  |by X.and if X=0 |
000008f0  74 68 65 20 6b 65 79 62  6f 61 72 64 20 69 73 20  |the keyboard is |
00000900  73 65 6c 65 63 74 65 64  20 61 6e 64 20 74 68 65  |selected and the|
00000910  20 52 53 34 32 33 20 69  73 0d 64 69 73 61 62 6c  | RS423 is.disabl|
00000920  65 64 20 28 77 68 69 63  68 20 6d 65 61 6e 73 20  |ed (which means |
00000930  74 68 61 74 20 6e 6f 20  63 61 72 72 69 65 72 20  |that no carrier |
00000940  77 6f 75 6c 64 20 62 65  20 73 65 6e 74 20 66 72  |would be sent fr|
00000950  6f 6d 20 61 0d 6d 6f 64  65 6d 20 66 6f 72 20 65  |om a.modem for e|
00000960  78 61 6d 70 6c 65 29 2e  20 49 66 20 58 3d 31 20  |xample). If X=1 |
00000970  74 68 65 6e 20 74 68 65  20 52 53 34 32 33 20 69  |then the RS423 i|
00000980  73 20 73 65 6c 65 63 74  65 64 20 61 6e 64 0d 65  |s selected and.e|
00000990  6e 61 62 6c 65 64 2c 20  73 6f 20 79 6f 75 20 63  |nabled, so you c|
000009a0  61 6e 20 72 65 63 65 69  76 65 20 66 72 6f 6d 20  |an receive from |
000009b0  69 74 2e 20 20 49 66 20  58 3d 32 20 74 68 65 6e  |it.  If X=2 then|
000009c0  20 74 68 65 0d 6b 65 79  62 6f 61 72 64 20 69 73  | the.keyboard is|
000009d0  20 73 65 6c 65 63 74 65  64 20 66 6f 72 20 69 6e  | selected for in|
000009e0  70 75 74 20 62 75 74 20  74 68 65 20 52 53 34 32  |put but the RS42|
000009f0  33 20 69 73 20 73 74 69  6c 6c 0d 65 6e 61 62 6c  |3 is still.enabl|
00000a00  65 64 2e 0d 0d 4f 6e 63  65 20 74 68 65 20 63 61  |ed...Once the ca|
00000a10  6c 6c 20 68 61 73 20 62  65 65 6e 20 65 78 65 63  |ll has been exec|
00000a20  75 74 65 64 20 74 68 65  20 76 61 6c 75 65 20 69  |uted the value i|
00000a30  6e 20 74 68 65 20 58 20  72 65 67 69 73 74 65 72  |n the X register|
00000a40  0d 77 69 6c 6c 20 62 65  20 30 20 69 66 20 74 68  |.will be 0 if th|
00000a50  65 20 70 72 65 76 69 6f  75 73 20 69 6e 70 75 74  |e previous input|
00000a60  20 77 61 73 20 66 72 6f  6d 20 74 68 65 20 6b 65  | was from the ke|
00000a70  79 62 6f 61 72 64 20 61  6e 64 20 31 0d 69 66 20  |yboard and 1.if |
00000a80  74 68 65 20 70 72 65 76  69 6f 75 73 20 69 6e 70  |the previous inp|
00000a90  75 74 20 77 61 73 20 66  72 6f 6d 20 74 68 65 20  |ut was from the |
00000aa0  52 53 34 32 33 2e 20 20  54 68 69 73 20 63 61 6e  |RS423.  This can|
00000ab0  20 68 65 6c 70 20 79 6f  75 0d 72 65 73 74 6f 72  | help you.restor|
00000ac0  65 20 70 72 65 76 69 6f  75 73 20 63 6f 6e 64 69  |e previous condi|
00000ad0  74 69 6f 6e 73 20 61 66  74 65 72 20 79 6f 75 20  |tions after you |
00000ae0  68 61 76 65 20 63 68 61  6e 67 65 64 0d 73 6f 6d  |have changed.som|
00000af0  65 74 68 69 6e 67 2e 0d  0d 41 6c 73 6f 20 6f 6e  |ething...Also on|
00000b00  20 65 78 69 74 20 74 68  65 20 76 61 6c 75 65 20  | exit the value |
00000b10  69 6e 20 74 68 65 20 41  63 63 75 6d 75 6c 61 74  |in the Accumulat|
00000b20  6f 72 20 69 73 20 74 68  65 20 73 61 6d 65 20 61  |or is the same a|
00000b30  73 20 69 74 0d 77 61 73  20 62 65 66 6f 72 65 20  |s it.was before |
00000b40  74 68 65 20 63 61 6c 6c  2c 20 77 65 20 73 61 79  |the call, we say|
00000b50  20 69 74 20 68 61 73 20  62 65 65 6e 20 70 72 65  | it has been pre|
00000b60  73 65 72 76 65 64 2e 20  20 54 68 65 0d 76 61 6c  |served.  The.val|
00000b70  75 65 20 69 6e 20 74 68  65 20 59 20 72 65 67 69  |ue in the Y regi|
00000b80  73 74 65 72 2c 20 61 6e  64 20 74 68 65 20 73 74  |ster, and the st|
00000b90  61 74 65 20 6f 66 20 74  68 65 20 43 61 72 72 79  |ate of the Carry|
00000ba0  20 66 6c 61 67 20 61 72  65 0d 75 6e 64 65 66 69  | flag are.undefi|
00000bb0  6e 65 64 2e 0d 0d 4f 53  42 59 54 45 20 31 31 37  |ned...OSBYTE 117|
00000bc0  20 69 73 20 61 6e 20 69  6e 66 6f 72 6d 61 74 69  | is an informati|
00000bd0  6f 6e 20 63 61 6c 6c 2e  20 20 59 6f 75 20 73 65  |on call.  You se|
00000be0  74 20 74 68 65 20 61 63  63 75 6d 75 6c 61 74 6f  |t the accumulato|
00000bf0  72 0d 74 6f 20 31 31 37  20 62 75 74 20 74 68 65  |r.to 117 but the|
00000c00  20 76 61 6c 75 65 73 20  6f 66 20 74 68 65 20 58  | values of the X|
00000c10  20 61 6e 64 20 59 20 72  65 67 69 73 74 65 72 73  | and Y registers|
00000c20  20 61 72 65 20 6f 66 20  6e 6f 0d 63 6f 6e 73 65  | are of no.conse|
00000c30  71 75 65 6e 63 65 2e 0d  0d 41 66 74 65 72 20 74  |quence...After t|
00000c40  68 65 20 63 61 6c 6c 20  74 68 65 20 61 63 63 75  |he call the accu|
00000c50  6d 75 6c 61 74 6f 72 20  61 6e 64 20 59 20 72 65  |mulator and Y re|
00000c60  67 69 73 74 65 72 20 68  61 76 65 20 62 65 65 6e  |gister have been|
00000c70  0d 70 72 65 73 65 72 76  65 64 20 61 6e 64 20 74  |.preserved and t|
00000c80  68 65 20 43 61 72 72 79  20 66 6c 61 67 20 69 73  |he Carry flag is|
00000c90  20 75 6e 64 65 66 69 6e  65 64 20 62 75 74 20 74  | undefined but t|
00000ca0  68 65 20 58 20 72 65 67  69 73 74 65 72 0d 63 6f  |he X register.co|
00000cb0  6e 74 61 69 6e 73 20 75  73 65 66 75 6c 20 69 6e  |ntains useful in|
00000cc0  66 6f 72 6d 61 74 69 6f  6e 20 61 62 6f 75 74 20  |formation about |
00000cd0  74 68 65 20 56 44 55 20  64 69 73 70 6c 61 79 20  |the VDU display |
00000ce0  73 74 61 74 75 73 2c 0d  62 69 74 20 62 79 20 62  |status,.bit by b|
00000cf0  69 74 2e 0d 0d 49 66 20  42 69 74 20 30 20 69 73  |it...If Bit 0 is|
00000d00  20 73 65 74 20 74 68 65  6e 20 70 72 69 6e 74 65  | set then printe|
00000d10  72 20 6f 75 74 70 75 74  20 69 73 20 65 6e 61 62  |r output is enab|
00000d20  6c 65 64 20 62 79 20 61  20 56 44 55 32 0d 49 66  |led by a VDU2.If|
00000d30  20 42 69 74 20 31 20 69  73 20 73 65 74 20 74 68  | Bit 1 is set th|
00000d40  65 6e 20 73 63 72 6f 6c  6c 69 6e 67 20 69 73 20  |en scrolling is |
00000d50  64 69 73 61 62 6c 65 64  0d 49 66 20 42 69 74 20  |disabled.If Bit |
00000d60  32 20 69 73 20 73 65 74  20 74 68 65 6e 20 70 61  |2 is set then pa|
00000d70  67 65 64 20 6d 6f 64 65  20 69 73 20 73 65 6c 65  |ged mode is sele|
00000d80  63 74 65 64 20 28 69 2e  65 2e 20 43 54 52 4c 20  |cted (i.e. CTRL |
00000d90  4e 29 0d 49 66 20 42 69  74 20 33 20 69 73 20 73  |N).If Bit 3 is s|
00000da0  65 74 20 74 68 65 6e 20  61 20 74 65 78 74 20 77  |et then a text w|
00000db0  69 6e 64 6f 77 20 69 73  20 69 6e 20 6f 70 65 72  |indow is in oper|
00000dc0  61 74 69 6f 6e 0d 20 20  20 42 69 74 20 34 20 69  |ation.   Bit 4 i|
00000dd0  73 20 6e 6f 74 20 75 73  65 64 0d 49 66 20 42 69  |s not used.If Bi|
00000de0  74 20 35 20 69 73 20 73  65 74 20 74 68 65 6e 20  |t 5 is set then |
00000df0  56 44 55 35 20 68 61 73  20 62 65 65 6e 20 73 65  |VDU5 has been se|
00000e00  6e 74 20 61 6e 64 20 74  65 78 74 20 69 73 20 62  |nt and text is b|
00000e10  65 69 6e 67 0d 20 20 20  70 72 69 6e 74 65 64 20  |eing.   printed |
00000e20  61 74 20 74 68 65 20 67  72 61 70 68 69 63 73 20  |at the graphics |
00000e30  63 75 72 73 6f 72 0d 49  66 20 42 69 74 20 36 20  |cursor.If Bit 6 |
00000e40  69 73 20 73 65 74 20 74  68 65 6e 20 74 68 65 20  |is set then the |
00000e50  69 6e 70 75 74 20 61 6e  64 20 6f 75 74 70 75 74  |input and output|
00000e60  20 63 75 72 73 6f 72 73  20 61 72 65 0d 20 20 20  | cursors are.   |
00000e70  73 65 70 61 72 61 74 65  64 20 61 6e 64 20 63 75  |separated and cu|
00000e80  72 73 6f 72 20 65 64 69  74 69 6e 67 20 69 73 20  |rsor editing is |
00000e90  69 6e 20 70 72 6f 67 72  65 73 73 0d 49 66 20 42  |in progress.If B|
00000ea0  69 74 20 37 20 69 73 20  73 65 74 20 74 68 65 6e  |it 7 is set then|
00000eb0  20 74 68 65 20 56 44 55  20 69 73 20 64 69 73 61  | the VDU is disa|
00000ec0  62 6c 65 64 20 66 6f 6c  6c 6f 77 69 6e 67 20 61  |bled following a|
00000ed0  20 56 44 55 32 31 0d 0d  59 6f 75 20 63 61 6e 20  | VDU21..You can |
00000ee0  74 65 73 74 20 74 68 65  20 76 61 6c 75 65 20 68  |test the value h|
00000ef0  65 6c 64 20 69 6e 20 58  20 62 69 74 20 62 79 20  |eld in X bit by |
00000f00  62 69 74 20 75 73 69 6e  67 20 74 68 65 0d 6c 6f  |bit using the.lo|
00000f10  67 69 63 61 6c 20 6f 70  65 72 61 74 6f 72 73 20  |gical operators |
00000f20  41 4e 44 20 6f 72 20 42  49 54 20 77 68 69 63 68  |AND or BIT which|
00000f30  20 49 27 6c 6c 20 63 6f  6d 65 20 6f 6e 74 6f 20  | I'll come onto |
00000f40  69 6e 20 61 20 6c 61 74  65 72 0d 6d 6f 64 75 6c  |in a later.modul|
00000f50  65 2e 0d 0d 4f 53 42 59  54 45 20 31 32 39 20 6f  |e...OSBYTE 129 o|
00000f60  70 65 72 61 74 65 73 20  6c 69 6b 65 20 42 41 53  |perates like BAS|
00000f70  49 43 27 73 20 49 4e 4b  45 59 2e 20 20 54 68 65  |IC's INKEY.  The|
00000f80  20 58 20 61 6e 64 20 59  0d 72 65 67 69 73 74 65  | X and Y.registe|
00000f90  72 73 20 68 6f 6c 64 20  74 68 65 20 74 69 6d 65  |rs hold the time|
00000fa0  20 6c 69 6d 69 74 20 66  6f 72 20 77 61 69 74 69  | limit for waiti|
00000fb0  6e 67 20 66 6f 72 20 61  20 6b 65 79 2e 20 20 58  |ng for a key.  X|
00000fc0  0d 63 6f 6e 74 61 69 6e  73 20 74 68 65 20 4c 6f  |.contains the Lo|
00000fd0  77 65 72 20 53 69 67 6e  69 66 69 63 61 6e 74 20  |wer Significant |
00000fe0  42 79 74 65 20 28 74 69  6d 65 20 4d 4f 44 20 32  |Byte (time MOD 2|
00000ff0  35 36 29 20 61 6e 64 20  59 0d 63 6f 6e 74 61 69  |56) and Y.contai|
00001000  6e 73 20 74 68 65 20 4d  53 42 20 28 74 69 6d 65  |ns the MSB (time|
00001010  20 44 49 56 20 32 35 36  29 20 75 70 20 74 6f 20  | DIV 256) up to |
00001020  61 20 6c 69 6d 69 74 20  6f 66 20 26 37 46 46 46  |a limit of &7FFF|
00001030  2e 20 0d 54 68 69 73 20  69 73 20 26 37 46 46 46  |. .This is &7FFF|
00001040  20 68 75 6e 64 72 65 64  74 68 73 20 6f 66 20 61  | hundredths of a|
00001050  20 73 65 63 6f 6e 64 20  67 69 76 69 6e 67 20 61  | second giving a|
00001060  6e 20 75 70 70 65 72 20  6c 69 6d 69 74 0d 6f 66  |n upper limit.of|
00001070  20 61 62 6f 75 74 20 35  20 61 6e 64 20 61 20 68  | about 5 and a h|
00001080  61 6c 66 20 6d 69 6e 75  74 65 73 2e 0d 0d 4f 6e  |alf minutes...On|
00001090  20 65 78 69 74 20 66 72  6f 6d 20 74 68 65 20 72  | exit from the r|
000010a0  6f 75 74 69 6e 65 20 74  68 65 20 58 20 72 65 67  |outine the X reg|
000010b0  69 73 74 65 72 20 77 69  6c 6c 20 68 6f 6c 64 20  |ister will hold |
000010c0  74 68 65 20 41 53 43 49  49 0d 76 61 6c 75 65 20  |the ASCII.value |
000010d0  6f 66 20 74 68 65 20 6b  65 79 20 70 72 65 73 73  |of the key press|
000010e0  65 64 2e 20 20 59 20 77  69 6c 6c 20 68 6f 6c 64  |ed.  Y will hold|
000010f0  20 7a 65 72 6f 20 61 6e  64 20 74 68 65 20 43 61  | zero and the Ca|
00001100  72 72 79 0d 66 6c 61 67  20 77 69 6c 6c 20 62 65  |rry.flag will be|
00001110  20 63 6c 65 61 72 2e 20  20 49 66 20 6e 6f 20 6b  | clear.  If no k|
00001120  65 79 20 77 61 73 20 70  72 65 73 73 65 64 20 64  |ey was pressed d|
00001130  75 72 69 6e 67 20 74 68  61 74 20 74 69 6d 65 0d  |uring that time.|
00001140  74 68 65 6e 20 59 20 77  69 6c 6c 20 63 6f 6e 74  |then Y will cont|
00001150  61 69 6e 20 26 46 46 20  61 6e 64 20 74 68 65 20  |ain &FF and the |
00001160  43 61 72 72 79 20 66 6c  61 67 20 77 69 6c 6c 20  |Carry flag will |
00001170  62 65 20 73 65 74 2e 20  20 49 66 0d 65 73 63 61  |be set.  If.esca|
00001180  70 65 20 77 61 73 20 70  72 65 73 73 65 64 20 74  |pe was pressed t|
00001190  68 65 6e 20 59 20 77 69  6c 6c 20 63 6f 6e 74 61  |hen Y will conta|
000011a0  69 6e 20 26 31 42 20 28  32 37 29 20 61 6e 64 20  |in &1B (27) and |
000011b0  74 68 65 0d 43 61 72 72  79 20 66 6c 61 67 20 77  |the.Carry flag w|
000011c0  69 6c 6c 20 62 65 20 73  65 74 2e 0d 0d 49 66 20  |ill be set...If |
000011d0  74 68 65 20 66 69 67 75  72 65 20 68 65 6c 64 20  |the figure held |
000011e0  69 6e 20 58 20 61 6e 64  20 59 20 69 73 20 6e 65  |in X and Y is ne|
000011f0  67 61 74 69 76 65 20 74  68 65 6e 20 74 68 69 73  |gative then this|
00001200  20 69 73 20 74 68 65 0d  65 71 75 69 76 61 6c 65  | is the.equivale|
00001210  6e 74 20 74 6f 20 49 4e  4b 45 59 28 2d 4e 29 20  |nt to INKEY(-N) |
00001220  77 68 65 72 65 20 4e 20  69 73 20 61 20 6b 65 79  |where N is a key|
00001230  20 6e 75 6d 62 65 72 2e  20 20 48 65 72 65 20 74  | number.  Here t|
00001240  68 65 0d 72 6f 75 74 69  6e 65 20 77 69 6c 6c 20  |he.routine will |
00001250  74 65 6c 6c 20 79 6f 75  20 69 66 20 74 68 65 20  |tell you if the |
00001260  6b 65 79 20 77 69 74 68  20 74 68 61 74 20 6e 75  |key with that nu|
00001270  6d 62 65 72 20 77 61 73  0d 70 72 65 73 73 65 64  |mber was.pressed|
00001280  20 61 74 20 74 68 65 20  6d 6f 6d 65 6e 74 20 74  | at the moment t|
00001290  68 65 20 72 6f 75 74 69  6e 65 20 73 63 61 6e 6e  |he routine scann|
000012a0  65 64 20 74 68 65 20 6b  65 79 62 6f 61 72 64 2e  |ed the keyboard.|
000012b0  0d 0d 4f 6e 20 65 78 69  74 20 58 20 61 6e 64 20  |..On exit X and |
000012c0  59 20 77 69 6c 6c 20 62  6f 74 68 20 63 6f 6e 74  |Y will both cont|
000012d0  61 69 6e 20 26 46 46 20  69 66 20 74 68 65 20 6b  |ain &FF if the k|
000012e0  65 79 20 69 73 20 70 72  65 73 73 65 64 2e 0d 0d  |ey is pressed...|
000012f0  54 68 65 20 66 69 6c 65  20 42 2f 6f 73 62 30 35  |The file B/osb05|
00001300  20 77 69 74 68 20 74 68  69 73 20 74 72 61 6e 73  | with this trans|
00001310  6d 69 73 73 69 6f 6e 20  63 6f 6e 74 61 69 6e 73  |mission contains|
00001320  20 61 20 73 6d 61 6c 6c  0d 70 72 6f 67 72 61 6d  | a small.program|
00001330  20 77 68 69 63 68 20 75  73 65 73 20 61 20 73 69  | which uses a si|
00001340  6d 69 6c 61 72 20 4f 53  42 59 54 45 20 63 61 6c  |milar OSBYTE cal|
00001350  6c 2c 20 6e 75 6d 62 65  72 20 31 32 31 2c 20 77  |l, number 121, w|
00001360  68 69 63 68 0d 73 63 61  6e 73 20 74 68 65 20 6b  |hich.scans the k|
00001370  65 79 62 6f 61 72 64 20  61 6e 64 20 72 65 74 75  |eyboard and retu|
00001380  72 6e 73 20 61 20 6e 75  6d 62 65 72 20 63 6f 72  |rns a number cor|
00001390  72 65 73 70 6f 6e 64 69  6e 67 20 74 6f 20 74 68  |responding to th|
000013a0  65 0d 6b 65 79 20 70 72  65 73 73 65 64 20 64 6f  |e.key pressed do|
000013b0  77 6e 20 61 74 20 74 68  65 20 74 69 6d 65 2e 20  |wn at the time. |
000013c0  20 54 68 69 73 20 69 73  20 74 68 65 6e 20 75 73  | This is then us|
000013d0  65 64 20 74 6f 20 70 6c  61 79 20 61 0d 6e 6f 74  |ed to play a.not|
000013e0  65 20 75 73 69 6e 67 20  61 6e 20 4f 53 57 4f 52  |e using an OSWOR|
000013f0  44 20 63 61 6c 6c 2e 0d  0d 4f 53 57 4f 52 44 20  |D call...OSWORD |
00001400  6f 70 65 72 61 74 65 73  20 69 6e 20 61 20 73 69  |operates in a si|
00001410  6d 69 6c 61 72 20 77 61  79 20 74 6f 20 4f 53 42  |milar way to OSB|
00001420  59 54 45 20 65 78 63 65  70 74 20 74 68 61 74 20  |YTE except that |
00001430  68 65 72 65 0d 74 68 65  20 70 61 72 61 6d 65 74  |here.the paramet|
00001440  65 72 73 20 79 6f 75 20  6e 65 65 64 20 74 6f 20  |ers you need to |
00001450  70 61 73 73 20 74 6f 20  61 6e 64 20 66 72 6f 6d  |pass to and from|
00001460  20 74 68 65 20 72 6f 75  74 69 6e 65 73 20 61 72  | the routines ar|
00001470  65 0d 74 6f 6f 20 62 69  67 20 74 6f 20 66 69 74  |e.too big to fit|
00001480  20 69 6e 74 6f 20 61 20  63 6f 75 70 6c 65 20 6f  | into a couple o|
00001490  66 20 62 79 74 65 73 2e  20 20 49 6e 20 74 68 69  |f bytes.  In thi|
000014a0  73 20 63 61 73 65 2c 0d  69 6e 73 74 65 61 64 20  |s case,.instead |
000014b0  6f 66 20 75 73 69 6e 67  20 58 20 61 6e 64 20 59  |of using X and Y|
000014c0  20 74 6f 20 68 6f 6c 64  20 70 61 72 61 6d 65 74  | to hold paramet|
000014d0  65 72 73 2c 20 79 6f 75  20 75 73 65 20 58 20 61  |ers, you use X a|
000014e0  6e 64 20 59 0d 74 6f 20  70 6f 69 6e 74 20 74 6f  |nd Y.to point to|
000014f0  20 61 20 62 6c 6f 63 6b  20 6f 66 20 6d 65 6d 6f  | a block of memo|
00001500  72 79 20 69 6e 20 77 68  69 63 68 20 79 6f 75 20  |ry in which you |
00001510  70 75 74 20 79 6f 75 72  0d 70 61 72 61 6d 65 74  |put your.paramet|
00001520  65 72 73 2e 20 20 54 68  65 20 61 63 63 75 6d 75  |ers.  The accumu|
00001530  6c 61 74 6f 72 20 68 6f  6c 64 73 20 74 68 65 20  |lator holds the |
00001540  4f 53 57 4f 52 44 20 6e  75 6d 62 65 72 20 69 6e  |OSWORD number in|
00001550  20 74 68 65 0d 73 61 6d  65 20 77 61 79 20 69 74  | the.same way it|
00001560  20 64 69 64 20 77 69 74  68 20 4f 53 42 59 54 45  | did with OSBYTE|
00001570  2e 20 20 4f 53 57 4f 52  44 20 69 73 20 63 61 6c  |.  OSWORD is cal|
00001580  6c 65 64 20 61 74 20 26  46 46 46 31 2e 0d 0d 54  |led at &FFF1...T|
00001590  68 65 72 65 20 61 72 65  20 6f 6e 6c 79 20 31 34  |here are only 14|
000015a0  20 4f 53 57 4f 52 44 20  72 6f 75 74 69 6e 65 73  | OSWORD routines|
000015b0  20 69 6e 20 74 68 65 20  42 42 43 20 4d 6f 64 65  | in the BBC Mode|
000015c0  6c 20 42 0d 6f 70 65 72  61 74 69 6e 67 20 73 79  |l B.operating sy|
000015d0  73 74 65 6d 2c 20 61 6e  64 20 31 36 20 69 6e 20  |stem, and 16 in |
000015e0  74 68 65 20 4d 61 73 74  65 72 2e 20 20 54 68 65  |the Master.  The|
000015f0  79 20 61 72 65 20 61 73  0d 66 6f 6c 6c 6f 77 73  |y are as.follows|
00001600  3a 0d 0d 4f 53 57 4f 52  44 20 30 20 20 20 20 20  |:..OSWORD 0     |
00001610  20 2d 20 52 65 61 64 20  61 20 6c 69 6e 65 20 66  | - Read a line f|
00001620  72 6f 6d 20 69 6e 70 75  74 0d 4f 53 57 4f 52 44  |rom input.OSWORD|
00001630  20 31 2f 32 20 20 20 20  2d 20 52 65 61 64 2f 77  | 1/2    - Read/w|
00001640  72 69 74 65 20 73 79 73  74 65 6d 20 63 6c 6f 63  |rite system cloc|
00001650  6b 0d 4f 53 57 4f 52 44  20 33 2f 34 20 20 20 20  |k.OSWORD 3/4    |
00001660  2d 20 52 65 61 64 2f 77  72 69 74 65 20 69 6e 74  |- Read/write int|
00001670  65 72 76 61 6c 20 74 69  6d 65 72 0d 4f 53 57 4f  |erval timer.OSWO|
00001680  52 44 20 35 2f 36 20 20  20 20 2d 20 52 65 61 64  |RD 5/6    - Read|
00001690  2f 77 72 69 74 65 20 49  2f 4f 20 70 72 6f 63 65  |/write I/O proce|
000016a0  73 73 6f 72 20 6d 65 6d  6f 72 79 0d 4f 53 57 4f  |ssor memory.OSWO|
000016b0  52 44 20 37 20 20 20 20  20 20 2d 20 53 6f 75 6e  |RD 7      - Soun|
000016c0  64 20 63 6f 6d 6d 61 6e  64 0d 4f 53 57 4f 52 44  |d command.OSWORD|
000016d0  20 38 20 20 20 20 20 20  2d 20 45 6e 76 65 6c 6f  | 8      - Envelo|
000016e0  70 65 20 64 65 66 69 6e  69 74 69 6f 6e 0d 4f 53  |pe definition.OS|
000016f0  57 4f 52 44 20 39 20 20  20 20 20 20 2d 20 52 65  |WORD 9      - Re|
00001700  61 64 20 76 61 6c 75 65  20 6f 66 20 61 20 70 69  |ad value of a pi|
00001710  78 65 6c 20 6f 6e 20 74  68 65 20 73 63 72 65 65  |xel on the scree|
00001720  6e 0d 4f 53 57 4f 52 44  20 31 30 20 20 20 20 20  |n.OSWORD 10     |
00001730  2d 20 52 65 61 64 20 64  65 66 69 6e 69 74 69 6f  |- Read definitio|
00001740  6e 20 6f 66 20 61 20 63  68 61 72 61 63 74 65 72  |n of a character|
00001750  0d 4f 53 57 4f 52 44 20  31 31 2f 31 32 20 20 2d  |.OSWORD 11/12  -|
00001760  20 52 65 61 64 2f 77 72  69 74 65 20 70 61 6c 65  | Read/write pale|
00001770  74 74 65 0d 4f 53 57 4f  52 44 20 31 33 20 20 20  |tte.OSWORD 13   |
00001780  20 20 2d 20 52 65 61 64  20 74 68 65 20 6c 61 73  |  - Read the las|
00001790  74 20 74 77 6f 20 67 72  61 70 68 69 63 73 20 63  |t two graphics c|
000017a0  75 72 73 6f 72 20 70 6f  73 69 74 69 6f 6e 73 0d  |ursor positions.|
000017b0  4f 53 57 4f 52 44 20 31  34 2f 31 35 20 20 2d 20  |OSWORD 14/15  - |
000017c0  52 65 61 64 2f 77 72 69  74 65 20 43 4d 4f 53 20  |Read/write CMOS |
000017d0  63 6c 6f 63 6b 20 69 6e  20 4d 61 73 74 65 72 0d  |clock in Master.|
000017e0  0d 4f 53 57 4f 52 44 20  63 61 6c 6c 73 20 77 69  |.OSWORD calls wi|
000017f0  74 68 20 6f 74 68 65 72  20 76 61 6c 75 65 73 20  |th other values |
00001800  69 6e 20 74 68 65 20 61  63 63 75 6d 75 6c 61 74  |in the accumulat|
00001810  6f 72 20 61 72 65 20 70  61 73 73 65 64 0d 74 6f  |or are passed.to|
00001820  20 73 69 64 65 77 61 79  73 20 52 4f 4d 53 20 61  | sideways ROMS a|
00001830  6e 64 20 79 6f 75 20 66  69 6e 64 20 74 68 65 6d  |nd you find them|
00001840  20 61 70 70 6c 79 69 6e  67 20 74 6f 20 66 69 6c  | applying to fil|
00001850  69 6e 67 0d 73 79 73 74  65 6d 73 20 61 6e 64 20  |ing.systems and |
00001860  74 68 65 20 6c 69 6b 65  2e 20 20 46 6f 72 20 65  |the like.  For e|
00001870  78 61 6d 70 6c 65 3a 0d  0d 4f 53 57 4f 52 44 20  |xample:..OSWORD |
00001880  31 32 37 20 65 6e 61 62  6c 65 73 20 79 6f 75 20  |127 enables you |
00001890  74 6f 20 72 65 61 64 2f  77 72 69 74 65 20 61 20  |to read/write a |
000018a0  73 65 63 74 6f 72 20 6f  66 20 61 20 64 69 73 63  |sector of a disc|
000018b0  20 69 6e 0d 74 68 65 20  64 69 73 63 20 66 69 6c  | in.the disc fil|
000018c0  69 6e 67 20 73 79 73 74  65 6d 0d 0d 4f 53 57 4f  |ing system..OSWO|
000018d0  52 44 20 31 32 32 20 65  6e 61 62 6c 65 73 20 79  |RD 122 enables y|
000018e0  6f 75 20 74 6f 20 77 6f  72 6b 20 77 69 74 68 20  |ou to work with |
000018f0  74 68 65 20 41 63 6f 72  6e 20 6f 72 20 42 42 43  |the Acorn or BBC|
00001900  0d 74 65 6c 65 73 6f 66  74 77 61 72 65 20 52 4f  |.telesoftware RO|
00001910  4d 53 0d 0d 4f 53 57 4f  52 44 20 36 34 20 61 63  |MS..OSWORD 64 ac|
00001920  63 65 73 73 65 73 20 74  68 65 20 73 74 61 74 75  |cesses the statu|
00001930  73 20 6f 66 20 74 68 65  20 41 4d 58 20 6d 6f 75  |s of the AMX mou|
00001940  73 65 20 69 66 20 79 6f  75 20 68 61 76 65 0d 74  |se if you have.t|
00001950  68 69 73 20 73 6f 66 74  77 61 72 65 20 69 6e 20  |his software in |
00001960  79 6f 75 72 20 6d 61 63  68 69 6e 65 2e 0d 0d 49  |your machine...I|
00001970  6e 20 61 6c 6c 20 63 61  73 65 73 20 74 68 65 20  |n all cases the |
00001980  4f 53 57 4f 52 44 20 62  6c 6f 63 6b 20 69 73 20  |OSWORD block is |
00001990  73 65 74 20 75 70 20 6c  69 6b 65 20 74 68 69 73  |set up like this|
000019a0  2e 20 20 59 6f 75 20 73  65 74 0d 61 73 69 64 65  |.  You set.aside|
000019b0  20 74 68 65 20 72 65 6c  65 76 61 6e 74 20 6e 75  | the relevant nu|
000019c0  6d 62 65 72 20 6f 66 20  62 79 74 65 73 20 66 6f  |mber of bytes fo|
000019d0  72 20 79 6f 75 72 20 70  61 72 61 6d 65 74 65 72  |r your parameter|
000019e0  20 62 6c 6f 63 6b 0d 62  79 20 75 73 69 6e 67 2c  | block.by using,|
000019f0  20 70 65 72 68 61 70 73  2c 20 74 68 65 20 46 4e  | perhaps, the FN|
00001a00  45 51 55 20 6f 72 20 45  51 55 20 66 75 6e 63 74  |EQU or EQU funct|
00001a10  69 6f 6e 73 20 69 6e 20  79 6f 75 72 0d 61 73 73  |ions in your.ass|
00001a20  65 6d 62 6c 65 72 20 70  72 6f 67 72 61 6d 2e 20  |embler program. |
00001a30  20 4c 65 74 27 73 20 73  61 79 20 74 68 61 74 20  | Let's say that |
00001a40  74 68 69 73 20 62 6c 6f  63 6b 20 73 74 61 72 74  |this block start|
00001a50  73 20 61 74 20 74 68 65  0d 61 64 64 72 65 73 73  |s at the.address|
00001a60  20 6c 61 62 65 6c 6c 65  64 20 27 6f 73 77 6f 72  | labelled 'oswor|
00001a70  64 5f 62 6c 6f 63 6b 27  0d 0d 20 20 20 20 20 20  |d_block'..      |
00001a80  20 20 20 20 20 20 20 4c  44 41 20 23 6e 75 6d 62  |       LDA #numb|
00001a90  65 72 5f 6f 66 5f 4f 53  57 4f 52 44 5f 63 61 6c  |er_of_OSWORD_cal|
00001aa0  6c 0d 20 20 20 20 20 20  20 20 20 20 20 20 20 4c  |l.             L|
00001ab0  44 58 20 23 28 6f 73 77  6f 72 64 5f 62 6c 6f 63  |DX #(osword_bloc|
00001ac0  6b 20 4d 4f 44 20 32 35  36 29 0d 20 20 20 20 20  |k MOD 256).     |
00001ad0  20 20 20 20 20 20 20 20  4c 44 59 20 23 28 6f 73  |        LDY #(os|
00001ae0  77 6f 72 64 5f 62 6c 6f  63 6b 20 44 49 56 20 32  |word_block DIV 2|
00001af0  35 36 29 0d 0d 73 6f 20  74 68 61 74 20 74 68 65  |56)..so that the|
00001b00  20 58 20 72 65 67 69 73  74 65 72 20 63 6f 6e 74  | X register cont|
00001b10  61 69 6e 73 20 74 68 65  20 4c 53 42 20 6f 66 20  |ains the LSB of |
00001b20  74 68 65 20 61 64 64 72  65 73 73 20 6f 66 0d 74  |the address of.t|
00001b30  68 65 20 70 61 72 61 6d  65 74 65 72 20 62 6c 6f  |he parameter blo|
00001b40  63 6b 20 61 6e 64 20 74  68 65 20 59 20 72 65 67  |ck and the Y reg|
00001b50  69 73 74 65 72 20 63 6f  6e 74 61 69 6e 73 20 74  |ister contains t|
00001b60  68 65 20 4d 53 42 20 6f  66 0d 74 68 69 73 20 61  |he MSB of.this a|
00001b70  64 64 72 65 73 73 2e 0d  0d 54 68 65 20 70 61 72  |ddress...The par|
00001b80  61 6d 65 74 65 72 20 62  6c 6f 63 6b 20 76 61 72  |ameter block var|
00001b90  69 65 73 20 69 6e 20 73  69 7a 65 20 64 65 70 65  |ies in size depe|
00001ba0  6e 64 69 6e 67 20 6f 6e  20 74 68 65 20 4f 53 57  |nding on the OSW|
00001bb0  4f 52 44 0d 63 61 6c 6c  20 61 6e 64 20 69 6e 20  |ORD.call and in |
00001bc0  6d 61 6e 79 20 63 61 73  65 73 2c 20 6c 69 6b 65  |many cases, like|
00001bd0  20 77 69 74 68 20 74 68  65 20 74 65 6c 65 74 65  | with the telete|
00001be0  78 74 20 4f 53 57 4f 52  44 20 63 61 6c 6c 2c 0d  |xt OSWORD call,.|
00001bf0  74 68 65 20 62 79 74 65  20 68 65 6c 64 20 61 74  |the byte held at|
00001c00  20 74 68 65 20 73 74 61  72 74 20 6f 66 20 74 68  | the start of th|
00001c10  65 20 62 6c 6f 63 6b 20  73 65 6c 65 63 74 73 20  |e block selects |
00001c20  64 69 66 66 65 72 65 6e  74 0d 6f 70 65 72 61 74  |different.operat|
00001c30  69 6f 6e 73 20 77 69 74  68 69 6e 20 74 68 65 20  |ions within the |
00001c40  6f 6e 65 20 4f 53 57 4f  52 44 20 63 61 6c 6c 2e  |one OSWORD call.|
00001c50  0d 0d 4c 65 74 27 73 20  6c 6f 6f 6b 20 61 74 20  |..Let's look at |
00001c60  74 68 65 20 53 4f 55 4e  44 20 63 61 6c 6c 2c 20  |the SOUND call, |
00001c70  4f 53 57 4f 52 44 20 37  2e 20 20 54 68 65 20 70  |OSWORD 7.  The p|
00001c80  61 72 61 6d 65 74 65 72  20 62 6c 6f 63 6b 0d 66  |arameter block.f|
00001c90  6f 72 20 74 68 69 73 20  69 73 20 61 73 20 66 6f  |or this is as fo|
00001ca0  6c 6c 6f 77 73 3a 0d 0d  6f 73 77 6f 72 64 5f 62  |llows:..osword_b|
00001cb0  6c 6f 63 6b 20 2b 20 30  20 20 4c 53 42 20 6f 66  |lock + 0  LSB of|
00001cc0  20 74 68 65 20 63 68 61  6e 6e 65 6c 20 6e 75 6d  | the channel num|
00001cd0  62 65 72 0d 6f 73 77 6f  72 64 5f 62 6c 6f 63 6b  |ber.osword_block|
00001ce0  20 2b 20 31 20 20 4d 53  42 20 6f 66 20 74 68 65  | + 1  MSB of the|
00001cf0  20 63 68 61 6e 6e 65 6c  20 6e 75 6d 62 65 72 0d  | channel number.|
00001d00  6f 73 77 6f 72 64 5f 62  6c 6f 63 6b 20 2b 20 32  |osword_block + 2|
00001d10  20 20 4c 53 42 20 6f 66  20 74 68 65 20 61 6d 70  |  LSB of the amp|
00001d20  6c 69 74 75 64 65 2f 65  6e 76 65 6c 6f 70 65 20  |litude/envelope |
00001d30  6e 75 6d 62 65 72 0d 6f  73 77 6f 72 64 5f 62 6c  |number.osword_bl|
00001d40  6f 63 6b 20 2b 20 33 20  20 4d 53 42 20 6f 66 20  |ock + 3  MSB of |
00001d50  74 68 65 20 61 6d 70 6c  69 74 75 64 65 2f 65 6e  |the amplitude/en|
00001d60  76 65 6c 6f 70 65 20 6e  75 6d 62 65 72 0d 6f 73  |velope number.os|
00001d70  77 6f 72 64 5f 62 6c 6f  63 6b 20 2b 20 34 20 20  |word_block + 4  |
00001d80  4c 53 42 20 6f 66 20 74  68 65 20 70 69 74 63 68  |LSB of the pitch|
00001d90  0d 6f 73 77 6f 72 64 5f  62 6c 6f 63 6b 20 2b 20  |.osword_block + |
00001da0  35 20 20 4d 53 42 20 6f  66 20 74 68 65 20 70 69  |5  MSB of the pi|
00001db0  74 63 68 0d 6f 73 77 6f  72 64 5f 62 6c 6f 63 6b  |tch.osword_block|
00001dc0  20 2b 20 36 20 20 4c 53  42 20 6f 66 20 74 68 65  | + 6  LSB of the|
00001dd0  20 64 75 72 61 74 69 6f  6e 0d 6f 73 77 6f 72 64  | duration.osword|
00001de0  5f 62 6c 6f 63 6b 20 2b  20 37 20 20 4d 53 42 20  |_block + 7  MSB |
00001df0  6f 66 20 74 68 65 20 64  75 72 61 74 69 6f 6e 0d  |of the duration.|
00001e00  0d 49 6e 20 66 61 63 74  20 74 68 65 20 73 74 72  |.In fact the str|
00001e10  75 63 74 75 72 65 20 65  78 61 63 74 6c 79 20 66  |ucture exactly f|
00001e20  6f 6c 6c 6f 77 73 20 74  68 65 20 42 41 53 49 43  |ollows the BASIC|
00001e30  20 53 4f 55 4e 44 0d 63  6f 6d 6d 61 6e 64 2e 20  | SOUND.command. |
00001e40  20 54 68 65 20 70 72 6f  67 72 61 6d 20 42 2f 6f  | The program B/o|
00001e50  73 62 30 35 20 69 6e 20  74 68 69 73 20 77 65 65  |sb05 in this wee|
00001e60  6b 27 73 20 74 65 6c 65  73 6f 66 74 77 61 72 65  |k's telesoftware|
00001e70  0d 74 72 61 6e 73 6d 69  73 73 69 6f 6e 20 69 73  |.transmission is|
00001e80  20 61 20 70 72 6f 67 72  61 6d 20 74 68 61 74 20  | a program that |
00001e90  74 61 6b 65 73 20 74 68  65 20 69 6e 74 65 72 6e  |takes the intern|
00001ea0  61 6c 20 76 61 6c 75 65  20 6f 66 20 61 0d 6b 65  |al value of a.ke|
00001eb0  79 20 70 75 73 68 65 64  20 28 74 68 65 20 62 61  |y pushed (the ba|
00001ec0  73 69 73 20 66 6f 72 20  69 74 73 20 76 61 6c 75  |sis for its valu|
00001ed0  65 20 66 6f 72 20 2d 49  4e 4b 45 59 29 20 61 6e  |e for -INKEY) an|
00001ee0  64 20 75 73 65 73 20 69  74 0d 74 6f 20 73 65 6c  |d uses it.to sel|
00001ef0  65 63 74 20 74 68 65 20  70 69 74 63 68 20 6f 66  |ect the pitch of|
00001f00  20 61 20 6e 6f 74 65 20  74 68 61 74 20 69 73 20  | a note that is |
00001f10  74 68 65 6e 20 70 6c 61  79 65 64 2e 20 20 49 74  |then played.  It|
00001f20  27 73 20 6e 6f 74 0d 70  61 72 74 69 63 75 6c 61  |'s not.particula|
00001f30  72 6c 79 20 61 6d 61 7a  69 6e 67 20 62 75 74 20  |rly amazing but |
00001f40  69 74 20 77 69 6c 6c 20  73 68 6f 77 20 79 6f 75  |it will show you|
00001f50  20 68 6f 77 20 74 68 65  20 4f 53 42 59 54 45 20  | how the OSBYTE |
00001f60  61 6e 64 0d 4f 53 57 4f  52 44 20 63 61 6c 6c 73  |and.OSWORD calls|
00001f70  20 61 72 65 20 73 65 74  20 6f 75 74 20 69 6e 20  | are set out in |
00001f80  61 73 73 65 6d 62 6c 65  72 2e 0d 0d 49 20 68 61  |assembler...I ha|
00001f90  76 65 20 75 73 65 64 20  4f 53 42 59 54 45 20 31  |ve used OSBYTE 1|
00001fa0  32 31 20 77 68 69 63 68  20 73 63 61 6e 73 20 74  |21 which scans t|
00001fb0  68 65 20 6b 65 79 62 6f  61 72 64 20 75 70 77 61  |he keyboard upwa|
00001fc0  72 64 73 20 66 72 6f 6d  0d 74 68 65 20 69 6e 74  |rds from.the int|
00001fd0  65 72 6e 61 6c 20 6b 65  79 20 6e 75 6d 62 65 72  |ernal key number|
00001fe0  20 68 65 6c 64 20 69 6e  20 58 2e 20 20 54 68 65  | held in X.  The|
00001ff0  20 69 6e 74 65 72 6e 61  6c 20 6b 65 79 20 6e 75  | internal key nu|
00002000  6d 62 65 72 0d 69 73 20  74 68 65 20 49 4e 4b 45  |mber.is the INKE|
00002010  59 20 6e 75 6d 62 65 72  20 6f 66 20 74 68 65 20  |Y number of the |
00002020  6b 65 79 20 77 69 74 68  20 61 6c 6c 20 69 74 73  |key with all its|
00002030  20 62 69 74 73 20 72 65  76 65 72 73 65 64 2e 20  | bits reversed. |
00002040  0d 54 68 65 20 70 6f 73  68 20 74 68 69 6e 67 20  |.The posh thing |
00002050  74 6f 20 73 61 79 20 69  73 20 74 68 61 74 20 69  |to say is that i|
00002060  73 20 68 61 73 20 62 65  65 6e 20 45 4f 52 64 20  |s has been EORd |
00002070  77 69 74 68 20 26 46 46  2e 20 0d 4d 6f 72 65 20  |with &FF. .More |
00002080  6f 6e 20 45 4f 52 20 69  6e 20 61 6e 6f 74 68 65  |on EOR in anothe|
00002090  72 20 6d 6f 64 75 6c 65  2e 20 20 49 20 68 61 76  |r module.  I hav|
000020a0  65 20 73 74 61 72 74 65  64 20 6d 79 20 73 63 61  |e started my sca|
000020b0  6e 20 66 72 6f 6d 0d 31  36 20 75 70 77 61 72 64  |n from.16 upward|
000020c0  73 20 77 68 69 63 68 20  6d 65 61 6e 73 20 49 20  |s which means I |
000020d0  61 76 6f 69 64 20 61 6e  79 20 70 72 6f 62 6c 65  |avoid any proble|
000020e0  6d 73 20 63 61 75 73 65  64 20 62 79 20 68 61 76  |ms caused by hav|
000020f0  69 6e 67 0d 6b 65 79 62  6f 61 72 64 20 6c 69 6e  |ing.keyboard lin|
00002100  6b 73 20 73 65 74 2e 20  20 49 6e 20 66 61 63 74  |ks set.  In fact|
00002110  20 4f 53 42 59 54 45 20  31 32 32 20 64 6f 65 73  | OSBYTE 122 does|
00002120  20 65 78 61 63 74 6c 79  20 74 68 69 73 0d 62 75  | exactly this.bu|
00002130  74 20 75 73 69 6e 67 20  69 74 20 77 6f 75 6c 64  |t using it would|
00002140  20 6e 6f 74 20 69 6c 6c  75 73 74 72 61 74 65 20  | not illustrate |
00002150  74 68 65 20 4f 53 42 59  54 45 20 73 65 74 74 69  |the OSBYTE setti|
00002160  6e 67 20 75 70 20 61 73  0d 6d 75 63 68 2e 20 20  |ng up as.much.  |
00002170  49 6e 20 66 61 63 74 20  49 20 68 61 76 65 20 6e  |In fact I have n|
00002180  6f 74 20 75 73 65 64 20  74 68 65 20 59 20 72 65  |ot used the Y re|
00002190  67 69 73 74 65 72 20 69  6e 20 74 68 65 73 65 0d  |gister in these.|
000021a0  4f 53 42 59 54 45 73 20  62 75 74 20 79 6f 75 20  |OSBYTEs but you |
000021b0  77 6f 75 6c 64 20 4c 44  59 20 77 69 74 68 20 77  |would LDY with w|
000021c0  68 61 74 65 76 65 72 20  76 61 6c 75 65 20 79 6f  |hatever value yo|
000021d0  75 20 77 61 6e 74 65 64  0d 62 65 66 6f 72 65 20  |u wanted.before |
000021e0  74 68 65 20 4a 53 52 2e  20 20 59 20 72 65 67 69  |the JSR.  Y regi|
000021f0  73 74 65 72 20 75 73 65  20 69 6e 20 4f 53 42 59  |ster use in OSBY|
00002200  54 45 53 20 69 73 20 6e  6f 74 20 61 73 20 63 6f  |TES is not as co|
00002210  6d 6d 6f 6e 0d 61 73 20  58 20 72 65 67 69 73 74  |mmon.as X regist|
00002220  65 72 20 75 73 65 2e 0d  0d 46 6f 72 20 6d 6f 72  |er use...For mor|
00002230  65 20 64 65 74 61 69 6c  65 64 20 69 6e 66 6f 72  |e detailed infor|
00002240  6d 61 74 69 6f 6e 20 6f  6e 20 4f 53 57 4f 52 44  |mation on OSWORD|
00002250  20 61 6e 64 20 4f 53 42  59 54 45 20 63 61 6c 6c  | and OSBYTE call|
00002260  73 20 49 0d 72 65 63 6f  6d 6d 65 6e 64 20 79 6f  |s I.recommend yo|
00002270  75 20 63 6f 6e 73 75 6c  74 20 74 68 65 20 61 64  |u consult the ad|
00002280  76 61 6e 63 65 64 20 75  73 65 72 20 6f 72 20 72  |vanced user or r|
00002290  65 66 65 72 65 6e 63 65  20 67 75 69 64 65 0d 66  |eference guide.f|
000022a0  6f 72 20 79 6f 75 72 20  70 61 72 74 69 63 75 6c  |or your particul|
000022b0  61 72 20 6d 61 63 68 69  6e 65 2e 0d 0d 50 6f 69  |ar machine...Poi|
000022c0  6e 74 73 20 74 6f 20 6e  6f 74 65 20 69 6e 20 42  |nts to note in B|
000022d0  2f 6f 73 62 30 35 20 61  72 65 20 74 68 61 74 20  |/osb05 are that |
000022e0  74 68 65 20 72 6f 75 74  69 6e 65 20 6c 6f 6f 70  |the routine loop|
000022f0  73 0d 63 6f 6e 74 69 6e  75 6f 75 73 6c 79 2c 20  |s.continuously, |
00002300  61 6c 62 65 69 74 20 76  69 61 20 42 41 53 49 43  |albeit via BASIC|
00002310  20 74 6f 20 6d 61 6b 65  20 69 74 20 65 61 73 79  | to make it easy|
00002320  20 74 6f 20 45 53 43 41  50 45 20 6f 75 74 0d 6f  | to ESCAPE out.o|
00002330  66 20 69 74 2e 20 20 49  66 20 6e 6f 20 6b 65 79  |f it.  If no key|
00002340  20 69 73 20 70 72 65 73  73 65 64 2c 20 69 2e 65  | is pressed, i.e|
00002350  2e 20 26 46 46 20 69 73  20 72 65 74 75 72 6e 65  |. &FF is returne|
00002360  64 20 69 6e 20 58 2c 0d  74 68 65 6e 20 74 68 65  |d in X,.then the|
00002370  20 53 4f 55 4e 44 20 73  65 63 74 69 6f 6e 20 6f  | SOUND section o|
00002380  66 20 74 68 65 20 63 6f  64 65 20 69 73 20 73 6b  |f the code is sk|
00002390  69 70 70 65 64 2e 20 41  6c 73 6f 20 74 68 65 0d  |ipped. Also the.|
000023a0  73 6f 75 6e 64 20 62 75  66 66 65 72 20 69 73 20  |sound buffer is |
000023b0  66 6c 75 73 68 65 64 20  75 73 69 6e 67 20 4f 53  |flushed using OS|
000023c0  42 59 54 45 20 32 31 20  77 68 65 6e 20 6e 6f 20  |BYTE 21 when no |
000023d0  6b 65 79 20 69 73 0d 70  72 65 73 73 65 64 2c 20  |key is.pressed, |
000023e0  77 68 69 63 68 20 63 75  74 73 20 6f 66 66 20 74  |which cuts off t|
000023f0  68 65 20 6e 6f 74 65 20  77 68 65 6e 20 79 6f 75  |he note when you|
00002400  20 6c 69 66 74 20 79 6f  75 72 20 66 69 6e 67 65  | lift your finge|
00002410  72 0d 66 72 6f 6d 20 74  68 65 20 6b 65 79 2e 20  |r.from the key. |
00002420  20 49 6e 20 6c 69 6e 65  20 34 34 30 20 6e 6f 74  | In line 440 not|
00002430  65 20 74 68 61 74 20 55  4e 54 49 4c 30 20 6d 65  |e that UNTIL0 me|
00002440  61 6e 73 20 65 78 61 63  74 6c 79 0d 74 68 65 20  |ans exactly.the |
00002450  73 61 6d 65 20 61 73 20  55 4e 54 49 4c 20 46 41  |same as UNTIL FA|
00002460  4c 53 45 20 73 69 6e 63  65 20 74 68 65 20 76 61  |LSE since the va|
00002470  6c 75 65 20 6f 66 20 46  41 4c 53 45 20 69 73 20  |lue of FALSE is |
00002480  30 20 69 6e 20 42 42 43  0d 42 41 53 49 43 2e 0d  |0 in BBC.BASIC..|
00002490  0d 54 6f 20 72 65 63 61  70 20 6f 6e 20 61 64 64  |.To recap on add|
000024a0  72 65 73 73 69 6e 67 20  6d 6f 64 65 73 2c 20 79  |ressing modes, y|
000024b0  6f 75 20 77 69 6c 6c 20  73 65 65 20 69 6e 20 6c  |ou will see in l|
000024c0  69 6e 65 73 20 6c 69 6b  65 20 31 34 30 0d 61 6e  |ines like 140.an|
000024d0  64 20 31 35 30 20 74 68  61 74 20 74 68 65 20 6e  |d 150 that the n|
000024e0  75 6d 62 65 72 20 69 73  20 70 72 65 63 65 64 65  |umber is precede|
000024f0  64 20 62 79 20 61 20 68  61 73 68 20 28 23 29 20  |d by a hash (#) |
00002500  77 68 69 63 68 0d 74 65  6c 6c 73 20 74 68 65 20  |which.tells the |
00002510  61 73 73 65 6d 62 6c 65  72 20 74 68 61 74 20 74  |assembler that t|
00002520  68 65 20 61 63 74 75 61  6c 20 6e 75 6d 62 65 72  |he actual number|
00002530  20 66 6f 6c 6c 6f 77 69  6e 67 20 69 73 20 74 6f  | following is to|
00002540  0d 62 65 20 75 73 65 64  2e 20 20 57 69 74 68 6f  |.be used.  Witho|
00002550  75 74 20 74 68 65 20 68  61 73 68 20 74 68 65 20  |ut the hash the |
00002560  61 73 73 65 6d 62 6c 65  72 20 74 72 65 61 74 73  |assembler treats|
00002570  20 74 68 65 0d 66 6f 6c  6c 6f 77 69 6e 67 20 6e  | the.following n|
00002580  75 6d 62 65 72 20 61 73  20 61 6e 20 61 64 64 72  |umber as an addr|
00002590  65 73 73 20 61 6e 64 20  72 65 61 64 73 20 66 72  |ess and reads fr|
000025a0  6f 6d 20 74 68 61 74 2e  20 20 49 74 27 73 20 61  |om that.  It's a|
000025b0  0d 63 6f 6d 6d 6f 6e 20  6d 69 73 74 61 6b 65 20  |.common mistake |
000025c0  74 6f 20 66 6f 72 67 65  74 20 74 68 65 20 68 61  |to forget the ha|
000025d0  73 68 20 77 68 65 6e 20  79 6f 75 20 69 6e 74 65  |sh when you inte|
000025e0  6e 64 20 69 6d 6d 65 64  69 61 74 65 0d 61 64 64  |nd immediate.add|
000025f0  72 65 73 73 69 6e 67 20  28 61 73 20 74 68 69 73  |ressing (as this|
00002600  20 69 73 20 63 61 6c 6c  65 64 29 2e 0d 0d 49 66  | is called)...If|
00002610  20 79 6f 75 20 68 61 76  65 20 42 41 53 49 43 32  | you have BASIC2|
00002620  20 6f 72 20 6c 61 74 65  72 20 79 6f 75 20 63 61  | or later you ca|
00002630  6e 20 72 65 70 6c 61 63  65 20 65 61 63 68 20 6f  |n replace each o|
00002640  63 63 75 72 72 65 6e 63  65 0d 6f 66 20 4f 50 54  |ccurrence.of OPT|
00002650  20 46 4e 45 51 55 57 28  6e 75 6d 62 65 72 29 20  | FNEQUW(number) |
00002660  77 69 74 68 20 45 51 55  57 20 6e 75 6d 62 65 72  |with EQUW number|
00002670  20 61 6e 64 20 79 6f 75  20 63 61 6e 2c 20 6f 66  | and you can, of|
00002680  0d 63 6f 75 72 73 65 2c  20 61 6c 73 6f 20 64 72  |.course, also dr|
00002690  6f 70 20 74 68 65 20 66  75 6e 63 74 69 6f 6e 20  |op the function |
000026a0  64 65 66 69 6e 69 74 69  6f 6e 20 66 72 6f 6d 20  |definition from |
000026b0  74 68 65 20 65 6e 64 20  6f 66 0d 74 68 65 20 70  |the end of.the p|
000026c0  72 6f 67 72 61 6d 2e 0d  0d 49 6e 20 74 68 65 20  |rogram...In the |
000026d0  6e 65 78 74 20 6d 6f 64  75 6c 65 20 77 65 27 6c  |next module we'l|
000026e0  6c 20 6c 6f 6f 6b 20 61  74 20 68 6f 77 20 79 6f  |l look at how yo|
000026f0  75 20 73 68 69 66 74 20  74 68 65 20 62 69 74 73  |u shift the bits|
00002700  20 6f 66 20 61 0d 62 79  74 65 20 61 62 6f 75 74  | of a.byte about|
00002710  20 61 6e 64 20 68 6f 77  20 74 6f 20 75 73 65 20  | and how to use |
00002720  74 68 65 20 73 74 61 63  6b 20 66 6f 72 20 74 65  |the stack for te|
00002730  6d 70 6f 72 61 72 79 20  73 74 6f 72 61 67 65 2e  |mporary storage.|
00002740  20 0d 54 68 65 20 70 72  6f 67 72 61 6d 20 77 69  | .The program wi|
00002750  6c 6c 20 74 61 6b 65 20  61 20 62 79 74 65 20 65  |ll take a byte e|
00002760  6e 74 65 72 65 64 20 61  73 20 61 20 63 68 61 72  |ntered as a char|
00002770  61 63 74 65 72 20 66 72  6f 6d 20 74 68 65 0d 6b  |acter from the.k|
00002780  65 79 62 6f 61 72 64 20  61 6e 64 20 70 72 69 6e  |eyboard and prin|
00002790  74 20 69 74 73 20 76 61  6c 75 65 20 69 6e 20 62  |t its value in b|
000027a0  69 6e 61 72 79 2c 20 68  65 78 61 64 65 63 69 6d  |inary, hexadecim|
000027b0  61 6c 20 61 6e 64 0d 64  65 63 69 6d 61 6c 2e 0d  |al and.decimal..|
000027c0
21_11_87/T\OSB05.m0
21_11_87/T\OSB05.m1
21_11_87/T\OSB05.m2
21_11_87/T\OSB05.m4
21_11_87/T\OSB05.m5