Home » CEEFAX disks » telesoftware10.adl » 18-11-88/T\MOU00

18-11-88/T\MOU00

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 » telesoftware10.adl
Filename: 18-11-88/T\MOU00
Read OK:
File size: 43F1 bytes
Load address: 0000
Exec address: 0000
File contents
Using a mouse with the BBC microcomputer - by - Gordon Horsington
-----------------------------------------------------------------

Module 0. Introduction
----------------------

An AMX compatible mouse can be used with the BBC B, BBC B+ and Master
series computers. This module introduces a block of seven modules which
deal with the design of software which will allow a mouse to be used
without its manufacturers control ROM or any other alternative software. A
mouse can be bought without a control ROM and, if you don't want to use
the art software that these ROMs contain, then buying just the hardware
halves the cost of owning a mouse. I hope to demonstrate that the software
you can easily create yourself can be just as useful as the software that
the manufacturers supply.

The seven modules are in files named T/MOU00 to T/MOU06. The following
topics will be covered in these modules.


Module 0. This module. Introduction and the User Port.
          Program: TESTMOU

Module 1. Reading the mouse coordinates.
          Program: MOUSE

Module 2. Tube compatible mouse software.
          Program: SPMOUSE

Module 3. Polling the mouse buttons.
          Programs: EVENT BUTTONS

Module 4. Reading a mouse with the negative INKEY and the keyboard scan.
          Programs: NEWKEYS LOADER NEWSCAN

Module 5. Reading a mouse with the BASIC ADVAL command.
          Program: ANMOUSE

Module 6. Using Sideways RAM for mouse software.
          Programs: SWMOUSE SWRMICE SWTEST

The later modules develop the ideas and techniques described in the
earlier modules and for this reason they need to be worked through from
module 0 to module 6 rather than used as a reference guide. It is
necessary to have either BASIC 2 or BASIC 4 and operating system 1.20 (or
higher) installed in your computer.


The User Port
-------------

There are two 6522 VIAs in the BBC B. VIA-A is used for internal functions
and the joystick fire buttons and is usually called the system VIA. VIA-B
provides the parallel printer interface and the User Port. An AMX
compatible mouse is connected to the User Port.

The 6522 VIA is quite a complex device controled by 16 registers. The
VIA-B registers are mapped onto Sheila addresses &60 to &6F (ie. &FE60 to
&FE6F) as shown in figure 1.



        Address             Description                Designation
       +-------+-------------------------------------+-------------+
       | &FE6F | Data register A (no handshake)      | DRA         |
       +-------+-------------------------------------+-------------+
       | &FE6E | Interrupt enable register           | IER         |
       +-------+-------------------------------------+-------------+
       | &FE6D | Interrupt flag register             | IFR         |
       +-------+-------------------------------------+-------------+
       | &FE6C | Peripheral control register         | PCR         |
       +-------+-------------------------------------+-------------+
       | &FE6B | Auxiliary control register          | ACR         |
       +-------+-------------------------------------+-------------+
       | &FE6A | Shift register                      | SR          |
       +-------+-------------------------------------+-------------+
       | &FE69 | Timer 2 initiate count              | T2CH        |
       +-------+-------------------------------------+-------------+
       | &FE68 | Timer 2 write latch, read counter   | T2CL        |
       +-------+-------------------------------------+-------------+
       | &FE67 | Timer 1 load latch, high byte       | T1LH        |
       +-------+-------------------------------------+-------------+
       | &FE66 | Timer 1 load latch, low byte        | T1LL        |
       +-------+-------------------------------------+-------------+
       | &FE65 | Timer 1 initiate count              | T1CH        |
       +-------+-------------------------------------+-------------+
       | &FE64 | Timer 1 write latch, read counter   | T1CL        |
       +-------+-------------------------------------+-------------+
       | &FE63 | Data direction register A           | DDRA        |
       +-------+-------------------------------------+-------------+
       | &FE62 | Data direction register B           | DDRB        |
       +-------+-------------------------------------+-------------+
       | &FE61 | Data register A                     | DRA         |
       +-------+-------------------------------------+-------------+
       | &FE60 | Data register B                     | DRB         |
       +-------+-------------------------------------+-------------+

Figure 1  The VIA-B registers
--------  -------------------


Five of these 16 registers are of interest when using a mouse. They
are data register B (DRB, &FE60), data direction register B (DDRB, &FE62),
the peripheral control register (PCR, &FE6C), the interrupt flag register
(IFR, &FE6D), and the interrupt enable register (IER, &FE6E). The
auxillary control register (ACR, &FE6B) is also of passing interest.

Both the system VIA and the user VIA have 20 I/O lines grouped into an A
side and a B side of 10 lines each. These 10 lines are divided into 8 data
lines and 2 handshake lines. The data lines are called PA0 to PA7 on the A
side and PB0 to PB7 on the B side. Data lines PA0 to PA7 can be read from
or written to data register A (&FE61) and data lines PB0 to PB7 can be
read from or written to data register B (&FE60). The B side of VIA-B is
known as the User Port and PB0 to PB7 are the User Port data lines. The
handshake lines are called CA1 and CA2 on the A side and CB1 and CB2 on
the B side. CB1 and CB2 are the User Port handshake lines.

The User Port data register, DRB, can be made an input register by writing
the number zero into DDRB. Clearing a bit in DDRB makes the eqivalent bit
in DRB an input. Setting a bit in DDRB makes the equivalent bit in DRB an
output.

The peripheral control register is used to control the use of the
handshake lines. The VIA-B PCR and the interpretation of its bits is shown
in figure 2.



bit 7       6       5         4         3       2       1         0
+-------+-------+-------+-----------+-------+-------+-------+-----------+
|      CB2 control      |CB1 control|      CA2 Control      |CA1 control|
|       User Port       | User Port |    Printer strobe     |Printer ack|
+-------+-------+-------+-----------+-------+-------+-------+-----------+


 Bit  Interpretation if bit clear (0)   Interpretation if bit set (1)
+---+---------------------------------+---------------------------------+
| 0 |Set bit 1 of IFR on -ve going CA1|Set bit 1 of IFR on +ve going CA1|
+---+---------------------------------+---------------------------------+
| 1 | DRA selected to clear interrupt | Interrupt not cleared by DRA    |
+---+---------------------------------+---------------------------------+
| 2 |Set bit 0 of IFR on -ve going CA2|Set bit 0 of IFR on +ve going CA2|
+---+---------------------------------+---------------------------------+
| 3 | Bit 3 always set                | Set CA2 to output (always set)  |
+---+---------------------------------+---------------------------------+
| 4 |Set bit 4 of IFR on -ve going CB1|Set bit 4 of IFR on +ve going CB1|
+---+---------------------------------+---------------------------------+
| 5 | DRB selected to clear interrupt | Interrupt not cleared by DRB    |
+---+---------------------------------+---------------------------------+
| 6 |Set bit 3 of IFR on -ve going CB2|Set bit 3 of IFR on +ve going CB2|
+---+---------------------------------+---------------------------------+
| 7 | Set CB2 to input mode           | Set CB2 to output mode          |
+---+---------------------------------+---------------------------------+

Figure 2  The peripheral control register
--------  -------------------------------


Both CB1 and CB2 are used as inputs by an AMX compatible mouse. When using
interrupt driven mouse software you will need to set bits 4 and 6 and
clear bits 5 and 7 of the PCR. This means that a positive going signal on
either CB1 or CB2 will generate an IQR interrupt and that interrupt will
be cleared by reading data register B, ie. by reading the data lines. Bit
7 of the PCR is clear to make CB2 an input, CB1 is an input line by
default. A program which alters bits 4 to 7 of the PCR must not alter bits
0 to 3 which are used by the parallel printer interface. The following
code can be used to set bits 4 and 6 and clear bits 5 and 7 of the PCR:


  LDA &FE6C  \ load A with the contents of the peripheral control register
  AND #&0F   \ AND with %00001111, ie. clear bit 4-7
  ORA #&50   \ OR with %01010000, ie. set bits 4 and 6
  STA &FE6C  \ store A in the peripheral control register


Mouse generated interrupts are enabled by setting bits 3 and 4 of the
interrupt enable register. Setting these bits uses an odd method. To alter
a bit in the IER you must write a number to the IER with a 1 in the same
bit position. If bit 7 of the number is set then the selected bit (or
bits) will also be set to 1. If bit 7 of the number is clear then the
selected bit (or bits) will be cleared. The selected bits (0 to 6) are set
to the same state as bit 7. To set bits 3 and 4 of the IER you have to
write the number &98 (%10011000) into the IER. Bits 3 and 4 will then take
the value of bit 7 and will be set, enabling interrupts from CB1 and CB2.

When bits 3 and 4 of the IER are set then a positive transition on CB1
will set bit 4 of the interrupt flag register and generate an IRQ
interrupt. A positive transition on CB2 will set bit 3 of the IFR and
generate an IQR interrupt. These interrupts can be recognised because
either bits 7 and 3 of IFR or bits 7 and 4 of the IFR will be set.

Mouse generated interrupts are disabled by writing the number &08
(%00011000) into the IER. This clears bits 3 and 4 of the IER so that a
positive going transition on CB1 or CB2 will still set either bit 4 or bit
3 of the IFR but it will not generate an IRQ interrupt. Mouse generated
interrupts can be enabled with ?&FE6E=&98 or *FX 151,78,152 and disabled
with ?&FE6E=&18 or *FX 151,78,24

The interrupt enable register and the interrupt flag register work as a
pair and the flag register must be interrogated by a program to see if a
mouse connected to the User Port is the source of an interrupt. The
interpretation of the bits in the IFR is tabulated in figure 3 which shows
that bits 7 and 3 or 7 and 4 of the IFR will be set if a mouse connected
to the User Port is the source of an interrupt.



             7       6     5     4     3     2     1     0
        +---------+-----+-----+-----+-----+-----+-----+-----+
  &FE6E |Set/Clear| T1  | T2  | CB1 | CB2 | SR  | CA1 | CA2 | IER
        +---------+-----+-----+-----+-----+-----+-----+-----+
  &FE6D |   IRQ   | T1  | T2  | CB1 | CB2 | SR  | CA1 | CA2 | IFR
        +---------+-----+-----+-----+-----+-----+-----+-----+



 Bit   Cause of interrupt        Interpretation
+---+-------------------------+-----------------------------------------+
| 0 | Change of signal on CA2 | Printer strobe                          |
+---+-------------------------+-----------------------------------------+
| 1 | Change of signal on CA1 | Printer acknowledge                     |
+---+-------------------------+-----------------------------------------+
| 2 | Completion of 8 shifts  |                                         |
|   | in the shift register   |                                         |
+---+-------------------------+-----------------------------------------+
| 3 | Change of signal on CB2 | Mouse movement in the Y direction       |
+---+-------------------------+-----------------------------------------+
| 4 | Change of signal on CB1 | Mouse movement in the X direction       |
+---+-------------------------+-----------------------------------------+
| 5 | Timer 2 complete        |                                         |
+---+-------------------------+-----------------------------------------+
| 6 | Timer 1 complete        |                                         |
+---+-------------------------+-----------------------------------------+
| 7 | Any bit, 0 to 6, is set | One of the above interrupts has occured |
+---+-------------------------+-----------------------------------------+

Figure 3. The interpretation of VIA-B IFR (mouse connected to User Port)
--------- --------------------------------------------------------------


An interrupt handling routine should interogate bits 7, 3 and 4 of the IFR
to find out if a mouse connected to the User Port is the source of an IRQ
interrupt. Bits 7 and 3 will be set if the mouse is moved up or down and
bits 7 and 4 will be set if the mouse is moved from side to side. If a
mouse is the source of an interrupt then the interrupt must be cleared by
reading the contents of DRB (because bit 5 of the PCR is clear). You can
therefore read the data lines and clear the interrupt at the same time.

The plane of movement of a mouse can be determined from the IFR but the
direction of change (either increasing or decreasing) has to be found from
the data lines. A movement either up or down will set bit 3 of the IFR. If
bit 3 of the IFR is set your program should test bit 2 of data register B.
If bit 2 of DRB is set then Y is decreasing but if it is clear then Y is
increasing. A movement from side to side will set bit 4 of the IFR. Your
program should then test bit 0 of DRB. If it is set then X is decreasing,
if it is clear then X is increasing.

The data lines also give the status of the mouse buttons. Pressing the
right button clears bit 7 of DRB, pressing the centre button clears bit 6
and the left button clears bit 5.

The auxiliary control register is of passing interest because it can
either set or clear latching the data lines on a signal from CB1. This
would be quite useful if the mouse had been designed to use only one
handshake line but, because it uses both CB1 and CB2 as inputs, the data
lines can only be latched for movement in the X direction. This seems to
be a pity but the AMX design is an industry standard for BBC computers and
we have to live with it. You can clear bit 1 of the ACR to disable
latching the data lines prior to using a mouse. The ACR is cleared by
pressing the Break key.

The status of the IFR and DRB can be demonstrated with the program
TESTMOU. This program does not enable the mouse generated interrupts but
it does show the continuously updated binary status of the IFR and DRB.
Connect your mouse to the computer, switch on, chain the program TESTMOU
and move the mouse around. Bit 7 of the IFR is always clear because
interrupts have not been enabled. Move the mouse quickly to either the
left or right. You should see CB1 set while it is moving and clear as soon
as it stops. Similarly move the mouse quickly up and down to see the same
effect on CB2. At the same time you will see bits 0 and 2 of DRB changing
state. You can also see the effect that pressing the mouse buttons has on
DRB.

This module has explained where to find the data produced by a mouse. The
following modules will explain how these data can be interpreted and used.


   10 REM> TESTMOU
   20 DIM mcode &100 :REM: machine code at mcode
   30 escape=&FF :REM: escape flag
   40 drb=&FE60 :REM: data register B
   50 ddrb=&FE62 :REM: data direction register B
   60 ifr=&FE6D :REM: interrupt flag register
   70 oswrch=&FFEE
   80 osbyte=&FFF4
   90 FOR pass=0 TO 2 STEP 2
  100 P%=mcode
  110 [       OPT pass
  120         LDA #&00
  130         STA ddrb      \ data register B = input
  140 .mainloop
  150         LDX #16
  160         LDY #16
  170         JSR vdu       \ VDU 31,16,16
  180         LDA drb       \ data register B
  190         JSR binary    \ print DRB in binary
  200         LDX #16
  210         LDY #18
  220         JSR vdu       \ VDU 31,16,18
  230         LDA ifr       \ interrupt flag register
  240         JSR binary    \ print IFR in binary
  250         LDA escape    \ poll the escape flag
  260         BPL mainloop  \ loop if escape not pressed
  270         LDA #&7E      \ acknowledge detection of an Escape condition
  280         JMP osbyte    \ acknowledge Escape and return to BASIC
  290 .binary
  300         LDX #&08      \ bit counter
  310 .nextbit
  320         ASL A         \ next bit into carry flag
  330         PHA           \ save the rest of the byte
  340         LDA #ASC("0") \ if carry clear print 0
  350         ADC #&00      \ if carry set add 1
  360         JSR oswrch    \ print 0 or 1
  370         PLA           \ restore the rest of the byte
  380         DEX           \ decrement bit counter
  390         BNE nextbit   \ branch for next bit
  400         RTS
  410 .vdu
  420         LDA #31
  430         JSR oswrch    \ VDU 31
  440         TXA
  450         JSR oswrch    \ VDU X
  460         TYA
  470         JMP oswrch    \ VDU Y and return
  480 ]
  490 NEXT
  500 MODE7
  510 VDU23,1,0;0;0;0;
  520 mouse$=CHR$141+CHR$132+CHR$157+CHR$131
      +"User port input and status bytes  "+CHR$156
  530 PRINTTAB(0,5)mouse$
  540 PRINTTAB(0,6)mouse$
  550 PRINTTAB(16,14)"76543210"
  560 PRINTTAB(9,16)"&FE60 %         DRB"
  570 PRINTTAB(9,18)"&FE6D %         IFR"
  580 PRINTTAB(19,20)"CC"
  590 PRINTTAB(19,21)"BB"
  600 PRINTTAB(19,22)"12"
  610 CALL mcode
  620 VDU31,0,24
  630 VDU23,1,1;0;0;0;
  640 END
00000000  55 73 69 6e 67 20 61 20  6d 6f 75 73 65 20 77 69  |Using a mouse wi|
00000010  74 68 20 74 68 65 20 42  42 43 20 6d 69 63 72 6f  |th the BBC micro|
00000020  63 6f 6d 70 75 74 65 72  20 2d 20 62 79 20 2d 20  |computer - by - |
00000030  47 6f 72 64 6f 6e 20 48  6f 72 73 69 6e 67 74 6f  |Gordon Horsingto|
00000040  6e 0d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |n.--------------|
00000050  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000080  2d 2d 2d 0d 0d 4d 6f 64  75 6c 65 20 30 2e 20 49  |---..Module 0. I|
00000090  6e 74 72 6f 64 75 63 74  69 6f 6e 0d 2d 2d 2d 2d  |ntroduction.----|
000000a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000000b0  2d 2d 0d 0d 41 6e 20 41  4d 58 20 63 6f 6d 70 61  |--..An AMX compa|
000000c0  74 69 62 6c 65 20 6d 6f  75 73 65 20 63 61 6e 20  |tible mouse can |
000000d0  62 65 20 75 73 65 64 20  77 69 74 68 20 74 68 65  |be used with the|
000000e0  20 42 42 43 20 42 2c 20  42 42 43 20 42 2b 20 61  | BBC B, BBC B+ a|
000000f0  6e 64 20 4d 61 73 74 65  72 0d 73 65 72 69 65 73  |nd Master.series|
00000100  20 63 6f 6d 70 75 74 65  72 73 2e 20 54 68 69 73  | computers. This|
00000110  20 6d 6f 64 75 6c 65 20  69 6e 74 72 6f 64 75 63  | module introduc|
00000120  65 73 20 61 20 62 6c 6f  63 6b 20 6f 66 20 73 65  |es a block of se|
00000130  76 65 6e 20 6d 6f 64 75  6c 65 73 20 77 68 69 63  |ven modules whic|
00000140  68 0d 64 65 61 6c 20 77  69 74 68 20 74 68 65 20  |h.deal with the |
00000150  64 65 73 69 67 6e 20 6f  66 20 73 6f 66 74 77 61  |design of softwa|
00000160  72 65 20 77 68 69 63 68  20 77 69 6c 6c 20 61 6c  |re which will al|
00000170  6c 6f 77 20 61 20 6d 6f  75 73 65 20 74 6f 20 62  |low a mouse to b|
00000180  65 20 75 73 65 64 0d 77  69 74 68 6f 75 74 20 69  |e used.without i|
00000190  74 73 20 6d 61 6e 75 66  61 63 74 75 72 65 72 73  |ts manufacturers|
000001a0  20 63 6f 6e 74 72 6f 6c  20 52 4f 4d 20 6f 72 20  | control ROM or |
000001b0  61 6e 79 20 6f 74 68 65  72 20 61 6c 74 65 72 6e  |any other altern|
000001c0  61 74 69 76 65 20 73 6f  66 74 77 61 72 65 2e 20  |ative software. |
000001d0  41 0d 6d 6f 75 73 65 20  63 61 6e 20 62 65 20 62  |A.mouse can be b|
000001e0  6f 75 67 68 74 20 77 69  74 68 6f 75 74 20 61 20  |ought without a |
000001f0  63 6f 6e 74 72 6f 6c 20  52 4f 4d 20 61 6e 64 2c  |control ROM and,|
00000200  20 69 66 20 79 6f 75 20  64 6f 6e 27 74 20 77 61  | if you don't wa|
00000210  6e 74 20 74 6f 20 75 73  65 0d 74 68 65 20 61 72  |nt to use.the ar|
00000220  74 20 73 6f 66 74 77 61  72 65 20 74 68 61 74 20  |t software that |
00000230  74 68 65 73 65 20 52 4f  4d 73 20 63 6f 6e 74 61  |these ROMs conta|
00000240  69 6e 2c 20 74 68 65 6e  20 62 75 79 69 6e 67 20  |in, then buying |
00000250  6a 75 73 74 20 74 68 65  20 68 61 72 64 77 61 72  |just the hardwar|
00000260  65 0d 68 61 6c 76 65 73  20 74 68 65 20 63 6f 73  |e.halves the cos|
00000270  74 20 6f 66 20 6f 77 6e  69 6e 67 20 61 20 6d 6f  |t of owning a mo|
00000280  75 73 65 2e 20 49 20 68  6f 70 65 20 74 6f 20 64  |use. I hope to d|
00000290  65 6d 6f 6e 73 74 72 61  74 65 20 74 68 61 74 20  |emonstrate that |
000002a0  74 68 65 20 73 6f 66 74  77 61 72 65 0d 79 6f 75  |the software.you|
000002b0  20 63 61 6e 20 65 61 73  69 6c 79 20 63 72 65 61  | can easily crea|
000002c0  74 65 20 79 6f 75 72 73  65 6c 66 20 63 61 6e 20  |te yourself can |
000002d0  62 65 20 6a 75 73 74 20  61 73 20 75 73 65 66 75  |be just as usefu|
000002e0  6c 20 61 73 20 74 68 65  20 73 6f 66 74 77 61 72  |l as the softwar|
000002f0  65 20 74 68 61 74 0d 74  68 65 20 6d 61 6e 75 66  |e that.the manuf|
00000300  61 63 74 75 72 65 72 73  20 73 75 70 70 6c 79 2e  |acturers supply.|
00000310  0d 0d 54 68 65 20 73 65  76 65 6e 20 6d 6f 64 75  |..The seven modu|
00000320  6c 65 73 20 61 72 65 20  69 6e 20 66 69 6c 65 73  |les are in files|
00000330  20 6e 61 6d 65 64 20 54  2f 4d 4f 55 30 30 20 74  | named T/MOU00 t|
00000340  6f 20 54 2f 4d 4f 55 30  36 2e 20 54 68 65 20 66  |o T/MOU06. The f|
00000350  6f 6c 6c 6f 77 69 6e 67  0d 74 6f 70 69 63 73 20  |ollowing.topics |
00000360  77 69 6c 6c 20 62 65 20  63 6f 76 65 72 65 64 20  |will be covered |
00000370  69 6e 20 74 68 65 73 65  20 6d 6f 64 75 6c 65 73  |in these modules|
00000380  2e 0d 0d 0d 4d 6f 64 75  6c 65 20 30 2e 20 54 68  |....Module 0. Th|
00000390  69 73 20 6d 6f 64 75 6c  65 2e 20 49 6e 74 72 6f  |is module. Intro|
000003a0  64 75 63 74 69 6f 6e 20  61 6e 64 20 74 68 65 20  |duction and the |
000003b0  55 73 65 72 20 50 6f 72  74 2e 0d 20 20 20 20 20  |User Port..     |
000003c0  20 20 20 20 20 50 72 6f  67 72 61 6d 3a 20 54 45  |     Program: TE|
000003d0  53 54 4d 4f 55 0d 0d 4d  6f 64 75 6c 65 20 31 2e  |STMOU..Module 1.|
000003e0  20 52 65 61 64 69 6e 67  20 74 68 65 20 6d 6f 75  | Reading the mou|
000003f0  73 65 20 63 6f 6f 72 64  69 6e 61 74 65 73 2e 0d  |se coordinates..|
00000400  20 20 20 20 20 20 20 20  20 20 50 72 6f 67 72 61  |          Progra|
00000410  6d 3a 20 4d 4f 55 53 45  0d 0d 4d 6f 64 75 6c 65  |m: MOUSE..Module|
00000420  20 32 2e 20 54 75 62 65  20 63 6f 6d 70 61 74 69  | 2. Tube compati|
00000430  62 6c 65 20 6d 6f 75 73  65 20 73 6f 66 74 77 61  |ble mouse softwa|
00000440  72 65 2e 0d 20 20 20 20  20 20 20 20 20 20 50 72  |re..          Pr|
00000450  6f 67 72 61 6d 3a 20 53  50 4d 4f 55 53 45 0d 0d  |ogram: SPMOUSE..|
00000460  4d 6f 64 75 6c 65 20 33  2e 20 50 6f 6c 6c 69 6e  |Module 3. Pollin|
00000470  67 20 74 68 65 20 6d 6f  75 73 65 20 62 75 74 74  |g the mouse butt|
00000480  6f 6e 73 2e 0d 20 20 20  20 20 20 20 20 20 20 50  |ons..          P|
00000490  72 6f 67 72 61 6d 73 3a  20 45 56 45 4e 54 20 42  |rograms: EVENT B|
000004a0  55 54 54 4f 4e 53 0d 0d  4d 6f 64 75 6c 65 20 34  |UTTONS..Module 4|
000004b0  2e 20 52 65 61 64 69 6e  67 20 61 20 6d 6f 75 73  |. Reading a mous|
000004c0  65 20 77 69 74 68 20 74  68 65 20 6e 65 67 61 74  |e with the negat|
000004d0  69 76 65 20 49 4e 4b 45  59 20 61 6e 64 20 74 68  |ive INKEY and th|
000004e0  65 20 6b 65 79 62 6f 61  72 64 20 73 63 61 6e 2e  |e keyboard scan.|
000004f0  0d 20 20 20 20 20 20 20  20 20 20 50 72 6f 67 72  |.          Progr|
00000500  61 6d 73 3a 20 4e 45 57  4b 45 59 53 20 4c 4f 41  |ams: NEWKEYS LOA|
00000510  44 45 52 20 4e 45 57 53  43 41 4e 0d 0d 4d 6f 64  |DER NEWSCAN..Mod|
00000520  75 6c 65 20 35 2e 20 52  65 61 64 69 6e 67 20 61  |ule 5. Reading a|
00000530  20 6d 6f 75 73 65 20 77  69 74 68 20 74 68 65 20  | mouse with the |
00000540  42 41 53 49 43 20 41 44  56 41 4c 20 63 6f 6d 6d  |BASIC ADVAL comm|
00000550  61 6e 64 2e 0d 20 20 20  20 20 20 20 20 20 20 50  |and..          P|
00000560  72 6f 67 72 61 6d 3a 20  41 4e 4d 4f 55 53 45 0d  |rogram: ANMOUSE.|
00000570  0d 4d 6f 64 75 6c 65 20  36 2e 20 55 73 69 6e 67  |.Module 6. Using|
00000580  20 53 69 64 65 77 61 79  73 20 52 41 4d 20 66 6f  | Sideways RAM fo|
00000590  72 20 6d 6f 75 73 65 20  73 6f 66 74 77 61 72 65  |r mouse software|
000005a0  2e 0d 20 20 20 20 20 20  20 20 20 20 50 72 6f 67  |..          Prog|
000005b0  72 61 6d 73 3a 20 53 57  4d 4f 55 53 45 20 53 57  |rams: SWMOUSE SW|
000005c0  52 4d 49 43 45 20 53 57  54 45 53 54 0d 0d 54 68  |RMICE SWTEST..Th|
000005d0  65 20 6c 61 74 65 72 20  6d 6f 64 75 6c 65 73 20  |e later modules |
000005e0  64 65 76 65 6c 6f 70 20  74 68 65 20 69 64 65 61  |develop the idea|
000005f0  73 20 61 6e 64 20 74 65  63 68 6e 69 71 75 65 73  |s and techniques|
00000600  20 64 65 73 63 72 69 62  65 64 20 69 6e 20 74 68  | described in th|
00000610  65 0d 65 61 72 6c 69 65  72 20 6d 6f 64 75 6c 65  |e.earlier module|
00000620  73 20 61 6e 64 20 66 6f  72 20 74 68 69 73 20 72  |s and for this r|
00000630  65 61 73 6f 6e 20 74 68  65 79 20 6e 65 65 64 20  |eason they need |
00000640  74 6f 20 62 65 20 77 6f  72 6b 65 64 20 74 68 72  |to be worked thr|
00000650  6f 75 67 68 20 66 72 6f  6d 0d 6d 6f 64 75 6c 65  |ough from.module|
00000660  20 30 20 74 6f 20 6d 6f  64 75 6c 65 20 36 20 72  | 0 to module 6 r|
00000670  61 74 68 65 72 20 74 68  61 6e 20 75 73 65 64 20  |ather than used |
00000680  61 73 20 61 20 72 65 66  65 72 65 6e 63 65 20 67  |as a reference g|
00000690  75 69 64 65 2e 20 49 74  20 69 73 0d 6e 65 63 65  |uide. It is.nece|
000006a0  73 73 61 72 79 20 74 6f  20 68 61 76 65 20 65 69  |ssary to have ei|
000006b0  74 68 65 72 20 42 41 53  49 43 20 32 20 6f 72 20  |ther BASIC 2 or |
000006c0  42 41 53 49 43 20 34 20  61 6e 64 20 6f 70 65 72  |BASIC 4 and oper|
000006d0  61 74 69 6e 67 20 73 79  73 74 65 6d 20 31 2e 32  |ating system 1.2|
000006e0  30 20 28 6f 72 0d 68 69  67 68 65 72 29 20 69 6e  |0 (or.higher) in|
000006f0  73 74 61 6c 6c 65 64 20  69 6e 20 79 6f 75 72 20  |stalled in your |
00000700  63 6f 6d 70 75 74 65 72  2e 0d 0d 0d 54 68 65 20  |computer....The |
00000710  55 73 65 72 20 50 6f 72  74 0d 2d 2d 2d 2d 2d 2d  |User Port.------|
00000720  2d 2d 2d 2d 2d 2d 2d 0d  0d 54 68 65 72 65 20 61  |-------..There a|
00000730  72 65 20 74 77 6f 20 36  35 32 32 20 56 49 41 73  |re two 6522 VIAs|
00000740  20 69 6e 20 74 68 65 20  42 42 43 20 42 2e 20 56  | in the BBC B. V|
00000750  49 41 2d 41 20 69 73 20  75 73 65 64 20 66 6f 72  |IA-A is used for|
00000760  20 69 6e 74 65 72 6e 61  6c 20 66 75 6e 63 74 69  | internal functi|
00000770  6f 6e 73 0d 61 6e 64 20  74 68 65 20 6a 6f 79 73  |ons.and the joys|
00000780  74 69 63 6b 20 66 69 72  65 20 62 75 74 74 6f 6e  |tick fire button|
00000790  73 20 61 6e 64 20 69 73  20 75 73 75 61 6c 6c 79  |s and is usually|
000007a0  20 63 61 6c 6c 65 64 20  74 68 65 20 73 79 73 74  | called the syst|
000007b0  65 6d 20 56 49 41 2e 20  56 49 41 2d 42 0d 70 72  |em VIA. VIA-B.pr|
000007c0  6f 76 69 64 65 73 20 74  68 65 20 70 61 72 61 6c  |ovides the paral|
000007d0  6c 65 6c 20 70 72 69 6e  74 65 72 20 69 6e 74 65  |lel printer inte|
000007e0  72 66 61 63 65 20 61 6e  64 20 74 68 65 20 55 73  |rface and the Us|
000007f0  65 72 20 50 6f 72 74 2e  20 41 6e 20 41 4d 58 0d  |er Port. An AMX.|
00000800  63 6f 6d 70 61 74 69 62  6c 65 20 6d 6f 75 73 65  |compatible mouse|
00000810  20 69 73 20 63 6f 6e 6e  65 63 74 65 64 20 74 6f  | is connected to|
00000820  20 74 68 65 20 55 73 65  72 20 50 6f 72 74 2e 0d  | the User Port..|
00000830  0d 54 68 65 20 36 35 32  32 20 56 49 41 20 69 73  |.The 6522 VIA is|
00000840  20 71 75 69 74 65 20 61  20 63 6f 6d 70 6c 65 78  | quite a complex|
00000850  20 64 65 76 69 63 65 20  63 6f 6e 74 72 6f 6c 65  | device controle|
00000860  64 20 62 79 20 31 36 20  72 65 67 69 73 74 65 72  |d by 16 register|
00000870  73 2e 20 54 68 65 0d 56  49 41 2d 42 20 72 65 67  |s. The.VIA-B reg|
00000880  69 73 74 65 72 73 20 61  72 65 20 6d 61 70 70 65  |isters are mappe|
00000890  64 20 6f 6e 74 6f 20 53  68 65 69 6c 61 20 61 64  |d onto Sheila ad|
000008a0  64 72 65 73 73 65 73 20  26 36 30 20 74 6f 20 26  |dresses &60 to &|
000008b0  36 46 20 28 69 65 2e 20  26 46 45 36 30 20 74 6f  |6F (ie. &FE60 to|
000008c0  0d 26 46 45 36 46 29 20  61 73 20 73 68 6f 77 6e  |.&FE6F) as shown|
000008d0  20 69 6e 20 66 69 67 75  72 65 20 31 2e 0d 0d 0d  | in figure 1....|
000008e0  0d 20 20 20 20 20 20 20  20 41 64 64 72 65 73 73  |.        Address|
000008f0  20 20 20 20 20 20 20 20  20 20 20 20 20 44 65 73  |             Des|
00000900  63 72 69 70 74 69 6f 6e  20 20 20 20 20 20 20 20  |cription        |
00000910  20 20 20 20 20 20 20 20  44 65 73 69 67 6e 61 74  |        Designat|
00000920  69 6f 6e 0d 20 20 20 20  20 20 20 2b 2d 2d 2d 2d  |ion.       +----|
00000930  2d 2d 2d 2b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |---+------------|
00000940  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000950  2d 2d 2d 2d 2d 2d 2d 2d  2d 2b 2d 2d 2d 2d 2d 2d  |---------+------|
00000960  2d 2d 2d 2d 2d 2d 2d 2b  0d 20 20 20 20 20 20 20  |-------+.       |
00000970  7c 20 26 46 45 36 46 20  7c 20 44 61 74 61 20 72  || &FE6F | Data r|
00000980  65 67 69 73 74 65 72 20  41 20 28 6e 6f 20 68 61  |egister A (no ha|
00000990  6e 64 73 68 61 6b 65 29  20 20 20 20 20 20 7c 20  |ndshake)      | |
000009a0  44 52 41 20 20 20 20 20  20 20 20 20 7c 0d 20 20  |DRA         |.  |
000009b0  20 20 20 20 20 2b 2d 2d  2d 2d 2d 2d 2d 2b 2d 2d  |     +-------+--|
000009c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000009e0  2d 2d 2d 2b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |---+------------|
000009f0  2d 2b 0d 20 20 20 20 20  20 20 7c 20 26 46 45 36  |-+.       | &FE6|
00000a00  45 20 7c 20 49 6e 74 65  72 72 75 70 74 20 65 6e  |E | Interrupt en|
00000a10  61 62 6c 65 20 72 65 67  69 73 74 65 72 20 20 20  |able register   |
00000a20  20 20 20 20 20 20 20 20  7c 20 49 45 52 20 20 20  |        | IER   |
00000a30  20 20 20 20 20 20 7c 0d  20 20 20 20 20 20 20 2b  |      |.       +|
00000a40  2d 2d 2d 2d 2d 2d 2d 2b  2d 2d 2d 2d 2d 2d 2d 2d  |-------+--------|
00000a50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000a60  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2b 2d 2d  |-------------+--|
00000a70  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2b 0d 20 20 20  |-----------+.   |
00000a80  20 20 20 20 7c 20 26 46  45 36 44 20 7c 20 49 6e  |    | &FE6D | In|
00000a90  74 65 72 72 75 70 74 20  66 6c 61 67 20 72 65 67  |terrupt flag reg|
00000aa0  69 73 74 65 72 20 20 20  20 20 20 20 20 20 20 20  |ister           |
00000ab0  20 20 7c 20 49 46 52 20  20 20 20 20 20 20 20 20  |  | IFR         |
00000ac0  7c 0d 20 20 20 20 20 20  20 2b 2d 2d 2d 2d 2d 2d  ||.       +------|
00000ad0  2d 2b 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |-+--------------|
00000ae0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000af0  2d 2d 2d 2d 2d 2d 2d 2b  2d 2d 2d 2d 2d 2d 2d 2d  |-------+--------|
00000b00  2d 2d 2d 2d 2d 2b 0d 20  20 20 20 20 20 20 7c 20  |-----+.       | |
00000b10  26 46 45 36 43 20 7c 20  50 65 72 69 70 68 65 72  |&FE6C | Peripher|
00000b20  61 6c 20 63 6f 6e 74 72  6f 6c 20 72 65 67 69 73  |al control regis|
00000b30  74 65 72 20 20 20 20 20  20 20 20 20 7c 20 50 43  |ter         | PC|
00000b40  52 20 20 20 20 20 20 20  20 20 7c 0d 20 20 20 20  |R         |.    |
00000b50  20 20 20 2b 2d 2d 2d 2d  2d 2d 2d 2b 2d 2d 2d 2d  |   +-------+----|
00000b60  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000b80  2d 2b 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2b  |-+-------------+|
00000b90  0d 20 20 20 20 20 20 20  7c 20 26 46 45 36 42 20  |.       | &FE6B |
00000ba0  7c 20 41 75 78 69 6c 69  61 72 79 20 63 6f 6e 74  || Auxiliary cont|
00000bb0  72 6f 6c 20 72 65 67 69  73 74 65 72 20 20 20 20  |rol register    |
00000bc0  20 20 20 20 20 20 7c 20  41 43 52 20 20 20 20 20  |      | ACR     |
00000bd0  20 20 20 20 7c 0d 20 20  20 20 20 20 20 2b 2d 2d  |    |.       +--|
00000be0  2d 2d 2d 2d 2d 2b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |-----+----------|
00000bf0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000c00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2b 2d 2d 2d 2d  |-----------+----|
00000c10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2b 0d 20 20 20 20 20  |---------+.     |
00000c20  20 20 7c 20 26 46 45 36  41 20 7c 20 53 68 69 66  |  | &FE6A | Shif|
00000c30  74 20 72 65 67 69 73 74  65 72 20 20 20 20 20 20  |t register      |
00000c40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c50  7c 20 53 52 20 20 20 20  20 20 20 20 20 20 7c 0d  || SR          |.|
00000c60  20 20 20 20 20 20 20 2b  2d 2d 2d 2d 2d 2d 2d 2b  |       +-------+|
00000c70  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000c90  2d 2d 2d 2d 2d 2b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |-----+----------|
00000ca0  2d 2d 2d 2b 0d 20 20 20  20 20 20 20 7c 20 26 46  |---+.       | &F|
00000cb0  45 36 39 20 7c 20 54 69  6d 65 72 20 32 20 69 6e  |E69 | Timer 2 in|
00000cc0  69 74 69 61 74 65 20 63  6f 75 6e 74 20 20 20 20  |itiate count    |
00000cd0  20 20 20 20 20 20 20 20  20 20 7c 20 54 32 43 48  |          | T2CH|
00000ce0  20 20 20 20 20 20 20 20  7c 0d 20 20 20 20 20 20  |        |.      |
00000cf0  20 2b 2d 2d 2d 2d 2d 2d  2d 2b 2d 2d 2d 2d 2d 2d  | +-------+------|
00000d00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000d10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2b  |---------------+|
00000d20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2b 0d 20  |-------------+. |
00000d30  20 20 20 20 20 20 7c 20  26 46 45 36 38 20 7c 20  |      | &FE68 | |
00000d40  54 69 6d 65 72 20 32 20  77 72 69 74 65 20 6c 61  |Timer 2 write la|
00000d50  74 63 68 2c 20 72 65 61  64 20 63 6f 75 6e 74 65  |tch, read counte|
00000d60  72 20 20 20 7c 20 54 32  43 4c 20 20 20 20 20 20  |r   | T2CL      |
00000d70  20 20 7c 0d 20 20 20 20  20 20 20 2b 2d 2d 2d 2d  |  |.       +----|
00000d80  2d 2d 2d 2b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |---+------------|
00000d90  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000da0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2b 2d 2d 2d 2d 2d 2d  |---------+------|
00000db0  2d 2d 2d 2d 2d 2d 2d 2b  0d 20 20 20 20 20 20 20  |-------+.       |
00000dc0  7c 20 26 46 45 36 37 20  7c 20 54 69 6d 65 72 20  || &FE67 | Timer |
00000dd0  31 20 6c 6f 61 64 20 6c  61 74 63 68 2c 20 68 69  |1 load latch, hi|
00000de0  67 68 20 62 79 74 65 20  20 20 20 20 20 20 7c 20  |gh byte       | |
00000df0  54 31 4c 48 20 20 20 20  20 20 20 20 7c 0d 20 20  |T1LH        |.  |
00000e00  20 20 20 20 20 2b 2d 2d  2d 2d 2d 2d 2d 2b 2d 2d  |     +-------+--|
00000e10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000e30  2d 2d 2d 2b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |---+------------|
00000e40  2d 2b 0d 20 20 20 20 20  20 20 7c 20 26 46 45 36  |-+.       | &FE6|
00000e50  36 20 7c 20 54 69 6d 65  72 20 31 20 6c 6f 61 64  |6 | Timer 1 load|
00000e60  20 6c 61 74 63 68 2c 20  6c 6f 77 20 62 79 74 65  | latch, low byte|
00000e70  20 20 20 20 20 20 20 20  7c 20 54 31 4c 4c 20 20  |        | T1LL  |
00000e80  20 20 20 20 20 20 7c 0d  20 20 20 20 20 20 20 2b  |      |.       +|
00000e90  2d 2d 2d 2d 2d 2d 2d 2b  2d 2d 2d 2d 2d 2d 2d 2d  |-------+--------|
00000ea0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000eb0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2b 2d 2d  |-------------+--|
00000ec0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2b 0d 20 20 20  |-----------+.   |
00000ed0  20 20 20 20 7c 20 26 46  45 36 35 20 7c 20 54 69  |    | &FE65 | Ti|
00000ee0  6d 65 72 20 31 20 69 6e  69 74 69 61 74 65 20 63  |mer 1 initiate c|
00000ef0  6f 75 6e 74 20 20 20 20  20 20 20 20 20 20 20 20  |ount            |
00000f00  20 20 7c 20 54 31 43 48  20 20 20 20 20 20 20 20  |  | T1CH        |
00000f10  7c 0d 20 20 20 20 20 20  20 2b 2d 2d 2d 2d 2d 2d  ||.       +------|
00000f20  2d 2b 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |-+--------------|
00000f30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000f40  2d 2d 2d 2d 2d 2d 2d 2b  2d 2d 2d 2d 2d 2d 2d 2d  |-------+--------|
00000f50  2d 2d 2d 2d 2d 2b 0d 20  20 20 20 20 20 20 7c 20  |-----+.       | |
00000f60  26 46 45 36 34 20 7c 20  54 69 6d 65 72 20 31 20  |&FE64 | Timer 1 |
00000f70  77 72 69 74 65 20 6c 61  74 63 68 2c 20 72 65 61  |write latch, rea|
00000f80  64 20 63 6f 75 6e 74 65  72 20 20 20 7c 20 54 31  |d counter   | T1|
00000f90  43 4c 20 20 20 20 20 20  20 20 7c 0d 20 20 20 20  |CL        |.    |
00000fa0  20 20 20 2b 2d 2d 2d 2d  2d 2d 2d 2b 2d 2d 2d 2d  |   +-------+----|
00000fb0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000fd0  2d 2b 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2b  |-+-------------+|
00000fe0  0d 20 20 20 20 20 20 20  7c 20 26 46 45 36 33 20  |.       | &FE63 |
00000ff0  7c 20 44 61 74 61 20 64  69 72 65 63 74 69 6f 6e  || Data direction|
00001000  20 72 65 67 69 73 74 65  72 20 41 20 20 20 20 20  | register A     |
00001010  20 20 20 20 20 20 7c 20  44 44 52 41 20 20 20 20  |      | DDRA    |
00001020  20 20 20 20 7c 0d 20 20  20 20 20 20 20 2b 2d 2d  |    |.       +--|
00001030  2d 2d 2d 2d 2d 2b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |-----+----------|
00001040  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001050  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2b 2d 2d 2d 2d  |-----------+----|
00001060  2d 2d 2d 2d 2d 2d 2d 2d  2d 2b 0d 20 20 20 20 20  |---------+.     |
00001070  20 20 7c 20 26 46 45 36  32 20 7c 20 44 61 74 61  |  | &FE62 | Data|
00001080  20 64 69 72 65 63 74 69  6f 6e 20 72 65 67 69 73  | direction regis|
00001090  74 65 72 20 42 20 20 20  20 20 20 20 20 20 20 20  |ter B           |
000010a0  7c 20 44 44 52 42 20 20  20 20 20 20 20 20 7c 0d  || DDRB        |.|
000010b0  20 20 20 20 20 20 20 2b  2d 2d 2d 2d 2d 2d 2d 2b  |       +-------+|
000010c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000010e0  2d 2d 2d 2d 2d 2b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |-----+----------|
000010f0  2d 2d 2d 2b 0d 20 20 20  20 20 20 20 7c 20 26 46  |---+.       | &F|
00001100  45 36 31 20 7c 20 44 61  74 61 20 72 65 67 69 73  |E61 | Data regis|
00001110  74 65 72 20 41 20 20 20  20 20 20 20 20 20 20 20  |ter A           |
00001120  20 20 20 20 20 20 20 20  20 20 7c 20 44 52 41 20  |          | DRA |
00001130  20 20 20 20 20 20 20 20  7c 0d 20 20 20 20 20 20  |        |.      |
00001140  20 2b 2d 2d 2d 2d 2d 2d  2d 2b 2d 2d 2d 2d 2d 2d  | +-------+------|
00001150  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001160  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2b  |---------------+|
00001170  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2b 0d 20  |-------------+. |
00001180  20 20 20 20 20 20 7c 20  26 46 45 36 30 20 7c 20  |      | &FE60 | |
00001190  44 61 74 61 20 72 65 67  69 73 74 65 72 20 42 20  |Data register B |
000011a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000011b0  20 20 20 20 7c 20 44 52  42 20 20 20 20 20 20 20  |    | DRB       |
000011c0  20 20 7c 0d 20 20 20 20  20 20 20 2b 2d 2d 2d 2d  |  |.       +----|
000011d0  2d 2d 2d 2b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |---+------------|
000011e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000011f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2b 2d 2d 2d 2d 2d 2d  |---------+------|
00001200  2d 2d 2d 2d 2d 2d 2d 2b  0d 0d 46 69 67 75 72 65  |-------+..Figure|
00001210  20 31 20 20 54 68 65 20  56 49 41 2d 42 20 72 65  | 1  The VIA-B re|
00001220  67 69 73 74 65 72 73 0d  2d 2d 2d 2d 2d 2d 2d 2d  |gisters.--------|
00001230  20 20 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |  --------------|
00001240  2d 2d 2d 2d 2d 0d 0d 0d  46 69 76 65 20 6f 66 20  |-----...Five of |
00001250  74 68 65 73 65 20 31 36  20 72 65 67 69 73 74 65  |these 16 registe|
00001260  72 73 20 61 72 65 20 6f  66 20 69 6e 74 65 72 65  |rs are of intere|
00001270  73 74 20 77 68 65 6e 20  75 73 69 6e 67 20 61 20  |st when using a |
00001280  6d 6f 75 73 65 2e 20 54  68 65 79 0d 61 72 65 20  |mouse. They.are |
00001290  64 61 74 61 20 72 65 67  69 73 74 65 72 20 42 20  |data register B |
000012a0  28 44 52 42 2c 20 26 46  45 36 30 29 2c 20 64 61  |(DRB, &FE60), da|
000012b0  74 61 20 64 69 72 65 63  74 69 6f 6e 20 72 65 67  |ta direction reg|
000012c0  69 73 74 65 72 20 42 20  28 44 44 52 42 2c 20 26  |ister B (DDRB, &|
000012d0  46 45 36 32 29 2c 0d 74  68 65 20 70 65 72 69 70  |FE62),.the perip|
000012e0  68 65 72 61 6c 20 63 6f  6e 74 72 6f 6c 20 72 65  |heral control re|
000012f0  67 69 73 74 65 72 20 28  50 43 52 2c 20 26 46 45  |gister (PCR, &FE|
00001300  36 43 29 2c 20 74 68 65  20 69 6e 74 65 72 72 75  |6C), the interru|
00001310  70 74 20 66 6c 61 67 20  72 65 67 69 73 74 65 72  |pt flag register|
00001320  0d 28 49 46 52 2c 20 26  46 45 36 44 29 2c 20 61  |.(IFR, &FE6D), a|
00001330  6e 64 20 74 68 65 20 69  6e 74 65 72 72 75 70 74  |nd the interrupt|
00001340  20 65 6e 61 62 6c 65 20  72 65 67 69 73 74 65 72  | enable register|
00001350  20 28 49 45 52 2c 20 26  46 45 36 45 29 2e 20 54  | (IER, &FE6E). T|
00001360  68 65 0d 61 75 78 69 6c  6c 61 72 79 20 63 6f 6e  |he.auxillary con|
00001370  74 72 6f 6c 20 72 65 67  69 73 74 65 72 20 28 41  |trol register (A|
00001380  43 52 2c 20 26 46 45 36  42 29 20 69 73 20 61 6c  |CR, &FE6B) is al|
00001390  73 6f 20 6f 66 20 70 61  73 73 69 6e 67 20 69 6e  |so of passing in|
000013a0  74 65 72 65 73 74 2e 0d  0d 42 6f 74 68 20 74 68  |terest...Both th|
000013b0  65 20 73 79 73 74 65 6d  20 56 49 41 20 61 6e 64  |e system VIA and|
000013c0  20 74 68 65 20 75 73 65  72 20 56 49 41 20 68 61  | the user VIA ha|
000013d0  76 65 20 32 30 20 49 2f  4f 20 6c 69 6e 65 73 20  |ve 20 I/O lines |
000013e0  67 72 6f 75 70 65 64 20  69 6e 74 6f 20 61 6e 20  |grouped into an |
000013f0  41 0d 73 69 64 65 20 61  6e 64 20 61 20 42 20 73  |A.side and a B s|
00001400  69 64 65 20 6f 66 20 31  30 20 6c 69 6e 65 73 20  |ide of 10 lines |
00001410  65 61 63 68 2e 20 54 68  65 73 65 20 31 30 20 6c  |each. These 10 l|
00001420  69 6e 65 73 20 61 72 65  20 64 69 76 69 64 65 64  |ines are divided|
00001430  20 69 6e 74 6f 20 38 20  64 61 74 61 0d 6c 69 6e  | into 8 data.lin|
00001440  65 73 20 61 6e 64 20 32  20 68 61 6e 64 73 68 61  |es and 2 handsha|
00001450  6b 65 20 6c 69 6e 65 73  2e 20 54 68 65 20 64 61  |ke lines. The da|
00001460  74 61 20 6c 69 6e 65 73  20 61 72 65 20 63 61 6c  |ta lines are cal|
00001470  6c 65 64 20 50 41 30 20  74 6f 20 50 41 37 20 6f  |led PA0 to PA7 o|
00001480  6e 20 74 68 65 20 41 0d  73 69 64 65 20 61 6e 64  |n the A.side and|
00001490  20 50 42 30 20 74 6f 20  50 42 37 20 6f 6e 20 74  | PB0 to PB7 on t|
000014a0  68 65 20 42 20 73 69 64  65 2e 20 44 61 74 61 20  |he B side. Data |
000014b0  6c 69 6e 65 73 20 50 41  30 20 74 6f 20 50 41 37  |lines PA0 to PA7|
000014c0  20 63 61 6e 20 62 65 20  72 65 61 64 20 66 72 6f  | can be read fro|
000014d0  6d 0d 6f 72 20 77 72 69  74 74 65 6e 20 74 6f 20  |m.or written to |
000014e0  64 61 74 61 20 72 65 67  69 73 74 65 72 20 41 20  |data register A |
000014f0  28 26 46 45 36 31 29 20  61 6e 64 20 64 61 74 61  |(&FE61) and data|
00001500  20 6c 69 6e 65 73 20 50  42 30 20 74 6f 20 50 42  | lines PB0 to PB|
00001510  37 20 63 61 6e 20 62 65  0d 72 65 61 64 20 66 72  |7 can be.read fr|
00001520  6f 6d 20 6f 72 20 77 72  69 74 74 65 6e 20 74 6f  |om or written to|
00001530  20 64 61 74 61 20 72 65  67 69 73 74 65 72 20 42  | data register B|
00001540  20 28 26 46 45 36 30 29  2e 20 54 68 65 20 42 20  | (&FE60). The B |
00001550  73 69 64 65 20 6f 66 20  56 49 41 2d 42 20 69 73  |side of VIA-B is|
00001560  0d 6b 6e 6f 77 6e 20 61  73 20 74 68 65 20 55 73  |.known as the Us|
00001570  65 72 20 50 6f 72 74 20  61 6e 64 20 50 42 30 20  |er Port and PB0 |
00001580  74 6f 20 50 42 37 20 61  72 65 20 74 68 65 20 55  |to PB7 are the U|
00001590  73 65 72 20 50 6f 72 74  20 64 61 74 61 20 6c 69  |ser Port data li|
000015a0  6e 65 73 2e 20 54 68 65  0d 68 61 6e 64 73 68 61  |nes. The.handsha|
000015b0  6b 65 20 6c 69 6e 65 73  20 61 72 65 20 63 61 6c  |ke lines are cal|
000015c0  6c 65 64 20 43 41 31 20  61 6e 64 20 43 41 32 20  |led CA1 and CA2 |
000015d0  6f 6e 20 74 68 65 20 41  20 73 69 64 65 20 61 6e  |on the A side an|
000015e0  64 20 43 42 31 20 61 6e  64 20 43 42 32 20 6f 6e  |d CB1 and CB2 on|
000015f0  0d 74 68 65 20 42 20 73  69 64 65 2e 20 43 42 31  |.the B side. CB1|
00001600  20 61 6e 64 20 43 42 32  20 61 72 65 20 74 68 65  | and CB2 are the|
00001610  20 55 73 65 72 20 50 6f  72 74 20 68 61 6e 64 73  | User Port hands|
00001620  68 61 6b 65 20 6c 69 6e  65 73 2e 0d 0d 54 68 65  |hake lines...The|
00001630  20 55 73 65 72 20 50 6f  72 74 20 64 61 74 61 20  | User Port data |
00001640  72 65 67 69 73 74 65 72  2c 20 44 52 42 2c 20 63  |register, DRB, c|
00001650  61 6e 20 62 65 20 6d 61  64 65 20 61 6e 20 69 6e  |an be made an in|
00001660  70 75 74 20 72 65 67 69  73 74 65 72 20 62 79 20  |put register by |
00001670  77 72 69 74 69 6e 67 0d  74 68 65 20 6e 75 6d 62  |writing.the numb|
00001680  65 72 20 7a 65 72 6f 20  69 6e 74 6f 20 44 44 52  |er zero into DDR|
00001690  42 2e 20 43 6c 65 61 72  69 6e 67 20 61 20 62 69  |B. Clearing a bi|
000016a0  74 20 69 6e 20 44 44 52  42 20 6d 61 6b 65 73 20  |t in DDRB makes |
000016b0  74 68 65 20 65 71 69 76  61 6c 65 6e 74 20 62 69  |the eqivalent bi|
000016c0  74 0d 69 6e 20 44 52 42  20 61 6e 20 69 6e 70 75  |t.in DRB an inpu|
000016d0  74 2e 20 53 65 74 74 69  6e 67 20 61 20 62 69 74  |t. Setting a bit|
000016e0  20 69 6e 20 44 44 52 42  20 6d 61 6b 65 73 20 74  | in DDRB makes t|
000016f0  68 65 20 65 71 75 69 76  61 6c 65 6e 74 20 62 69  |he equivalent bi|
00001700  74 20 69 6e 20 44 52 42  20 61 6e 0d 6f 75 74 70  |t in DRB an.outp|
00001710  75 74 2e 0d 0d 54 68 65  20 70 65 72 69 70 68 65  |ut...The periphe|
00001720  72 61 6c 20 63 6f 6e 74  72 6f 6c 20 72 65 67 69  |ral control regi|
00001730  73 74 65 72 20 69 73 20  75 73 65 64 20 74 6f 20  |ster is used to |
00001740  63 6f 6e 74 72 6f 6c 20  74 68 65 20 75 73 65 20  |control the use |
00001750  6f 66 20 74 68 65 0d 68  61 6e 64 73 68 61 6b 65  |of the.handshake|
00001760  20 6c 69 6e 65 73 2e 20  54 68 65 20 56 49 41 2d  | lines. The VIA-|
00001770  42 20 50 43 52 20 61 6e  64 20 74 68 65 20 69 6e  |B PCR and the in|
00001780  74 65 72 70 72 65 74 61  74 69 6f 6e 20 6f 66 20  |terpretation of |
00001790  69 74 73 20 62 69 74 73  20 69 73 20 73 68 6f 77  |its bits is show|
000017a0  6e 0d 69 6e 20 66 69 67  75 72 65 20 32 2e 0d 0d  |n.in figure 2...|
000017b0  0d 0d 62 69 74 20 37 20  20 20 20 20 20 20 36 20  |..bit 7       6 |
000017c0  20 20 20 20 20 20 35 20  20 20 20 20 20 20 20 20  |      5         |
000017d0  34 20 20 20 20 20 20 20  20 20 33 20 20 20 20 20  |4         3     |
000017e0  20 20 32 20 20 20 20 20  20 20 31 20 20 20 20 20  |  2       1     |
000017f0  20 20 20 20 30 0d 2b 2d  2d 2d 2d 2d 2d 2d 2b 2d  |    0.+-------+-|
00001800  2d 2d 2d 2d 2d 2d 2b 2d  2d 2d 2d 2d 2d 2d 2b 2d  |------+-------+-|
00001810  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2b 2d 2d 2d 2d 2d  |----------+-----|
00001820  2d 2d 2b 2d 2d 2d 2d 2d  2d 2d 2b 2d 2d 2d 2d 2d  |--+-------+-----|
00001830  2d 2d 2b 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2b 0d  |--+-----------+.|
00001840  7c 20 20 20 20 20 20 43  42 32 20 63 6f 6e 74 72  ||      CB2 contr|
00001850  6f 6c 20 20 20 20 20 20  7c 43 42 31 20 63 6f 6e  |ol      |CB1 con|
00001860  74 72 6f 6c 7c 20 20 20  20 20 20 43 41 32 20 43  |trol|      CA2 C|
00001870  6f 6e 74 72 6f 6c 20 20  20 20 20 20 7c 43 41 31  |ontrol      |CA1|
00001880  20 63 6f 6e 74 72 6f 6c  7c 0d 7c 20 20 20 20 20  | control|.|     |
00001890  20 20 55 73 65 72 20 50  6f 72 74 20 20 20 20 20  |  User Port     |
000018a0  20 20 7c 20 55 73 65 72  20 50 6f 72 74 20 7c 20  |  | User Port | |
000018b0  20 20 20 50 72 69 6e 74  65 72 20 73 74 72 6f 62  |   Printer strob|
000018c0  65 20 20 20 20 20 7c 50  72 69 6e 74 65 72 20 61  |e     |Printer a|
000018d0  63 6b 7c 0d 2b 2d 2d 2d  2d 2d 2d 2d 2b 2d 2d 2d  |ck|.+-------+---|
000018e0  2d 2d 2d 2d 2b 2d 2d 2d  2d 2d 2d 2d 2b 2d 2d 2d  |----+-------+---|
000018f0  2d 2d 2d 2d 2d 2d 2d 2d  2b 2d 2d 2d 2d 2d 2d 2d  |--------+-------|
00001900  2b 2d 2d 2d 2d 2d 2d 2d  2b 2d 2d 2d 2d 2d 2d 2d  |+-------+-------|
00001910  2b 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2b 0d 0d 0d  |+-----------+...|
00001920  20 42 69 74 20 20 49 6e  74 65 72 70 72 65 74 61  | Bit  Interpreta|
00001930  74 69 6f 6e 20 69 66 20  62 69 74 20 63 6c 65 61  |tion if bit clea|
00001940  72 20 28 30 29 20 20 20  49 6e 74 65 72 70 72 65  |r (0)   Interpre|
00001950  74 61 74 69 6f 6e 20 69  66 20 62 69 74 20 73 65  |tation if bit se|
00001960  74 20 28 31 29 0d 2b 2d  2d 2d 2b 2d 2d 2d 2d 2d  |t (1).+---+-----|
00001970  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001980  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2b 2d 2d 2d  |------------+---|
00001990  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000019a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2b 0d  |--------------+.|
000019b0  7c 20 30 20 7c 53 65 74  20 62 69 74 20 31 20 6f  || 0 |Set bit 1 o|
000019c0  66 20 49 46 52 20 6f 6e  20 2d 76 65 20 67 6f 69  |f IFR on -ve goi|
000019d0  6e 67 20 43 41 31 7c 53  65 74 20 62 69 74 20 31  |ng CA1|Set bit 1|
000019e0  20 6f 66 20 49 46 52 20  6f 6e 20 2b 76 65 20 67  | of IFR on +ve g|
000019f0  6f 69 6e 67 20 43 41 31  7c 0d 2b 2d 2d 2d 2b 2d  |oing CA1|.+---+-|
00001a00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001a20  2b 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |+---------------|
00001a30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001a40  2d 2d 2b 0d 7c 20 31 20  7c 20 44 52 41 20 73 65  |--+.| 1 | DRA se|
00001a50  6c 65 63 74 65 64 20 74  6f 20 63 6c 65 61 72 20  |lected to clear |
00001a60  69 6e 74 65 72 72 75 70  74 20 7c 20 49 6e 74 65  |interrupt | Inte|
00001a70  72 72 75 70 74 20 6e 6f  74 20 63 6c 65 61 72 65  |rrupt not cleare|
00001a80  64 20 62 79 20 44 52 41  20 20 20 20 7c 0d 2b 2d  |d by DRA    |.+-|
00001a90  2d 2d 2b 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |--+-------------|
00001aa0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001ab0  2d 2d 2d 2d 2b 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----+-----------|
00001ac0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001ad0  2d 2d 2d 2d 2d 2d 2b 0d  7c 20 32 20 7c 53 65 74  |------+.| 2 |Set|
00001ae0  20 62 69 74 20 30 20 6f  66 20 49 46 52 20 6f 6e  | bit 0 of IFR on|
00001af0  20 2d 76 65 20 67 6f 69  6e 67 20 43 41 32 7c 53  | -ve going CA2|S|
00001b00  65 74 20 62 69 74 20 30  20 6f 66 20 49 46 52 20  |et bit 0 of IFR |
00001b10  6f 6e 20 2b 76 65 20 67  6f 69 6e 67 20 43 41 32  |on +ve going CA2|
00001b20  7c 0d 2b 2d 2d 2d 2b 2d  2d 2d 2d 2d 2d 2d 2d 2d  ||.+---+---------|
00001b30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001b40  2d 2d 2d 2d 2d 2d 2d 2d  2b 2d 2d 2d 2d 2d 2d 2d  |--------+-------|
00001b50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001b60  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2b 0d 7c 20 33 20  |----------+.| 3 |
00001b70  7c 20 42 69 74 20 33 20  61 6c 77 61 79 73 20 73  || Bit 3 always s|
00001b80  65 74 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |et              |
00001b90  20 20 7c 20 53 65 74 20  43 41 32 20 74 6f 20 6f  |  | Set CA2 to o|
00001ba0  75 74 70 75 74 20 28 61  6c 77 61 79 73 20 73 65  |utput (always se|
00001bb0  74 29 20 20 7c 0d 2b 2d  2d 2d 2b 2d 2d 2d 2d 2d  |t)  |.+---+-----|
00001bc0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001bd0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2b 2d 2d 2d  |------------+---|
00001be0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001bf0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2b 0d  |--------------+.|
00001c00  7c 20 34 20 7c 53 65 74  20 62 69 74 20 34 20 6f  || 4 |Set bit 4 o|
00001c10  66 20 49 46 52 20 6f 6e  20 2d 76 65 20 67 6f 69  |f IFR on -ve goi|
00001c20  6e 67 20 43 42 31 7c 53  65 74 20 62 69 74 20 34  |ng CB1|Set bit 4|
00001c30  20 6f 66 20 49 46 52 20  6f 6e 20 2b 76 65 20 67  | of IFR on +ve g|
00001c40  6f 69 6e 67 20 43 42 31  7c 0d 2b 2d 2d 2d 2b 2d  |oing CB1|.+---+-|
00001c50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001c70  2b 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |+---------------|
00001c80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001c90  2d 2d 2b 0d 7c 20 35 20  7c 20 44 52 42 20 73 65  |--+.| 5 | DRB se|
00001ca0  6c 65 63 74 65 64 20 74  6f 20 63 6c 65 61 72 20  |lected to clear |
00001cb0  69 6e 74 65 72 72 75 70  74 20 7c 20 49 6e 74 65  |interrupt | Inte|
00001cc0  72 72 75 70 74 20 6e 6f  74 20 63 6c 65 61 72 65  |rrupt not cleare|
00001cd0  64 20 62 79 20 44 52 42  20 20 20 20 7c 0d 2b 2d  |d by DRB    |.+-|
00001ce0  2d 2d 2b 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |--+-------------|
00001cf0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001d00  2d 2d 2d 2d 2b 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----+-----------|
00001d10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001d20  2d 2d 2d 2d 2d 2d 2b 0d  7c 20 36 20 7c 53 65 74  |------+.| 6 |Set|
00001d30  20 62 69 74 20 33 20 6f  66 20 49 46 52 20 6f 6e  | bit 3 of IFR on|
00001d40  20 2d 76 65 20 67 6f 69  6e 67 20 43 42 32 7c 53  | -ve going CB2|S|
00001d50  65 74 20 62 69 74 20 33  20 6f 66 20 49 46 52 20  |et bit 3 of IFR |
00001d60  6f 6e 20 2b 76 65 20 67  6f 69 6e 67 20 43 42 32  |on +ve going CB2|
00001d70  7c 0d 2b 2d 2d 2d 2b 2d  2d 2d 2d 2d 2d 2d 2d 2d  ||.+---+---------|
00001d80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001d90  2d 2d 2d 2d 2d 2d 2d 2d  2b 2d 2d 2d 2d 2d 2d 2d  |--------+-------|
00001da0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001db0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2b 0d 7c 20 37 20  |----------+.| 7 |
00001dc0  7c 20 53 65 74 20 43 42  32 20 74 6f 20 69 6e 70  || Set CB2 to inp|
00001dd0  75 74 20 6d 6f 64 65 20  20 20 20 20 20 20 20 20  |ut mode         |
00001de0  20 20 7c 20 53 65 74 20  43 42 32 20 74 6f 20 6f  |  | Set CB2 to o|
00001df0  75 74 70 75 74 20 6d 6f  64 65 20 20 20 20 20 20  |utput mode      |
00001e00  20 20 20 20 7c 0d 2b 2d  2d 2d 2b 2d 2d 2d 2d 2d  |    |.+---+-----|
00001e10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001e20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2b 2d 2d 2d  |------------+---|
00001e30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001e40  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2b 0d  |--------------+.|
00001e50  0d 46 69 67 75 72 65 20  32 20 20 54 68 65 20 70  |.Figure 2  The p|
00001e60  65 72 69 70 68 65 72 61  6c 20 63 6f 6e 74 72 6f  |eripheral contro|
00001e70  6c 20 72 65 67 69 73 74  65 72 0d 2d 2d 2d 2d 2d  |l register.-----|
00001e80  2d 2d 2d 20 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |---  -----------|
00001e90  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001ea0  2d 2d 2d 2d 0d 0d 0d 42  6f 74 68 20 43 42 31 20  |----...Both CB1 |
00001eb0  61 6e 64 20 43 42 32 20  61 72 65 20 75 73 65 64  |and CB2 are used|
00001ec0  20 61 73 20 69 6e 70 75  74 73 20 62 79 20 61 6e  | as inputs by an|
00001ed0  20 41 4d 58 20 63 6f 6d  70 61 74 69 62 6c 65 20  | AMX compatible |
00001ee0  6d 6f 75 73 65 2e 20 57  68 65 6e 20 75 73 69 6e  |mouse. When usin|
00001ef0  67 0d 69 6e 74 65 72 72  75 70 74 20 64 72 69 76  |g.interrupt driv|
00001f00  65 6e 20 6d 6f 75 73 65  20 73 6f 66 74 77 61 72  |en mouse softwar|
00001f10  65 20 79 6f 75 20 77 69  6c 6c 20 6e 65 65 64 20  |e you will need |
00001f20  74 6f 20 73 65 74 20 62  69 74 73 20 34 20 61 6e  |to set bits 4 an|
00001f30  64 20 36 20 61 6e 64 0d  63 6c 65 61 72 20 62 69  |d 6 and.clear bi|
00001f40  74 73 20 35 20 61 6e 64  20 37 20 6f 66 20 74 68  |ts 5 and 7 of th|
00001f50  65 20 50 43 52 2e 20 54  68 69 73 20 6d 65 61 6e  |e PCR. This mean|
00001f60  73 20 74 68 61 74 20 61  20 70 6f 73 69 74 69 76  |s that a positiv|
00001f70  65 20 67 6f 69 6e 67 20  73 69 67 6e 61 6c 20 6f  |e going signal o|
00001f80  6e 0d 65 69 74 68 65 72  20 43 42 31 20 6f 72 20  |n.either CB1 or |
00001f90  43 42 32 20 77 69 6c 6c  20 67 65 6e 65 72 61 74  |CB2 will generat|
00001fa0  65 20 61 6e 20 49 51 52  20 69 6e 74 65 72 72 75  |e an IQR interru|
00001fb0  70 74 20 61 6e 64 20 74  68 61 74 20 69 6e 74 65  |pt and that inte|
00001fc0  72 72 75 70 74 20 77 69  6c 6c 0d 62 65 20 63 6c  |rrupt will.be cl|
00001fd0  65 61 72 65 64 20 62 79  20 72 65 61 64 69 6e 67  |eared by reading|
00001fe0  20 64 61 74 61 20 72 65  67 69 73 74 65 72 20 42  | data register B|
00001ff0  2c 20 69 65 2e 20 62 79  20 72 65 61 64 69 6e 67  |, ie. by reading|
00002000  20 74 68 65 20 64 61 74  61 20 6c 69 6e 65 73 2e  | the data lines.|
00002010  20 42 69 74 0d 37 20 6f  66 20 74 68 65 20 50 43  | Bit.7 of the PC|
00002020  52 20 69 73 20 63 6c 65  61 72 20 74 6f 20 6d 61  |R is clear to ma|
00002030  6b 65 20 43 42 32 20 61  6e 20 69 6e 70 75 74 2c  |ke CB2 an input,|
00002040  20 43 42 31 20 69 73 20  61 6e 20 69 6e 70 75 74  | CB1 is an input|
00002050  20 6c 69 6e 65 20 62 79  0d 64 65 66 61 75 6c 74  | line by.default|
00002060  2e 20 41 20 70 72 6f 67  72 61 6d 20 77 68 69 63  |. A program whic|
00002070  68 20 61 6c 74 65 72 73  20 62 69 74 73 20 34 20  |h alters bits 4 |
00002080  74 6f 20 37 20 6f 66 20  74 68 65 20 50 43 52 20  |to 7 of the PCR |
00002090  6d 75 73 74 20 6e 6f 74  20 61 6c 74 65 72 20 62  |must not alter b|
000020a0  69 74 73 0d 30 20 74 6f  20 33 20 77 68 69 63 68  |its.0 to 3 which|
000020b0  20 61 72 65 20 75 73 65  64 20 62 79 20 74 68 65  | are used by the|
000020c0  20 70 61 72 61 6c 6c 65  6c 20 70 72 69 6e 74 65  | parallel printe|
000020d0  72 20 69 6e 74 65 72 66  61 63 65 2e 20 54 68 65  |r interface. The|
000020e0  20 66 6f 6c 6c 6f 77 69  6e 67 0d 63 6f 64 65 20  | following.code |
000020f0  63 61 6e 20 62 65 20 75  73 65 64 20 74 6f 20 73  |can be used to s|
00002100  65 74 20 62 69 74 73 20  34 20 61 6e 64 20 36 20  |et bits 4 and 6 |
00002110  61 6e 64 20 63 6c 65 61  72 20 62 69 74 73 20 35  |and clear bits 5|
00002120  20 61 6e 64 20 37 20 6f  66 20 74 68 65 20 50 43  | and 7 of the PC|
00002130  52 3a 0d 0d 0d 20 20 4c  44 41 20 26 46 45 36 43  |R:...  LDA &FE6C|
00002140  20 20 5c 20 6c 6f 61 64  20 41 20 77 69 74 68 20  |  \ load A with |
00002150  74 68 65 20 63 6f 6e 74  65 6e 74 73 20 6f 66 20  |the contents of |
00002160  74 68 65 20 70 65 72 69  70 68 65 72 61 6c 20 63  |the peripheral c|
00002170  6f 6e 74 72 6f 6c 20 72  65 67 69 73 74 65 72 0d  |ontrol register.|
00002180  20 20 41 4e 44 20 23 26  30 46 20 20 20 5c 20 41  |  AND #&0F   \ A|
00002190  4e 44 20 77 69 74 68 20  25 30 30 30 30 31 31 31  |ND with %0000111|
000021a0  31 2c 20 69 65 2e 20 63  6c 65 61 72 20 62 69 74  |1, ie. clear bit|
000021b0  20 34 2d 37 0d 20 20 4f  52 41 20 23 26 35 30 20  | 4-7.  ORA #&50 |
000021c0  20 20 5c 20 4f 52 20 77  69 74 68 20 25 30 31 30  |  \ OR with %010|
000021d0  31 30 30 30 30 2c 20 69  65 2e 20 73 65 74 20 62  |10000, ie. set b|
000021e0  69 74 73 20 34 20 61 6e  64 20 36 0d 20 20 53 54  |its 4 and 6.  ST|
000021f0  41 20 26 46 45 36 43 20  20 5c 20 73 74 6f 72 65  |A &FE6C  \ store|
00002200  20 41 20 69 6e 20 74 68  65 20 70 65 72 69 70 68  | A in the periph|
00002210  65 72 61 6c 20 63 6f 6e  74 72 6f 6c 20 72 65 67  |eral control reg|
00002220  69 73 74 65 72 0d 0d 0d  4d 6f 75 73 65 20 67 65  |ister...Mouse ge|
00002230  6e 65 72 61 74 65 64 20  69 6e 74 65 72 72 75 70  |nerated interrup|
00002240  74 73 20 61 72 65 20 65  6e 61 62 6c 65 64 20 62  |ts are enabled b|
00002250  79 20 73 65 74 74 69 6e  67 20 62 69 74 73 20 33  |y setting bits 3|
00002260  20 61 6e 64 20 34 20 6f  66 20 74 68 65 0d 69 6e  | and 4 of the.in|
00002270  74 65 72 72 75 70 74 20  65 6e 61 62 6c 65 20 72  |terrupt enable r|
00002280  65 67 69 73 74 65 72 2e  20 53 65 74 74 69 6e 67  |egister. Setting|
00002290  20 74 68 65 73 65 20 62  69 74 73 20 75 73 65 73  | these bits uses|
000022a0  20 61 6e 20 6f 64 64 20  6d 65 74 68 6f 64 2e 20  | an odd method. |
000022b0  54 6f 20 61 6c 74 65 72  0d 61 20 62 69 74 20 69  |To alter.a bit i|
000022c0  6e 20 74 68 65 20 49 45  52 20 79 6f 75 20 6d 75  |n the IER you mu|
000022d0  73 74 20 77 72 69 74 65  20 61 20 6e 75 6d 62 65  |st write a numbe|
000022e0  72 20 74 6f 20 74 68 65  20 49 45 52 20 77 69 74  |r to the IER wit|
000022f0  68 20 61 20 31 20 69 6e  20 74 68 65 20 73 61 6d  |h a 1 in the sam|
00002300  65 0d 62 69 74 20 70 6f  73 69 74 69 6f 6e 2e 20  |e.bit position. |
00002310  49 66 20 62 69 74 20 37  20 6f 66 20 74 68 65 20  |If bit 7 of the |
00002320  6e 75 6d 62 65 72 20 69  73 20 73 65 74 20 74 68  |number is set th|
00002330  65 6e 20 74 68 65 20 73  65 6c 65 63 74 65 64 20  |en the selected |
00002340  62 69 74 20 28 6f 72 0d  62 69 74 73 29 20 77 69  |bit (or.bits) wi|
00002350  6c 6c 20 61 6c 73 6f 20  62 65 20 73 65 74 20 74  |ll also be set t|
00002360  6f 20 31 2e 20 49 66 20  62 69 74 20 37 20 6f 66  |o 1. If bit 7 of|
00002370  20 74 68 65 20 6e 75 6d  62 65 72 20 69 73 20 63  | the number is c|
00002380  6c 65 61 72 20 74 68 65  6e 20 74 68 65 0d 73 65  |lear then the.se|
00002390  6c 65 63 74 65 64 20 62  69 74 20 28 6f 72 20 62  |lected bit (or b|
000023a0  69 74 73 29 20 77 69 6c  6c 20 62 65 20 63 6c 65  |its) will be cle|
000023b0  61 72 65 64 2e 20 54 68  65 20 73 65 6c 65 63 74  |ared. The select|
000023c0  65 64 20 62 69 74 73 20  28 30 20 74 6f 20 36 29  |ed bits (0 to 6)|
000023d0  20 61 72 65 20 73 65 74  0d 74 6f 20 74 68 65 20  | are set.to the |
000023e0  73 61 6d 65 20 73 74 61  74 65 20 61 73 20 62 69  |same state as bi|
000023f0  74 20 37 2e 20 54 6f 20  73 65 74 20 62 69 74 73  |t 7. To set bits|
00002400  20 33 20 61 6e 64 20 34  20 6f 66 20 74 68 65 20  | 3 and 4 of the |
00002410  49 45 52 20 79 6f 75 20  68 61 76 65 20 74 6f 0d  |IER you have to.|
00002420  77 72 69 74 65 20 74 68  65 20 6e 75 6d 62 65 72  |write the number|
00002430  20 26 39 38 20 28 25 31  30 30 31 31 30 30 30 29  | &98 (%10011000)|
00002440  20 69 6e 74 6f 20 74 68  65 20 49 45 52 2e 20 42  | into the IER. B|
00002450  69 74 73 20 33 20 61 6e  64 20 34 20 77 69 6c 6c  |its 3 and 4 will|
00002460  20 74 68 65 6e 20 74 61  6b 65 0d 74 68 65 20 76  | then take.the v|
00002470  61 6c 75 65 20 6f 66 20  62 69 74 20 37 20 61 6e  |alue of bit 7 an|
00002480  64 20 77 69 6c 6c 20 62  65 20 73 65 74 2c 20 65  |d will be set, e|
00002490  6e 61 62 6c 69 6e 67 20  69 6e 74 65 72 72 75 70  |nabling interrup|
000024a0  74 73 20 66 72 6f 6d 20  43 42 31 20 61 6e 64 20  |ts from CB1 and |
000024b0  43 42 32 2e 0d 0d 57 68  65 6e 20 62 69 74 73 20  |CB2...When bits |
000024c0  33 20 61 6e 64 20 34 20  6f 66 20 74 68 65 20 49  |3 and 4 of the I|
000024d0  45 52 20 61 72 65 20 73  65 74 20 74 68 65 6e 20  |ER are set then |
000024e0  61 20 70 6f 73 69 74 69  76 65 20 74 72 61 6e 73  |a positive trans|
000024f0  69 74 69 6f 6e 20 6f 6e  20 43 42 31 0d 77 69 6c  |ition on CB1.wil|
00002500  6c 20 73 65 74 20 62 69  74 20 34 20 6f 66 20 74  |l set bit 4 of t|
00002510  68 65 20 69 6e 74 65 72  72 75 70 74 20 66 6c 61  |he interrupt fla|
00002520  67 20 72 65 67 69 73 74  65 72 20 61 6e 64 20 67  |g register and g|
00002530  65 6e 65 72 61 74 65 20  61 6e 20 49 52 51 0d 69  |enerate an IRQ.i|
00002540  6e 74 65 72 72 75 70 74  2e 20 41 20 70 6f 73 69  |nterrupt. A posi|
00002550  74 69 76 65 20 74 72 61  6e 73 69 74 69 6f 6e 20  |tive transition |
00002560  6f 6e 20 43 42 32 20 77  69 6c 6c 20 73 65 74 20  |on CB2 will set |
00002570  62 69 74 20 33 20 6f 66  20 74 68 65 20 49 46 52  |bit 3 of the IFR|
00002580  20 61 6e 64 0d 67 65 6e  65 72 61 74 65 20 61 6e  | and.generate an|
00002590  20 49 51 52 20 69 6e 74  65 72 72 75 70 74 2e 20  | IQR interrupt. |
000025a0  54 68 65 73 65 20 69 6e  74 65 72 72 75 70 74 73  |These interrupts|
000025b0  20 63 61 6e 20 62 65 20  72 65 63 6f 67 6e 69 73  | can be recognis|
000025c0  65 64 20 62 65 63 61 75  73 65 0d 65 69 74 68 65  |ed because.eithe|
000025d0  72 20 62 69 74 73 20 37  20 61 6e 64 20 33 20 6f  |r bits 7 and 3 o|
000025e0  66 20 49 46 52 20 6f 72  20 62 69 74 73 20 37 20  |f IFR or bits 7 |
000025f0  61 6e 64 20 34 20 6f 66  20 74 68 65 20 49 46 52  |and 4 of the IFR|
00002600  20 77 69 6c 6c 20 62 65  20 73 65 74 2e 0d 0d 4d  | will be set...M|
00002610  6f 75 73 65 20 67 65 6e  65 72 61 74 65 64 20 69  |ouse generated i|
00002620  6e 74 65 72 72 75 70 74  73 20 61 72 65 20 64 69  |nterrupts are di|
00002630  73 61 62 6c 65 64 20 62  79 20 77 72 69 74 69 6e  |sabled by writin|
00002640  67 20 74 68 65 20 6e 75  6d 62 65 72 20 26 30 38  |g the number &08|
00002650  0d 28 25 30 30 30 31 31  30 30 30 29 20 69 6e 74  |.(%00011000) int|
00002660  6f 20 74 68 65 20 49 45  52 2e 20 54 68 69 73 20  |o the IER. This |
00002670  63 6c 65 61 72 73 20 62  69 74 73 20 33 20 61 6e  |clears bits 3 an|
00002680  64 20 34 20 6f 66 20 74  68 65 20 49 45 52 20 73  |d 4 of the IER s|
00002690  6f 20 74 68 61 74 20 61  0d 70 6f 73 69 74 69 76  |o that a.positiv|
000026a0  65 20 67 6f 69 6e 67 20  74 72 61 6e 73 69 74 69  |e going transiti|
000026b0  6f 6e 20 6f 6e 20 43 42  31 20 6f 72 20 43 42 32  |on on CB1 or CB2|
000026c0  20 77 69 6c 6c 20 73 74  69 6c 6c 20 73 65 74 20  | will still set |
000026d0  65 69 74 68 65 72 20 62  69 74 20 34 20 6f 72 20  |either bit 4 or |
000026e0  62 69 74 0d 33 20 6f 66  20 74 68 65 20 49 46 52  |bit.3 of the IFR|
000026f0  20 62 75 74 20 69 74 20  77 69 6c 6c 20 6e 6f 74  | but it will not|
00002700  20 67 65 6e 65 72 61 74  65 20 61 6e 20 49 52 51  | generate an IRQ|
00002710  20 69 6e 74 65 72 72 75  70 74 2e 20 4d 6f 75 73  | interrupt. Mous|
00002720  65 20 67 65 6e 65 72 61  74 65 64 0d 69 6e 74 65  |e generated.inte|
00002730  72 72 75 70 74 73 20 63  61 6e 20 62 65 20 65 6e  |rrupts can be en|
00002740  61 62 6c 65 64 20 77 69  74 68 20 3f 26 46 45 36  |abled with ?&FE6|
00002750  45 3d 26 39 38 20 6f 72  20 2a 46 58 20 31 35 31  |E=&98 or *FX 151|
00002760  2c 37 38 2c 31 35 32 20  61 6e 64 20 64 69 73 61  |,78,152 and disa|
00002770  62 6c 65 64 0d 77 69 74  68 20 3f 26 46 45 36 45  |bled.with ?&FE6E|
00002780  3d 26 31 38 20 6f 72 20  2a 46 58 20 31 35 31 2c  |=&18 or *FX 151,|
00002790  37 38 2c 32 34 0d 0d 54  68 65 20 69 6e 74 65 72  |78,24..The inter|
000027a0  72 75 70 74 20 65 6e 61  62 6c 65 20 72 65 67 69  |rupt enable regi|
000027b0  73 74 65 72 20 61 6e 64  20 74 68 65 20 69 6e 74  |ster and the int|
000027c0  65 72 72 75 70 74 20 66  6c 61 67 20 72 65 67 69  |errupt flag regi|
000027d0  73 74 65 72 20 77 6f 72  6b 20 61 73 20 61 0d 70  |ster work as a.p|
000027e0  61 69 72 20 61 6e 64 20  74 68 65 20 66 6c 61 67  |air and the flag|
000027f0  20 72 65 67 69 73 74 65  72 20 6d 75 73 74 20 62  | register must b|
00002800  65 20 69 6e 74 65 72 72  6f 67 61 74 65 64 20 62  |e interrogated b|
00002810  79 20 61 20 70 72 6f 67  72 61 6d 20 74 6f 20 73  |y a program to s|
00002820  65 65 20 69 66 20 61 0d  6d 6f 75 73 65 20 63 6f  |ee if a.mouse co|
00002830  6e 6e 65 63 74 65 64 20  74 6f 20 74 68 65 20 55  |nnected to the U|
00002840  73 65 72 20 50 6f 72 74  20 69 73 20 74 68 65 20  |ser Port is the |
00002850  73 6f 75 72 63 65 20 6f  66 20 61 6e 20 69 6e 74  |source of an int|
00002860  65 72 72 75 70 74 2e 20  54 68 65 0d 69 6e 74 65  |errupt. The.inte|
00002870  72 70 72 65 74 61 74 69  6f 6e 20 6f 66 20 74 68  |rpretation of th|
00002880  65 20 62 69 74 73 20 69  6e 20 74 68 65 20 49 46  |e bits in the IF|
00002890  52 20 69 73 20 74 61 62  75 6c 61 74 65 64 20 69  |R is tabulated i|
000028a0  6e 20 66 69 67 75 72 65  20 33 20 77 68 69 63 68  |n figure 3 which|
000028b0  20 73 68 6f 77 73 0d 74  68 61 74 20 62 69 74 73  | shows.that bits|
000028c0  20 37 20 61 6e 64 20 33  20 6f 72 20 37 20 61 6e  | 7 and 3 or 7 an|
000028d0  64 20 34 20 6f 66 20 74  68 65 20 49 46 52 20 77  |d 4 of the IFR w|
000028e0  69 6c 6c 20 62 65 20 73  65 74 20 69 66 20 61 20  |ill be set if a |
000028f0  6d 6f 75 73 65 20 63 6f  6e 6e 65 63 74 65 64 0d  |mouse connected.|
00002900  74 6f 20 74 68 65 20 55  73 65 72 20 50 6f 72 74  |to the User Port|
00002910  20 69 73 20 74 68 65 20  73 6f 75 72 63 65 20 6f  | is the source o|
00002920  66 20 61 6e 20 69 6e 74  65 72 72 75 70 74 2e 0d  |f an interrupt..|
00002930  0d 0d 0d 20 20 20 20 20  20 20 20 20 20 20 20 20  |...             |
00002940  37 20 20 20 20 20 20 20  36 20 20 20 20 20 35 20  |7       6     5 |
00002950  20 20 20 20 34 20 20 20  20 20 33 20 20 20 20 20  |    4     3     |
00002960  32 20 20 20 20 20 31 20  20 20 20 20 30 0d 20 20  |2     1     0.  |
00002970  20 20 20 20 20 20 2b 2d  2d 2d 2d 2d 2d 2d 2d 2d  |      +---------|
00002980  2b 2d 2d 2d 2d 2d 2b 2d  2d 2d 2d 2d 2b 2d 2d 2d  |+-----+-----+---|
00002990  2d 2d 2b 2d 2d 2d 2d 2d  2b 2d 2d 2d 2d 2d 2b 2d  |--+-----+-----+-|
000029a0  2d 2d 2d 2d 2b 2d 2d 2d  2d 2d 2b 0d 20 20 26 46  |----+-----+.  &F|
000029b0  45 36 45 20 7c 53 65 74  2f 43 6c 65 61 72 7c 20  |E6E |Set/Clear| |
000029c0  54 31 20 20 7c 20 54 32  20 20 7c 20 43 42 31 20  |T1  | T2  | CB1 |
000029d0  7c 20 43 42 32 20 7c 20  53 52 20 20 7c 20 43 41  || CB2 | SR  | CA|
000029e0  31 20 7c 20 43 41 32 20  7c 20 49 45 52 0d 20 20  |1 | CA2 | IER.  |
000029f0  20 20 20 20 20 20 2b 2d  2d 2d 2d 2d 2d 2d 2d 2d  |      +---------|
00002a00  2b 2d 2d 2d 2d 2d 2b 2d  2d 2d 2d 2d 2b 2d 2d 2d  |+-----+-----+---|
00002a10  2d 2d 2b 2d 2d 2d 2d 2d  2b 2d 2d 2d 2d 2d 2b 2d  |--+-----+-----+-|
00002a20  2d 2d 2d 2d 2b 2d 2d 2d  2d 2d 2b 0d 20 20 26 46  |----+-----+.  &F|
00002a30  45 36 44 20 7c 20 20 20  49 52 51 20 20 20 7c 20  |E6D |   IRQ   | |
00002a40  54 31 20 20 7c 20 54 32  20 20 7c 20 43 42 31 20  |T1  | T2  | CB1 |
00002a50  7c 20 43 42 32 20 7c 20  53 52 20 20 7c 20 43 41  || CB2 | SR  | CA|
00002a60  31 20 7c 20 43 41 32 20  7c 20 49 46 52 0d 20 20  |1 | CA2 | IFR.  |
00002a70  20 20 20 20 20 20 2b 2d  2d 2d 2d 2d 2d 2d 2d 2d  |      +---------|
00002a80  2b 2d 2d 2d 2d 2d 2b 2d  2d 2d 2d 2d 2b 2d 2d 2d  |+-----+-----+---|
00002a90  2d 2d 2b 2d 2d 2d 2d 2d  2b 2d 2d 2d 2d 2d 2b 2d  |--+-----+-----+-|
00002aa0  2d 2d 2d 2d 2b 2d 2d 2d  2d 2d 2b 0d 0d 0d 0d 20  |----+-----+.... |
00002ab0  42 69 74 20 20 20 43 61  75 73 65 20 6f 66 20 69  |Bit   Cause of i|
00002ac0  6e 74 65 72 72 75 70 74  20 20 20 20 20 20 20 20  |nterrupt        |
00002ad0  49 6e 74 65 72 70 72 65  74 61 74 69 6f 6e 0d 2b  |Interpretation.+|
00002ae0  2d 2d 2d 2b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |---+------------|
00002af0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2b 2d 2d  |-------------+--|
00002b00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002b20  2d 2d 2d 2d 2d 2d 2d 2b  0d 7c 20 30 20 7c 20 43  |-------+.| 0 | C|
00002b30  68 61 6e 67 65 20 6f 66  20 73 69 67 6e 61 6c 20  |hange of signal |
00002b40  6f 6e 20 43 41 32 20 7c  20 50 72 69 6e 74 65 72  |on CA2 | Printer|
00002b50  20 73 74 72 6f 62 65 20  20 20 20 20 20 20 20 20  | strobe         |
00002b60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002b70  20 7c 0d 2b 2d 2d 2d 2b  2d 2d 2d 2d 2d 2d 2d 2d  | |.+---+--------|
00002b80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002b90  2d 2b 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |-+--------------|
00002ba0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002bb0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2b 0d 7c 20 31  |-----------+.| 1|
00002bc0  20 7c 20 43 68 61 6e 67  65 20 6f 66 20 73 69 67  | | Change of sig|
00002bd0  6e 61 6c 20 6f 6e 20 43  41 31 20 7c 20 50 72 69  |nal on CA1 | Pri|
00002be0  6e 74 65 72 20 61 63 6b  6e 6f 77 6c 65 64 67 65  |nter acknowledge|
00002bf0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002c00  20 20 20 20 20 7c 0d 2b  2d 2d 2d 2b 2d 2d 2d 2d  |     |.+---+----|
00002c10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002c20  2d 2d 2d 2d 2d 2b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |-----+----------|
00002c30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002c40  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2b  |---------------+|
00002c50  0d 7c 20 32 20 7c 20 43  6f 6d 70 6c 65 74 69 6f  |.| 2 | Completio|
00002c60  6e 20 6f 66 20 38 20 73  68 69 66 74 73 20 20 7c  |n of 8 shifts  ||
00002c70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002c90  20 20 20 20 20 20 20 20  20 7c 0d 7c 20 20 20 7c  |         |.|   ||
00002ca0  20 69 6e 20 74 68 65 20  73 68 69 66 74 20 72 65  | in the shift re|
00002cb0  67 69 73 74 65 72 20 20  20 7c 20 20 20 20 20 20  |gister   |      |
00002cc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002ce0  20 20 20 7c 0d 2b 2d 2d  2d 2b 2d 2d 2d 2d 2d 2d  |   |.+---+------|
00002cf0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002d00  2d 2d 2d 2b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |---+------------|
00002d10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002d20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2b 0d 7c  |-------------+.||
00002d30  20 33 20 7c 20 43 68 61  6e 67 65 20 6f 66 20 73  | 3 | Change of s|
00002d40  69 67 6e 61 6c 20 6f 6e  20 43 42 32 20 7c 20 4d  |ignal on CB2 | M|
00002d50  6f 75 73 65 20 6d 6f 76  65 6d 65 6e 74 20 69 6e  |ouse movement in|
00002d60  20 74 68 65 20 59 20 64  69 72 65 63 74 69 6f 6e  | the Y direction|
00002d70  20 20 20 20 20 20 20 7c  0d 2b 2d 2d 2d 2b 2d 2d  |       |.+---+--|
00002d80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002d90  2d 2d 2d 2d 2d 2d 2d 2b  2d 2d 2d 2d 2d 2d 2d 2d  |-------+--------|
00002da0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002dc0  2d 2b 0d 7c 20 34 20 7c  20 43 68 61 6e 67 65 20  |-+.| 4 | Change |
00002dd0  6f 66 20 73 69 67 6e 61  6c 20 6f 6e 20 43 42 31  |of signal on CB1|
00002de0  20 7c 20 4d 6f 75 73 65  20 6d 6f 76 65 6d 65 6e  | | Mouse movemen|
00002df0  74 20 69 6e 20 74 68 65  20 58 20 64 69 72 65 63  |t in the X direc|
00002e00  74 69 6f 6e 20 20 20 20  20 20 20 7c 0d 2b 2d 2d  |tion       |.+--|
00002e10  2d 2b 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |-+--------------|
00002e20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2b 2d 2d 2d 2d  |-----------+----|
00002e30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002e50  2d 2d 2d 2d 2d 2b 0d 7c  20 35 20 7c 20 54 69 6d  |-----+.| 5 | Tim|
00002e60  65 72 20 32 20 63 6f 6d  70 6c 65 74 65 20 20 20  |er 2 complete   |
00002e70  20 20 20 20 20 7c 20 20  20 20 20 20 20 20 20 20  |     |          |
00002e80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002e90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 7c  |               ||
00002ea0  0d 2b 2d 2d 2d 2b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.+---+----------|
00002eb0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2b  |---------------+|
00002ec0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002ee0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2b 0d 7c 20 36 20 7c  |---------+.| 6 ||
00002ef0  20 54 69 6d 65 72 20 31  20 63 6f 6d 70 6c 65 74  | Timer 1 complet|
00002f00  65 20 20 20 20 20 20 20  20 7c 20 20 20 20 20 20  |e        |      |
00002f10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002f30  20 20 20 7c 0d 2b 2d 2d  2d 2b 2d 2d 2d 2d 2d 2d  |   |.+---+------|
00002f40  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002f50  2d 2d 2d 2b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |---+------------|
00002f60  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002f70  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2b 0d 7c  |-------------+.||
00002f80  20 37 20 7c 20 41 6e 79  20 62 69 74 2c 20 30 20  | 7 | Any bit, 0 |
00002f90  74 6f 20 36 2c 20 69 73  20 73 65 74 20 7c 20 4f  |to 6, is set | O|
00002fa0  6e 65 20 6f 66 20 74 68  65 20 61 62 6f 76 65 20  |ne of the above |
00002fb0  69 6e 74 65 72 72 75 70  74 73 20 68 61 73 20 6f  |interrupts has o|
00002fc0  63 63 75 72 65 64 20 7c  0d 2b 2d 2d 2d 2b 2d 2d  |ccured |.+---+--|
00002fd0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002fe0  2d 2d 2d 2d 2d 2d 2d 2b  2d 2d 2d 2d 2d 2d 2d 2d  |-------+--------|
00002ff0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00003010  2d 2b 0d 0d 46 69 67 75  72 65 20 33 2e 20 54 68  |-+..Figure 3. Th|
00003020  65 20 69 6e 74 65 72 70  72 65 74 61 74 69 6f 6e  |e interpretation|
00003030  20 6f 66 20 56 49 41 2d  42 20 49 46 52 20 28 6d  | of VIA-B IFR (m|
00003040  6f 75 73 65 20 63 6f 6e  6e 65 63 74 65 64 20 74  |ouse connected t|
00003050  6f 20 55 73 65 72 20 50  6f 72 74 29 0d 2d 2d 2d  |o User Port).---|
00003060  2d 2d 2d 2d 2d 2d 20 2d  2d 2d 2d 2d 2d 2d 2d 2d  |------ ---------|
00003070  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000030a0  2d 2d 2d 2d 2d 0d 0d 0d  41 6e 20 69 6e 74 65 72  |-----...An inter|
000030b0  72 75 70 74 20 68 61 6e  64 6c 69 6e 67 20 72 6f  |rupt handling ro|
000030c0  75 74 69 6e 65 20 73 68  6f 75 6c 64 20 69 6e 74  |utine should int|
000030d0  65 72 6f 67 61 74 65 20  62 69 74 73 20 37 2c 20  |erogate bits 7, |
000030e0  33 20 61 6e 64 20 34 20  6f 66 20 74 68 65 20 49  |3 and 4 of the I|
000030f0  46 52 0d 74 6f 20 66 69  6e 64 20 6f 75 74 20 69  |FR.to find out i|
00003100  66 20 61 20 6d 6f 75 73  65 20 63 6f 6e 6e 65 63  |f a mouse connec|
00003110  74 65 64 20 74 6f 20 74  68 65 20 55 73 65 72 20  |ted to the User |
00003120  50 6f 72 74 20 69 73 20  74 68 65 20 73 6f 75 72  |Port is the sour|
00003130  63 65 20 6f 66 20 61 6e  20 49 52 51 0d 69 6e 74  |ce of an IRQ.int|
00003140  65 72 72 75 70 74 2e 20  42 69 74 73 20 37 20 61  |errupt. Bits 7 a|
00003150  6e 64 20 33 20 77 69 6c  6c 20 62 65 20 73 65 74  |nd 3 will be set|
00003160  20 69 66 20 74 68 65 20  6d 6f 75 73 65 20 69 73  | if the mouse is|
00003170  20 6d 6f 76 65 64 20 75  70 20 6f 72 20 64 6f 77  | moved up or dow|
00003180  6e 20 61 6e 64 0d 62 69  74 73 20 37 20 61 6e 64  |n and.bits 7 and|
00003190  20 34 20 77 69 6c 6c 20  62 65 20 73 65 74 20 69  | 4 will be set i|
000031a0  66 20 74 68 65 20 6d 6f  75 73 65 20 69 73 20 6d  |f the mouse is m|
000031b0  6f 76 65 64 20 66 72 6f  6d 20 73 69 64 65 20 74  |oved from side t|
000031c0  6f 20 73 69 64 65 2e 20  49 66 20 61 0d 6d 6f 75  |o side. If a.mou|
000031d0  73 65 20 69 73 20 74 68  65 20 73 6f 75 72 63 65  |se is the source|
000031e0  20 6f 66 20 61 6e 20 69  6e 74 65 72 72 75 70 74  | of an interrupt|
000031f0  20 74 68 65 6e 20 74 68  65 20 69 6e 74 65 72 72  | then the interr|
00003200  75 70 74 20 6d 75 73 74  20 62 65 20 63 6c 65 61  |upt must be clea|
00003210  72 65 64 20 62 79 0d 72  65 61 64 69 6e 67 20 74  |red by.reading t|
00003220  68 65 20 63 6f 6e 74 65  6e 74 73 20 6f 66 20 44  |he contents of D|
00003230  52 42 20 28 62 65 63 61  75 73 65 20 62 69 74 20  |RB (because bit |
00003240  35 20 6f 66 20 74 68 65  20 50 43 52 20 69 73 20  |5 of the PCR is |
00003250  63 6c 65 61 72 29 2e 20  59 6f 75 20 63 61 6e 0d  |clear). You can.|
00003260  74 68 65 72 65 66 6f 72  65 20 72 65 61 64 20 74  |therefore read t|
00003270  68 65 20 64 61 74 61 20  6c 69 6e 65 73 20 61 6e  |he data lines an|
00003280  64 20 63 6c 65 61 72 20  74 68 65 20 69 6e 74 65  |d clear the inte|
00003290  72 72 75 70 74 20 61 74  20 74 68 65 20 73 61 6d  |rrupt at the sam|
000032a0  65 20 74 69 6d 65 2e 0d  0d 54 68 65 20 70 6c 61  |e time...The pla|
000032b0  6e 65 20 6f 66 20 6d 6f  76 65 6d 65 6e 74 20 6f  |ne of movement o|
000032c0  66 20 61 20 6d 6f 75 73  65 20 63 61 6e 20 62 65  |f a mouse can be|
000032d0  20 64 65 74 65 72 6d 69  6e 65 64 20 66 72 6f 6d  | determined from|
000032e0  20 74 68 65 20 49 46 52  20 62 75 74 20 74 68 65  | the IFR but the|
000032f0  0d 64 69 72 65 63 74 69  6f 6e 20 6f 66 20 63 68  |.direction of ch|
00003300  61 6e 67 65 20 28 65 69  74 68 65 72 20 69 6e 63  |ange (either inc|
00003310  72 65 61 73 69 6e 67 20  6f 72 20 64 65 63 72 65  |reasing or decre|
00003320  61 73 69 6e 67 29 20 68  61 73 20 74 6f 20 62 65  |asing) has to be|
00003330  20 66 6f 75 6e 64 20 66  72 6f 6d 0d 74 68 65 20  | found from.the |
00003340  64 61 74 61 20 6c 69 6e  65 73 2e 20 41 20 6d 6f  |data lines. A mo|
00003350  76 65 6d 65 6e 74 20 65  69 74 68 65 72 20 75 70  |vement either up|
00003360  20 6f 72 20 64 6f 77 6e  20 77 69 6c 6c 20 73 65  | or down will se|
00003370  74 20 62 69 74 20 33 20  6f 66 20 74 68 65 20 49  |t bit 3 of the I|
00003380  46 52 2e 20 49 66 0d 62  69 74 20 33 20 6f 66 20  |FR. If.bit 3 of |
00003390  74 68 65 20 49 46 52 20  69 73 20 73 65 74 20 79  |the IFR is set y|
000033a0  6f 75 72 20 70 72 6f 67  72 61 6d 20 73 68 6f 75  |our program shou|
000033b0  6c 64 20 74 65 73 74 20  62 69 74 20 32 20 6f 66  |ld test bit 2 of|
000033c0  20 64 61 74 61 20 72 65  67 69 73 74 65 72 20 42  | data register B|
000033d0  2e 0d 49 66 20 62 69 74  20 32 20 6f 66 20 44 52  |..If bit 2 of DR|
000033e0  42 20 69 73 20 73 65 74  20 74 68 65 6e 20 59 20  |B is set then Y |
000033f0  69 73 20 64 65 63 72 65  61 73 69 6e 67 20 62 75  |is decreasing bu|
00003400  74 20 69 66 20 69 74 20  69 73 20 63 6c 65 61 72  |t if it is clear|
00003410  20 74 68 65 6e 20 59 20  69 73 0d 69 6e 63 72 65  | then Y is.incre|
00003420  61 73 69 6e 67 2e 20 41  20 6d 6f 76 65 6d 65 6e  |asing. A movemen|
00003430  74 20 66 72 6f 6d 20 73  69 64 65 20 74 6f 20 73  |t from side to s|
00003440  69 64 65 20 77 69 6c 6c  20 73 65 74 20 62 69 74  |ide will set bit|
00003450  20 34 20 6f 66 20 74 68  65 20 49 46 52 2e 20 59  | 4 of the IFR. Y|
00003460  6f 75 72 0d 70 72 6f 67  72 61 6d 20 73 68 6f 75  |our.program shou|
00003470  6c 64 20 74 68 65 6e 20  74 65 73 74 20 62 69 74  |ld then test bit|
00003480  20 30 20 6f 66 20 44 52  42 2e 20 49 66 20 69 74  | 0 of DRB. If it|
00003490  20 69 73 20 73 65 74 20  74 68 65 6e 20 58 20 69  | is set then X i|
000034a0  73 20 64 65 63 72 65 61  73 69 6e 67 2c 0d 69 66  |s decreasing,.if|
000034b0  20 69 74 20 69 73 20 63  6c 65 61 72 20 74 68 65  | it is clear the|
000034c0  6e 20 58 20 69 73 20 69  6e 63 72 65 61 73 69 6e  |n X is increasin|
000034d0  67 2e 0d 0d 54 68 65 20  64 61 74 61 20 6c 69 6e  |g...The data lin|
000034e0  65 73 20 61 6c 73 6f 20  67 69 76 65 20 74 68 65  |es also give the|
000034f0  20 73 74 61 74 75 73 20  6f 66 20 74 68 65 20 6d  | status of the m|
00003500  6f 75 73 65 20 62 75 74  74 6f 6e 73 2e 20 50 72  |ouse buttons. Pr|
00003510  65 73 73 69 6e 67 20 74  68 65 0d 72 69 67 68 74  |essing the.right|
00003520  20 62 75 74 74 6f 6e 20  63 6c 65 61 72 73 20 62  | button clears b|
00003530  69 74 20 37 20 6f 66 20  44 52 42 2c 20 70 72 65  |it 7 of DRB, pre|
00003540  73 73 69 6e 67 20 74 68  65 20 63 65 6e 74 72 65  |ssing the centre|
00003550  20 62 75 74 74 6f 6e 20  63 6c 65 61 72 73 20 62  | button clears b|
00003560  69 74 20 36 0d 61 6e 64  20 74 68 65 20 6c 65 66  |it 6.and the lef|
00003570  74 20 62 75 74 74 6f 6e  20 63 6c 65 61 72 73 20  |t button clears |
00003580  62 69 74 20 35 2e 0d 0d  54 68 65 20 61 75 78 69  |bit 5...The auxi|
00003590  6c 69 61 72 79 20 63 6f  6e 74 72 6f 6c 20 72 65  |liary control re|
000035a0  67 69 73 74 65 72 20 69  73 20 6f 66 20 70 61 73  |gister is of pas|
000035b0  73 69 6e 67 20 69 6e 74  65 72 65 73 74 20 62 65  |sing interest be|
000035c0  63 61 75 73 65 20 69 74  20 63 61 6e 0d 65 69 74  |cause it can.eit|
000035d0  68 65 72 20 73 65 74 20  6f 72 20 63 6c 65 61 72  |her set or clear|
000035e0  20 6c 61 74 63 68 69 6e  67 20 74 68 65 20 64 61  | latching the da|
000035f0  74 61 20 6c 69 6e 65 73  20 6f 6e 20 61 20 73 69  |ta lines on a si|
00003600  67 6e 61 6c 20 66 72 6f  6d 20 43 42 31 2e 20 54  |gnal from CB1. T|
00003610  68 69 73 0d 77 6f 75 6c  64 20 62 65 20 71 75 69  |his.would be qui|
00003620  74 65 20 75 73 65 66 75  6c 20 69 66 20 74 68 65  |te useful if the|
00003630  20 6d 6f 75 73 65 20 68  61 64 20 62 65 65 6e 20  | mouse had been |
00003640  64 65 73 69 67 6e 65 64  20 74 6f 20 75 73 65 20  |designed to use |
00003650  6f 6e 6c 79 20 6f 6e 65  0d 68 61 6e 64 73 68 61  |only one.handsha|
00003660  6b 65 20 6c 69 6e 65 20  62 75 74 2c 20 62 65 63  |ke line but, bec|
00003670  61 75 73 65 20 69 74 20  75 73 65 73 20 62 6f 74  |ause it uses bot|
00003680  68 20 43 42 31 20 61 6e  64 20 43 42 32 20 61 73  |h CB1 and CB2 as|
00003690  20 69 6e 70 75 74 73 2c  20 74 68 65 20 64 61 74  | inputs, the dat|
000036a0  61 0d 6c 69 6e 65 73 20  63 61 6e 20 6f 6e 6c 79  |a.lines can only|
000036b0  20 62 65 20 6c 61 74 63  68 65 64 20 66 6f 72 20  | be latched for |
000036c0  6d 6f 76 65 6d 65 6e 74  20 69 6e 20 74 68 65 20  |movement in the |
000036d0  58 20 64 69 72 65 63 74  69 6f 6e 2e 20 54 68 69  |X direction. Thi|
000036e0  73 20 73 65 65 6d 73 20  74 6f 0d 62 65 20 61 20  |s seems to.be a |
000036f0  70 69 74 79 20 62 75 74  20 74 68 65 20 41 4d 58  |pity but the AMX|
00003700  20 64 65 73 69 67 6e 20  69 73 20 61 6e 20 69 6e  | design is an in|
00003710  64 75 73 74 72 79 20 73  74 61 6e 64 61 72 64 20  |dustry standard |
00003720  66 6f 72 20 42 42 43 20  63 6f 6d 70 75 74 65 72  |for BBC computer|
00003730  73 20 61 6e 64 0d 77 65  20 68 61 76 65 20 74 6f  |s and.we have to|
00003740  20 6c 69 76 65 20 77 69  74 68 20 69 74 2e 20 59  | live with it. Y|
00003750  6f 75 20 63 61 6e 20 63  6c 65 61 72 20 62 69 74  |ou can clear bit|
00003760  20 31 20 6f 66 20 74 68  65 20 41 43 52 20 74 6f  | 1 of the ACR to|
00003770  20 64 69 73 61 62 6c 65  0d 6c 61 74 63 68 69 6e  | disable.latchin|
00003780  67 20 74 68 65 20 64 61  74 61 20 6c 69 6e 65 73  |g the data lines|
00003790  20 70 72 69 6f 72 20 74  6f 20 75 73 69 6e 67 20  | prior to using |
000037a0  61 20 6d 6f 75 73 65 2e  20 54 68 65 20 41 43 52  |a mouse. The ACR|
000037b0  20 69 73 20 63 6c 65 61  72 65 64 20 62 79 0d 70  | is cleared by.p|
000037c0  72 65 73 73 69 6e 67 20  74 68 65 20 42 72 65 61  |ressing the Brea|
000037d0  6b 20 6b 65 79 2e 0d 0d  54 68 65 20 73 74 61 74  |k key...The stat|
000037e0  75 73 20 6f 66 20 74 68  65 20 49 46 52 20 61 6e  |us of the IFR an|
000037f0  64 20 44 52 42 20 63 61  6e 20 62 65 20 64 65 6d  |d DRB can be dem|
00003800  6f 6e 73 74 72 61 74 65  64 20 77 69 74 68 20 74  |onstrated with t|
00003810  68 65 20 70 72 6f 67 72  61 6d 0d 54 45 53 54 4d  |he program.TESTM|
00003820  4f 55 2e 20 54 68 69 73  20 70 72 6f 67 72 61 6d  |OU. This program|
00003830  20 64 6f 65 73 20 6e 6f  74 20 65 6e 61 62 6c 65  | does not enable|
00003840  20 74 68 65 20 6d 6f 75  73 65 20 67 65 6e 65 72  | the mouse gener|
00003850  61 74 65 64 20 69 6e 74  65 72 72 75 70 74 73 20  |ated interrupts |
00003860  62 75 74 0d 69 74 20 64  6f 65 73 20 73 68 6f 77  |but.it does show|
00003870  20 74 68 65 20 63 6f 6e  74 69 6e 75 6f 75 73 6c  | the continuousl|
00003880  79 20 75 70 64 61 74 65  64 20 62 69 6e 61 72 79  |y updated binary|
00003890  20 73 74 61 74 75 73 20  6f 66 20 74 68 65 20 49  | status of the I|
000038a0  46 52 20 61 6e 64 20 44  52 42 2e 0d 43 6f 6e 6e  |FR and DRB..Conn|
000038b0  65 63 74 20 79 6f 75 72  20 6d 6f 75 73 65 20 74  |ect your mouse t|
000038c0  6f 20 74 68 65 20 63 6f  6d 70 75 74 65 72 2c 20  |o the computer, |
000038d0  73 77 69 74 63 68 20 6f  6e 2c 20 63 68 61 69 6e  |switch on, chain|
000038e0  20 74 68 65 20 70 72 6f  67 72 61 6d 20 54 45 53  | the program TES|
000038f0  54 4d 4f 55 0d 61 6e 64  20 6d 6f 76 65 20 74 68  |TMOU.and move th|
00003900  65 20 6d 6f 75 73 65 20  61 72 6f 75 6e 64 2e 20  |e mouse around. |
00003910  42 69 74 20 37 20 6f 66  20 74 68 65 20 49 46 52  |Bit 7 of the IFR|
00003920  20 69 73 20 61 6c 77 61  79 73 20 63 6c 65 61 72  | is always clear|
00003930  20 62 65 63 61 75 73 65  0d 69 6e 74 65 72 72 75  | because.interru|
00003940  70 74 73 20 68 61 76 65  20 6e 6f 74 20 62 65 65  |pts have not bee|
00003950  6e 20 65 6e 61 62 6c 65  64 2e 20 4d 6f 76 65 20  |n enabled. Move |
00003960  74 68 65 20 6d 6f 75 73  65 20 71 75 69 63 6b 6c  |the mouse quickl|
00003970  79 20 74 6f 20 65 69 74  68 65 72 20 74 68 65 0d  |y to either the.|
00003980  6c 65 66 74 20 6f 72 20  72 69 67 68 74 2e 20 59  |left or right. Y|
00003990  6f 75 20 73 68 6f 75 6c  64 20 73 65 65 20 43 42  |ou should see CB|
000039a0  31 20 73 65 74 20 77 68  69 6c 65 20 69 74 20 69  |1 set while it i|
000039b0  73 20 6d 6f 76 69 6e 67  20 61 6e 64 20 63 6c 65  |s moving and cle|
000039c0  61 72 20 61 73 20 73 6f  6f 6e 0d 61 73 20 69 74  |ar as soon.as it|
000039d0  20 73 74 6f 70 73 2e 20  53 69 6d 69 6c 61 72 6c  | stops. Similarl|
000039e0  79 20 6d 6f 76 65 20 74  68 65 20 6d 6f 75 73 65  |y move the mouse|
000039f0  20 71 75 69 63 6b 6c 79  20 75 70 20 61 6e 64 20  | quickly up and |
00003a00  64 6f 77 6e 20 74 6f 20  73 65 65 20 74 68 65 20  |down to see the |
00003a10  73 61 6d 65 0d 65 66 66  65 63 74 20 6f 6e 20 43  |same.effect on C|
00003a20  42 32 2e 20 41 74 20 74  68 65 20 73 61 6d 65 20  |B2. At the same |
00003a30  74 69 6d 65 20 79 6f 75  20 77 69 6c 6c 20 73 65  |time you will se|
00003a40  65 20 62 69 74 73 20 30  20 61 6e 64 20 32 20 6f  |e bits 0 and 2 o|
00003a50  66 20 44 52 42 20 63 68  61 6e 67 69 6e 67 0d 73  |f DRB changing.s|
00003a60  74 61 74 65 2e 20 59 6f  75 20 63 61 6e 20 61 6c  |tate. You can al|
00003a70  73 6f 20 73 65 65 20 74  68 65 20 65 66 66 65 63  |so see the effec|
00003a80  74 20 74 68 61 74 20 70  72 65 73 73 69 6e 67 20  |t that pressing |
00003a90  74 68 65 20 6d 6f 75 73  65 20 62 75 74 74 6f 6e  |the mouse button|
00003aa0  73 20 68 61 73 20 6f 6e  0d 44 52 42 2e 0d 0d 54  |s has on.DRB...T|
00003ab0  68 69 73 20 6d 6f 64 75  6c 65 20 68 61 73 20 65  |his module has e|
00003ac0  78 70 6c 61 69 6e 65 64  20 77 68 65 72 65 20 74  |xplained where t|
00003ad0  6f 20 66 69 6e 64 20 74  68 65 20 64 61 74 61 20  |o find the data |
00003ae0  70 72 6f 64 75 63 65 64  20 62 79 20 61 20 6d 6f  |produced by a mo|
00003af0  75 73 65 2e 20 54 68 65  0d 66 6f 6c 6c 6f 77 69  |use. The.followi|
00003b00  6e 67 20 6d 6f 64 75 6c  65 73 20 77 69 6c 6c 20  |ng modules will |
00003b10  65 78 70 6c 61 69 6e 20  68 6f 77 20 74 68 65 73  |explain how thes|
00003b20  65 20 64 61 74 61 20 63  61 6e 20 62 65 20 69 6e  |e data can be in|
00003b30  74 65 72 70 72 65 74 65  64 20 61 6e 64 20 75 73  |terpreted and us|
00003b40  65 64 2e 0d 0d 0d 20 20  20 31 30 20 52 45 4d 3e  |ed....   10 REM>|
00003b50  20 54 45 53 54 4d 4f 55  0d 20 20 20 32 30 20 44  | TESTMOU.   20 D|
00003b60  49 4d 20 6d 63 6f 64 65  20 26 31 30 30 20 3a 52  |IM mcode &100 :R|
00003b70  45 4d 3a 20 6d 61 63 68  69 6e 65 20 63 6f 64 65  |EM: machine code|
00003b80  20 61 74 20 6d 63 6f 64  65 0d 20 20 20 33 30 20  | at mcode.   30 |
00003b90  65 73 63 61 70 65 3d 26  46 46 20 3a 52 45 4d 3a  |escape=&FF :REM:|
00003ba0  20 65 73 63 61 70 65 20  66 6c 61 67 0d 20 20 20  | escape flag.   |
00003bb0  34 30 20 64 72 62 3d 26  46 45 36 30 20 3a 52 45  |40 drb=&FE60 :RE|
00003bc0  4d 3a 20 64 61 74 61 20  72 65 67 69 73 74 65 72  |M: data register|
00003bd0  20 42 0d 20 20 20 35 30  20 64 64 72 62 3d 26 46  | B.   50 ddrb=&F|
00003be0  45 36 32 20 3a 52 45 4d  3a 20 64 61 74 61 20 64  |E62 :REM: data d|
00003bf0  69 72 65 63 74 69 6f 6e  20 72 65 67 69 73 74 65  |irection registe|
00003c00  72 20 42 0d 20 20 20 36  30 20 69 66 72 3d 26 46  |r B.   60 ifr=&F|
00003c10  45 36 44 20 3a 52 45 4d  3a 20 69 6e 74 65 72 72  |E6D :REM: interr|
00003c20  75 70 74 20 66 6c 61 67  20 72 65 67 69 73 74 65  |upt flag registe|
00003c30  72 0d 20 20 20 37 30 20  6f 73 77 72 63 68 3d 26  |r.   70 oswrch=&|
00003c40  46 46 45 45 0d 20 20 20  38 30 20 6f 73 62 79 74  |FFEE.   80 osbyt|
00003c50  65 3d 26 46 46 46 34 0d  20 20 20 39 30 20 46 4f  |e=&FFF4.   90 FO|
00003c60  52 20 70 61 73 73 3d 30  20 54 4f 20 32 20 53 54  |R pass=0 TO 2 ST|
00003c70  45 50 20 32 0d 20 20 31  30 30 20 50 25 3d 6d 63  |EP 2.  100 P%=mc|
00003c80  6f 64 65 0d 20 20 31 31  30 20 5b 20 20 20 20 20  |ode.  110 [     |
00003c90  20 20 4f 50 54 20 70 61  73 73 0d 20 20 31 32 30  |  OPT pass.  120|
00003ca0  20 20 20 20 20 20 20 20  20 4c 44 41 20 23 26 30  |         LDA #&0|
00003cb0  30 0d 20 20 31 33 30 20  20 20 20 20 20 20 20 20  |0.  130         |
00003cc0  53 54 41 20 64 64 72 62  20 20 20 20 20 20 5c 20  |STA ddrb      \ |
00003cd0  64 61 74 61 20 72 65 67  69 73 74 65 72 20 42 20  |data register B |
00003ce0  3d 20 69 6e 70 75 74 0d  20 20 31 34 30 20 2e 6d  |= input.  140 .m|
00003cf0  61 69 6e 6c 6f 6f 70 0d  20 20 31 35 30 20 20 20  |ainloop.  150   |
00003d00  20 20 20 20 20 20 4c 44  58 20 23 31 36 0d 20 20  |      LDX #16.  |
00003d10  31 36 30 20 20 20 20 20  20 20 20 20 4c 44 59 20  |160         LDY |
00003d20  23 31 36 0d 20 20 31 37  30 20 20 20 20 20 20 20  |#16.  170       |
00003d30  20 20 4a 53 52 20 76 64  75 20 20 20 20 20 20 20  |  JSR vdu       |
00003d40  5c 20 56 44 55 20 33 31  2c 31 36 2c 31 36 0d 20  |\ VDU 31,16,16. |
00003d50  20 31 38 30 20 20 20 20  20 20 20 20 20 4c 44 41  | 180         LDA|
00003d60  20 64 72 62 20 20 20 20  20 20 20 5c 20 64 61 74  | drb       \ dat|
00003d70  61 20 72 65 67 69 73 74  65 72 20 42 0d 20 20 31  |a register B.  1|
00003d80  39 30 20 20 20 20 20 20  20 20 20 4a 53 52 20 62  |90         JSR b|
00003d90  69 6e 61 72 79 20 20 20  20 5c 20 70 72 69 6e 74  |inary    \ print|
00003da0  20 44 52 42 20 69 6e 20  62 69 6e 61 72 79 0d 20  | DRB in binary. |
00003db0  20 32 30 30 20 20 20 20  20 20 20 20 20 4c 44 58  | 200         LDX|
00003dc0  20 23 31 36 0d 20 20 32  31 30 20 20 20 20 20 20  | #16.  210      |
00003dd0  20 20 20 4c 44 59 20 23  31 38 0d 20 20 32 32 30  |   LDY #18.  220|
00003de0  20 20 20 20 20 20 20 20  20 4a 53 52 20 76 64 75  |         JSR vdu|
00003df0  20 20 20 20 20 20 20 5c  20 56 44 55 20 33 31 2c  |       \ VDU 31,|
00003e00  31 36 2c 31 38 0d 20 20  32 33 30 20 20 20 20 20  |16,18.  230     |
00003e10  20 20 20 20 4c 44 41 20  69 66 72 20 20 20 20 20  |    LDA ifr     |
00003e20  20 20 5c 20 69 6e 74 65  72 72 75 70 74 20 66 6c  |  \ interrupt fl|
00003e30  61 67 20 72 65 67 69 73  74 65 72 0d 20 20 32 34  |ag register.  24|
00003e40  30 20 20 20 20 20 20 20  20 20 4a 53 52 20 62 69  |0         JSR bi|
00003e50  6e 61 72 79 20 20 20 20  5c 20 70 72 69 6e 74 20  |nary    \ print |
00003e60  49 46 52 20 69 6e 20 62  69 6e 61 72 79 0d 20 20  |IFR in binary.  |
00003e70  32 35 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |250         LDA |
00003e80  65 73 63 61 70 65 20 20  20 20 5c 20 70 6f 6c 6c  |escape    \ poll|
00003e90  20 74 68 65 20 65 73 63  61 70 65 20 66 6c 61 67  | the escape flag|
00003ea0  0d 20 20 32 36 30 20 20  20 20 20 20 20 20 20 42  |.  260         B|
00003eb0  50 4c 20 6d 61 69 6e 6c  6f 6f 70 20 20 5c 20 6c  |PL mainloop  \ l|
00003ec0  6f 6f 70 20 69 66 20 65  73 63 61 70 65 20 6e 6f  |oop if escape no|
00003ed0  74 20 70 72 65 73 73 65  64 0d 20 20 32 37 30 20  |t pressed.  270 |
00003ee0  20 20 20 20 20 20 20 20  4c 44 41 20 23 26 37 45  |        LDA #&7E|
00003ef0  20 20 20 20 20 20 5c 20  61 63 6b 6e 6f 77 6c 65  |      \ acknowle|
00003f00  64 67 65 20 64 65 74 65  63 74 69 6f 6e 20 6f 66  |dge detection of|
00003f10  20 61 6e 20 45 73 63 61  70 65 20 63 6f 6e 64 69  | an Escape condi|
00003f20  74 69 6f 6e 0d 20 20 32  38 30 20 20 20 20 20 20  |tion.  280      |
00003f30  20 20 20 4a 4d 50 20 6f  73 62 79 74 65 20 20 20  |   JMP osbyte   |
00003f40  20 5c 20 61 63 6b 6e 6f  77 6c 65 64 67 65 20 45  | \ acknowledge E|
00003f50  73 63 61 70 65 20 61 6e  64 20 72 65 74 75 72 6e  |scape and return|
00003f60  20 74 6f 20 42 41 53 49  43 0d 20 20 32 39 30 20  | to BASIC.  290 |
00003f70  2e 62 69 6e 61 72 79 0d  20 20 33 30 30 20 20 20  |.binary.  300   |
00003f80  20 20 20 20 20 20 4c 44  58 20 23 26 30 38 20 20  |      LDX #&08  |
00003f90  20 20 20 20 5c 20 62 69  74 20 63 6f 75 6e 74 65  |    \ bit counte|
00003fa0  72 0d 20 20 33 31 30 20  2e 6e 65 78 74 62 69 74  |r.  310 .nextbit|
00003fb0  0d 20 20 33 32 30 20 20  20 20 20 20 20 20 20 41  |.  320         A|
00003fc0  53 4c 20 41 20 20 20 20  20 20 20 20 20 5c 20 6e  |SL A         \ n|
00003fd0  65 78 74 20 62 69 74 20  69 6e 74 6f 20 63 61 72  |ext bit into car|
00003fe0  72 79 20 66 6c 61 67 0d  20 20 33 33 30 20 20 20  |ry flag.  330   |
00003ff0  20 20 20 20 20 20 50 48  41 20 20 20 20 20 20 20  |      PHA       |
00004000  20 20 20 20 5c 20 73 61  76 65 20 74 68 65 20 72  |    \ save the r|
00004010  65 73 74 20 6f 66 20 74  68 65 20 62 79 74 65 0d  |est of the byte.|
00004020  20 20 33 34 30 20 20 20  20 20 20 20 20 20 4c 44  |  340         LD|
00004030  41 20 23 41 53 43 28 22  30 22 29 20 5c 20 69 66  |A #ASC("0") \ if|
00004040  20 63 61 72 72 79 20 63  6c 65 61 72 20 70 72 69  | carry clear pri|
00004050  6e 74 20 30 0d 20 20 33  35 30 20 20 20 20 20 20  |nt 0.  350      |
00004060  20 20 20 41 44 43 20 23  26 30 30 20 20 20 20 20  |   ADC #&00     |
00004070  20 5c 20 69 66 20 63 61  72 72 79 20 73 65 74 20  | \ if carry set |
00004080  61 64 64 20 31 0d 20 20  33 36 30 20 20 20 20 20  |add 1.  360     |
00004090  20 20 20 20 4a 53 52 20  6f 73 77 72 63 68 20 20  |    JSR oswrch  |
000040a0  20 20 5c 20 70 72 69 6e  74 20 30 20 6f 72 20 31  |  \ print 0 or 1|
000040b0  0d 20 20 33 37 30 20 20  20 20 20 20 20 20 20 50  |.  370         P|
000040c0  4c 41 20 20 20 20 20 20  20 20 20 20 20 5c 20 72  |LA           \ r|
000040d0  65 73 74 6f 72 65 20 74  68 65 20 72 65 73 74 20  |estore the rest |
000040e0  6f 66 20 74 68 65 20 62  79 74 65 0d 20 20 33 38  |of the byte.  38|
000040f0  30 20 20 20 20 20 20 20  20 20 44 45 58 20 20 20  |0         DEX   |
00004100  20 20 20 20 20 20 20 20  5c 20 64 65 63 72 65 6d  |        \ decrem|
00004110  65 6e 74 20 62 69 74 20  63 6f 75 6e 74 65 72 0d  |ent bit counter.|
00004120  20 20 33 39 30 20 20 20  20 20 20 20 20 20 42 4e  |  390         BN|
00004130  45 20 6e 65 78 74 62 69  74 20 20 20 5c 20 62 72  |E nextbit   \ br|
00004140  61 6e 63 68 20 66 6f 72  20 6e 65 78 74 20 62 69  |anch for next bi|
00004150  74 0d 20 20 34 30 30 20  20 20 20 20 20 20 20 20  |t.  400         |
00004160  52 54 53 0d 20 20 34 31  30 20 2e 76 64 75 0d 20  |RTS.  410 .vdu. |
00004170  20 34 32 30 20 20 20 20  20 20 20 20 20 4c 44 41  | 420         LDA|
00004180  20 23 33 31 0d 20 20 34  33 30 20 20 20 20 20 20  | #31.  430      |
00004190  20 20 20 4a 53 52 20 6f  73 77 72 63 68 20 20 20  |   JSR oswrch   |
000041a0  20 5c 20 56 44 55 20 33  31 0d 20 20 34 34 30 20  | \ VDU 31.  440 |
000041b0  20 20 20 20 20 20 20 20  54 58 41 0d 20 20 34 35  |        TXA.  45|
000041c0  30 20 20 20 20 20 20 20  20 20 4a 53 52 20 6f 73  |0         JSR os|
000041d0  77 72 63 68 20 20 20 20  5c 20 56 44 55 20 58 0d  |wrch    \ VDU X.|
000041e0  20 20 34 36 30 20 20 20  20 20 20 20 20 20 54 59  |  460         TY|
000041f0  41 0d 20 20 34 37 30 20  20 20 20 20 20 20 20 20  |A.  470         |
00004200  4a 4d 50 20 6f 73 77 72  63 68 20 20 20 20 5c 20  |JMP oswrch    \ |
00004210  56 44 55 20 59 20 61 6e  64 20 72 65 74 75 72 6e  |VDU Y and return|
00004220  0d 20 20 34 38 30 20 5d  0d 20 20 34 39 30 20 4e  |.  480 ].  490 N|
00004230  45 58 54 0d 20 20 35 30  30 20 4d 4f 44 45 37 0d  |EXT.  500 MODE7.|
00004240  20 20 35 31 30 20 56 44  55 32 33 2c 31 2c 30 3b  |  510 VDU23,1,0;|
00004250  30 3b 30 3b 30 3b 0d 20  20 35 32 30 20 6d 6f 75  |0;0;0;.  520 mou|
00004260  73 65 24 3d 43 48 52 24  31 34 31 2b 43 48 52 24  |se$=CHR$141+CHR$|
00004270  31 33 32 2b 43 48 52 24  31 35 37 2b 43 48 52 24  |132+CHR$157+CHR$|
00004280  31 33 31 0d 20 20 20 20  20 20 2b 22 55 73 65 72  |131.      +"User|
00004290  20 70 6f 72 74 20 69 6e  70 75 74 20 61 6e 64 20  | port input and |
000042a0  73 74 61 74 75 73 20 62  79 74 65 73 20 20 22 2b  |status bytes  "+|
000042b0  43 48 52 24 31 35 36 0d  20 20 35 33 30 20 50 52  |CHR$156.  530 PR|
000042c0  49 4e 54 54 41 42 28 30  2c 35 29 6d 6f 75 73 65  |INTTAB(0,5)mouse|
000042d0  24 0d 20 20 35 34 30 20  50 52 49 4e 54 54 41 42  |$.  540 PRINTTAB|
000042e0  28 30 2c 36 29 6d 6f 75  73 65 24 0d 20 20 35 35  |(0,6)mouse$.  55|
000042f0  30 20 50 52 49 4e 54 54  41 42 28 31 36 2c 31 34  |0 PRINTTAB(16,14|
00004300  29 22 37 36 35 34 33 32  31 30 22 0d 20 20 35 36  |)"76543210".  56|
00004310  30 20 50 52 49 4e 54 54  41 42 28 39 2c 31 36 29  |0 PRINTTAB(9,16)|
00004320  22 26 46 45 36 30 20 25  20 20 20 20 20 20 20 20  |"&FE60 %        |
00004330  20 44 52 42 22 0d 20 20  35 37 30 20 50 52 49 4e  | DRB".  570 PRIN|
00004340  54 54 41 42 28 39 2c 31  38 29 22 26 46 45 36 44  |TTAB(9,18)"&FE6D|
00004350  20 25 20 20 20 20 20 20  20 20 20 49 46 52 22 0d  | %         IFR".|
00004360  20 20 35 38 30 20 50 52  49 4e 54 54 41 42 28 31  |  580 PRINTTAB(1|
00004370  39 2c 32 30 29 22 43 43  22 0d 20 20 35 39 30 20  |9,20)"CC".  590 |
00004380  50 52 49 4e 54 54 41 42  28 31 39 2c 32 31 29 22  |PRINTTAB(19,21)"|
00004390  42 42 22 0d 20 20 36 30  30 20 50 52 49 4e 54 54  |BB".  600 PRINTT|
000043a0  41 42 28 31 39 2c 32 32  29 22 31 32 22 0d 20 20  |AB(19,22)"12".  |
000043b0  36 31 30 20 43 41 4c 4c  20 6d 63 6f 64 65 0d 20  |610 CALL mcode. |
000043c0  20 36 32 30 20 56 44 55  33 31 2c 30 2c 32 34 0d  | 620 VDU31,0,24.|
000043d0  20 20 36 33 30 20 56 44  55 32 33 2c 31 2c 31 3b  |  630 VDU23,1,1;|
000043e0  30 3b 30 3b 30 3b 0d 20  20 36 34 30 20 45 4e 44  |0;0;0;.  640 END|
000043f0  0d                                                |.|
000043f1
18-11-88/T\MOU00.m0
18-11-88/T\MOU00.m1
18-11-88/T\MOU00.m2
18-11-88/T\MOU00.m4
18-11-88/T\MOU00.m5