; -----------------------------------------------------------------------------
; IEEEFS 0.05 (c) Intelligent Interfaces Ltd. 1983
; reverse engineered by Eelco Huininga
; Filename     : IEEEFS-0.5.rom
; Load address : 00008000
; Exec address : 0000D9CD
; Length       : 00002000
; -----------------------------------------------------------------------------

fsnumber           = 7                            ; IEEEFS Filing system number
handlemin          = &FE                          ; File handle range (minimum)
handlemax          = &FF                          ; File handle range (maximum)
datahandle         = &FE                          ; File handle for the DATA channel
cmdhandle          = &FF                          ; File handle for the COMMAND channel

; -----------------------------------------------------------------------------
; TMS9914A registers
; -----------------------------------------------------------------------------
intstatus0         = &FC20                        ; (read)  Interrupt Status Register 0
intstatus1         = &FC24                        ; (read)  Interrupt Status Register 1
addrstatus         = &FC22                        ; (read)  Address Status Register
busstatus          = &FC26                        ; (read)  Bus Status Register
cmdpassthru        = &FC23                        ; (read)  Command Pass Through Register
datin              = &FC27                        ; (read)  Data In Register

intmask0           = &FC20                        ; (write) Interrupt Mask Register 0
intmask1           = &FC24                        ; (write) Interrupt Mask Register 1
auxcmd             = &FC26                        ; (write) Auxiliary Command Register
address            = &FC21                        ; (write) Address Register
serpoll            = &FC25                        ; (write) Serial Poll Register
parpoll            = &FC23                        ; (write) Parallel Poll Register
datout             = &FC27                        ; (write) Data Out Register

; -----------------------------------------------------------------------------
; TMS9914 Auxiliary commands
; -----------------------------------------------------------------------------
set                = &80                          ; Set flag
clr                = &00                          ; Clear flag

swrst              = &00                          ; Software reset
dacr               = &01                          ; Release DAC (Data Accepted) holdoff
rhdf               = &02                          ; Release RFD (Ready For Data) holdoff
hdfa               = &03                          ; Holfoff on all data
hdfe               = &04                          ; Holfoff on EOI (End or Identify) only
nbaf               = &05                          ; New byte available false
fget               = &06                          ; Force group execute trigger
rtl                = &07                          ; Return to local
feoi               = &08                          ; Send EOI (End or Identify) with next byte
lon                = &09                          ; Listen only
ton                = &0A                          ; Talk only
gts                = &0B                          ; Go to standby
tca                = &0C                          ; Take control asynchronously
tcs                = &0D                          ; Take control synchronously
rpp                = &0E                          ; Request parallel poll
sic                = &0F                          ; Send interface clear
sre                = &10                          ; Send remote enable
rqc                = &11                          ; Request control
rlc                = &12                          ; Release control
dai                = &13                          ; Disable all interrupts
pts                = &14                          ; Pass through next secondary
stdl               = &15                          ; Short T1 settling time
shdw               = &16                          ; Shadow handshake
vstdl              = &17                          ; Very short T1 delay
rsv2               = &18                          ; Request service bit 2

; -----------------------------------------------------------------------------
; OS call addresses
; -----------------------------------------------------------------------------
filev              = &0212                        ; FILEV Read or write a whole file or its attributes
osasci             = &FFE3                        ; OSASCI Write character routine
osnewl             = &FFE7                        ; OSNEWL Write a new-line routine
osword             = &FFF1                        ; OSWORD Various OS routines
osbyte             = &FFF4                        ; OSBYTE Various OS routines


; -----------------------------------------------------------------------------
; Start of code
; -----------------------------------------------------------------------------

8000  00           .     EQUB &00                 ; Language entry
8001  00           .     EQUB &00
8002  00           .     EQUB &00
8003  4C 90 83     L..   JMP service              ; Service entry
8006  82           .     EQUB &82                 ; ROM type; 1....... : Service entry: set
                                                  ;           .0...... : Language entry: not set
                                                  ;           ..0..... : Relocatable to the second processor: not set
                                                  ;           ...0.... : Electron firm key expansions availabe: not set
                                                  ;           ....0010 : Processor type: 6502 code (not BASIC)
8007  20                 EQUB &20                 ; Copyright offset
8008  02           .     EQUB &02                 ; Version 2
.title
8009  49 45 45 45  IEEE  EQUS "IEEE Filing System"
      20 46 69 6C   Fil                           ; Title string
      69 6E 67 20  ing 
      53 79 73 74  Syst
      65 6D        em
801B  00           .     EQUB &00                 ; Title termination byte

.version
801C  30 2E 30 35        EQUS "0.05"              ; Version string
8020  00           .     EQUB &00                 ; Version termination byte

.copyright
8021  28 43 29 31  (C)1  EQUS "(C)1983 INTELLIGENT INTERFACES LTD AND ACORN COMPUTERS LTD"
      39 38 33 20  993                            ; Copyright string
      49 4E 54 45  INTE
      4C 4C 49 47  LLIG
      45 4E 54 20  ENT 
      49 4E 54 45  INTE
      52 46 41 43  RFAC
      45 53 20 4C  ES L
      54 44 20 41  TD A
      4E 44 20 41  ND A
      43 4F 52 4E  CORN
      20 43 4F 4D   COM
      50 55 54 45  PUTE
      52 53 20 4C  RS L
      54 44        TD
805B  00           .     EQUB &00                 ; Copyright termination byte

; -----------------------------------------------------------------------------
; Unused byte?
; -----------------------------------------------------------------------------
.
805C  00           .     EQUB &00                 ; Unused byte???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
805D  4C 3F 93     L?.   JMP &933F                ; Jump to FILEV handler
.
8060  4C E0 8E     L..   JMP &8EE0                ; Jump to ARGSV handler 
.
8063  4C 6D 89     Lm.   JMP &896D                ; Jump to BGETV handler
.
8066  4C 31 8A     L1.   JMP &8A31                ; Jump to BPUTV handler
.
8069  4C 3F 93     L?.   JMP &933F                ; Jump to GPBPV handler
.
806C  4C 14 8D     L..   JMP &8D14                ; Jump to FINDV handler
.
806F  4C F6 8E     L..   JMP &8EF6                ; Jump to FSCV handler

; -----------------------------------------------------------------------------
; Command to start IEEEFS
; -----------------------------------------------------------------------------
.
8072  0D           .     EQUB &0D                 ; Command to start IEEEFS
8073  45 45 45     EEEI  EQUS "EEEI"

; -----------------------------------------------------------------------------
; Vectors table
; -----------------------------------------------------------------------------
.
8077  1B           .     EQUB &1B                 ; Point to extended vector FILEV (&FF1B)
8078  1E           .     EQUB &1E                 ; Point to extended vector ARGSV (&FF1E)
8079  21           !     EQUB &21                 ; Point to extended vector BGETV (&FF21)
807A  24           $     EQUB &24                 ; Point to extended vector BPUTV (&FF24)
807B  27           '     EQUB &27                 ; Point to extended vector GPBPV (&FF27)
807C  2A           *     EQUB &2A                 ; Point to extended vector FINDV (&FF2A)
807D  2D           -     EQUB &2D                 ; Point to extended vector FSCV (&FF2D)

; -----------------------------------------------------------------------------
; Extended vectors table
; -----------------------------------------------------------------------------
.
807E  5D           `     EQUB &5D                 ; New address for vector FILEV (&805D)
807F  60           ]     EQUB &60                 ; New address for vector ARGSV (&8060)
8080  63           c     EQUB &63                 ; New address for vector BGETV (&8063)
8081  66           f     EQUB &66                 ; New address for vector BPUTV (&8066)
8082  69           i     EQUB &69                 ; New address for vector GPBPV (&8069)
8083  6C           l     EQUB &6C                 ; New address for vector FINDV (&806C)
8084  6F           o     EQUB &6F                 ; New address for vector FSCV  (&806F)

; -----------------------------------------------------------------------------
; Initialisation values for zero page &B0-&B9 and &C0-&C9
; -----------------------------------------------------------------------------
.                                                 ; Pointers to locations in the private workspace
8085  00           .     EQUB &00                 ; &B0-&B1/&C0-&C1: privateworkspace+&00 (&1900)
8086  20                 EQUB &20                 ; &B2-&B3/&C2-&C3: privateworkspace+&20 (&1820)
8087  2F           /     EQUB &2F                 ; &B4-&B5/&C4-&C5: privateworkspace+&2F (&182F)
8088  0B           .     EQUB &0B                 ; &B6-&B7/&C6-&C7: privateworkspace+&0B (&190B)
8089  2C           ,     EQUB &2C                 ; &B8-&B9/&C8-&C9: privateworkspace+&2C (&192C)

; -----------------------------------------------------------------------------
; Unused bytes???
; -----------------------------------------------------------------------------
.
808A  52 08        ,R.   BIT &0852
808C  28           (     PLP
808D  07           .     ...
808E  50 00        P.    BVC &8090

; -----------------------------------------------------------------------------
; Error messages
; -----------------------------------------------------------------------------
.                                                 ; Error &DE : Channel
8090  07           .     EQUB &07                 ; Length of error message
8091  43 68 61 6E  Chan  EQUS "Channel"           ; Error message
      6E 65 6C     nel
8098  DE           .     EQUB &DE                 ; Error number

.                                                 ; Error &DC : Syntax
8099  06           .     EQUB &06
809A  53 79 6E 74  Synt  EQUS "Syntax"
      61 78        ax
80A0  DC           .     EQUB &DC

.                                                 ; Error &06 : Type mismatch
80A1  0D           .     EQUB &0D
80A2  54 79 70 65  Type  EQUS "Type mismatch"
      20 6D 69 73   mis
      6D 61 74 63  matc
      68           h
80AF  06                 EQUB &06

.                                                 ; Error &88 : Out of range
80B0  0C           .     EQUB &0C
80B1  4F 75 74 20  Out   EQUS "Out of range"
      6F 66 20 72  of r
      61 6E 67 65  ange
80BD  88           .     EQUB &88

.                                                 ; Error &8B : No BBC device no
80BE  10           .     EQUB &10
80BF  4E 6F 20 42  No B  EQUS "No BBC device no"
      42 43 20 64  BC D
      65 76 69 63  evic
      65 20 6E 6F  e no
80CF  8B           .     EQUB &8B

.                                                 ; Error &89 : No device talked
80D0  10           .     EQUB &10
80D1  4E 6F 20 64  No d  EQUS "No device talked"
      65 76 69 63  evic
      65 20 74 61  e ta
      6C 6B 65 64  lked
80E1  89           .     ...

.                                                 ; Error &8A : No device listened
80E2  12           .     EQUB &12
80E3  4E 6F 20 64  No d  EQUS "No device listened"
      65 76 69 63  evic
      65 20 6C 69  e li
      73 74 65 6E  sten
      65 64        ed
80F5  8A           .     EQUB &8A

.                                                 ; Error &8D : String too long
80F6  0F           .     ...
80F7  53 74 72 69  Stri  EQUS "String too long"
      6E 67 20 74  ng t
      6F 6F 20 6C  oo l
      6F 6E 67     ong
8106  8D           .     EQUB &8D

.                                                 ; Error &8C : Clear not executed
8107  12           .     ...
8108  43 6C 65 61  Clea  EQUS "Clear not executed"
      72 20 6E 6F  r no
      74 20 65 78  t ex
      65 63 75 74  ecut
      65 64        ed
811A  8C           .     EQUB &8C

.                                                 ; Error &FE : Bad command
811B  0B           .     EQUB &0B
811C  42 61 64 20  Bad   EQUS "Bad command"
      63 6F 6D 6D  comm
      61 6E 64     and
8127  FE           .     EQUB &FE

; -----------------------------------------------------------------------------
; Unused bytes ???
; -----------------------------------------------------------------------------
.
8128  FA           .     ...
8129  2F           /     ...
812A  B7           .     ...
812B  7F                ...
812C  FB           .     ...
812D  7F                ...
812E  D4           .     ...
812F  FF           .     ...
8130  22           "     ...
8131  06 10        ..    ASL &10
8133  08           .     PHP
8134  08           .     PHP
8135  03           .     ...
8136  C9 40        .@    CMP #&40
8138  FF           .     ...
8139  BF           .     ...
813A  BF           .     ...
813B  FF           .     ...
813C  FE DF FC     ...   INC &FCDF,X
813F  FF           .     EQUB &FF

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
8140  54           T     EQUB &54
8141  4C           L     EQUB &4C
8142  55           U     EQUB &55
8143  53           S     EQUB &53
8144  52           R     EQUB &52
8145  57           W     EQUB &57
8146  42           B     EQUB &42
8147  43           C     EQUB &43
8148  45           E     EQUB &45
8149  47           G     EQUB &47
814A  44           D     EQUB &44
814B  50           P     EQUB &50
814C  80           .     EQUB &80

.
814D  01           .     EQUB &01
814E  29           )     EQUB &29
814F  3B           ;     EQUB &3B
8150  48           H     EQUB &48
8151  6A           j     EQUB &6A
8152  94           .     EQUB &94
8153  9F           .     EQUB &9F
8154  AA           .     EQUB &AA
8155  AF           .     EQUB &AF
8156  BA           .     EQUB &BA
8157  C3           .     EQUB &C3
8158  CE           .     EQUB &CE
8159  00           .     EQUB &00

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
815A  41 4C 4B     ALK   EQUS "ALK"               ; TALK
915D  90           .     EQUB &90
815E  4B 45 43 4F  KECO  EQUS "KECONTROL"         ; TAKECONTROL
      4E 54 52 4F  NTRO
      4C           L
8167  92           .     EQUB &92
8168  52 41 4E 53  RANS  EQUS "RANSFER"           ; TRANSFER
      46 45 52     FER
816F  91           .     EQUB &91
8170  49 47 47 45  IGGE  EQUS "IGGER"             ; TRIGGER
      52           R
8175  91           .     EQUB &91
8176  49 4D 45 4F  IMEO  EQUS "IMEOUTON"          ; TIMEOUTON
      55 54 4F 4E  UTON
817E  8F           .     EQUB &8F
817F  46 46        FF    EQUS "FF"                ; TIMEOUTOFF
8181  8F           .     EQUB &8F
8182  49 53 54 45  ISTE  EQUS "ISTEN"             ; LISTEN
      4E           N
8187  90           .     EQUB &90
8188  4F 43 41 4C  OCAL  EQUS "OCALLOCKOUT"       ; LOCALLOCKOUT
      4C 4F 43 4B  LOCK
      4F 55 54     OUT
8193  91           .     EQUB &91
8194  4E 54 41 4C  NTAL  EQUS "NTALK"             ; UNTALK
      4B           L
8199  91           .     EQUB &91
819A  4C 49 53 54  LIST  EQUS "LISTEN"            ; UNLISTEN
      45 4E        EN
81A0  90           .     EQUB &90
81A1  54 41 54 55  TATU  EQUS "TATUS"             ; STATUS
      53           S
81A6  90           .     EQUB &90
81A7  45 52 49 41  ERIA  EQUS "ERIALPOLL"         ; SERIALPOLL
      4C 50 4F 4C  LPOL
      4C           L
81B0  92           .     EQUB &92
81B1  4C 45 43 54  LECT  EQUS "LECTEDDEVICECLEAR" ; SELECTEDDEVICECLEAR
      45 44 44 45  EDDE
      56 49 43 45  VICE
      43 4C 45 41  CLEA
      52           R
81C2  91           .     EQUB &91
81C3  45 41 44 42  EADB  EQUS "EADBINARY"         ; READBINARY
      49 4E 41 52  INAR
      59           Y
81CC  90           .     EQUB &90
81CD  4D 4F 54 45  MOTE  EQUS "MOTEENABLE"        ; REMOTEENABLE
      45 4E 41 42  ENAB
      4C 45        LE
81D7  92           .     EQUB &92
81D8  44 49 53 41  DISA  EQUS "DISABLE"           ; REMOTEDISABLE
      42 4C 45     BLE
81DF  92           .     EQUB &92
81E0  51 55 45 53  QUES  EQUS "QUESTCONTROL"      ; REQUESTCONTROL
      54 43 4F 4E  TCON
      54 52 4F 4C  TROL
81EC  92           .     EQUB &92
81ED  52 49 54 45  RITE  EQUS "RITEBINARY"        ; WRITEBINARY
      42 49 4E 41  BINA
      52 59        RY
81F7  90           .     EQUB &90
81F8  42 43 44 45  BCDE  EQUS "BCDEVICENO"        ; BBCDEVICENO
      56 49 43 45  VICE
      4E 4F        NO
8202  8F           .     EQUB &8F
8203  4C 45 41 52  LEAR  EQUS "LEAR"              ; CLEAR
8207  8F           .     EQUB &8F
8208  4E 44 4F 46  NDOF  EQUS "NDOFSTRING"        ; ENDOFSTRING
      53 54 52 49  STRI
      4E 47        NG
8212  8F           .     EQUS &8F
8213  4F 54 4F 4C  OTOL  EQUS "OTOLOCAL"          ; GOTOLOCAL
      4F 43 41 4C  OCAL
821B  91           .     EQUB &91
821C  45 56 49 43  EVIC  EQUS "EVICECLEAR"        ; DEVICECLEAR
      45 43 4C 45  ECLE
      41 52        AR
8226  91           .     EQUB &91
8227  41 52 41 4C  ARAL  EQUS "ARALLELPOLLREQUEST"; PARALLELPOLLREQUEST
      4C 45 4C 50  LELP
      4F 4C 4C 52  OLLR
      45 51 55 45  EQUE
      53 54        ST
8239  92           .     EQUB &92
823A  45 4E 41 42  ENAB  EQUS "ENABLE"            ; PARALLELPOLLENABLE
      4C 45        LE
8240  91           .     EQUB &91
8241  44 49 53 41  DISA  EQUS "DISABLE"           ; PARALLELPOLLDISABLE
      42 4C 45     BLE
8248  91           .     EQUB &91
8249  55 4E 43 4F  UNCO  EQUS "UNCONFIGURE"       ; PARALLELPOLLUNCONFIGURE
      4E 46 49 47  NFIG
      55 52 45     URE
8254  91           .     EQUB &91

; -----------------------------------------------------------------------------
; LSB of * command routines
; -----------------------------------------------------------------------------
.
8255  0F           .     ...
8256  05 00        ..    ORA &00
8258  C6 00        ..    DEC &00
825A  00           .     BRK
825B  00           .     BRK
825C  00           .     BRK
825D  00           .     BRK
825E  00           .     BRK
825F  00           .     BRK
8260  00           .     BRK
8261  00           .     BRK
8262  8D 1D 17     ...   STA &171D
8265  00           .     BRK
8266  00           .     BRK
8267  00           .     BRK
8268  00           .     BRK
8269  00           .     BRK
826A  1A           .     ...
826B  00           .     BRK
826C  00           .     BRK
826D  00           .     BRK
826E  00           .     BRK
826F  00           .     BRK
8270  93           .     ...
8271  00           .     BRK
8272  00           .     BRK
8273  00           .     BRK
8274  00           .     BRK
8275  00           .     BRK
8276  00           .     BRK
8277  00           .     BRK
8278  26 DA        &.    ROL &DA
827A  00           .     BRK
827B  00           .     BRK
827C  CF           .     ...
827D  2F           /     ...
827E  00           .     BRK
827F  00           .     BRK
8280  00           .     BRK
8281  00           .     BRK
8282  9C           .     ...
8283  00           .     BRK
8284  00           .     BRK
8285  00           .     BRK
8286  00           .     BRK
8287  00           .     BRK
8288  00           .     BRK
8289  00           .     BRK
828A  00           .     BRK
828B  00           .     BRK
828C  00           .     BRK
828D  00           .     BRK
828E  BF           .     ...
828F  00           .     BRK
8290  41 00        ..    EOR (&00,X)
8292  00           .     BRK
8293  00           .     BRK
8294  06 00        ..    ASL &00
8296  00           .     BRK
8297  00           .     BRK
8298  00           .     BRK
8299  00           .     BRK
829A  00           .     BRK
829B  B2           .     ...
829C  4E 00 00     N..   LSR &0000
829F  00           .     BRK
82A0  00           .     BRK
82A1  82           .     ...
82A2  00           .     BRK
82A3  58           X     CLI
82A4  00           .     BRK
82A5  00           .     BRK
82A6  00           .     BRK
82A7  00           .     BRK
82A8  00           .     BRK
82A9  00           .     BRK
82AA  00           .     BRK
82AB  49 00        I.    EOR #&00
82AD  00           .     BRK
82AE  00           .     BRK
82AF  00           .     BRK
82B0  00           .     BRK
82B1  00           .     BRK
82B2  00           .     BRK
82B3  00           .     BRK
82B4  00           .     BRK
82B5  00           .     BRK
82B6  00           .     BRK
82B7  00           .     BRK
82B8  00           .     BRK
82B9  00           .     BRK
82BA  00           .     BRK
82BB  00           .     BRK
82BC  00           .     BRK
82BD  A9 00        ..    LDA #&00
82BF  74           t     ...
82C0  00           .     BRK
82C1  00           .     BRK
82C2  00           .     BRK
82C3  00           .     BRK
82C4  00           .     BRK
82C5  00           .     BRK
82C6  00           .     BRK
82C7  12           .     ...
82C8  87           .     ...
82C9  00           .     BRK
82CA  00           .     BRK
82CB  00           .     BRK
82CC  7F                ...
82CD  00           .     BRK
82CE  00           .     BRK
82CF  00           .     BRK
82D0  00           .     BRK
82D1  00           .     BRK
82D2  22           "     ...
82D3  00           .     BRK
82D4  00           .     BRK
82D5  00           .     BRK
82D6  00           .     BRK
82D7  00           .     BRK
82D8  00           .     BRK
82D9  00           .     BRK
82DA  2E 00 00     ...   ROL &0000
82DD  00           .     BRK
82DE  00           .     BRK
82DF  00           .     BRK
82E0  00           .     BRK
82E1  00           .     BRK
82E2  00           .     BRK
82E3  00           .     BRK
82E4  00           .     BRK
82E5  00           .     BRK
82E6  00           .     BRK
82E7  3A           :     ...
82E8  00           .     BRK
82E9  00           .     BRK
82EA  00           .     BRK
82EB  00           .     BRK
82EC  00           .     BRK
82ED  00           .     BRK
82EE  00           .     BRK
82EF  00           .     BRK
82F0  00           .     BRK
82F1  00           .     BRK
82F2  3A           :     ...
82F3  00           .     BRK
82F4  00           .     BRK
82F5  00           .     BRK
82F6  00           .     BRK
82F7  00           .     BRK
82F8  00           .     BRK
82F9  00           .     BRK
82FA  00           .     BRK
82FB  00           .     BRK
82FC  00           .     BRK
82FD  5A           Z     ...
82FE  00           .     BRK
82FF  00           .     BRK
8300  00           .     BRK
8301  00           .     BRK
8302  B6 00        ..    LDX &00,Y
8304  00           .     BRK
8305  00           .     BRK
8306  00           .     BRK
8307  00           .     BRK
8308  00           .     BRK
8309  00           .     BRK
830A  00           .     BRK
830B  00           .     BRK
830C  00           .     BRK
830D  E5 00        ..    SBC &00
830F  00           .     BRK
8310  00           .     BRK
8311  00           .     BRK
8312  00           .     BRK
8313  00           .     BRK
8314  00           .     BRK
8315  00           .     BRK
8316  7D 00 00     }..   ADC &0000,X
8319  00           .     BRK
831A  00           .     BRK
831B  00           .     BRK
831C  00           .     BRK
831D  00           .     BRK
831E  00           .     BRK
831F  00           .     BRK
8320  00           .     BRK
8321  5B           [     ...
8322  00           .     BRK
8323  00           .     BRK
8324  00           .     BRK
8325  00           .     BRK
8326  00           .     BRK
8327  00           .     BRK
8328  00           .     BRK
8329  00           .     BRK
832A  00           .     BRK
832B  00           .     BRK
832C  00           .     BRK
832D  E1 00        ..    SBC (&00,X)
832F  00           .     BRK
8330  00           .     BRK
8331  00           .     BRK
8332  00           .     BRK
8333  00           .     BRK
8334  06 E8        ..    ASL &E8
8336  00           .     BRK
8337  00           .     BRK
8338  00           .     BRK
8339  00           .     BRK
833A  00           .     BRK
833B  D7           .     ...
833C  F0 00        ..    BEQ &833E
833E  00           .     BRK
833F  00           .     BRK
8340  00           .     BRK
8341  00           .     BRK
8342  00           .     BRK
8343  67           g     ...
8344  00           .     BRK
8345  00           .     BRK
8346  00           .     BRK
8347  00           .     BRK
8348  00           .     BRK
8349  00           .     BRK
834A  00           .     BRK
834B  00           .     BRK
834C  00           .     BRK
834D  00           .     BRK
834E  00           .     BRK
834F  CB           .     ...
8350  A8           .     TAY
8351  06 40        .@    ASL &40
8353  00           .     BRK
8354  A8           .     TAY
8355  07           .     ...
8356  A2 01        ..    LDX #&01

; -----------------------------------------------------------------------------
; Help message displayed when *HELP IEEE is issued
; -----------------------------------------------------------------------------
.
8358  0D           .     EQUB &0D
8359  65 64 69 75  ediu  EQUS "ediuG resU 884EEEI ot refeR"
      47 20 72 65  G re                           ; Refer to IEEE488 User Guide
      73 55 20 38  sU 8
      38 34 45 45  84EE
      45 49 20 6F  EI o
      74 20 72 65  t re
      66 65 52     feR
      0D                 EQUD  &0D

; -----------------------------------------------------------------------------
; Unused bytes???
; -----------------------------------------------------------------------------
.
8375  06 E0        ..    ASL &E0
8377  61 FB        ..    ADC (&FB,X)
8379  FF           .     ...
837A  F3           .     ...
837B  FF           .     ...
837C  FF           .     ...
837D  3F           ?     ...
837E  FF           .     ...
837F  FF           .     ...
8380  21 26        !&    AND (&26,X)
8382  D1 04        ..    CMP (&04),Y
8384  B0 01        ..    BCS &8387
8386  D0 00        ..    BNE &8388
8388  FB           .     ...
8389  CF           .     ...
838A  F0 FF        ..    BEQ &838B
838C  FC           .     ...
838D  AF           .     ...
838E  FD           .     EQUB &FD
838F  BF           .     EQUB &BF

; -----------------------------------------------------------------------------
; Service call entry
; -----------------------------------------------------------------------------
.service
8390  08           .     PHP
8391  48           H     PHA
8392  8A           .     TXA
8393  48           H     PHA
8394  98           .     TYA
8395  48           H     PHA
8396  A2 0F        ..    LDX #&0F
.
8398  B5 B0        ..    LDA &B0,X                ; Push zero page &B0-&BF to the stack
839A  48           H     PHA
839B  CA           .     DEX
839C  10 FA        ..    BPL &8398
839E  BA           .     TSX
839F  BD 12 01     ...   LDA &0112,X              ; ROM number
83A2  AA           .     TAX
83A3  BD F0 0D     ...   LDA &0DF0,X              ; Private workspace page number
83A6  85 B1        ..    STA &B1
83A8  A2 04        ..    LDX #&04
83AA  A0 09        ..    LDY #&09
.
83AC  A5 B1        ..    LDA &B1                  ; Private workspace page number
83AE  99 B0 00     ...   STA &00B0,Y
83B1  88           .     DEY
83B2  BD 85 80     ...   LDA &8085,X
83B5  99 B0 00     ...   STA &00B0,Y              ; Initialize filing system scratch space (&B0-&B9: 00-19-20-18-2F-18-0B-19-2C-19)
83B8  88           .     DEY
83B9  CA           .     DEX
83BA  10 F0        ..    BPL &83AC
83BC  C6 B3        ..    DEC &B3
83BE  C6 B5        ..    DEC &B5
83C0  BA           .     TSX
83C1  BD 13 01     ...   LDA &0113,X
83C4  48           H     PHA                      ; Restore A
83C5  BD 11 01     ...   LDA &0111,X
83C8  A8           .     TAY                      ; Restore Y
83C9  BD 12 01     ...   LDA &0112,X
83CC  AA           .     TAX                      ; Restore X
83CD  68           h     PLA
83CE  C9 05        ..    CMP #&05                 ; Is it an unrecognixed interrupt?
83D0  F0 36        .6    BEQ &8408
83D2  C9 08        ..    CMP #&08                 ; Is it an unrecognized OSWORD call?
83D4  F0 35        .5    BEQ &840B
83D6  C9 04        ..    CMP #&04                 ; Is it an unrecognized * command?
83D8  F0 34        .4    BEQ &840E
83DA  C9 12        ..    CMP #&12                 ; Is it an initialize filing system call?
83DC  F0 33        .3    BEQ &8411
83DE  C9 01        ..    CMP #&01                 ; Is it an absolute workspace claim?
83E0  F0 32        .2    BEQ &8414
83E2  C9 02        ..    CMP #&02                 ; Is it an private workspace claim?
83E4  F0 31        .1    BEQ &8417
83E6  C9 09        ..    CMP #&09                 ; Is it an *HELP command interception?
83E8  F0 30        .0    BEQ &841A
83EA  C9 06        ..    CMP #&06                 ; Has an BRK been executed?
83EC  F0 2F        ./    BEQ &841D
83EE  4C F7 83     L..   JMP &83F7                ; Jump to the exit routine
.
83F1  BA           .     TSX
83F2  A9 00        ..    LDA #&00
83F4  9D 13 01     ...   STA &0113,X
.
83F7  A2 00        ..    LDX #&00
.
83F9  68           h     PLA                      ; Restore zero page &B0-&BF
83FA  95 B0        ..    STA &B0,X
83FC  E8           .     INX
83FD  E0 10        ..    CPX #&10
83FF  90 F8        ..    BCC &83F9
8401  68           h     PLA
8402  A8           .     TAY
8403  68           h     PLA
8404  AA           .     TAX
8405  68           h     PLA
8406  28           (     PLP
8407  60           `     RTS
.
8408  4C 20 84     L .   JMP &8420                ; Service call &05 (Unknown interrupt)
.
840B  4C 0F 85     L..   JMP &850F                ; Service call &08 (Unrecognized OSWORD call)
.
840E  4C 62 85     Lb.   JMP &8562                ; Service call &04 (Unrecognized * command)
.
8411  4C 93 86     L..   JMP &8693                ; Service call &12 (Initialise filing system)
.
8414  4C 02 86     L..   JMP &8602                ; Service call &01 (Absolute public workspace claim)
.
8417  4C 0F 86     L..   JMP &860F                ; Service call &02 (Relative space claim)
.
841A  4C 3E 86     L>.   JMP &863E                ; Service call &09 (*HELP command interception)
.
841D  4C 6E 86     Ln.   JMP &866E                ; Service call &06 (BRK has been executed)

; -----------------------------------------------------------------------------
; Service call &05 : Unknown interrupt
; -----------------------------------------------------------------------------
.
8420  AD 20 FC     . .   LDA intstatus0
8423  85 BE        ..    STA &BE
8425  29 C0        ).    AND #&C0                 ; Is either the RLC or the MAC bit set in the TMS9914A's Interrupt Status Register 0?
8427  D0 03        ..    BNE &842C                ; Yes? Then continue
8429  4C F7 83     L..   JMP &83F7                ; No? Jump to the exit routine
.
842C  AD 24 FC     .$.   LDA intstatus1
842F  85 BF        ..    STA &BF
8431  A5 BE        ..    LDA &BE                  ; The TMS9914A's Interrupt Status Register 0
8433  29 10        ).    AND #&10                 ; Is the END bit set in the TMS9914A's Interrupt Status Register 0?
8435  F0 4E        .N    BEQ &8485
8437  A0 02        ..    LDY #&02                 ; Yes, it's set
8439  B1 B6        ..    LDA (&B6),Y
843B  29 10        ).    AND #&10                 ; Is the 'Computer in process of acknowledging an unidentified command from another device' flag set?
843D  F0 1F        ..    BEQ &845E
843F  B1 B6        ..    LDA (&B6),Y
8441  29 08        ).    AND #&08                 ; Is the Computer in process of becoming controller in charge' flag set?
8443  F0 0E        ..    BEQ &8453
8445  B1 B6        ..    LDA (&B6),Y
8447  29 F7        ).    AND #&F7                 ; Clear the 'Computer in process of becoming controller in charge' flag
8449  91 B6        ..    STA (&B6),Y
844B  A0 00        ..    LDY #&00
844D  B1 B6        ..    LDA (&B6),Y
844F  09 04        ..    ORA #&04                 ; Set the 'computer is controller in charge' flag
8451  91 B6        ..    STA (&B6),Y
.
8453  A0 02        ..    LDY #&02
8455  B1 B6        ..    LDA (&B6),Y
8457  29 EF        ).    AND #&EF                 ; Clear the 'Computer in process of acknowledging an unidentified command from another device' flag
8459  91 B6        ..    STA (&B6),Y
845B  4C 85 84     L..   JMP &8485
.
845E  B1 B6        ..    LDA (&B6),Y
8460  29 20        )     AND #&20                 ; Is the 'Computer in process of entering the controller active state following a TRANSFER command' flag set?
8462  F0 1B        ..    BEQ &847F
8464  A9 04        ..    LDA #clr+hdfe            ; Load the mnemonic for Clear Holdoff on EOI only
8466  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
8469  A9 09        ..    LDA #clr+lon             ; Load the mnemonic for Clear Listen only
846B  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
846E  B1 B6        ..    LDA (&B6),Y
8470  29 DF        ).    AND #&DF                 ; Clear the 'Computer in process of entering the controller active state following a TRANSFER command' flag
8472  91 B6        ..    STA (&B6),Y
8474  A0 00        ..    LDY #&00
8476  B1 B6        ..    LDA (&B6),Y
8478  29 F7        ).    AND #&F7                 ; Clear the 'TRANSFER in progress' flag
847A  91 B6        ..    STA (&B6),Y
847C  4C 85 84     L..   JMP &8485
.
847F  B1 B6        ..    LDA (&B6),Y
8481  09 02        ..    ORA #&02                 ; Set the 'Output error' flag
8483  91 B6        ..    STA (&B6),Y
.
8485  A5 BE        ..    LDA &BE
8487  29 20        )     AND #&20                 ; Now check if the SPAS bit in the TMS9914A's Interrupt Status Register 0 is set
8489  F0 13        ..    BEQ &849E
848B  20 08 85      ..   JSR &8508                ; Yes, it's set. Now check if the 'TRANSFER in progress' flag is set
848E  F0 06        ..    BEQ &8496                ; If not, then branch
8490  AD 27 FC     .'.   LDA datin                ; This will clear the BI flag in the TMS9914A's Interrupt Status Register 0
8493  4C 9E 84     L..   JMP &849E
.
8496  A0 02        ..    LDY #&02
8498  B1 B6        ..    LDA (&B6),Y
849A  09 01        ..    ORA #&01                 ; Set the 'input error' flag
849C  91 B6        ..    STA (&B6),Y
.
849E  A5 BE        ..    LDA &BE
84A0  29 08        ).    AND #&08                 ; Now check if the BO bit in the TMS9914A's Interrupt Status Register 0 is set
84A2  F0 1B        ..    BEQ &84BF
84A4  20 08 85      ..   JSR &8508                ; Yes, it's set. Now check if the 'TRANSFER in progress' flag is set
84A7  F0 10        ..    BEQ &84B9
84A9  A9 0C        ..    LDA #tca                 ; Load the mnemonic for Take control asynchronously
84AB  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
84AE  A0 02        ..    LDY #&02
84B0  B1 B6        ..    LDA (&B6),Y
84B2  09 20        .     ORA #&20                 ; Set the 'Computer in process of entering the controller active state following a TRANSFER command' flag
84B4  91 B6        ..    STA (&B6),Y
84B6  4C BF 84     L..   JMP &84BF
.
84B9  B1 B6        ..    LDA (&B6),Y
84BB  09 40        .@    ORA #&40                 ; Set the 'END end remote message received' flag
84BD  91 B6        ..    STA (&B6),Y
.
84BF  A5 BF        ..    LDA &BF
84C1  29 20        )     AND #&20                 ; Now check if the MA bit in the TMS9914A's Interrupt Status Register 1 is set
84C3  F0 2F        ./    BEQ &84F4
84C5  A0 00        ..    LDY #&00
84C7  B1 B6        ..    LDA (&B6),Y
84C9  29 04        ).    AND #&04                 ; Check if the 'Computer is controller in charge' is set
84CB  F0 0B        ..    BEQ &84D8
84CD  A0 02        ..    LDY #&02
84CF  B1 B6        ..    LDA (&B6),Y
84D1  09 04        ..    ORA #&04                 ; Set the 'Conflict for control of interface' flag
84D3  91 B6        ..    STA (&B6),Y
84D5  4C F1 84     L..   JMP &84F1
.
84D8  AD 23 FC     .#.   LDA cmdpassthru
84DB  C9 09        ..    CMP #&09                 ; TCT (Take Control)
84DD  D0 12        ..    BNE &84F1
84DF  A9 00        ..    LDA #&00
84E1  8D 25 FC     .%.   STA serpoll
84E4  A9 11        ..    LDA #rqc                 ; Load the mnemonic for 'Request control'
84E6  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
84E9  A0 02        ..    LDY #&02
84EB  B1 B6        ..    LDA (&B6),Y
84ED  09 08        ..    ORA #&08                 ; Set the 'Computer in process of becoming controller in charge' flag
84EF  91 B6        ..    STA (&B6),Y
.
84F1  20 85 86      ..   JSR &8685
.
84F4  A5 BF        ..    LDA &BF
84F6  29 40        )@    AND #&40                 ; Now check if the SRQ bit in the TMS9914A's Interrupt Status Register 1 is set
84F8  F0 0B        ..    BEQ &8505
84FA  A0 00        ..    LDY #&00
84FC  B1 B6        ..    LDA (&B6),Y
84FE  09 80        ..    ORA #&80                 ; Set the 'REN remote enable remote message being sent' flag
8500  91 B6        ..    STA (&B6),Y
8502  20 85 86      ..   JSR &8685
.
8505  4C F1 83     L..   JMP &83F1

; -----------------------------------------------------------------------------
; Check if the 'TRANSFER in progress' flag is set
; -----------------------------------------------------------------------------
.
8508  A0 00        ..    LDY #&00
850A  B1 B6        ..    LDA (&B6),Y
850C  29 08        ).    AND #&08                 ; Check if the 'TRANSFER in progress' flag is set
850E  60           `     RTS

; -----------------------------------------------------------------------------
; Service call &08 : Unrecognised OSWORD call
; -----------------------------------------------------------------------------
.
850F  A5 EF        ..    LDA &EF
8511  C9 80        ..    CMP #&80                 ; Is it an OSWORD &80 call?
8513  F0 03        ..    BEQ &8518                ; Yes? Jump to the handler
8515  4C F7 83     L..   JMP &83F7                ; No? Jump to the exit routine
.
8518  A0 01        ..    LDY #&01
851A  B1 B8        ..    LDA (&B8),Y              ; Check if IEEEFS is the current filing system
851C  D0 0B        ..    BNE &8529                ; No? Then continue
851E  A9 81        ..    LDA #&81                 ; Yes? Then display error message
8520  85 CB        ..    STA &CB
8522  A9 1B        ..    LDA #&1B
8524  85 CA        ..    STA &CA
8526  4C 0D 93     L..   JMP &930D                ; Print error &FE (Bad command)
.
8529  A5 F0        ..    LDA &F0
852B  85 BA        ..    STA &BA
852D  A5 F1        ..    LDA &F1
852F  85 BB        ..    STA &BB
8531  A0 00        ..    LDY #&00
8533  B1 BA        ..    LDA (&BA),Y
8535  48           H     PHA                      ; Preserve the original contents of XY+&00
8536  C8           .     INY
8537  B1 BA        ..    LDA (&BA),Y
8539  48           H     PHA                      ; Preserve the original contents of XY+&01
853A  F0 05        ..    BEQ &8541
853C  38           8     SEC
853D  E9 03        ..    SBC #&03
853F  91 BA        ..    STA (&BA),Y              ; XY+&01 -= 3
.
8541  88           .     DEY
8542  38           8     SEC
8543  B1 BA        ..    LDA (&BA),Y
8545  E9 03        ..    SBC #&03
8547  91 BA        ..    STA (&BA),Y              ; XY+&00 -= 3
8549  58           X     CLI
854A  20 D0 86      ..   JSR &86D0                ; Jump to the OSWORD &80 handler
854D  78           x     SEI
854E  A5 F0        ..    LDA &F0
8550  85 BA        ..    STA &BA
8552  A5 F1        ..    LDA &F1
8554  85 BB        ..    STA &BB
8556  A0 01        ..    LDY #&01
8558  68           h     PLA                      ; Restore the original contents of XY+&00
8559  91 BA        ..    STA (&BA),Y
855B  88           .     DEY                      ; Restore the original contents of XY+&01
855C  68           h     PLA
855D  91 BA        ..    STA (&BA),Y
855F  4C F1 83     L..   JMP &83F1

; -----------------------------------------------------------------------------
; Service call &04 : Unrecognised * command
; -----------------------------------------------------------------------------
.
8562  A2 04        ..    LDX #&04
.
8564  B1 F2        ..    LDA (&F2),Y              ; Was the command *IEEE ?
8566  29 DF        ).    AND #&DF                 ; Transform to uppercase
8568  DD 72 80     .r.   CMP &8072,X
856B  D0 0A        ..    BNE &8577
856D  C8           .     INY
856E  CA           .     DEX
856F  10 F3        ..    BPL &8564
8571  20 7A 85      z.   JSR &857A                ; Initialise IEEEFS
8574  4C F1 83     L..   JMP &83F1
.
8577  4C F7 83     L..   JMP &83F7                ; Jump to the exit routine

; -----------------------------------------------------------------------------
; Initialise IEEEFS
; -----------------------------------------------------------------------------
.
857A  A9 06        ..    LDA #&06
857C  20 3B 86      ;.   JSR &863B                ; Call FSCV with A=&06: Shut down current filing system because IEEEFS is taking over
857F  A2 06        ..    LDX #&06
8581  A0 0D        ..    LDY #&0D
.
8583  A9 FF        ..    LDA #&FF
8585  99 12 02     ...   STA filev,Y              ; MSB
8588  88           .     DEY
8589  BD 77 80     .w.   LDA &8077,X
858C  99 12 02     ...   STA filev,Y              ; LSB
858F  88           .     DEY
8590  CA           .     DEX
8591  10 F0        ..    BPL &8583
8593  A2 00        ..    LDX #&00
8595  A0 FF        ..    LDY #&FF
8597  A9 A8        ..    LDA #&A8
8599  20 F4 FF      ..   JSR osbyte               ; Read address of extended vector table (&0D9F)
859C  8A           .     TXA
859D  18           .     CLC
859E  69 1B        i.    ADC #&1B
85A0  85 BA        ..    STA &BA
85A2  90 01        ..    BCC &85A5
85A4  C8           .     INY
.
85A5  84 BB        ..    STY &BB                  ; (&BA) = &0DBA
85A7  A2 06        ..    LDX #&06
85A9  A0 14        ..    LDY #&14
.
85AB  A5 F4        ..    LDA &F4
85AD  91 BA        ..    STA (&BA),Y
85AF  88           .     DEY
85B0  A9 80        ..    LDA #&80
85B2  91 BA        ..    STA (&BA),Y              ; MSB
85B4  88           .     DEY
85B5  BD 7E 80     .~.   LDA &807E,X
85B8  91 BA        ..    STA (&BA),Y              ; LSB
85BA  88           .     DEY
85BB  CA           .     DEX
85BC  10 ED        ..    BPL &85AB
85BE  A5 F4        ..    LDA &F4
85C0  48           H     PHA
85C1  A2 0F        ..    LDX #&0F
85C3  A9 8F        ..    LDA #&8F
85C5  20 F4 FF      ..   JSR osbyte               ; Issue paged ROM service call &0F (Vectors claimed)
85C8  A2 0A        ..    LDX #&0A
85CA  A9 8F        ..    LDA #&8F
85CC  20 F4 FF      ..   JSR osbyte               ; Issue paged ROM service call &0A (Claim absolute workspace)
85CF  68           h     PLA
85D0  AA           .     TAX
85D1  BD F0 0D     ...   LDA &0DF0,X
85D4  85 C1        ..    STA &C1
85D6  A2 04        ..    LDX #&04
85D8  A0 09        ..    LDY #&09
.
85DA  A5 C1        ..    LDA &C1                  ; Initialize filing system work space (&C0-&C9: 00-19-20-18-2F-18-0B-19-2C-19)
85DC  99 C0 00     ...   STA &00C0,Y
85DF  88           .     DEY
85E0  BD 85 80     ...   LDA &8085,X
85E3  99 C0 00     ...   STA &00C0,Y
85E6  88           .     DEY
85E7  CA           .     DEX
85E8  10 F0        ..    BPL &85DA
85EA  C6 C3        ..    DEC &C3
85EC  C6 C5        ..    DEC &C5
85EE  A9 FF        ..    LDA #&FF
85F0  A0 01        ..    LDY #&01
85F2  91 C8        ..    STA (&C8),Y              ; Set (&C8),1 to &FF
85F4  A9 80        ..    LDA #&80
85F6  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
85F9  A9 00        ..    LDA #&00
85FB  8D 23 0E     .#.   STA &0E23
85FE  8D 24 0E     .$.   STA &0E24
8601  60           `     RTS

; -----------------------------------------------------------------------------
; Service call &01 : Absolute public workspace claim (2 pages)
; -----------------------------------------------------------------------------
.
8602  C0 10        ..    CPY #&10                 ; Y starts with &0E. We need 2 pages, so check if someone else already has claimed 2 public pages (Y=&10)
8604  B0 06        ..    BCS &860C
8606  BA           .     TSX
8607  A9 10        ..    LDA #&10
8609  9D 11 01     ...   STA &0111,X
.
860C  4C F7 83     L..   JMP &83F7                ; Jump to the exit routine

; -----------------------------------------------------------------------------
; Service call &02 : Relative space claim (1 page)
; -----------------------------------------------------------------------------
.
860F  98           .     TYA
8610  9D F0 0D     ...   STA &0DF0,X
8613  BA           .     TSX
8614  FE 11 01     ...   INC &0111,X              ; Claim 1 page)
8617  84 B1        ..    STY &B1
8619  A0 0C        ..    LDY #&0C
.
861B  88           .     DEY
861C  A5 B1        ..    LDA &B1
861E  99 B0 00     ...   STA &00B0,Y
8621  88           .     DEY
8622  D0 F7        ..    BNE &861B
8624  A9 01        ..    LDA #&01
8626  A0 00        ..    LDY #&00
8628  91 B0        ..    STA (&B0),Y
862A  A9 0A        ..    LDA #&0A
862C  C8           .     INY
862D  91 B0        ..    STA (&B0),Y
862F  A9 00        ..    LDA #&00
8631  A0 12        ..    LDY #&12
.
8633  91 B6        ..    STA (&B6),Y
8635  88           .     DEY
8636  10 FB        ..    BPL &8633
8638  4C F7 83     L..   JMP &83F7                ; Jump to the exit routine
.
863B  6C 1E 02     l..   JMP (&021E)

; -----------------------------------------------------------------------------
; Service call &09 : *HELP command interception
; -----------------------------------------------------------------------------
.
863E  88           .     DEY
.
863F  C8           .     INY
8640  B1 F2        ..    LDA (&F2),Y
8642  C9 20        .     CMP #&20
8644  F0 F9        ..    BEQ &863F
8646  C9 0D        ..    CMP #&0D
8648  D0 06        ..    BNE &8650
864A  20 A0 86      ..   JSR &86A0                ; Print the ROM title and version
.
864D  4C F7 83     L..   JMP &83F7                ; Jump to the exit routine
.
8650  A2 04        ..    LDX #&04
.
8652  B1 F2        ..    LDA (&F2),Y
8654  DD 72 80     .r.   CMP &8072,X              ; Is it *HELP IEEE?
8657  D0 F4        ..    BNE &864D
8659  C8           .     INY
865A  CA           .     DEX
865B  10 F5        ..    BPL &8652
865D  20 A0 86      ..   JSR &86A0                ; Print the ROM title and version
8660  A2 1C        ..    LDX #&1C
.
8662  BD 58 83     .X.   LDA &8358,X              ; Print 'Refer to users manual'
8665  20 E3 FF      ..   JSR osasci
8668  CA           .     DEX
8669  10 F7        ..    BPL &8662
866B  4C F1 83     L..   JMP &83F1

; -----------------------------------------------------------------------------
; Service call &06 : BRK has been executed
; -----------------------------------------------------------------------------
.
866E  A9 80        ..    LDA #&80
8670  A0 02        ..    LDY #&02
8672  91 B8        ..    STA (&B8),Y              ; Set (&B8),2 to &80
8674  A0 01        ..    LDY #&01
8676  B1 B8        ..    LDA (&B8),Y              ; Is IEEEFS the current filing system, and is it initialized?
8678  F0 08        ..    BEQ &8682                ; Jump if it's not
867A  A9 00        ..    LDA #&00
867C  8D 24 0E     .$.   STA &0E24
867F  8D 23 0E     .#.   STA &0E23
.
8682  4C F1 83     L..   JMP &83F1

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
8685  A9 01        .     LDA #clr+dacr  .         ; Load mnemonic for Clear Release DAC Holdoff
8687  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
868A  A0 02        ..    LDY #&02
868C  B1 B6        ..    LDA (&B6),Y
868E  09 10        ..    ORA #&10                 ; Set the 'Computer in process of acknowledging an unidentified command from another device' flag
8690  91 B6        ..    STA (&B6),Y
8692  60           `     RTS

; -----------------------------------------------------------------------------
; Service call &12 : Initialise filing system
; -----------------------------------------------------------------------------
.
8693  C0 08        ..    CPY #&08
8695  D0 06        ..    BNE &869D
8697  20 7A 85      z.   JSR &857A                ; Initialise IEEEFS
869A  4C F1 83     L..   JMP &83F1
.
869D  4C F7 83     L..   JMP &83F7                ; Jump to the exit routine

; -----------------------------------------------------------------------------
; Print the ROM title and version
; -----------------------------------------------------------------------------
.
86A0  20 E7 FF      ..   JSR osnewl
86A3  A2 12        ..    LDX #&12
86A5  A0 00        ..    LDY #&00
.
86A7  B9 09 80     ...   LDA title,Y
86AA  20 E3 FF      ..   JSR osasci               ; Print the ROM title
86AD  C8           .     INY
86AE  CA           .     DEX
86AF  D0 F6        ..    BNE &86A7
86B1  A9 20        .     LDA #&20
86B3  20 E3 FF      ..   JSR osasci
86B6  A2 04        ..    LDX #&04
86B8  A0 00        ..    LDY #&00
.
86BA  B9 1C 80     ...   LDA &version,Y           ; And the ROM version
86BD  20 E3 FF      ..   JSR osasci
86C0  C8           .     INY
86C1  CA           .     DEX
86C2  D0 F6        ..    BNE &86BA
86C4  20 E7 FF      ..   JSR osnewl
86C7  60           `     RTS

; -----------------------------------------------------------------------------
; Unused bytes
; -----------------------------------------------------------------------------
.
86C8  20 04 F0      ..   JSR &F004
86CB  00           .     BRK
86CC  00           .     BRK
86CD  23           #     ...
86CE  66 01        f.    ROR &01

; -----------------------------------------------------------------------------
; OSWORD &80 handler
; -----------------------------------------------------------------------------
.
86D0  8D 21 0E     .!.   STA &0E21                ; Preserve the A register
86D3  8E 1F 0E     ...   STX &0E1F                ; Preserve the X register
86D6  8C 20 0E     . .   STY &0E20                ; Preserve the Y register
86D9  BA           .     TSX
86DA  8E 22 0E     .".   STX &0E22                ; Preserve the stack pointer
86DD  A0 00        ..    LDY #&00
86DF  B1 BA        ..    LDA (&BA),Y              ; XY+&00
86E1  F0 03        ..    BEQ &86E6
86E3  4C 7F 87     L.   JMP &877F
.
86E6  C8           .     INY
86E7  B1 BA        ..    LDA (&BA),Y              ; XY+&01
86E9  D0 5B        .[    BNE &8746
86EB  C8           .     INY
86EC  B1 BA        ..    LDA (&BA),Y              ; XY+&02
86EE  C9 58        .X    CMP #&58
86F0  D0 03        ..    BNE &86F5
86F2  4C 06 91     L..   JMP &9106                ; Jump to &9106 for OSWORD &80 command &58
.
86F5  C9 54        .T    CMP #&54
86F7  D0 03        ..    BNE &86FC
86F9  4C B2 90     L..   JMP &90B2                ; Jump to &90B2 for OSWORD &80 command &54
.
86FC  C9 70        .p    CMP #&70
86FE  D0 03        ..    BNE &8703
8700  4C 22 92     L".   JMP &9222                ; Jump to &9222 for OSWORD &80 command &70
.
8703  C9 71        .q    CMP #&71
8705  D0 03        ..    BNE &870A
8707  4C 2E 92     L..   JMP &922E                ; Jump to &922E for OSWORD &80 command &71
.
870A  C9 50        .P    CMP #&50
870C  D0 03        ..    BNE &8711
870E  4C B6 8F     L..   JMP &8FB6                ; Jump to &8FB6 for OSWORD &80 command &50
.
8711  C9 51        .Q    CMP #&51
8713  D0 03        ..    BNE &8718
8715  4C DA 8F     L..   JMP &8FDA                ; Jump to &8FDA for OSWORD &80 command &51
.
8718  C9 52        .R    CMP #&52
871A  D0 03        ..    BNE &871F
871C  4C CF 8F     L..   JMP &8FCF                ; Jump to &8FCF for OSWORD &80 command &52
.
871F  C9 64        .d    CMP #&64
8721  D0 03        ..    BNE &8726
8723  4C 3A 92     L:.   JMP &923A                ; Jump to &923A for OSWORD &80 command &64
.
8726  C9 61        .a    CMP #&61
8728  D0 03        ..    BNE &872D
872A  4C BF 91     L..   JMP &91BF                ; Jump to &91BF for OSWORD &80 command &61
.
872D  C9 62        .b    CMP #&62
872F  D0 03        ..    BNE &8734
8731  4C 5B 91     L[.   JMP &915B                ; Jump to &915B for OSWORD &80 command &62
.
8734  C9 60        .`    CMP #&60
8736  D0 03        ..    BNE &873B
8738  4C CB 91     L..   JMP &91CB                ; Jump to &91CB for OSWORD &80 command &60
.
873B  A9 81        ..    LDA #&81
873D  85 CB        ..    STA &CB
873F  A9 1B        ..    LDA #&1B
8741  85 CA        ..    STA &CA
8743  4C 0D 93     L..   JMP &930D                ; Print error &FE (Bad command)
.
8746  A0 02        ..    LDY #&02
8748  B1 BA        ..    LDA (&BA),Y              ; XY+&02
874A  C9 01        ..    CMP #&01                 ; Is it OSWORD call &80 command &01?
874C  D0 1B        ..    BNE &8769
874E  A0 01        ..    LDY #&01
8750  B1 BA        ..    LDA (&BA),Y
8752  C9 04        ..    CMP #&04                 ; And is XY+&01 = 4?
8754  F0 03        ..    BEQ &8759                ; Then jump to the OSWORD call &80 command &01 code
8756  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.                                                 ; OSWORD call &80 command &01
8759  20 0E 89      ..   JSR &890E                ; Increase the pointer to the OSWORD parameterblock by 3
875C  20 0D 9A      ..   JSR &9A0D
875F  A0 03        ..    LDY #&03
.
8761  B1 C6        ..    LDA (&C6),Y
8763  91 BA        ..    STA (&BA),Y
8765  88           .     DEY
8766  10 F9        ..    BPL &8761
8768  60           `     RTS
.
8769  C9 02        ..    CMP #&02                 ; Is it OSWORD call &80 command &02?
876B  D0 CE        ..    BNE &873B                ; No? Then Print error &FE (Bad command)
876D  88           .     DEY
876E  B1 BA        ..    LDA (&BA),Y
8770  C9 01        ..    CMP #&01                 ; And is XY+&01 = 1?
8772  D0 E2        ..    BNE &8756                ; No? Then print error &88 (Out of range)
8774  20 06 92      ..   JSR &9206                ; OSWORD call &80 command &02
8777  A0 03        ..    LDY #&03
8779  AD 00 0F     ...   LDA &0F00
877C  91 BA        ..    STA (&BA),Y
877E  60           `     RTS
.
877F  A0 01        ..    LDY #&01
8781  B1 BA        ..    LDA (&BA),Y
8783  F0 3B        .;    BEQ &87C0
8785  A0 00        ..    LDY #&00
8787  B1 BA        ..    LDA (&BA),Y
8789  C9 02        ..    CMP #&02
878B  F0 03        ..    BEQ &8790
878D  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
8790  A0 02        ..    LDY #&02
8792  B1 BA        ..    LDA (&BA),Y
8794  C9 44        .D    CMP #&44                 ; OSWORD call &80 command &44
8796  D0 A3        ..    BNE &873B                ; Print error &FE (Bad command)
8798  20 B2 90      ..   JSR &90B2                ; Send UNL (Unlisten) to the GPIB bus
879B  20 A9 95      ..   JSR &95A9                ; Send SPE (Serial Poll Enable) to the GPIB bus
879E  20 23 88      #.   JSR &8823
87A1  A0 01        ..    LDY #&01
87A3  B1 BA        ..    LDA (&BA),Y
87A5  F0 38        .8    BEQ &87DF                ; Print error &88 (Out of range)
87A7  8D 1C 0E     ...   STA &0E1C
87AA  20 7F 92      .   JSR &927F
87AD  A0 01        ..    LDY #&01
87AF  B1 BA        ..    LDA (&BA),Y
87B1  F0 2C        .,    BEQ &87DF                ; Print error &88 (Out of range)
87B3  A8           .     TAY
87B4  20 08 89      ..   JSR &8908                ; Increase the pointer to the OSWORD parameterblock by 4
.
87B7  B9 00 0F     ...   LDA &0F00,Y
87BA  91 BA        ..    STA (&BA),Y
87BC  88           .     DEY
87BD  D0 F8        ..    BNE &87B7
87BF  60           `     RTS
.
87C0  A0 02        ..    LDY #&02
87C2  B1 BA        ..    LDA (&BA),Y
87C4  29 20        )     AND #&20                 ; Is the command between &20-3F, &60-&7F, &A0-&BF and &E0-&FF?
87C6  F0 44        .D    BEQ &880C                ; No? Then jump
87C8  B1 BA        ..    LDA (&BA),Y
87CA  C9 20        .     CMP #&20                 ; OSWORD call &80 command &20
87CC  D0 06        ..    BNE &87D4
87CE  20 DD 95      ..   JSR &95DD
87D1  4C D7 87     L..   JMP &87D7
.
87D4  20 B2 90      ..   JSR &90B2                ; Send UNL (Unlisten) to the GPIB bus
.
87D7  A0 00        ..    LDY #&00
87D9  B1 BA        ..    LDA (&BA),Y
87DB  C9 01        ..    CMP #&01                 ; XY+&00 must be > &00
87DD  B0 03        ..    BCS &87E2
.
87DF  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
87E2  C9 10        ..    CMP #&10                 ; XY+&00 must be < &10
87E4  B0 F9        ..    BCS &87DF                ; Print error &88 (Out of range)
87E6  8D 27 0E     .'.   STA &0E27                ; Value between &01 and &0F
87E9  20 14 89      ..   JSR &8914                ; Increase the pointer to the OSWORD parameterblock by 2
.
87EC  AC 27 0E     .'.   LDY &0E27                ; Cycle through n parameters, where n is XY+&00. The last parameter to be processed is the command (XY+2)
87EF  B1 BA        ..    LDA (&BA),Y
87F1  8D 03 0F     ...   STA &0F03                ; Store the parameter XY+n  at &0F03
87F4  20 F8 92      ..   JSR &92F8                ; Is A between &F0 and &FD? If not, then print error &88 Out of range
87F7  20 D3 8B      ..   JSR &8BD3
87FA  CE 27 0E     .'.   DEC &0E27
87FD  D0 ED        ..    BNE &87EC
87FF  A0 00        ..    LDY #&00
8801  B1 BA        ..    LDA (&BA),Y
8803  8D 10 0E     ...   STA &0E10                ; Number of parameters
8806  4C 77 8C     Lw.   JMP &8C77

8809  4C 5F 8F     L_.   JMP &8F5F                ; Code is never reached??? The JMP above was probably a JSR and later changed to a JMP...
.
880C  B1 BA        ..    LDA (&BA),Y
880E  C9 41        .A    CMP #&41                 ; OSWORD call &80 command &41
8810  D0 1E        ..    BNE &8830
8812  A0 00        ..    LDY #&00
8814  B1 BA        ..    LDA (&BA),Y
8816  C9 01        ..    CMP #&01
8818  D0 C5        ..    BNE &87DF                ; Print error &88 (Out of range)
881A  20 DD 95      ..   JSR &95DD
881D  20 7D 99      }.   JSR &997D
8820  4C 23 88     L#.   JMP &8823                ; Pretty useless command, eh?
.
8823  A0 03        ..    LDY #&03
8825  B1 BA        ..    LDA (&BA),Y
8827  20 F8 92      ..   JSR &92F8                ; Is A between &F0 and &FD? If not, then print error &88 Out of range
882A  99 00 0F     ...   STA &0F00,Y              ; Store it in &0F03
882D  4C E6 90     L..   JMP &90E6
.
8830  C9 81        ..    CMP #&81                 ; OSWORD call &80 command &81
8832  D0 22        ."    BNE &8856
8834  A0 00        ..    LDY #&00
8836  B1 BA        ..    LDA (&BA),Y
8838  C9 00        ..    CMP #&00                 ; This is pretty useless, since using a CMP #&00 followed by a BCS will always branch (bug???)
883A  B0 03        ..    BCS &883F
.
883C  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
883F  C9 03        ..    CMP #&03
8841  90 03        ..    BCC &8846                ; Branch if A < 3
8843  4C F9 8F     L..   JMP &8FF9                ; Print error &8D (String too long)
.
8846  91 C0        ..    STA (&C0),Y              ; Store number of EOS bytes in (&C0),0
8848  20 14 89      ..   JSR &8914                ; Increase the pointer to the OSWORD parameterblock by 2
884B  A8           .     TAY
.
884C  B1 BA        ..    LDA (&BA),Y
884E  91 C0        ..    STA (&C0),Y
8850  88           .     DEY
8851  D0 F9        ..    BNE &884C
8853  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
8856  C9 40        .@    CMP #&40                 ; OSWORD call &80 command &40
8858  D0 17        ..    BNE &8871
885A  A0 00        ..    LDY #&00
885C  B1 BA        ..    LDA (&BA),Y              ; XY+&00 must be 1
885E  C9 01        ..    CMP #&01
8860  D0 DA        ..    BNE &883C                ; Print error &88 (Out of range)
8862  A0 03        ..    LDY #&03
8864  B1 BA        ..    LDA (&BA),Y              ; XY+&03 must be between &00 and &1F
8866  C9 00        ..    CMP #&00                 ; Another useless command, since using a CMP #&00 followed by a BCC will always branch
8868  90 D2        ..    BCC &883C                ; Print error &88 (Out of range)
886A  C9 1F        ..    CMP #&1F                 ; Only values between &00 and &1F are valid
886C  B0 CE        ..    BCS &883C                ; Print error &88 (Out of range)
886E  4C 87 8F     L..   JMP &8F87                ; Jump to OSWORD call &80 command &40
.
8871  C9 18        ..    CMP #&18                 ; OSWORD call &80 command &18
8873  D0 06        ..    BNE &887B
8875  20 21 89      !.   JSR &8921                ; Check if XY+&00 = 4. Yes: &0E0A-&0E0D = (&BA),3-7 ,No: print Out of range
8878  4C 4A 90     LJ.   JMP &904A                ; Jump to OSWORD call &80 command &18
.
887B  C9 14        ..    CMP #&14                 ; OSWORD call &80 command &14
887D  D0 06        ..    BNE &8885
887F  20 21 89      !.   JSR &8921                ; Check if XY+&00 = 4. Yes: &0E0A-&0E0D = (&BA),3-7 ,No: print Out of range
8882  4C 22 90     L".   JMP &9022                ; Jump to OSWORD call &80 command &14
.
8885  C9 10        ..    CMP #&10                 ; OSWORD call &80 command &10
8887  D0 3E        .>    BNE &88C7
8889  A0 00        ..    LDY #&00
888B  B1 BA        ..    LDA (&BA),Y              ; Check if XY+&00 = 4, else print Out of range
888D  C9 04        ..    CMP #&04
888F  D0 42        .B    BNE &88D3                ; Print error &88 (Out of range)
8891  20 0E 89      ..   JSR &890E                ; Increase the pointer to the OSWORD parameterblock by 3
8894  20 DD 95      ..   JSR &95DD
8897  20 7D 99      }.   JSR &997D
889A  20 BD 99      ..   JSR &99BD                ; Prints error &89 (No device talked) if the 'a device has been TALKed' and error &8A (No device listened) if the 'a device or devices have been LISTENed' flags are not set
889D  A0 03        ..    LDY #&03
.
889F  B1 BA        ..    LDA (&BA),Y
88A1  D0 1B        ..    BNE &88BE
88A3  88           .     DEY
88A4  10 F9        ..    BPL &889F
88A6  A9 00        ..    LDA #&00
88A8  A0 03        ..    LDY #&03
.
88AA  99 0A 0E     ...   STA &0E0A,Y
88AD  88           .     DEY
88AE  10 FA        ..    BPL &88AA
88B0  A0 00        ..    LDY #&00
88B2  B1 C6        ..    LDA (&C6),Y
88B4  09 08        ..    ORA #&08                 ; Set bit 3 of (&C6),0 (TRANSFER in progress)
88B6  91 C6        ..    STA (&C6),Y
88B8  20 82 96      ..   JSR &9682
88BB  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
88BE  20 2F 89      /.   JSR &892F
88C1  20 78 96      x.   JSR &9678
88C4  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
88C7  C9 48        .H    CMP #&48                 ; OSWORD call &80 command &48
88C9  D0 25        .%    BNE &88F0
88CB  A0 00        ..    LDY #&00
88CD  B1 BA        ..    LDA (&BA),Y
88CF  C9 02        ..    CMP #&02
88D1  F0 03        ..    BEQ &88D6
.
88D3  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
88D6  20 B2 90      ..   JSR &90B2                ; Send UNL (Unlisten) to the GPIB bus
88D9  A0 03        ..    LDY #&03
88DB  B1 BA        ..    LDA (&BA),Y
88DD  20 F8 92      ..   JSR &92F8                ; Is A between &F0 and &FD? If not, then print error &88 Out of range
88E0  20 D3 8B      ..   JSR &8BD3
88E3  A0 04        ..    LDY #&04
88E5  B1 BA        ..    LDA (&BA),Y
88E7  C9 00        ..    CMP #&00
88E9  90 E8        ..    BCC &88D3                ; This branch will never happen! Print error &88 (Out of range)
88EB  A0 03        ..    LDY #&03
88ED  4C F2 91     L..   JMP &91F2
.
88F0  C9 42        .B    CMP #&42                 ; OSWORD call &80 command &42
88F2  D0 11        ..    BNE &8905                ; Print error &FE (Bad command)
88F4  A0 00        ..    LDY #&00
88F6  B1 BA        ..    LDA (&BA),Y
88F8  C9 01        ..    CMP #&01
88FA  D0 D7        ..    BNE &88D3                ; Print error &88 (Out of range)
88FC  20 B2 90      ..   JSR &90B2                ; Send UNL (Unlisten) to the GPIB bus
88FF  20 23 88      #.   JSR &8823
8902  4C A0 92     L..   JMP &92A0
.
8905  4C 3B 87     L;.   JMP &873B                ; Print error &FE (Bad command)

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
8908  E6 BA        ..    INC &BA                  ; Increase the pointer to the OSWORD parameterblock by 4
890A  D0 02        ..    BNE &890E
890C  E6 BB        ..    INC &BB
.
890E  E6 BA        ..    INC &BA                  ; Increase the pointer to the OSWORD parameterblock by 3
8910  D0 02        ..    BNE &8914
8912  E6 BB        ..    INC &BB
.
8914  E6 BA        ..    INC &BA                  ; Increase the pointer to the OSWORD parameterblock by 2
8916  D0 02        ..    BNE &891A
8918  E6 BB        ..    INC &BB
.
891A  E6 BA        ..    INC &BA                  ; Increase the pointer to the OSWORD parameterblock by 1
891C  D0 02        ..    BNE &8920
891E  E6 BB        ..    INC &BB
.
8920  60           `     RTS

; -----------------------------------------------------------------------------
; Check if XY+&00 = 4. Yes: &0E0A-&0E0D = (&BA),3-7 ,No: print Out of range
; -----------------------------------------------------------------------------
.
8921  A0 00        ..    LDY #&00
8923  B1 BA        ..    LDA (&BA),Y
8925  C9 04        ..    CMP #&04
8927  F0 03        ..    BEQ &892C
8929  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
892C  20 0E 89      ..   JSR &890E                ; Increase the pointer to the OSWORD parameterblock by 3
.
892F  A2 00        ..    LDX #&00
8931  A0 03        ..    LDY #&03
8933  38           8     SEC
.
8934  A9 00        ..    LDA #&00
8936  F1 BA        ..    SBC (&BA),Y
8938  9D 0A 0E     ...   STA &0E0A,X
893B  E8           .     INX
893C  88           .     DEY
893D  10 F5        ..    BPL &8934
893F  60           `     RTS

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
8940  EA           .     NOP
8941  EA           .     NOP
8942  EA           .     NOP
8943  EA           .     NOP
8944  EA           .     NOP
8945  EA           .     NOP
8946  EA           .     NOP
8947  00           .     BRK
8948  7B           {     ...
8949  4F           O     ...
894A  DD BF DC     ...   CMP &DCBF,X
894D  F7           .     ...
894E  FB           .     ...
894F  7B           {     ...
8950  00           .     BRK
8951  0E 50 80     .P.   ASL &8050
8954  A4 08        ..    LDY &08
8956  90 10        ..    BCC &8968
8958  FB           .     ...
8959  FF           .     ...
895A  FD 7F F9     ..   SBC &F97F,X
895D  FF           .     ...
895E  FB           .     ...
895F  FF           .     ...
8960  A4 00         ..   LDY &00
8962  00           .     BRK
8963  04           .     ...
8964  A0 0D        ..    LDY #&0D
8966  C0 20        .     CPY #&20
8968  FA           .     ...
8969  D9 D5 FF     ...   CMP &FFD5,Y
896C  FB           .     ...

; -----------------------------------------------------------------------------
; BGETV handler
; -----------------------------------------------------------------------------
.
896D  8D 21 0E     .!.   STA &0E21                ; Preserve the A register
8970  8C 20 0E     . .   STY &0E20                ; Preserve the Y register
8973  8E 1F 0E     ...   STX &0E1F                ; Preserve the X register
8976  BA           .     TSX
8977  8E 22 0E     .".   STX &0E22                ; Preserve the stack pointer
897A  C0 FF        ..    CPY #cmdhandle           ; Is it COMMAND file handle (&FF)?
897C  F0 03        ..    BEQ &8981
897E  4C EC 89     L..   JMP &89EC
.                                                 ; COMMAND file handle (&FF)
8981  20 BA 8A      ..   JSR &8ABA                ; Check if COMMAND file handle (&FF) is actually open
8984  AD FF 0E     ...   LDA &0EFF
8987  D0 36        .6    BNE &89BF
8989  AC 24 0E     .$.   LDY &0E24
898C  D0 0B        ..    BNE &8999
898E  EE 24 0E     .$.   INC &0E24
.
8991  AC 20 0E     . .   LDY &0E20                ; Restore the Y register
8994  AE 1F 0E     ...   LDX &0E1F                ; Restore the X register
8997  18           .     CLC                      ; Clear the carry flag
8998  60           `     RTS
.
8999  C0 01        ..    CPY #&01
899B  D0 0C        ..    BNE &89A9
899D  EE 24 0E     .$.   INC &0E24
89A0  AD 00 0F     ...   LDA &0F00
89A3  8D 23 0E     .#.   STA &0E23
89A6  4C 91 89     L..   JMP &8991                ; Jump to the BGETV exit routine
.
89A9  AC 23 0E     .#.   LDY &0E23
89AC  B9 00 0F     ...   LDA &0F00,Y
89AF  CE 23 0E     .#.   DEC &0E23
89B2  F0 03        ..    BEQ &89B7
89B4  4C 91 89     L..   JMP &8991                ; Jump to the BGETV exit routine
.
89B7  A0 00        ..    LDY #&00
89B9  8C 24 0E     .$.   STY &0E24
89BC  4C 91 89     L..   JMP &8991                ; Jump to the BGETV exit routine
.
89BF  C9 40        .@    CMP #&40
89C1  F0 03        ..    BEQ &89C6
89C3  4C 75 8F     Lu.   JMP &8F75                ; Print error &06 (Type mismatch)
.
89C6  AC 24 0E     .$.   LDY &0E24
89C9  D0 0B        ..    BNE &89D6
89CB  A0 04        ..    LDY #&04
89CD  8C 23 0E     .#.   STY &0E23
89D0  EE 24 0E     .$.   INC &0E24
89D3  4C 91 89     L..   JMP &8991                ; Jump to the BGETV exit routine
.
89D6  AC 23 0E     .#.   LDY &0E23
89D9  B9 FF 0E     ...   LDA &0EFF,Y
89DC  CE 23 0E     .#.   DEC &0E23
89DF  F0 03        ..    BEQ &89E4
89E1  4C 91 89     L..   JMP &8991                ; Jump to the BGETV exit routine
.
89E4  A0 00        ..    LDY #&00
89E6  8C 24 0E     .$.   STY &0E24
89E9  4C 91 89     L..   JMP &8991                ; Jump to the BGETV exit routine
.
89EC  C0 FE        ..    CPY #datahandle          ; Is it DATA file handle (&FE)?
89EE  F0 0B        ..    BEQ &89FB
.
89F0  A9 80        ..    LDA #&80
89F2  85 CB        ..    STA &CB
89F4  A9 90        ..    LDA #&90
89F6  85 CA        ..    STA &CA
89F8  4C 0D 93     L..   JMP &930D                ; Print error &DE (Channel)
.                                                 ; DATA file handle (&FE)
89FB  20 C6 8A      ..   JSR &8AC6                ; Check if DATA file handle (&FE) is actually open
89FE  A0 01        ..    LDY #&01
8A00  B1 C6        ..    LDA (&C6),Y
8A02  29 01        ).    AND #&01                 ; Is bit bit 0 of (&C6),1 set (binary coded data being handled)?
8A04  F0 0C        ..    BEQ &8A12                ; Jump if no binary coded data is being handled
8A06  20 DD 95      ..   JSR &95DD
8A09  20 2B 99      +.   JSR &992B                ; Read byte from the TMS9914 'Data in' register and store it in &0E0E
8A0C  AD 0E 0E     ...   LDA &0E0E
8A0F  4C 91 89     L..   JMP &8991                ; Jump to the BGETV exit routine
.
8A12  20 7D 99      }.   JSR &997D
8A15  20 93 99      ..   JSR &9993                ; Prints error &89 (No device talked) if the 'a device has been TALKed' is not set
8A18  AC 24 0E     .$.   LDY &0E24
8A1B  D0 11        ..    BNE &8A2E
8A1D  20 DD 95      ..   JSR &95DD
8A20  20 6E 96      n.   JSR &966E
8A23  EE 24 0E     .$.   INC &0E24
8A26  A9 00        ..    LDA #&00
8A28  8D FF 0E     ...   STA &0EFF
8A2B  4C 91 89     L..   JMP &8991                ; Jump to the BGETV exit routine
.
8A2E  4C 99 89     L..   JMP &8999                ; BGET COMMAND routine for &0EFF = 0 and &0E24 != 0

; -----------------------------------------------------------------------------
; BPUTV handler
; -----------------------------------------------------------------------------
.
8A31  8D 21 0E     .!.   STA &0E21                ; Preserve the A register
8A34  8C 20 0E     . .   STY &0E20                ; Preserve the Y register
8A37  8E 1F 0E     ...   STX &0E1F                ; Preserve the X register
8A3A  BA           .     TSX
8A3B  8E 22 0E     .".   STX &0E22                ; Preserve the stack pointer
8A3E  C0 FF        ..    CPY #cmdhandle           ; Is it COMMAND file handle (&FF)?
8A40  D0 03        ..    BNE &8A45
8A42  4C D2 8A     L..   JMP &8AD2                ; Jump to COMMAND file handle (&FF)'s routine
.
8A45  C0 FE        ..    CPY #datahandle          ; Is it DATA file handle (&FE)?
8A47  F0 03        ..    BEQ &8A4C
8A49  4C F0 89     L..   JMP &89F0                ; Print error &DE (Channel)
.                                                 ; DATA file handle (&FE)
8A4C  20 C6 8A      ..   JSR &8AC6                ; Check if DATA file handle (&FE) is actually open
8A4F  20 DD 95      ..   JSR &95DD
8A52  A0 01        ..    LDY #&01
8A54  B1 C6        ..    LDA (&C6),Y
8A56  29 01        ).    AND #&01                 ; Is bit 0 of (&C6),1 set (binary coded data being handled)?
8A58  F0 0C        ..    BEQ &8A66                ; Jump if no binary coded data is being handled
8A5A  AD 21 0E     .!.   LDA &0E21                ; Byte to be written
8A5D  8D 0E 0E     ...   STA &0E0E
8A60  20 F9 98      ..   JSR &98F9                ; Write contents of &0E0E to the TMS9914A's 'Data out' register
8A63  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
8A66  20 7D 99      }.   JSR &997D
8A69  20 D7 99      ..   JSR &99D7                ; Prints error &8A (No device listened) if the 'a device or devices have been LISTENed' flag is not set
.
8A6C  AC 24 0E     .$.   LDY &0E24
8A6F  D0 11        ..    BNE &8A82
8A71  AD 21 0E     .!.   LDA &0E21                ; Byte to be written
8A74  F0 03        ..    BEQ &8A79
8A76  4C 75 8F     Lu.   JMP &8F75                ; Print error &06 (Type mismatch)
.
8A79  8D FF 0E     ...   STA &0EFF                ; &0EFF=&00
8A7C  EE 24 0E     .$.   INC &0E24
8A7F  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
8A82  AD 21 0E     .!.   LDA &0E21                ; Byte to be written
8A85  99 FF 0E     ...   STA &0EFF,Y
8A88  EE 24 0E     .$.   INC &0E24
8A8B  88           .     DEY
8A8C  CC 00 0F     ...   CPY &0F00
8A8F  D0 26        .&    BNE &8AB7
8A91  A9 00        ..    LDA #&00
8A93  8D 24 0E     .$.   STA &0E24
8A96  AC 20 0E     . .   LDY &0E20                ; Restore the Y register on entry (file handle)
8A99  C0 FF        ..    CPY #cmdhandle           ; Is it the COMMAND file handle (&FF)?
8A9B  D0 14        ..    BNE &8AB1
8A9D  AD 10 0E     ...   LDA &0E10
8AA0  C9 80        ..    CMP #&80
8AA2  D0 03        ..    BNE &8AA7
8AA4  4C 4A 93     LJ.   JMP &934A                ; * handler
.
8AA7  C9 81        ..    CMP #&81
8AA9  D0 03        ..    BNE &8AAE
8AAB  4C ED 8F     L..   JMP &8FED                ; Set EOS character(s): &0F00=no. of chars, &0F01=2nd character, &0F02=1st character
.
8AAE  4C 07 8C     L..   JMP &8C07                ; Print error &DC (Syntax)
.
8AB1  20 0C 91      ..   JSR &910C
8AB4  20 5A 96      Z.   JSR &965A
.
8AB7  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Check if COMMAND file handle (&FF) is actually open
; -----------------------------------------------------------------------------
.
8ABA  A0 01        ..    LDY #&01
8ABC  B1 C6        ..    LDA (&C6),Y
8ABE  29 04        ).    AND #&04                 ; Is bit 2 of (&C6),1 set?
8AC0  D0 03        ..    BNE &8AC5                ; Yes? Then exit. No? Then print 'Channel'
8AC2  4C ED 90     L..   JMP &90ED                ; Print error &DE (Channel)
.
8AC5  60           `     RTS

; -----------------------------------------------------------------------------
; Check if DATA file handle (&FE) is actually open
; -----------------------------------------------------------------------------
.
8AC6  A0 01        ..    LDY #&01
8AC8  B1 C6        ..    LDA (&C6),Y
8ACA  29 08        ).    AND #&08                 ; Is bit 3 of (&C6),1 set?
8ACC  D0 03        ..    BNE &8AD1                ; Yes? Then exit. No? Then print 'Channel'
8ACE  4C ED 90     L..   JMP &90ED                ; Print error &DE (Channel)
.
8AD1  60           `     RTS

; -----------------------------------------------------------------------------
; COMMAND file handle (&FF)
; -----------------------------------------------------------------------------
.
8AD2  20 BA 8A      ..   JSR &8ABA                ; Check if COMMAND file handle (&FF) is actually open
8AD5  20 EE 8B      ..   JSR &8BEE                ; &0E10 = (&C8),2
8AD8  29 80        ).    AND #&80                 ; Check if bit 7 is set
8ADA  D0 90        ..    BNE &8A6C                ; Yes? Then jump
8ADC  AD 10 0E     ...   LDA &0E10
8ADF  29 40        )@    AND #&40                 ; Check if bit 6 is set
8AE1  D0 17        ..    BNE &8AFA                ; Yes? Then jump
8AE3  AD 10 0E     ...   LDA &0E10
8AE6  29 20        )     AND #&20                 ; Check if bit 5 is set
8AE8  F0 03        ..    BEQ &8AED
8AEA  4C 6E 8B     Ln.   JMP &8B6E                ; Yes? Then jump
.
8AED  AD 10 0E     ...   LDA &0E10
8AF0  29 10        ).    AND #&10                 ; Check if bit 4 is set?
8AF2  F0 03        ..    BEQ &8AF7
8AF4  4C AC 8C     L..   JMP &8CAC                ; Yes? Then jump
.
8AF7  4C 07 8C     L..   JMP &8C07                ; Print error &DC (Syntax)
.
8AFA  AC 24 0E     .$.   LDY &0E24
8AFD  D0 24        .$    BNE &8B23
8AFF  AD 21 0E     .!.   LDA &0E21                ; Byte to be written
8B02  C9 FF        ..    CMP #&FF
8B04  D0 08        ..    BNE &8B0E
8B06  8D FF 0E     ...   STA &0EFF                ; &0EFF=&FF
8B09  A0 05        ..    LDY #&05
8B0B  4C 1A 8B     L..   JMP &8B1A
.
8B0E  C9 40        .@    CMP #&40
8B10  F0 03        ..    BEQ &8B15
8B12  4C 75 8F     Lu.   JMP &8F75                ; Print error &06 (Type mismatch)
.
8B15  8D FF 0E     ...   STA &0EFF                ; &0EFF=&40
8B18  A0 04        ..    LDY #&04
.
8B1A  8C 23 0E     .#.   STY &0E23                ; &0E23=&05
8B1D  EE 24 0E     .$.   INC &0E24
8B20  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
8B23  AD 21 0E     .!.   LDA &0E21                ; Byte to be written
8B26  99 FF 0E     ...   STA &0EFF,Y
8B29  CC 23 0E     .#.   CPY &0E23
8B2C  F0 06        ..    BEQ &8B34
8B2E  EE 24 0E     .$.   INC &0E24
8B31  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
8B34  A9 00        ..    LDA #&00
8B36  8D 24 0E     .$.   STA &0E24
8B39  AD 10 0E     ...   LDA &0E10
8B3C  29 0F        ).    AND #&0F
8B3E  D0 03        ..    BNE &8B43
8B40  4C 69 8F     Li.   JMP &8F69                ; &0EFF must be &40, &0F00-&0F02 must be 0, &0F03 = Channel : Set primary GPIB controller's address
.
8B43  AD 10 0E     ...   LDA &0E10
8B46  29 01        ).    AND #&01
8B48  F0 03        ..    BEQ &8B4D
8B4A  4C CE 90     L..   JMP &90CE
.
8B4D  AD 10 0E     ...   LDA &0E10
8B50  29 02        ).    AND #&02
8B52  F0 03        ..    BEQ &8B57
8B54  4C 95 92     L..   JMP &9295
.
8B57  AD 10 0E     ...   LDA &0E10
8B5A  29 04        ).    AND #&04
8B5C  F0 03        ..    BEQ &8B61
8B5E  4C 57 92     LW.   JMP &9257
.
8B61  AD 10 0E     ...   LDA &0E10
8B64  29 08        ).    AND #&08
8B66  F0 03        ..    BEQ &8B6B
8B68  4C DF 91     L..   JMP &91DF
.
8B6B  4C 07 8C     L..   JMP &8C07                ; Print error &DC (Syntax)

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
8B6E  AC 24 0E     .$.   LDY &0E24
8B71  D0 23        .#    BNE &8B96
8B73  AD 21 0E     .!.   LDA &0E21                ; Byte to be written
8B76  F0 15        ..    BEQ &8B8D
8B78  C9 FF        ..    CMP #&FF
8B7A  D0 05        ..    BNE &8B81
8B7C  A0 05        ..    LDY #&05
8B7E  4C 8A 8B     L..   JMP &8B8A
.
8B81  C9 40        .@    CMP #&40
8B83  F0 03        ..    BEQ &8B88
8B85  4C 75 8F     Lu.   JMP &8F75                ; Print error &06 (Type mismatch)
.
8B88  A0 04        ..    LDY #&04
.
8B8A  8C 23 0E     .#.   STY &0E23
.
8B8D  8D FF 0E     ...   STA &0EFF                ; &0EFF=&00
8B90  EE 24 0E     .$.   INC &0E24
8B93  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
8B96  AD FF 0E     ...   LDA &0EFF
8B99  F0 11        ..    BEQ &8BAC
8B9B  AD 21 0E     .!.   LDA &0E21                ; Byte to be written
8B9E  99 FF 0E     ...   STA &0EFF,Y
8BA1  CC 23 0E     .#.   CPY &0E23
8BA4  F0 1B        ..    BEQ &8BC1
8BA6  EE 24 0E     .$.   INC &0E24
8BA9  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
8BAC  AD 21 0E     .!.   LDA &0E21                ; Byte to be written
8BAF  99 FF 0E     ...   STA &0EFF,Y
8BB2  EE 24 0E     .$.   INC &0E24
8BB5  88           .     DEY
8BB6  CC 00 0F     ...   CPY &0F00
8BB9  F0 3B        .;    BEQ &8BF6
8BBB  EA           .     NOP
8BBC  EA           .     NOP
8BBD  EA           .     NOP
8BBE  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
8BC1  A9 00        ..    LDA #&00
8BC3  8D 24 0E     .$.   STA &0E24
.
8BC6  AD FF 0E     ...   LDA &0EFF
8BC9  C9 FF        ..    CMP #&FF
8BCB  D0 03        ..    BNE &8BD0
8BCD  20 B6 92      ..   JSR &92B6
.
8BD0  20 E4 92      ..   JSR &92E4                ; &0F00-&0F02 must be 0, &0F03 must be between &F0 and &FD

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
8BD3  A8           .     TAY
8BD4  B1 C2        ..    LDA (&C2),Y
8BD6  29 80        ).    AND #&80                 ; Check if bit 7 is set (channel is opened)
8BD8  D0 03        ..    BNE &8BDD                ; Yes it is
8BDA  4C ED 90     L..   JMP &90ED                ; Print error &DE (Channel)
.
8BDD  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
8BE0  20 56 95      V.   JSR &9556                ; Set MLA (My Listen Address) and, if available, MSA (My Secondary Address)
8BE3  A0 01        ..    LDY #&01
8BE5  B1 C6        ..    LDA (&C6),Y
8BE7  09 20        .     ORA #&20                 ; Set bit 5 of (&C6),1 (a device or devices has been LISTENed)
8BE9  91 C6        ..    STA (&C6),Y
8BEB  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; &0E10 = (&C8),2
; -----------------------------------------------------------------------------
.
8BEE  A0 02        ..    LDY #&02
8BF0  B1 C8        ..    LDA (&C8),Y
8BF2  8D 10 0E     ...   STA &0E10
8BF5  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
8BF6  A9 00        ..    LDA #&00
8BF8  8D 24 0E     .$.   STA &0E24
8BFB  AC 00 0F     ...   LDY &0F00
8BFE  B9 00 0F     ...   LDA &0F00,Y
8C01  29 DF        ).    AND #&DF                 ; Transform to uppercase
8C03  C9 45        .E    CMP #&45                 ; Check for "EXECUTE"
8C05  F0 0D        ..    BEQ &8C14
.
8C07  A9 80        ..    LDA #&80
8C09  85 CB        ..    STA &CB
8C0B  A9 99        ..    LDA #&99
8C0D  85 CA        ..    STA &CA
8C0F  4C 0D 93     L..   JMP &930D                ; Print error &DC (Syntax)

8C12  EA           .     NOP                      ; Code is never reached???
8C13  EA           .     NOP                      ; Code is never reached???
.
8C14  88           .     DEY
8C15  F0 F0        ..    BEQ &8C07
8C17  B9 00 0F     ...   LDA &0F00,Y
8C1A  C9 2E        ..    CMP #&2E
8C1C  F0 56        .V    BEQ &8C74
8C1E  29 DF        ).    AND #&DF                 ; Transform to uppercase
8C20  C9 58        .X    CMP #&58
8C22  D0 E3        ..    BNE &8C07
8C24  88           .     DEY
8C25  F0 E0        ..    BEQ &8C07
8C27  B9 00 0F     ...   LDA &0F00,Y
8C2A  C9 2E        ..    CMP #&2E
8C2C  F0 46        .F    BEQ &8C74
8C2E  29 DF        ).    AND #&DF                 ; Transform to uppercase
8C30  C9 45        .E    CMP #&45
8C32  D0 D3        ..    BNE &8C07
8C34  88           .     DEY
8C35  F0 D0        ..    BEQ &8C07
8C37  B9 00 0F     ...   LDA &0F00,Y
8C3A  C9 2E        ..    CMP #&2E
8C3C  F0 36        .6    BEQ &8C74
8C3E  29 DF        ).    AND #&DF                 ; Transform to uppercase
8C40  C9 43        .C    CMP #&43
8C42  D0 C3        ..    BNE &8C07
8C44  88           .     DEY
8C45  F0 C0        ..    BEQ &8C07
8C47  B9 00 0F     ...   LDA &0F00,Y
8C4A  C9 2E        ..    CMP #&2E
8C4C  F0 26        .&    BEQ &8C74
8C4E  29 DF        ).    AND #&DF                 ; Transform to uppercase
8C50  C9 55        .U    CMP #&55
8C52  D0 B3        ..    BNE &8C07
8C54  88           .     DEY
8C55  F0 B0        ..    BEQ &8C07
8C57  B9 00 0F     ...   LDA &0F00,Y
8C5A  C9 2E        ..    CMP #&2E
8C5C  F0 16        ..    BEQ &8C74
8C5E  29 DF        ).    AND #&DF                 ; Transform to uppercase
8C60  C9 54        .T    CMP #&54
8C62  D0 A3        ..    BNE &8C07
8C64  88           .     DEY
8C65  F0 A0        ..    BEQ &8C07
8C67  B9 00 0F     ...   LDA &0F00,Y
8C6A  C9 2E        ..    CMP #&2E
8C6C  F0 06        ..    BEQ &8C74
8C6E  29 DF        ).    AND #&DF                 ; Transform to uppercase
8C70  C9 45        .E    CMP #&45
8C72  D0 93        ..    BNE &8C07
.
8C74  88           .     DEY
8C75  D0 90        ..    BNE &8C07
.
8C77  AD 10 0E     ...   LDA &0E10
8C7A  29 0F        ).    AND #&0F
8C7C  D0 03        ..    BNE &8C81
8C7E  4C AA 90     L..   JMP &90AA                ; (&C8),2 = &80 and exit with A, X and Y preserved
.
8C81  AD 10 0E     ...   LDA &0E10
8C84  29 01        ).    AND #&01
8C86  F0 03        ..    BEQ &8C8B
8C88  4C 6F 91     Lo.   JMP &916F                ; Jump if bit 0 is set
.
8C8B  AD 10 0E     ...   LDA &0E10
8C8E  29 02        ).    AND #&02
8C90  F0 03        ..    BEQ &8C95
8C92  4C 85 91     L..   JMP &9185                ; Jump if bit 1 is set
.
8C95  AD 10 0E     ...   LDA &0E10
8C98  29 04        ).    AND #&04
8C9A  F0 03        ..    BEQ &8C9F
8C9C  4C B1 91     L..   JMP &91B1                ; Jump if bit 2 is set
.
8C9F  AD 10 0E     ...   LDA &0E10
8CA2  29 08        ).    AND #&08
8CA4  F0 03        ..    BEQ &8CA9
8CA6  4C 9B 91     L..   JMP &919B                ; Jump if bit 3 is set
.
8CA9  4C 07 8C     L..   JMP &8C07                ; Print error &DC (Syntax)

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
8CAC  AC 24 0E     .$.   LDY &0E24
8CAF  D0 18        ..    BNE &8CC9
8CB1  AD 21 0E     .!.   LDA &0E21                ; Restore A register on entry
8CB4  C9 40        .@    CMP #&40
8CB6  F0 03        ..    BEQ &8CBB
8CB8  4C 75 8F     Lu.   JMP &8F75                ; Print error &06 (Type mismatch)
.
8CBB  8D FF 0E     ...   STA &0EFF                ; &0EFF=&40
8CBE  A0 04        ..    LDY #&04
8CC0  8C 23 0E     .#.   STY &0E23
8CC3  EE 24 0E     .$.   INC &0E24
8CC6  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
8CC9  AD 21 0E     .!.   LDA &0E21                ; Restore A register on entry
8CCC  99 FF 0E     ...   STA &0EFF,Y
8CCF  CC 23 0E     .#.   CPY &0E23
8CD2  F0 06        ..    BEQ &8CDA
8CD4  EE 24 0E     .$.   INC &0E24
8CD7  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
8CDA  A9 00        ..    LDA #&00
8CDC  8D 24 0E     .$.   STA &0E24
8CDF  AD 10 0E     ...   LDA &0E10
8CE2  29 0F        ).    AND #&0F
8CE4  D0 03        ..    BNE &8CE9
8CE6  4C 22 91     L".   JMP &9122                ; Jump if bits 0-3 are clear
.
8CE9  AD 10 0E     ...   LDA &0E10
8CEC  29 01        ).    AND #&01
8CEE  F0 03        ..    BEQ &8CF3
8CF0  4C 62 92     Lb.   JMP &9262                ; Jump if bit 0 is set
.
8CF3  AD 10 0E     ...   LDA &0E10
8CF6  29 02        ).    AND #&02
8CF8  F0 03        ..    BEQ &8CFD
8CFA  4C E7 91     L..   JMP &91E7                ; Jump if bit 1 is set
.
8CFD  AD 10 0E     ...   LDA &0E10
8D00  29 04        ).    AND #&04
8D02  F0 03        ..    BEQ &8D07
8D04  4C 1A 90     L..   JMP &901A                ; Jump if bit 2 is set
.
8D07  AD 10 0E     ...   LDA &0E10
8D0A  29 08        ).    AND #&08
8D0C  F0 03        ..    BEQ &8D11
8D0E  4C 42 90     LB.   JMP &9042                ; Jump if bit 3 is set
.
8D11  4C 07 8C     L..   JMP &8C07                ; Print error &DC (Syntax)

; -----------------------------------------------------------------------------
; FINDV handler
; -----------------------------------------------------------------------------
.
8D14  C9 00        ..    CMP #&00
8D16  D0 03        ..    BNE &8D1B
8D18  4C A7 8E     L..   JMP &8EA7                ; Channel is to be closed
.                                                 ; Open channel
8D1B  86 CA        ..    STX &CA                  ; LSB of pointer to (???)
8D1D  84 CB        ..    STY &CB                  ; MSB of pointer to (???)
8D1F  A0 00        ..    LDY #&00
8D21  B1 CA        ..    LDA (&CA),Y
8D23  29 DF        ).    AND #&DF                 ; Transform to uppercase
8D25  C9 43        .C    CMP #&43
8D27  D0 03        ..    BNE &8D2C
8D29  4C E4 8D     L..   JMP &8DE4                ; Jump if it starts with a 'C'
.
8D2C  C9 44        .D    CMP #&44
8D2E  D0 03        ..    BNE &8D33
8D30  4C 62 8E     Lb.   JMP &8E62                ; Jump if it starts with a 'D'
.
8D33  C8           .     INY                      ; It does not start with an 'C' or an 'D'
8D34  B1 CA        ..    LDA (&CA),Y
8D36  C9 0D        ..    CMP #&0D
8D38  D0 F9        ..    BNE &8D33
8D3A  88           .     DEY
8D3B  20 01 93      ..   JSR &9301                ; Check if the last byte in the string is numeric. If it's not, generate an 'Out of range' error
8D3E  88           .     DEY
8D3F  10 0B        ..    BPL &8D4C                ; Jumps if there are more digits in the command
.
8D41  8D 00 0F     ...   STA &0F00                ; Store the second parameter in &0F00
8D44  A9 80        ..    LDA #&80
8D46  8D 01 0F     ...   STA &0F01                ; No first parameter was given, so default it to &80
8D49  4C A0 8D     L..   JMP &8DA0
.
8D4C  8D 03 0F     ...   STA &0F03                ; The last numeric value in the string
8D4F  B1 CA        ..    LDA (&CA),Y              ; Get second last value
8D51  C9 2C        .,    CMP #&2C                 ; Is the second last value ','?
8D53  F0 1C        ..    BEQ &8D71
8D55  20 03 93      ..   JSR &9303                ; Check if A is numeric. If it's not, generate an 'Out of range' error
8D58  AA           .     TAX
8D59  18           .     CLC
.
8D5A  A9 0A        ..    LDA #&0A
8D5C  6D 03 0F     m..   ADC &0F03
8D5F  8D 03 0F     ...   STA &0F03                ; &0F03 will contain the hex value of the last two digits
8D62  CA           .     DEX
8D63  D0 F5        ..    BNE &8D5A
8D65  88           .     DEY
8D66  30 D9        0.    BMI &8D41                ; Branch if Y < 0
8D68  B1 CA        ..    LDA (&CA),Y              ; Get previous byte
8D6A  C9 2C        .,    CMP #&2C                 ; It should be a ','
8D6C  F0 03        ..    BEQ &8D71
8D6E  4C 07 8C     L..   JMP &8C07                ; Print error &DC (Syntax)
.
8D71  AD 03 0F     ...   LDA &0F03                ; There are more parameters, so store our last parameter in &0F01
8D74  8D 01 0F     ...   STA &0F01
8D77  88           .     DEY
8D78  20 01 93      ..   JSR &9301                ; Check if (&CA),Y is numeric. If it's not, generate an 'Out of range' error
8D7B  88           .     DEY
8D7C  10 06        ..    BPL &8D84                ; If the first parameter is just one digit, we're done
8D7E  8D 00 0F     ...   STA &0F00                ; So store it then in &0F00
8D81  4C A0 8D     L..   JMP &8DA0
.
8D84  8D 03 0F     ...   STA &0F03                ; The first parameter contains two digits
8D87  20 01 93      ..   JSR &9301                ; Check if (&CA),Y is numeric. If it's not, generate an 'Out of range' error
8D8A  AA           .     TAX
8D8B  18           .     CLC
8D8C  A9 0A        ..    LDA #&0A
8D8E  6D 03 0F     m..   ADC &0F03
8D91  8D 03 0F     ...   STA &0F03
8D94  CA           .     DEX
8D95  D0 F5        ..    BNE &8D8C
8D97  88           .     DEY
8D98  30 03        0.    BMI &8D9D                ; Branch if there are no more characters in the string
8D9A  4C 07 8C     L..   JMP &8C07                ; Print error &DC (Syntax)
.
8D9D  8D 00 0F     ...   STA &0F00
.                                                 ; Okay, first parameter is in &0F00, second parameter is in &0F01
8DA0  A0 EF        ..    LDY #&EF                 ; Loop through &F0-&FD
.
8DA2  C8           .     INY
8DA3  C0 FE        ..    CPY #&FE
8DA5  F0 2A        .*    BEQ &8DD1
8DA7  B1 C2        ..    LDA (&C2),Y
8DA9  30 F7        0.    BMI &8DA2                ; Loop through (&C2),Y until A is not negative
8DAB  AD 00 0F     ...   LDA &0F00
8DAE  20 D4 8D      ..   JSR &8DD4                ; Is it between 00 and 1F?
8DB1  09 80        ..    ORA #&80                 ; Set bit 7
8DB3  91 C2        ..    STA (&C2),Y
8DB5  AD 01 0F     ...   LDA &0F01
8DB8  29 80        ).    AND #&80                 ; Was there just one parameter?
8DBA  D0 0F        ..    BNE &8DCB
8DBC  AD 01 0F     ...   LDA &0F01                ; No, so handle the second parameter
8DBF  20 D4 8D      ..   JSR &8DD4                ; Is it between 00 and 1F?
8DC2  AD 01 0F     ...   LDA &0F01
8DC5  09 80        ..    ORA #&80                 ; Set bit 7
8DC7  91 C4        ..    STA (&C4),Y              ; And store it in (&C4), filepointer
8DC9  98           .     TYA
8DCA  60           `     RTS                      ; Return with the file handle in A
.
8DCB  A9 00        ..    LDA #&00
8DCD  91 C4        ..    STA (&C4),Y
8DCF  98           .     TYA
8DD0  60           `     RTS
.
8DD1  A9 00        ..    LDA #&00                 ; No free handles were found, so return with A=0
8DD3  60           `     RTS

; -----------------------------------------------------------------------------
; Check if A is between &00 and &1F
; -----------------------------------------------------------------------------
.
8DD4  C9 00        ..    CMP #&00
8DD6  B0 07        ..    BCS &8DDF                ; This is pretty useless, since using a CMP #&00 followed by a BCS will always branch
.
8DD8  A9 00        ..    LDA #&00
8DDA  91 C2        ..    STA (&C2),Y
8DDC  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
8DDF  C9 1F        ..    CMP #&1F
8DE1  B0 F5        ..    BCS &8DD8
8DE3  60           `     RTS

; -----------------------------------------------------------------------------
; FINDV: Open COMMAND channel
; -----------------------------------------------------------------------------
.
8DE4  C8           .     INY
8DE5  B1 CA        ..    LDA (&CA),Y
8DE7  C9 0D        ..    CMP #&0D
8DE9  F0 58        .X    BEQ &8E43                ; Print error &DC (Syntax)
8DEB  C9 2E        ..    CMP #&2E
8DED  D0 03        ..    BNE &8DF2
8DEF  4C 50 8E     LP.   JMP &8E50
.
8DF2  29 DF        ).    AND #&DF                 ; Transform to uppercase
8DF4  C9 4F        .O    CMP #&4F
8DF6  D0 4B        .K    BNE &8E43                ; Print error &DC (Syntax)
8DF8  C8           .     INY
8DF9  B1 CA        ..    LDA (&CA),Y
8DFB  C9 0D        ..    CMP #&0D
8DFD  F0 44        .D    BEQ &8E43                ; Print error &DC (Syntax)
8DFF  C9 2E        ..    CMP #&2E
8E01  F0 4D        .M    BEQ &8E50
8E03  29 DF        ).    AND #&DF                 ; Transform to uppercase
8E05  C9 4D        .M    CMP #&4D
8E07  D0 3A        .:    BNE &8E43                ; Print error &DC (Syntax)
8E09  C8           .     INY
8E0A  B1 CA        ..    LDA (&CA),Y
8E0C  C9 0D        ..    CMP #&0D
8E0E  F0 33        .3    BEQ &8E43                ; Print error &DC (Syntax)
8E10  C9 2E        ..    CMP #&2E
8E12  F0 3C        .<    BEQ &8E50
8E14  29 DF        ).    AND #&DF                 ; Transform to uppercase
8E16  C9 4D        .M    CMP #&4D
8E18  D0 29        .)    BNE &8E43                ; Print error &DC (Syntax)
8E1A  C8           .     INY
8E1B  B1 CA        ..    LDA (&CA),Y
8E1D  C9 0D        ..    CMP #&0D
8E1F  F0 22        ."    BEQ &8E43                ; Print error &DC (Syntax)
8E21  C9 2E        ..    CMP #&2E
8E23  F0 2B        .+    BEQ &8E50
8E25  29 DF        ).    AND #&DF                 ; Transform to uppercase
8E27  C9 41        .A    CMP #&41
8E29  D0 18        ..    BNE &8E43                ; Print error &DC (Syntax)
8E2B  C8           .     INY
8E2C  B1 CA        ..    LDA (&CA),Y
8E2E  C9 0D        ..    CMP #&0D
8E30  F0 11        ..    BEQ &8E43                ; Print error &DC (Syntax)
8E32  C9 2E        ..    CMP #&2E
8E34  F0 1A        ..    BEQ &8E50
8E36  29 DF        ).    AND #&DF                 ; Transform to uppercase
8E38  C9 4E        .N    CMP #&4E
8E3A  D0 07        ..    BNE &8E43                ; Print error &DC (Syntax)
8E3C  C8           .     INY
8E3D  B1 CA        ..    LDA (&CA),Y
8E3F  C9 0D        ..    CMP #&0D
8E41  D0 03        ..    BNE &8E46
.
8E43  4C 07 8C     L..   JMP &8C07                ; Print error &DC (Syntax)
.
8E46  C9 2E        ..    CMP #&2E
8E48  F0 06        ..    BEQ &8E50
8E4A  29 DF        ).    AND #&DF                 ; Transform to uppercase
8E4C  C9 44        .D    CMP #&44
8E4E  D0 F3        ..    BNE &8E43                ; Print error &DC (Syntax)
.
8E50  C8           .     INY
8E51  B1 CA        ..    LDA (&CA),Y
8E53  C9 0D        ..    CMP #&0D
8E55  D0 EC        ..    BNE &8E43                ; Print error &DC (Syntax)
8E57  A0 01        ..    LDY #&01
8E59  A9 04        ..    LDA #&04
8E5B  11 C6        ..    ORA (&C6),Y              ; Set bit 2 of (&C6),1 (COMMAND file handle (&FF) is open)
8E5D  91 C6        ..    STA (&C6),Y
8E5F  A9 FF        ..    LDA #cmdhandle           ; Return with A=&FF
8E61  60           `     RTS

; -----------------------------------------------------------------------------
; FINDV: Open DATA channel
; -----------------------------------------------------------------------------
.
8E62  C8           .     INY
8E63  B1 CA        ..    LDA (&CA),Y
8E65  C9 0D        ..    CMP #&0D
8E67  F0 DA        ..    BEQ &8E43                ; Print error &DC (Syntax)
8E69  C9 2E        ..    CMP #&2E
8E6B  F0 28        .(    BEQ &8E95
8E6D  29 DF        ).    AND #&DF                 ; Transform to uppercase
8E6F  C9 41        .A    CMP #&41
8E71  D0 D0        ..    BNE &8E43                ; Print error &DC (Syntax)
8E73  C8           .     INY
8E74  B1 CA        ..    LDA (&CA),Y
8E76  C9 0D        ..    CMP #&0D
8E78  F0 C9        ..    BEQ &8E43                ; Print error &DC (Syntax)
8E7A  C9 2E        ..    CMP #&2E
8E7C  F0 17        ..    BEQ &8E95
8E7E  29 DF        ).    AND #&DF                 ; Transform to uppercase
8E80  C9 54        .T    CMP #&54
8E82  D0 BF        ..    BNE &8E43                ; Print error &DC (Syntax)
8E84  C8           .     INY
8E85  B1 CA        ..    LDA (&CA),Y
8E87  C9 0D        ..    CMP #&0D
8E89  F0 B8        ..    BEQ &8E43                ; Print error &DC (Syntax)
8E8B  C9 2E        ..    CMP #&2E
8E8D  F0 06        ..    BEQ &8E95
8E8F  29 DF        ).    AND #&DF                 ; Transform to uppercase
8E91  C9 41        .A    CMP #&41
8E93  D0 AE        ..    BNE &8E43                ; Print error &DC (Syntax)
.
8E95  C8           .     INY
8E96  B1 CA        ..    LDA (&CA),Y
8E98  C9 0D        ..    CMP #&0D
8E9A  D0 A7        ..    BNE &8E43                ; Print error &DC (Syntax)
8E9C  A9 08        ..    LDA #&08
8E9E  A0 01        ..    LDY #&01
8EA0  11 C6        ..    ORA (&C6),Y              ; Set bit 3 of (&C6),1 (DATA file handle (&FE) is open)
8EA2  91 C6        ..    STA (&C6),Y
8EA4  A9 FE        ..    LDA #datahandle          ; Return with A=&FE
8EA6  60           `     RTS

; -----------------------------------------------------------------------------
; FINDV: Close channel
; -----------------------------------------------------------------------------
.
8EA7  C0 00        ..    CPY #&00
8EA9  F0 0E        ..    BEQ &8EB9                ; All files must be closed
8EAB  C0 EF        ..    CPY #&EF
8EAD  B0 03        ..    BCS &8EB2
8EAF  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
8EB2  C0 FE        ..    CPY #&FE
8EB4  B0 0D        ..    BCS &8EC3                ; Is the channel > &FD?
8EB6  91 C2        ..    STA (&C2),Y              ; No? Then set the channel's flag to zero
8EB8  60           `     RTS                      ; And exit
.
8EB9  A0 EF        ..    LDY #&EF
.
8EBB  91 C2        ..    STA (&C2),Y              ; Set all channel flags to zero
8EBD  C8           .     INY
8EBE  C0 FE        ..    CPY #&FE
8EC0  D0 F9        ..    BNE &8EBB
8EC2  60           `     RTS
.
8EC3  C0 FE        ..    CPY #datahandle
8EC5  D0 09        ..    BNE &8ED0
8EC7  A0 01        ..    LDY #&01                 ; Close the DATA channel
8EC9  B1 C6        ..    LDA (&C6),Y
8ECB  29 F7        ).    AND #&F7                 ; Clear bit 3 of (&C6),1 (DATA file handle (&FE) is closed)
8ECD  91 C6        ..    STA (&C6),Y
8ECF  60           `     RTS
.
8ED0  C0 FF        ..    CPY #cmdhandle
8ED2  F0 03        ..    BEQ &8ED7
8ED4  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
8ED7  A0 01        ..    LDY #&01                 ; Close the COMMAND channel
8ED9  B1 C6        ..    LDA (&C6),Y
8EDB  29 FB        ).    AND #&FB                 ; Clear bit 2 of (&C6),1 (COMMAND file handle (&FF) is closed)
8EDD  91 C6        ..    STA (&C6),Y
8EDF  60           `     RTS

; -----------------------------------------------------------------------------
; OSARGS handler
; -----------------------------------------------------------------------------
.
8EE0  C0 00        ..    CPY #&00
8EE2  D0 07        ..    BNE &8EEB               ; Print error &FE (Bad command)
8EE4  C9 00        ..    CMP #&00
8EE6  D0 02        ..    BNE &8EEA
8EE8  A9 07        ..    LDA #fsnumber           ; Return filing system number
.
8EEA  60           `     RTS
.
8EEB  A9 1B        ..    LDA #&1B
8EED  85 CA        ..    STA &CA
8EEF  A9 81        ..    LDA #&81
8EF1  85 CB        ..    STA &CB
8EF3  4C 0D 93     L..   JMP &930D                ; Print error &FE (Bad command)

; -----------------------------------------------------------------------------
; FSCV handler
; -----------------------------------------------------------------------------
.
8EF6  C9 06        ..    CMP #&06
8EF8  F0 0B        ..    BEQ &8F05
8EFA  C9 07         ..   CMP #&07
8EFC  F0 0E        ..    BEQ &8F0C
8EFE  C9 08        ..    CMP #&08
8F00  F0 0E        ..    BEQ &8F10
8F02  4C EB 8E     L..   JMP &8EEB                ; Print error &FE (Bad command)
.
8F05  A0 01        ..    LDY #&01                 ; FSCV New filing system start (so shut down IEEEFS and close all files)
8F07  A9 00        ..    LDA #&00
8F09  91 C8        ..    STA (&C8),Y              ; (&C8),1 = 0
8F0B  60           `     RTS
.
8F0C  A2 FE        ..    LDX #handlemin
8F0E  A0 FF        ..    LDY #handlemax
.
8F10  60           `     RTS

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
8F11  0E 06 00     ...   ASL &0006
8F14  40           @     RTI
8F15  1E 40 10     .@.   ASL &1040,Y
8F18  FF           .     ...
8F19  3A           :     ...
8F1A  E3           .     ...
8F1B  FF           .     ...
8F1C  FF           .     ...
8F1D  FF           .     ...
8F1E  FD 7F 28     .(   SBC &287F,X
8F21  CE 42 04     .B.   DEC &0442
8F24  00           .     BRK
8F25  2F           /     ...
8F26  E8           .     INX
8F27  20 FF CF      ..   JSR &CFFF
8F2A  72           r     ...
8F2B  FF           .     ...
8F2C  FF           .     ...
8F2D  EF           .     ...
8F2E  FF           .     ...
8F2F  FB           .     ...
8F30  08           .     PHP
8F31  00           .     BRK
8F32  10 04        ..    BPL &8F38
8F34  06 00        ..    ASL &00
8F36  20 80 FB      ..   JSR &FB80
8F39  5F           _     ...
8F3A  99 EF FF     ...   STA &FFEF,Y
8F3D  4D F4 FF     M..   EOR &FFF4
8F40  40           @     RTI
8F41  01 10         .    ORA (&10,X)
8F43  00           .     BRK
8F44  00           .     BRK
8F45  24 F0        $.    BIT &F0
8F47  20 FF 4F      .O   JSR &4FFF
8F4A  BA           .     TSX
8F4B  FE FF 6F     ..o   INC &6FFF,X
8F4E  7B           {     ...
8F4F  FB           .     ...
8F50  A0 06         ..   LDY #&06
8F52  00           .     BRK
8F53  01 00        ..    ORA (&00,X)
8F55  32           2     ...
8F56  20 00 FF      ..   JSR &FF00
8F59  FF           .     ...
8F5A  A9 40        .@    LDA #&40
8F5C  20 97 90      ..   JSR &9097

; -----------------------------------------------------------------------------
; OSWORD call &80 exit procedure
; -----------------------------------------------------------------------------
.                                                 ; Restore A, X and Y registers and exit
8F5F  AD 21 0E     .!.   LDA &0E21                ; Restore the A register
8F62  AC 20 0E     . .   LDY &0E20                ; Restore the Y register
8F65  AE 1F 0E     ...   LDX &0E1F                ; Restore the X register
8F68  60           `     RTS

; -----------------------------------------------------------------------------
; &0EFF must be &40, &0F00-&0F02 must be 0, &0F03 = Channel : Set primary GPIB controller's address
; -----------------------------------------------------------------------------
.
8F69  A9 80        ..    LDA #&80
8F6B  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
8F6E  AD FF 0E     ...   LDA &0EFF
8F71  C9 40        .@    CMP #&40
8F73  F0 0B        ..    BEQ &8F80
.
8F75  A9 80        ..    LDA #&80
8F77  85 CB        ..    STA &CB
8F79  A9 A1        ..    LDA #&A1
8F7B  85 CA        ..    STA &CA
8F7D  4C 0D 93     L..   JMP &930D                ; Print error &06 (Type mismatch)
.
8F80  20 95 8F      ..   JSR &8F95                ; Check if &0F00, &0F01 and &0F02 are 0. If they're not, print error &88 Out of range
8F83  C9 1F        ..    CMP #&1F
8F85  B0 17        ..    BCS &8F9E                ; Print error &88 (Out of range)

; -----------------------------------------------------------------------------
; OSWORD call &80 command &40
; -----------------------------------------------------------------------------
.
8F87  A0 00        ..    LDY #&00
8F89  91 C8        ..    STA (&C8),Y
8F8B  C8           .     INY
8F8C  B1 C6        ..    LDA (&C6),Y
8F8E  09 40        .@    ORA #&40                 ; Set the 'a primary address has been specified' flag
8F90  91 C6        ..    STA (&C6),Y
8F92  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Check if &0F00, &0F01 and &0F02 are 0. If they're not, print error &88 Out of range
; -----------------------------------------------------------------------------
.
8F95  A0 02        ..    LDY #&02
8F97  A9 00        ..    LDA #&00
.
8F99  D9 00 0F     ...   CMP &0F00,Y
8F9C  F0 0B        ..    BEQ &8FA9
.
8F9E  A9 80        ..    LDA #&80
8FA0  85 CB        ..    STA &CB
8FA2  A9 B0        ..    LDA #&B0
8FA4  85 CA        ..    STA &CA
8FA6  4C 0D 93     L..   JMP &930D                ; Print error &88 (Out of range)
.
8FA9  88           .     DEY
8FAA  10 ED        ..    BPL &8F99
8FAC  A0 03        ..    LDY #&03
8FAE  B9 00 0F     ...   LDA &0F00,Y
8FB1  C9 00        ..    CMP #&00
8FB3  90 E9        ..    BCC &8F9E                ; Print error &88 (Out of range)
8FB5  60           `     RTS                      ; Note: the BCC instruction is never executed when combined with CMP #&00

; -----------------------------------------------------------------------------
; OSWORD call &80 command &50
; -----------------------------------------------------------------------------
.
8FB6  A0 01        ..    LDY #&01
8FB8  B1 C6        ..    LDA (&C6),Y
8FBA  29 40        )@    AND #&40                 ; Has a primary address been specified yet?
8FBC  D0 0B        ..    BNE &8FC9
8FBE  A9 80        ..    LDA #&80                 ; If not, then display the error message
8FC0  85 CB        ..    STA &CB
8FC2  A9 BE        ..    LDA #&BE
8FC4  85 CA        ..    STA &CA
8FC6  4C 0D 93     L..   JMP &930D                ; Print error &8B (No BBC device no)
.
8FC9  20 00 95      ..   JSR &9500                ; Reset controller and IEEEFS
8FCC  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; OSWORD call &80 command &52 (Set Timeout Off)
; -----------------------------------------------------------------------------
.
8FCF  A0 01        ..    LDY #&01
8FD1  B1 C6        ..    LDA (&C6),Y
8FD3  29 FD        ).    AND #&FD                 ; Clear bit 1 of (&C6),1
8FD5  91 C6        ..    STA (&C6),Y
8FD7  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; OSWORD call &80 command &51 (Set Timeout On)
; -----------------------------------------------------------------------------
.
8FDA  A0 01        ..    LDY #&01
8FDC  B1 C6        ..    LDA (&C6),Y
8FDE  09 02        ..    ORA #&02                 ; Set bit 1 of (&C6),1
8FE0  91 C6        ..    STA (&C6),Y
8FE2  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
8FE5  A9 81        ..    LDA #&81                 ; Code is never reached???
8FE7  20 97 90      ..   JSR &9097                ; Code is never reached???
8FEA  4C 5F 8F     L_.   JMP &8F5F                ; Code is never reached???

; -----------------------------------------------------------------------------
; Set EOS character(s): &0F00=no. of chars, &0F01=2nd character, &0F02=1st character
; -----------------------------------------------------------------------------
.
8FED  A9 80        ..    LDA #&80
8FEF  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
8FF2  AD 00 0F     ...   LDA &0F00                ; A = number of EOS characters
8FF5  C9 03        ..    CMP #&03
8FF7  90 0B        ..    BCC &9004                ; Branch if A < 3
.
8FF9  A9 80        ..    LDA #&80
8FFB  85 CB        ..    STA &CB
8FFD  A9 F6         ..   LDA #&F6
8FFF  85 CA        ..    STA &CA
9001  4C 0D 93     L..   JMP &930D                ; Print error &8D (String too long)
.
9004  AC 00 0F     ...   LDY &0F00
.
9007  B9 00 0F     ...   LDA &0F00,Y
900A  91 C0        ..    STA (&C0),Y
900C  88           .     DEY
900D  10 F8        ..    BPL &9007
900F  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
9012  A9 14         ..   LDA #&14                 ; Code is never reached???
9014  20 97 90      ..   JSR &9097                ; Code is never reached???
9017  4C 5F 8F     L_.   JMP &8F5F                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
901A  A9 80        ..    LDA #&80
901C  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
901F  20 68 90      h.   JSR &9068                ; &0E0A-&0E0D = &00000000 - &0F00-&0F03

; -----------------------------------------------------------------------------
; OSWORD call &80 command &14
; -----------------------------------------------------------------------------
.
9022  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
9025  20 7D 99      }.   JSR &997D
9028  20 93 99      ..   JSR &9993                ; Prints error &89 (No device talked) if the 'a device has been TALKed' is not set
902B  EA           .     NOP
902C  EA           .     NOP
902D  EA           .     NOP
902E  20 5F 90      _.   JSR &905F                ; Set the 'binary coded data is being handled' flag
9031  A0 03        ..    LDY #&03
9033  A9 FF        ..    LDA #&FF
9035  91 C8        ..    STA (&C8),Y              ; (&C8),3 = &FF
9037  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
903A  A9 18        ..    LDA #&18                 ; Code is never reached???
903C  20 97 90      ..   JSR &9097                ; Code is never reached???
903F  4C 5F 8F     L_.   JMP &8F5F                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9042  A9 80        ..    LDA #&80
9044  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
9047  20 68 90      h.   JSR &9068                ; &0E0A-&0E0D = &00000000 - &0F00-&0F03

; -----------------------------------------------------------------------------
; OSWORD call &80 command &18
; -----------------------------------------------------------------------------
.
904A  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
904D  20 7D 99      }.   JSR &997D
9050  20 D7 99      ..   JSR &99D7                ; Prints error &8A (No device listened) if the 'a device or devices have been LISTENed' flag is not set
9053  20 0C 91      ..   JSR &910C
9056  20 94 98      ..   JSR &9894                ; Set Talk only & Go to standby
9059  20 5F 90      _.   JSR &905F                ; Set the 'binary coded data is being handled' flag
905C  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Set the 'binary coded data is being handled' flag
; -----------------------------------------------------------------------------
.
905F  A0 01        ..    LDY #&01
9061  B1 C6        ..    LDA (&C6),Y
9063  09 01        ..    ORA #&01                 ; Set bit 0 of (&C6),1
9065  91 C6        ..    STA (&C6),Y
9067  60           `     RTS

; -----------------------------------------------------------------------------
; &0E0A-&0E0D = &00000000 - &0F00-&0F03
; -----------------------------------------------------------------------------
.
9068  A2 03        ..    LDX #&03
906A  A0 00        ..    LDY #&00
.
906C  38           8     SEC
906D  A9 00        ..    LDA #&00
906F  FD 00 0F     ...   SBC &0F00,X
9072  99 0A 0E     ...   STA &0E0A,Y
9075  C8           .     INY
9076  CA           .     DEX
9077  10 F4        ..    BPL &906D
9079  60           `     RTS

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
907A  EA           .     NOP                      ; Code is never reached???
907B  EA           .     NOP                      ; Code is never reached???
907C  EA           .     NOP                      ; Code is never reached???
907D  EA           .     NOP                      ; Code is never reached???
907E  EA           .     NOP                      ; Code is never reached???
907F  EA           .     NOP                      ; Code is never reached???
9080  EA           .     NOP                      ; Code is never reached???
9081  EA           .     NOP                      ; Code is never reached???
9082  20 0D 9A      ..   JSR &9A0D                ; Code is never reached???
9085  A9 40        .@    LDA #&40                 ; Code is never reached???
9087  8D FF 0E     ...   STA &0EFF                ; Code is never reached???
908A  A0 03        ..    LDY #&03                 ; Code is never reached???
.
908C  B1 C6        ..    LDA (&C6),Y              ; Code is never reached???
908E  99 00 0F     ...   STA &0F00,Y              ; Code is never reached???
9091  88           .     DEY                      ; Code is never reached???
9092  10 F8        ..    BPL &908C                ; Code is never reached???
9094  4C 5F 8F     L_.   JMP &8F5F                ; Code is never reached???

; -----------------------------------------------------------------------------
; Store A in (&C8),2
; -----------------------------------------------------------------------------
.
9097  A0 02        ..    LDY #&02
9099  91 C8        ..    STA (&C8),Y
909B  60           `     RTS

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
909C  A9 20        .     LDA #&20                 ; Code is never reached???
909E  20 97 90      ..   JSR &9097                ; Code is never reached???
90A1  20 DD 95      ..   JSR &95DD                ; Code is never reached???
90A4  20 7D 99      }.   JSR &997D                ; Code is never reached???
90A7  4C 5F 8F     L_.   JMP &8F5F                ; Code is never reached???

; -----------------------------------------------------------------------------
; (&C8),2 = &80 and exit with A, X and Y preserved
; -----------------------------------------------------------------------------
.
90AA  A9 80        ..    LDA #&80
90AC  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
90AF  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; OSWORD call &80 command &54
; -----------------------------------------------------------------------------
.
90B2  20 DD 95      ..   JSR &95DD
90B5  20 7D 99      }.   JSR &997D
.
90B8  20 51 96      Q.   JSR &9651                ; Send UNL (Unlisten) to the GPIB bus
90BB  A0 01        ..    LDY #&01
90BD  B1 C6        ..    LDA (&C6),Y
90BF  29 DF        ).    AND #&DF                 ; Clear bit 5 of (&C6),1 (a device or devices has been LISTENed)
90C1  91 C6        ..    STA (&C6),Y
90C3  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
90C6  A9 41        .A    LDA #&41                 ; Code is never reached???
90C8  20 97 90      ..   JSR &9097                ; Code is never reached???
90CB  4C 5F 8F     L_.   JMP &8F5F                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
90CE  A9 80        ..    LDA #&80
90D0  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
90D3  20 DD 95      ..   JSR &95DD
90D6  20 7D 99      }.   JSR &997D
.
90D9  AD FF 0E     ...   LDA &0EFF
90DC  C9 FF        ..    CMP #&FF
90DE  D0 03        ..    BNE &90E3
90E0  20 B6 92      ..   JSR &92B6
.
90E3  20 E4 92      ..   JSR &92E4                ; &0F00-&0F02 must be 0, &0F03 must be between &F0 and &FD

; -----------------------------------------------------------------------------
; OSWORD call &80 command &41 TALK
; -----------------------------------------------------------------------------
.
90E6  A8           .     TAY
90E7  B1 C2        ..    LDA (&C2),Y              ; Check if bit 7 is set (channel is opened)
90E9  29 80        ).    AND #&80
90EB  D0 0B        ..    BNE &90F8                ; Yes, it's set
.
90ED  A9 80        ..    LDA #&80                 ; If it's not open, then print error &DE Channel
90EF  85 CB        ..    STA &CB
90F1  A9 90        ..    LDA #&90
90F3  85 CA        ..    STA &CA
90F5  4C 0D 93     L..   JMP &930D                ; Print error &DE (Channel)
.
90F8  20 7B 95      {.   JSR &957B                ; Set MTA (My Talk Address) and, if available, MSA (My Secondary Address)
90FB  A0 01        ..    LDY #&01
90FD  B1 C6        ..    LDA (&C6),Y
90FF  09 10        ..    ORA #&10                 ; Set bit 4 of (&C6),1 (a device has been TALKed)
9101  91 C6        ..    STA (&C6),Y
9103  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; OSWORD call &80 command &58 UNTALK
; -----------------------------------------------------------------------------
.
9106  20 DD 95      ..   JSR &95DD
9109  20 7D 99      }.   JSR &997D
.
910C  20 A0 95      ..   JSR &95A0                ; Send UNT (Untalk) to the GPIB bus
910F  A0 01        ..    LDY #&01
9111  B1 C6        ..    LDA (&C6),Y
9113  29 EF        ).    AND #&EF                 ; Clear bit 4 of (&C6),1 (a device has been TALKed)
9115  91 C6        ..    STA (&C6),Y
9117  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
911A  A9 10        ..    LDA #&10                 ; Code is never reached???
911C  20 97 90      ..   JSR &9097                ; Code is never reached???
911F  4C 5F 8F     L_.   JMP &8F5F                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9122  A9 80        ..    LDA #&80
9124  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
9127  20 DD 95      ..   JSR &95DD
912A  20 7D 99      }.   JSR &997D
912D  20 BD 99      ..   JSR &99BD                ; Prints error &89 (No device talked) if the 'a device has been TALKed' and error &8A (No device listened) if the 'a device or devices have been LISTENed' flags are not set
9130  A0 03        ..    LDY #&03
.
9132  B9 00 0F     ...   LDA &0F00,Y
9135  D0 1B        ..    BNE &9152
9137  88           .     DEY
9138  10 F8        ..    BPL &9132
913A  A9 00        ..    LDA #&00
913C  A0 03        ..    LDY #&03
.
913E  99 0A 0E     ...   STA &0E0A,Y
9141  88           .     DEY
9142  10 FA        ..    BPL &913E
9144  A0 00        ..    LDY #&00
9146  B1 C6        ..    LDA (&C6),Y
9148  09 08        ..    ORA #&08                 ; Set bit 3 of (&C6),0 (TRANSFER in progress)
914A  91 C6        ..    STA (&C6),Y
914C  20 82 96      ..   JSR &9682
914F  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit
.
9152  20 68 90      h.   JSR &9068                ; &0E0A-&0E0D = &00000000 - &0F00-&0F03
9155  20 78 96      x.   JSR &9678
9158  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; OSWORD call &80 command &62
; -----------------------------------------------------------------------------
.
915B  20 DD 95      ..   JSR &95DD
915E  20 7D 99      }.   JSR &997D
9161  20 48 96      H.   JSR &9648                ; Send DCL (Device Clear) to the GPIB bus
9164  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
9167  A9 21        .!    LDA #&21                 ; Code is never reached???
9169  20 97 90      ..   JSR &9097                ; Code is never reached???
916C  4C B2 90     L..   JMP &90B2                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
916F  A9 80        ..    LDA #&80
9171  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
9174  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
9177  20 C8 95      ..   JSR &95C8                ; Send PPD (Parallel Poll Disable) to the GPIB bus
917A  4C B8 90     L..   JMP &90B8

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
917D  A9 22        ."    LDA #&22                 ; Code is never reached???
917F  20 97 90      ..   JSR &9097                ; Code is never reached???
9182  4C B2 90     L..   JMP &90B2                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9185  A9 80        ..    LDA #&80
9187  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
918A  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
918D  20 10 96      ..   JSR &9610                ; Send GTL (Go To Local) to the GPIB bus
9190  4C B8 90     L..   JMP &90B8

9193  A9 28        .(    LDA #&28                 ; Code is never reached???
9195  20 97 90      ..   JSR &9097                ; Code is never reached???
9198  4C B2 90     L..   JMP &90B2                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
919B  A9 80        ..    LDA #&80
919D  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
91A0  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
91A3  20 22 96      ".   JSR &9622                ; Send GET (Group Execute Trigger) to the GPIB bus
91A6  4C B8 90     L..   JMP &90B8

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
91A9  A9 24        .$    LDA #&24                 ; Code is never reached???
91AB  20 97 90      ..   JSR &9097                ; Code is never reached???
91AE  4C B2 90     L..   JMP &90B2                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
91B1  A9 80        ..    LDA #&80
91B3  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
91B6  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
91B9  20 19 96      ..   JSR &9619                ; Send SDC (Selected Device Clear) to the GPIB bus
91BC  4C B8 90     L..   JMP &90B8

; -----------------------------------------------------------------------------
; OSWORD call &80 command &61
; -----------------------------------------------------------------------------
.
91BF  20 DD 95      ..   JSR &95DD
91C2  20 7D 99      }.   JSR &997D
91C5  20 3F 96      ?.   JSR &963F                ; Send LLO (Local Lockout) to the GPIB bus
91C8  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; OSWORD call &80 command &60
; -----------------------------------------------------------------------------
.
91CB  20 DD 95      ..   JSR &95DD
91CE  20 7D 99      }.   JSR &997D
91D1  20 D4 95      ..   JSR &95D4                ; Send PPU (Parallel Poll Unconfigure) to the GPIB bus
91D4  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Unused code
; -----------------------------------------------------------------------------
.
91D7  A9 48        .H    LDA #&48                 ; Code is never reached???
91D9  20 97 90      ..   JSR &9097                ; Code is never reached???
91DC  4C B2 90     L..   JMP &90B2                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
91DF  A9 12        ..    LDA #&12
91E1  20 97 90      ..   JSR &9097                ; Set bit 4 and 1 and clear bits 7, 6, 5, 3, 2 and 0 of (&C8),2
91E4  4C C6 8B     L..   JMP &8BC6

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
91E7  A9 80        ..    LDA #&80
91E9  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
91EC  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
91EF  20 95 8F      ..   JSR &8F95                ; Check if &0F00, &0F01 and &0F02 are 0. If they're not, print error &88 Out of range
.                                                 ; OSWORD &80 command &48 entry point
91F2  C9 10        ..    CMP #&10
91F4  90 03        ..    BCC &91F9                ; A must be between &00 and &0F
91F6  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
91F9  09 60        .`    ORA #&60                 ; 01100000 PPE (Parallel Poll Enable)
91FB  29 EF        ).    AND #&EF                 ; Clear bit 4
91FD  99 00 0F     ...   STA &0F00,Y              
9200  20 BB 95      ..   JSR &95BB                ; Send a PPC and a PPE to the GBIP bus
9203  4C B8 90     L..   JMP &90B8

; -----------------------------------------------------------------------------
; OSWORD call &80 command &02
; -----------------------------------------------------------------------------
.
9206  20 DD 95      ..   JSR &95DD
9209  20 E0 99      ..   JSR &99E0                ; If the 'computer is controller in charge' flag is not set then exit with C set and set the 'non fatal error' flag
920C  20 92 96      ..   JSR &9692                ; Perform parallel poll (result is stored in &0F00)
920F  A9 40        .@    LDA #&40
9211  8D FF 0E     ...   STA &0EFF                ; &0EFF=&40
9214  A9 00        ..    LDA #&00
9216  8D 03 0F     ...   STA &0F03
9219  8D 02 0F     ...   STA &0F02
921C  8D 01 0F     ...   STA &0F01
921F  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; OSWORD call &80 command &70
; -----------------------------------------------------------------------------
.
9222  20 DD 95      ..   JSR &95DD
9225  20 69 99      i.   JSR &9969                ; Prints error &8C (Clear not executed) if the 'CLEAR executed' flag is not set
9228  20 F4 95      ..   JSR &95F4                ; Send 'Set sre' to the TMS9914A and set the flag in the private workspace
922B  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; OSWORD call &80 command &71
; -----------------------------------------------------------------------------
.
922E  20 DD 95      ..   JSR &95DD
9231  20 69 99      i.   JSR &9969                ; Prints error &8C (Clear not executed) if the 'CLEAR executed' flag has not been set
9234  20 02 96      ..   JSR &9602                ; Send 'Clear sre' to the TMS9914A and clear the flag in the private workspace
9237  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; OSWORD call &80 command &64
; -----------------------------------------------------------------------------
.
923A  20 DD 95      ..   JSR &95DD
923D  20 FB 99      ..   JSR &99FB                ; If the 'computer is controller in charge' flag is set then exit with C set and set the 'non fatal error' flag
9240  20 E9 99      ..   JSR &99E9                ; If bits 4, 3 or 2 of (&C6),2 are set then exit with C set and bit 7 of (&C6),3 set
9243  20 39 96      9.   JSR &9639                ; Set the rsv1 bit in the controller's Serial Poll register
9246  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
; Unused bytes
; -----------------------------------------------------------------------------
.
9249  A9 44        .D    LDA #&44                 ; Code is never reached???
924B  20 97 90      ..   JSR &9097                ; Code is never reached???
924E  20 B2 90      ..   JSR &90B2                ; Code is never reached???
9251  20 A9 95      ..   JSR &95A9                ; Code is never reached???
9254  4C 5F 8F     L_.   JMP &8F5F                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9257  A9 11        ..    LDA #&11
9259  20 97 90      ..   JSR &9097                ; Set bit 4 and 0 and clear bits 7, 6, 5, 3, 2 and 1 of (&C8),2
925C  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
925F  4C D9 90     L..   JMP &90D9

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9262  A9 80        ..    LDA #&80
9264  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
9267  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
926A  A0 03        ..    LDY #&03
.
926C  88           .     DEY
926D  F0 08        ..    BEQ &9277
926F  B9 00 0F     ...   LDA &0F00,Y
9272  F0 F8        ..    BEQ &926C
9274  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
9277  A0 03        ..    LDY #&03
9279  B9 00 0F     ...   LDA &0F00,Y
927C  8D 1C 0E     ...   STA &0E1C
.
927F  20 64 96      d.   JSR &9664
9282  20 B2 95      ..   JSR &95B2                ; Send SPD (Serial Poll Disable) to the GPIB bus
9285  A9 00        ..    LDA #&00
9287  8D FF 0E     ...   STA &0EFF                ; &0EFF=&00
928A  4C 0C 91     L..   JMP &910C

; -----------------------------------------------------------------------------
; Unused bytes
; -----------------------------------------------------------------------------
.
928D  A9 42        .B    LDA #&42                 ; Code is never reached???
928F  20 97 90      ..   JSR &9097                ; Code is never reached???
9292  4C B2 90     L..   JMP &90B2                ; Code is never reached???

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9295  A9 80        ..    LDA #&80
9297  20 97 90      ..   JSR &9097                ; Store A in (&C8),2
929A  20 F2 99      ..   JSR &99F2                ; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
929D  20 D9 90      ..   JSR &90D9
.
92A0  20 2B 96      +.   JSR &962B                ; Send TCT (Take Control) to the GPIB bus, and send 'Release Control' to the controller's Auxiliary Command Register
92A3  A0 00        ..    LDY #&00
92A5  B1 C6        ..    LDA (&C6),Y
92A7  29 FB        ).    AND #&FB                 ; Clear bit 2 of (&C6),0 (computer is controller in charge)
92A9  91 C6        ..    STA (&C6),Y
92AB  A0 01        ..    LDY #&01
92AD  B1 C6        ..    LDA (&C6),Y
92AF  29 CF        ).    AND #&CF                 ; Clear bit 5 and 4 of (&C6),1 (a device has been TALKed/a device or devices have been LISTENed)
92B1  91 C6        ..    STA (&C6),Y
92B3  4C 5F 8F     L_.   JMP &8F5F                ; Restore A, X and Y registers and exit

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
92B6  A0 04        ..    LDY #&04
92B8  A9 88        ..    LDA #&88
92BA  D9 00 0F     ...   CMP &0F00,Y
92BD  D0 2E        ..    BNE &92ED                ; Print error &88 (Out of range)
92BF  A9 78        .x    LDA #&78
92C1  39 00 0F     9..   AND &0F00,Y
92C4  AA           .     TAX
92C5  88           .     DEY
92C6  A9 80        ..    LDA #&80
92C8  39 00 0F     9..   AND &0F00,Y
92CB  D0 20        .     BNE &92ED                ; Print error &88 (Out of range)
92CD  A9 80        ..    LDA #&80
92CF  19 00 0F     ...   ORA &0F00,Y
92D2  99 00 0F     ...   STA &0F00,Y
92D5  88           .     DEY
92D6  A9 00        ..    LDA #&00
.
92D8  99 00 0F     ...   STA &0F00,Y
92DB  88           .     DEY
92DC  10 FA        ..    BPL &92D8
92DE  A9 40        .@    LDA #&40
92E0  8D FF 0E     ...   STA &0EFF                ; &0EFF=&40
92E3  60           `     RTS

; -----------------------------------------------------------------------------
; &0F00-&0F02 must be 0, &0F03 must be between &F0 and &FD
; -----------------------------------------------------------------------------
.
92E4  A0 02        ..    LDY #&02
92E6  A9 00        ..    LDA #&00
.
92E8  D9 00 0F     ...   CMP &0F00,Y
92EB  F0 03        ..    BEQ &92F0
.
92ED  4C 9E 8F     L..   JMP &8F9E                ; Print error &88 (Out of range)
.
92F0  88           .     DEY
92F1  10 F5        ..    BPL &92E8
92F3  A0 03        ..    LDY #&03
92F5  B9 00 0F     ...   LDA &0F00,Y
.                                                 ; Is A between &F0 and &FD? If not, then print error &88 Out of range
92F8  C9 F0        ..    CMP #&F0
92FA  90 F1        ..    BCC &92ED                ; Print error &88 (Out of range)
92FC  C9 FE        ..    CMP #&FE
92FE  B0 ED        ..    BCS &92ED                ; Print error &88 (Out of range)
9300  60           `     RTS

; -----------------------------------------------------------------------------
; Check if (&CA),Y is numeric. If it's not, generate an 'Out of range' error
; -----------------------------------------------------------------------------
.
9301  B1 CA        ..    LDA (&CA),Y
.                                                 ; Check if A is numeric. If it's not, generate an 'Out of range' error
9303  C9 3A        .:    CMP #&3A
9305  B0 E6        ..    BCS &92ED                ; Print error &88 (Out of range)
9307  38           8     SEC
9308  E9 30        .0    SBC #&30
930A  90 E1        ..    BCC &92ED                ; Print error &88 (Out of range)
930C  60           `     RTS

; -----------------------------------------------------------------------------
; Display error message stored at location (&CA)
; -----------------------------------------------------------------------------
.
930D  A9 00        ..    LDA #&00
930F  8D 00 01     ...   STA &0100                ; Start the error message with a BRK
9312  A0 00        ..    LDY #&00
9314  B1 CA        ..    LDA (&CA),Y
9316  A8           .     TAY
.
9317  B1 CA        ..    LDA (&CA),Y
9319  99 01 01     ...   STA &0101,Y              ; Store the error message at &0102
931C  88           .     DEY
931D  D0 F8        ..    BNE &9317
931F  A0 00        ..    LDY #&00
9321  B1 CA        ..    LDA (&CA),Y
9323  A8           .     TAY
9324  C8           .     INY
9325  B1 CA        ..    LDA (&CA),Y
9327  8D 01 01     ...   STA &0101                ; Store the error number in &0101
932A  A9 00        ..    LDA #&00
932C  99 01 01     ...   STA &0101,Y              ; Terminate the error message with &00
932F  8D 24 0E     .$.   STA &0E24
9332  B1 CA        ..    LDA (&CA),Y
9334  85 FF        ..    STA &FF                  ; Also store the error number in &FF (Escape flag)
9336  88           .     DEY
9337  4C 00 01     L..   JMP &0100                ; Generate the error

; -----------------------------------------------------------------------------
; Unused bytes
; -----------------------------------------------------------------------------
.
933A  EA           .     NOP                      ; Code is never reached???
933B  EA           .     NOP                      ; Code is never reached???
933C  EA           .     NOP                      ; Code is never reached???
933D  EA           .     NOP                      ; Code is never reached???
933E  EA           .     NOP                      ; Code is never reached???

; -----------------------------------------------------------------------------
; GBPBV handler
; -----------------------------------------------------------------------------
.
933F  A9 81        ..    LDA #&81
9341  85 CB        ..    STA &CB
9343  A9 1B        ..    LDA #&1B
9345  85 CA        ..    STA &CA
9347  4C 0D 93     L..   JMP &930D                ; Print error &FE (Bad command)

; -----------------------------------------------------------------------------
; Handle other * commands
; -----------------------------------------------------------------------------
.
934A  A0 00        ..    LDY #&00
934C  A2 00        ..    LDX #&00
.
934E  C8           .     INY
934F  B9 00 0F     ...   LDA &0F00,Y
9352  C9 20        .     CMP #&20
9354  F0 04        ..    BEQ &935A
9356  E8           .     INX
9357  9D 00 0F     ...   STA &0F00,X
.
935A  CC 00 0F     ...   CPY &0F00
935D  D0 EF        ..    BNE &934E
935F  8E 00 0F     ...   STX &0F00
9362  AC 00 0F     ...   LDY &0F00
9365  C0 02        ..    CPY #&02
9367  B0 03        ..    BCS &936C
.
9369  4C 07 8C     L..   JMP &8C07                ; Print error &DC (Syntax)
.
936C  B9 00 0F     ...   LDA &0F00,Y
936F  29 DF        ).    AND #&DF                 ; Transform to uppercase
9371  99 00 0F     ...   STA &0F00,Y
9374  A2 00        ..    LDX #&00
.
9376  E8           .     INX
9377  BD 3F 81     .?.   LDA &813F,X
937A  30 ED        0.    BMI &9369                ; Print error &DC (Syntax)
937C  D9 00 0F     ...   CMP &0F00,Y
937F  D0 F5        ..    BNE &9376
9381  BD 4C 81     .L.   LDA &814C,X
9384  AA           .     TAX
9385  CA           .     DEX
.
9386  E8           .     INX
9387  BD 59 81     .Y.   LDA &8159,X
938A  10 11        ..    BPL &939D
938C  88           .     DEY
938D  D0 DA        ..    BNE &9369                ; Print error &DC (Syntax)
.
938F  EA           .     NOP
9390  EA           .     NOP
9391  8D 26 0E     .&.   STA &0E26                ; MSB
9394  BD 54 82     .T.   LDA &8254,X
9397  8D 25 0E     .%.   STA &0E25                ; LSB
939A  6C 25 0E     l%.   JMP (&0E25)
.
939D  88           .     DEY
939E  F0 C9        ..    BEQ &9369                ; Print error &DC (Syntax)
93A0  B9 00 0F     ...   LDA &0F00,Y
93A3  C9 2E        ..    CMP #&2E
93A5  D0 0C        ..    BNE &93B3
93A7  88           .     DEY
93A8  D0 BF        ..    BNE &9369                ; Print error &DC (Syntax)
93AA  CA           .     DEX
.
93AB  E8           .     INX
93AC  BD 59 81     .Y.   LDA &8159,X
93AF  10 FA        ..    BPL &93AB
93B1  30 DC        0.    BMI &938F
.
93B3  29 DF        ).    AND #&DF                 ; Transform to uppercase
93B5  99 00 0F     ...   STA &0F00,Y
.
93B8  BD 59 81     .Y.   LDA &8159,X
93BB  30 AC        0.    BMI &9369                ; Print error &DC (Syntax)
93BD  D9 00 0F     ...   CMP &0F00,Y
93C0  F0 C4        ..    BEQ &9386
93C2  BD 54 82     .T.   LDA &8254,X
93C5  AA           .     TAX
93C6  D0 F0        ..    BNE &93B8
93C8  F0 9F        ..    BEQ &9369                ; Print error &DC (Syntax)

; -----------------------------------------------------------------------------
; Unused bytes
; -----------------------------------------------------------------------------
93CA  F7           .     ...
93CB  FF           .     ...
93CC  FB           .     ...
93CD  AB           .     ...
93CE  F3           .     ...
93CF  FF           .     ...
93D0  80           .     ...
93D1  03           .     ...
93D2  10 03        ..    BPL &93D7
93D4  40           @     RTI
93D5  20 05 24      .$   JSR &2405
93D8  FE CF FE     ...   INC &FECF,X
93DB  7F                ...
93DC  FA           .     ...
93DD  4B           K     ...
93DE  76 FF        v.    ROR &FF,X
93E0  20 6C 10      l.   JSR &106C
93E3  02           .     ...
93E4  01 01        ..    ORA (&01,X)
93E6  1E 00 BB     ...   ASL &BB00,Y
93E9  7F                ...
93EA  FF           .     ...
93EB  FF           .     ...
93EC  FF           .     ...
93ED  2B           +     ...
93EE  5D FF A4     ]..   EOR &A4FF,Y
93F1  05 10        ..    ORA &10
93F3  09 02        ..    ORA #&02
93F5  81 80        ..    STA (&80,X)
93F7  0A           .     ASL A
93F8  D5 5F        ._    CMP &5F,X
93FA  F5 FF        ..    SBC &FF,X
93FC  7B           {     ...
93FD  8F           .     ...
93FE  FE BF FD     ...   INC &FDBF,X
9401  BB           .     ...
9402  DB           .     ...
9403  FF           .     ...
9404  FF           .     ...
9405  F7           .     ...
9406  EF           .     ...
9407  FE C0 0C     ...   INC &0CC0,X
940A  30 00        0.    BMI &940C
940C  42           B     ...
940D  24 AC        $.    BIT &AC
940F  00           .     BRK
9410  DF           .     ...
9411  FF           .     ...
9412  FF           .     ...
9413  FF           .     ...
9414  7F                ...
9415  FF           .     ...
9416  FA           .     ...
9417  FE 84 0C     ...   INC &0C84,X
941A  A0 30        .0    LDY #&30
941C  01 07        ..    ORA (&07,X)
941E  50 50        PP    BVC &9470
9420  FF           .     ...
9421  9F           .     ...
9422  FF           .     ...
9423  FF           .     ...
9424  7F                ...
9425  2F           /     ...
9426  7D FF EC     }..   ADC &ECFF,X
9429  07           .     ...
942A  35 00        5.    AND &00,X
942C  0A           .     ASL A
942D  0E 58 00     .X.   ASL &0058
9430  DF           .     ...
9431  EF           .     ...
9432  FF           .     ...
9433  BF           .     ...
9434  FF           .     ...
9435  FF           .     ...
9436  F3           .     ...
9437  FD 04 0B     ...   SBC &0B04,X
943A  84 00        ..    STY &00
943C  0A           .     ASL A
943D  00           .     BRK
943E  22           "     ...
943F  00           .     BRK
9440  FF           .     ...
9441  FF           .     ...
9442  F8           .     SED
9443  FF           .     ...
9444  FF           .     ...
9445  1F           .     ...
9446  79 FF 06     y..   ADC &06FF,Y
9449  07           .     ...
944A  E1 00        ..    SBC (&00,X)
944C  07           .     ...
944D  48           H     PHA
944E  00           .     BRK
944F  00           .     BRK
9450  FB           .     ...
9451  ED B5 FF     ...   SBC &FFB5
9454  FF           .     ...
9455  DF           .     ...
9456  FF           .     ...
9457  FF           .     ...
9458  10 0C        ..    BPL &9466
945A  01 40         @    ORA (&40,X)
945C  24 11        $.    BIT &11
945E  80           .     ...
945F  20 EF 5F      ._   JSR &5FEF
9462  FF           .     ...
9463  FF           .     ...
9464  FF           .     ...
9465  FE F7 FE     ...   INC &FEF7,X
9468  41 0A        ..    EOR (&0A,X)
946A  70 40        p@    BCS &94AC
946C  68           h     PLA
946D  5A           Z     ...
946E  51 10        Q.    EOR (&10),Y
9470  FF           .     ...
9471  EF           .     ...
9472  FA           .     ...
9473  FF           .     ...
9474  FF           .     ...
9475  BF           .     ...
9476  FB           .     ...
9477  FF           .     ...
9478  84 88        ..    STY &88
947A  90 00        ..    BCC &947C
947C  02           .     ...
947D  0B           .     ...
947E  13           .     ...
947F  00           .     BRK
9480  FF           .     ...
9481  0F           .     ...
9482  FD FF FF     ...   SBC &FFFF,X
9485  EB           .     ...
9486  F6 EF        ..    INC &EF,X
9488  00           .     BRK
9489  03           .     ...
948A  6A           j     ROR A
948B  00           .     BRK
948C  03           .     ...
948D  97           .     ...
948E  90 00        ..    BCC &9490
9490  FF           .     ...
9491  FF           .     ...
9492  FE 7F FF     ..   INC &FF7F,X
9495  EF           .     ...
9496  F4           .     ...
9497  FF           .     ...
9498  00           .     BRK
9499  0B           .     ...
949A  D1 09        ..    CMP (&09),Y
949C  00           .     BRK
949D  07           .     ...
949E  D0 10        ..    BNE &94B0
94A0  FE EF F9     ...   INC &F9EF,X
94A3  FF           .     ...
94A4  FF           .     ...
94A5  EF           .     ...
94A6  FB           .     ...
94A7  FF           .     ...
94A8  00           .     BRK
94A9  2D 04 60     -.`   AND &6004
94AC  00           .     BRK
94AD  93           .     ...
94AE  40           @     RTI
94AF  00           .     BRK
94B0  FF           .     ...
94B1  B9 FE FF     ...   LDA &FFFE,Y
94B4  FF           .     ...
94B5  DF           .     ...
94B6  FF           .     ...
94B7  FD 00 09     ...   SBC &0900,X
94BA  08           .     PHP
94BB  00           .     BRK
94BC  00           .     BRK
94BD  22           "     ...
94BE  F0 00        ..    BEQ &94C0
94C0  FF           .     ...
94C1  FF           .     ...
94C2  FA           .     ...
94C3  FF           .     ...
94C4  FF           .     ...
94C5  6F           o     ...
94C6  EF           .     ...
94C7  FE 80 21     ..!   INC &2180,X
94CA  08           .     PHP
94CB  00           .     BRK
94CC  00           .     BRK
94CD  00           .     BRK
94CE  40           @     RTI
94CF  00           .     BRK
94D0  FF           .     ...
94D1  EF           .     ...
94D2  EC FF FF     ...   CPX &FFFF
94D5  DF           .     ...
94D6  F3           .     ...
94D7  FF           .     ...
94D8  28           (     PLP
94D9  28           (     PLP
94DA  C0 00        ..    CPY #&00
94DC  01 18        ..    ORA (&18,X)
94DE  61 C2        ..    ADC (&C2,X)
94E0  BF           .     ...
94E1  AE F1 FF     ...   LDX &FFF1
94E4  EE EF EF     ...   INC &EFEF
94E7  EF           .     ...
94E8  40           @     RTI
94E9  1F           .     ...
94EA  41 00        ..    EOR (&00,X)
94EC  00           .     BRK
94ED  00           .     BRK
94EE  60           `     RTS
94EF  80           .     ...
94F0  FF           .     ...
94F1  2F           /     ...
94F2  FF           .     ...
94F3  FF           .     ...
94F4  FF           .     ...
94F5  5F           _     ...
94F6  FA           .     ...
94F7  FF           .     ...
94F8  00           .     BRK
94F9  0E 30 00     .0.   ASL &0030
94FC  00           .     BRK
94FD  08           .     PHP
94FE  39 00        9..   AND &A900,Y

; -----------------------------------------------------------------------------
; Reset controller and IEEEFS
; -----------------------------------------------------------------------------
.
9500  A9 80        ..    LDA #set+swrst           ; Load mnemonic for 'Set Software Reset'
9502  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
9505  A9 38        .8    LDA #&38                 ; Set the SPAS, END and BO bits in the TMS9914A's Interrupt Mask 0 register
9507  8D 20 FC     . .   STA intmask0
950A  A9 60        .`    LDA #&60                 ; Set the SRQ and MA bits in the TMS9914A's Interrupt Mask 0 register
950C  8D 24 FC     .$.   STA intmask1
950F  A0 00        ..    LDY #&00
9511  B1 C8        ..    LDA (&C8),Y              ; Get primary address (as set by OSWORD &80 command &40)
9513  8D 21 FC     .!.   STA address              ; Set the primary address
9516  A9 8F        ..    LDA #set+sic             ; Load the mnemonic for 'Set Send interface clear'
9518  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
951B  A9 00        ..    LDA #&00
951D  91 C6        ..    STA (&C6),Y              ; Clear all bits of (&C6),0
951F  C8           .     INY
9520  B1 C6        ..    LDA (&C6),Y
9522  29 4E        )N    AND #&4E                 ; Clear bits 7, 5, 4 and 0 of (&C6),1
9524  91 C6        ..    STA (&C6),Y
9526  C8           .     INY
9527  A9 00        ..    LDA #&00
9529  91 C6        ..    STA (&C6),Y              ; Clear all bits of (&C6),2
952B  C8           .     INY
952C  91 C6        ..    STA (&C6),Y              ; Clear all bits of (&C6),3
952E  A9 00        ..    LDA #clr+swrst           ; Load mnemonic for 'Clear Software Reset'
9530  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
9533  A9 01        ..    LDA #&01
9535  8D 11 0E     ...   STA &0E11
9538  20 55 98      U.   JSR &9855                ; Read interval timer; parameterblock is at &0E12
.
953B  20 D8 97      ..   JSR &97D8
953E  90 FB        ..    BCC &953B
9540  A9 0F        ..    LDA #clr+sic             ; Load the mnemonic for 'Clear Set interface clear'
9542  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
9545  20 A4 97      ..   JSR &97A4
9548  A0 00        ..    LDY #&00
954A  A9 04        ..    LDA #&04
954C  91 C6        ..    STA (&C6),Y              ; Clear all bits and set bit 2 of (&C6),0 (computer is controller in charge)
954E  C8           .     INY
954F  B1 C6        ..    LDA (&C6),Y
9551  09 80        ..    ORA #&80                 ; Set bit 7 of (&C6),1 (CLEAR executed)
9553  91 C6        ..    STA (&C6),Y
9555  60           `     RTS

; -----------------------------------------------------------------------------
; Set MLA (My Listen Address) and, if available, MSA (My Secondary Address)
; -----------------------------------------------------------------------------
.
9556  AC 03 0F     ...   LDY &0F03                ; Channel
9559  B1 C2        ..    LDA (&C2),Y              ; Get primary address
955B  29 1F        ).    AND #&1F                 ; 00011111
955D  09 20        .     ORA #&20                 ; 00100000
955F  8D 27 FC     .'.   STA datout               ; MLA (My Listen Address)
9562  20 A4 97      ..   JSR &97A4
9565  AC 03 0F     ...   LDY &0F03                ; Channel
9568  B1 C4        ..    LDA (&C4),Y              ; Get secondary address
956A  29 80        ).    AND #&80                 ; mask 10000000
956C  F0 0C        ..    BEQ &957A                ; Jump if no secondary address is used
956E  B1 C4        ..    LDA (&C4),Y              ; Get secondary address again
9570  29 3F        )?    AND #&3F                 ; 00111111
9572  09 60        .`    ORA #&60                 ; 01100000
9574  8D 27 FC     .'.   STA datout               ; MSA (My Secondary Address)
9577  20 A4 97      ..   JSR &97A4
.
957A  60           `     RTS

; -----------------------------------------------------------------------------
; Set MTA (My Talk Address) and, if available, MSA (My Secondary Address)
; -----------------------------------------------------------------------------
.
957B  AC 03 0F     ...   LDY &0F03                ; Channel
957E  B1 C2        ..    LDA (&C2),Y              ; Get primary address
9580  29 1F        ).    AND #&1F                 ; 00011111
9582  09 40        .@    ORA #&40                 ; 01000000
9584  8D 27 FC     .'.   STA datout               ; MTA (My Talk Address)
9587  20 A4 97      ..   JSR &97A4
958A  AC 03 0F     ...   LDY &0F03                ; Channel
958D  B1 C4        ..    LDA (&C4),Y              ; Get secondary address
958F  29 80        ).    AND #&80                 ; mask 10000000
9591  F0 0C        ..    BEQ &959F                ; Jump if no secondary address is used
9593  B1 C4        ..    LDA (&C4),Y              ; Get secondary address again
9595  29 1F        ).    AND #&1F                 ; 00011111
9597  09 60        .`    ORA #&60                 ; 01100000
9599  8D 27 FC     .'.   STA datout               ; MSA (My Secondary Address)
959C  20 A4 97      ..   JSR &97A4
.
959F  60           `     RTS

; -----------------------------------------------------------------------------
; Send UNT (Untalk) to the GPIB bus
; -----------------------------------------------------------------------------
.
95A0  A9 5F        ._    LDA #&5F
95A2  8D 27 FC     .'.   STA datout               ; UNT (Untalk)
95A5  20 A4 97      ..   JSR &97A4
95A8  60           `     RTS

; -----------------------------------------------------------------------------
; Send SPE (Serial Poll Enable) to the GPIB bus
; -----------------------------------------------------------------------------
.
95A9  A9 18        ..    LDA #&18
95AB  8D 27 FC     .'.   STA datout               ; SPE (Serial Poll Enable)
95AE  20 A4 97      ..   JSR &97A4
95B1  60           `     RTS

; -----------------------------------------------------------------------------
; Send SPD (Serial Poll Disable) to the GPIB bus
; -----------------------------------------------------------------------------
.
95B2  A9 19        ..    LDA #&19
95B4  8D 27 FC     .'.   STA datout               ; SPD (Serial Poll Disable)
95B7  20 A4 97      ..   JSR &97A4
95BA  60           `     RTS

; -----------------------------------------------------------------------------
; Send a PPC and a PPE to the GBIP bus
; -----------------------------------------------------------------------------
.
95BB  20 B0 98      ..   JSR &98B0                ; Send PPC (Parallel Poll Configure) to the GPIB bus
95BE  AD 03 0F     ...   LDA &0F03                ; This should be PPE (Parallel Poll Enable) 0110sppp
95C1  8D 27 FC     .'.   STA datout
95C4  20 A4 97      ..   JSR &97A4
95C7  60           `     RTS

; -----------------------------------------------------------------------------
; Send PPD (Parallel Poll Disable) to the GPIB bus
; -----------------------------------------------------------------------------
.
95C8  20 B0 98      ..   JSR &98B0                ; Send PPC (Parallel Poll Configure) to the GPIB bus
95CB  A9 70        .p    LDA #&70                 ; PPD (Parallel Poll Disable)
95CD  8D 27 FC     .'.   STA datout
95D0  20 A4 97      ..   JSR &97A4
95D3  60           `     RTS

; -----------------------------------------------------------------------------
; Send PPU (Parallel Poll Unconfigure) to the GPIB bus
; -----------------------------------------------------------------------------
.
95D4  A9 15        ..    LDA #&15
95D6  8D 27 FC     .'.   STA datout               ; PPU (Parallel Poll Unconfigure)
95D9  20 A4 97      ..   JSR &97A4
95DC  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
95DD  A0 00        ..    LDY #&00
95DF  B1 C6        ..    LDA (&C6),Y
95E1  29 2C        ),    AND #&2C                 ; Clear bits 7, 6, 4, 1 and 0 of (&C6),0
95E3  91 C6        ..    STA (&C6),Y
95E5  A0 02        ..    LDY #&02
95E7  B1 C6        ..    LDA (&C6),Y
95E9  29 BC        ).    AND #&BC                 ; Clear bits 6, 1 and 0 of (&C6),2
95EB  91 C6        ..    STA (&C6),Y
95ED  A0 03        ..    LDY #&03
95EF  A9 00        ..    LDA #&00
95F1  91 C6        ..    STA (&C6),Y              ; Clear all bits of (&C6),3
95F3  60           `     RTS

; -----------------------------------------------------------------------------
; Send 'Set sre' to the TMS9914A and set the flag in the private workspace
; -----------------------------------------------------------------------------
95F4  A9 90        ..    LDA #&set+sre            ; Load the mnemonic for 'Set Send remote enable'
95F6  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
95F9  A0 02        ..    LDY #&02
95FB  B1 C6        ..    LDA (&C6),Y
95FD  09 80        ..    ORA #&80                 ; Set bit 7 of (&C6),2
95FF  91 C6        ..    STA (&C6),Y
9601  60           `     RTS

; -----------------------------------------------------------------------------
; Send 'Clear sre' to the TMS9914A and clear the flag in the private workspace
; -----------------------------------------------------------------------------
.
9602  A9 10        ..    LDA #clr+sre             ; Load the mnemonic for 'Clear Send remote enable'
9604  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
9607  A0 02        ..    LDY #&02
9609  B1 C6        ..    LDA (&C6),Y
960B  29 7F        )    AND #&7F                 ; Clear bit 7 of (&C6),2
960D  91 C6        ..    STA (&C6),Y
960F  60           `     RTS

; -----------------------------------------------------------------------------
; Send GTL (Go To Local) to the GPIB bus
; -----------------------------------------------------------------------------
.
9610  A9 01        ..    LDA #&01
9612  8D 27 FC     .'.   STA datout               ; GTL (Go To Local)
9615  20 A4 97      ..   JSR &97A4
9618  60           `     RTS

; -----------------------------------------------------------------------------
; Send SDC (Selected Device Clear) to the GPIB bus
; -----------------------------------------------------------------------------
.
9619  A9 04        ..    LDA #&04
961B  8D 27 FC     .'.   STA datout               ; SDC (Selected Device Clear)
961E  20 A4 97      ..   JSR &97A4
9621  60           `     RTS

; -----------------------------------------------------------------------------
; Send GET (Group Execute Trigger) to the GPIB bus
; -----------------------------------------------------------------------------
.
9622  A9 08        ..    LDA #&08
9624  8D 27 FC     .'.   STA datout               ; GET (Group Execute Trigger)
9627  20 A4 97      ..   JSR &97A4
962A  60           `     RTS

; -----------------------------------------------------------------------------
; Send TCT (Take Control) to the GPIB bus, and send 'Release Control' to the controller's Auxiliary Command Register
; -----------------------------------------------------------------------------
.
962B  A9 09        ..    LDA #&09
962D  8D 27 FC     .'.   STA datout               ; TCT (Take Control)
9630  20 A4 97      ..   JSR &97A4
9633  A9 12        ..    LDA #rlc                 ; Load the mnemonic for 'Release control'
9635  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
9638  60           `     RTS

; -----------------------------------------------------------------------------
; Set the rsv1 bit in the controller's Serial Poll register
; -----------------------------------------------------------------------------
.
9639  A9 40        .@    LDA #&40                 ; 01000000
963B  8D 25 FC     .%.   STA serpoll
963E  60           `     RTS

; -----------------------------------------------------------------------------
; Send LLO (Local Lockout) to the GPIB bus
; -----------------------------------------------------------------------------
.
963F  A9 11        ..    LDA #&11
9641  8D 27 FC     .'.   STA datout               ; LLO (Local Lockout)
9644  20 A4 97      ..   JSR &97A4
9647  60           `     RTS

; -----------------------------------------------------------------------------
; Send DCL (Device Clear) to the GPIB bus
; -----------------------------------------------------------------------------
.
9648  A9 14        ..    LDA #&14
964A  8D 27 FC     .'.   STA datout               ; DCL (Device Clear)
964D  20 A4 97      ..   JSR &97A4
9650  60           `     RTS

; -----------------------------------------------------------------------------
; Send UNL (Unlisten) to the GPIB bus
; -----------------------------------------------------------------------------
.
9651  A9 3F        .?    LDA #&3F
9653  8D 27 FC     .'.   STA datout               ; UNL (Unlisten)
9656  20 A4 97      ..   JSR &97A4
9659  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
965A  20 94 98      ..   JSR &9894                ; Set Talk only & Go to standby
965D  20 5F 98      _.   JSR &985F                ; Write string stored in &0F01 with length &0F00 to the IEEE488 bus
9660  20 A2 98      ..   JSR &98A2                ; Take control asynchronously & Clear Talk only
9663  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9664  20 C7 96      ..   JSR &96C7                ; Send auxiliary commands lon=1, hdfa=1, rhdf, gts
9667  20 26 98      &.   JSR &9826
966A  20 DC 96      ..   JSR &96DC                ; Send auxiliary commands tca, hdfa=0, lon=0
966D  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
966E  20 C7 96      ..   JSR &96C7                ; Send auxiliary commands lon=1, hdfa=1, rhdf, gts
9671  20 EF 96      ..   JSR &96EF                ; Read string from the IEEE488 bus
9674  20 DC 96      ..   JSR &96DC                ; Send auxiliary commands tca, hdfa=0, lon=0
9677  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9678  20 C7 96      ..   JSR &96C7                ; Send auxiliary commands lon=1, hdfa=1, rhdf, gts
967B  20 0B 98      ..   JSR &980B
967E  20 DC 96      ..   JSR &96DC                ; Send auxiliary commands tca, hdfa=0, lon=0
9681  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9682  A9 89        ..    LDA #set+lon             ; Load the mnemonic for 'Set Listen only'
9684  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
9687  A9 84        ..    LDA #set+hdfe            ; Load the mnemonic for 'Set Holdoff on EOI only'
9689  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
968C  A9 0B        ..    LDA #gts                 ; Load the mnemonic for 'Go to standby'
968E  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
9691  60           `     RTS

; -----------------------------------------------------------------------------
; Perform parallel poll (result is stored in &0F00)
; -----------------------------------------------------------------------------
.
9692  20 D1 97      ..   JSR &97D1                ; Is the 'TRANSFER in progress' flag?
9695  F0 18        ..    BEQ &96AF                ; No? Then do the parallel poll
9697  A9 0D        ..    LDA #tcs                 ; Load the mnemonic for 'Take control synchronously'
9699  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
969C  20 A4 97      ..   JSR &97A4
969F  A9 04        ..    LDA #clr+hdfe            ; Load the mnemonic for 'Clear Holdoff on EOI only'
96A1  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96A4  A9 09        ..    LDA #clr+lon             ; Load the mnemonic for 'Clear Listen only'
96A6  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96A9  20 AF 96      ..   JSR &96AF                ; Do the parallel poll
96AC  4C 82 96     L..   JMP &9682
.
96AF  A9 8E        ..    LDA #set+rpp             ; Load the mnemonic for 'Set Request parallel poll'
96B1  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96B4  EA           .     NOP                      ; 1 NOP = 2 clockcycles
96B5  EA           .     NOP
96B6  EA           .     NOP
96B7  EA           .     NOP
96B8  AD 23 FC     .#.   LDA cmdpassthru          ; Status bits obtained from the Command Passthru register
96BB  8D 00 0F     ...   STA &0F00
96BE  A9 0E        ..    LDA #clr+rpp             ; Load the mnemonic for 'Clear Request parallel poll'
96C0  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96C3  20 A4 97      ..   JSR &97A4
96C6  60           `     RTS

; -----------------------------------------------------------------------------
; Send auxiliary commands lon=1, hdfa=1, rhdf, gts
; -----------------------------------------------------------------------------
.
96C7  A9 89        ..    LDA #set+lon             ; Load the mnemonic for 'Set Listen only'
96C9  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96CC  A9 83        ..    LDA #set+hdfa            ; Load the mnemonic for 'Set Holdoff on all data'
96CE  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96D1  A9 02        ..    LDA #rhdf                ; Load the mnemonic for 'Release RFD Holdoff'
96D3  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96D6  A9 0B        ..    LDA #gts                 ; Load the mnemonic for 'Go to standby'
96D8  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96DB  60           `     RTS

; -----------------------------------------------------------------------------
; Send auxiliary commands tca, hdfa=0, lon=0
; -----------------------------------------------------------------------------
.
96DC  A9 0C        ..    LDA #tca                 ; Load the mnemonic for Take control asynchronously
96DE  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96E1  20 A4 97      ..   JSR &97A4
96E4  A9 03        ..    LDA #clr+hdfa            ; Load the mnemonic for Clear Holdoff on all data
96E6  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96E9  A9 09        ..    LDA #clr+lon             ; Load the mnemonic for Clear Listen only
96EB  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
96EE  60           `     RTS

; -----------------------------------------------------------------------------
; Read string from the IEEE488 bus
; -----------------------------------------------------------------------------
.
96EF  A0 00        ..    LDY #&00
96F1  B1 C0        ..    LDA (&C0),Y              ; A = No. of EOS characters
96F3  8D 01 0E     ...   STA &0E01
96F6  8D 0F 0E     ...   STA &0E0F
96F9  A9 00        ..    LDA #&00
96FB  8D 00 0E     ...   STA &0E00
96FE  8D 00 0F     ...   STA &0F00
9701  4C 09 97     L..   JMP &9709
.
9704  A9 02        ..    LDA #rhdf                ; Load the mnemonic for Release RFD Holdoff
9706  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
.
9709  20 7D 97      }.   JSR &977D
970C  AD 27 FC     .'.   LDA datin
970F  8D 0E 0E     ...   STA &0E0E
.
9712  AC 0F 0E     ...   LDY &0E0F
9715  D1 C0        ..    CMP (&C0),Y
9717  D0 18        ..    BNE &9731
9719  20 71 97      q.   JSR &9771                ; If &0E0F = &0E01 then &0F00 = &0E00
971C  AE 00 0E     ...   LDX &0E00
971F  E8           .     INX
9720  F0 09        ..    BEQ &972B
9722  AD 0E 0E     ...   LDA &0E0E
9725  9D 00 0F     ...   STA &0F00,X
9728  8E 00 0E     ...   STX &0E00
.
972B  CE 0F 0E     ...   DEC &0E0F
972E  D0 2B        .+    BNE &975B
9730  60           `     RTS
.
9731  20 6A 97      j.   JSR &976A                ; Compare &0E0F with &0E01
9734  F0 09        ..    BEQ &973F
9736  AD 01 0E     ...   LDA &0E01
9739  8D 0F 0E     ...   STA &0E0F
973C  4C 12 97     L..   JMP &9712
.
973F  AE 00 0E     ...   LDX &0E00
9742  E8           .     INX
9743  D0 0D        ..    BNE &9752
9745  CA           .     DEX
9746  8E 00 0F     ...   STX &0F00
9749  A0 00        ..    LDY #&00
974B  B1 C6        ..    LDA (&C6),Y
974D  09 10        ..    ORA #&10                 ; Set bit 4 of (&C6),0 (string of more than 255 characters received)
974F  91 C6        ..    STA (&C6),Y
9751  60           `     RTS
.
9752  AD 0E 0E     ...   LDA &0E0E
9755  9D 00 0F     ...   STA &0F00,X
9758  8E 00 0E     ...   STX &0E00
.
975B  A0 00        ..    LDY #&00
975D  B1 C6        ..    LDA (&C6),Y
975F  29 40        )@    AND #&40                 ; Check if 6 of (&C6),0 is set
9761  D0 03        ..    BNE &9766                ; Jump if the 'END end remote message received' flag is set
9763  4C 04 97     L..   JMP &9704
.
9766  20 71 97      q.   JSR &9771                ; If &0E0F = &0E01 then &0F00 = &0E00
9769  60           `     RTS

; -----------------------------------------------------------------------------
; Compare &0E0F with &0E01
; -----------------------------------------------------------------------------
.
976A  AD 0F 0E     ...   LDA &0E0F
976D  CD 01 0E     ...   CMP &0E01
9770  60           `     RTS

; -----------------------------------------------------------------------------
; If &0E0F = &0E01 then &0F00 = &0E00
; -----------------------------------------------------------------------------
.
9771  20 6A 97      j.   JSR &976A                ; Compare &0E0F with &0E01
9774  D0 06        ..    BNE &977C
9776  AD 00 0E     ...   LDA &0E00
9779  8D 00 0F     ...   STA &0F00
.
977C  60           `     RTS

; -----------------------------------------------------------------------------
; (used for reads)
; -----------------------------------------------------------------------------
.
977D  20 49 98      I.   JSR &9849                ; Is the 'use timeouts' flag set?
9780  D0 0B        ..    BNE &978D                ; Yes? Then go to 978D
.
9782  20 F2 98      ..   JSR &98F2                ; Is the 'input error' flag set?
9785  D0 14        ..    BNE &979B                ; Yes? Then go to 979B
9787  20 BF 98      ..   JSR &98BF                ; Check if the escape flag is set, and if it is, exit
978A  4C 82 97     L..   JMP &9782
.
978D  20 50 98      P.   JSR &9850
.
9790  20 F2 98      ..   JSR &98F2                ; Is the 'input error' flag set?
9793  D0 06        ..    BNE &979B                ; Yes? Then go to 979B
9795  20 DA 98      ..   JSR &98DA
9798  4C 90 97     L..   JMP &9790
.
979B  A0 02        ..    LDY #&02
979D  B1 C6        ..    LDA (&C6),Y
979F  29 FE        ).    AND #&FE                 ; Clear bit 0 of (&C6),2 (input error flag)
97A1  91 C6        ..    STA (&C6),Y
97A3  60           `     RTS

; -----------------------------------------------------------------------------
; (used for writes and auxcmd's)
; -----------------------------------------------------------------------------
.
97A4  20 49 98      I.   JSR &9849                ; Is the 'use timeouts' flag set?
97A7  D0 0E        ..    BNE &97B7                ; Yes? Then go to 97B7
.
97A9  20 EB 98      ..   JSR &98EB                ; Is the 'output error' flag set?
97AC  D0 1A        ..    BNE &97C8                ; Yes? Then go to 97C8
97AE  20 04 9A      ..   JSR &9A04                ; If the 'incomplete source handshake' flag is set then exit with C set and set the 'non fatal error' flag
97B1  20 BF 98      ..   JSR &98BF                ; Check if the escape flag is set, and if it is, exit
97B4  4C A9 97     L..   JMP &97A9
.
97B7  20 50 98      P.   JSR &9850
.
97BA  20 EB 98      ..   JSR &98EB                ; Is the 'output error' flag set?
97BD  D0 09        ..    BNE &97C8                ; Yes? Then go to 97C8
97BF  20 04 9A      ..   JSR &9A04                ; If the 'incomplete source handshake' flag is set then exit with C set and set the 'non fatal error' flag
97C2  20 C9 98      ..   JSR &98C9
97C5  4C BA 97     L..   JMP &97BA
.
97C8  A0 02        ..    LDY #&02
97CA  B1 C6        ..    LDA (&C6),Y
97CC  29 FD        ).    AND #&FD                 ; Clear bit 1 of (&C6),2
97CE  91 C6        ..    STA (&C6),Y
97D0  60           `     RTS

; -----------------------------------------------------------------------------
; Is the 'TRANSFER in progress' flag?
; -----------------------------------------------------------------------------
.
97D1  A0 00        ..    LDY #&00
97D3  B1 C6        ..    LDA (&C6),Y
97D5  29 08        ).    AND #&08                 ; Is bit 3 of (&C6),0 set?
97D7  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
97D8  A2 17        ..    LDX #&17
97DA  A0 0E        ..    LDY #&0E
97DC  A9 03        ..    LDA #&03
97DE  20 F1 FF      ..   JSR osword               ; Read interval timer; parameterblock is at &0E17
97E1  AD 18 0E     ...   LDA &0E18
97E4  CD 13 0E     ...   CMP &0E13
97E7  B0 12        ..    BCS &97FB
97E9  AD 11 0E     ...   LDA &0E11
97EC  18           .     CLC
97ED  6D 12 0E     m..   ADC &0E12
97F0  8D 11 0E     ...   STA &0E11
97F3  A9 00        ..    LDA #&00
97F5  8D 12 0E     ...   STA &0E12
97F8  8D 13 0E     ...   STA &0E13
.
97FB  AD 17 0E     ...   LDA &0E17
97FE  38           8     SEC
97FF  ED 12 0E     ...   SBC &0E12
9802  CD 11 0E     ...   CMP &0E11
9805  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9806  A9 02        ..    LDA #rhdf                ; Load the mnemonic for Release RFD Holdoff
9808  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
.
980B  20 7D 97      }.   JSR &977D
980E  AD 27 FC     .'.   LDA datin                ; Clear BI bit in Interrupt Status 0 ???
9811  EE 0A 0E     ...   INC &0E0A
9814  D0 F0        ..    BNE &9806
9816  EE 0B 0E     ...   INC &0E0B
9819  D0 EB        ..    BNE &9806
981B  EE 0C 0E     ...   INC &0E0C
981E  D0 E6        ..    BNE &9806
9820  EE 0D 0E     ...   INC &0E0D
9823  D0 E1        ..    BNE &9806
9825  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9826  A9 00        ..    LDA #&00
9828  8D 00 0F     ...   STA &0F00
982B  4C 33 98     L3.   JMP &9833

; -----------------------------------------------------------------------------
; Read 
; -----------------------------------------------------------------------------
.
982E  A9 02        ..    LDA #rhdf                ; Load the mnemonic for Release RFD Holdoff
9830  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
.
9833  20 7D 97      }.   JSR &977D
9836  AE 00 0F     ...   LDX &0F00
9839  E8           .     INX
983A  AD 27 FC     .'.   LDA datin
983D  9D 00 0F     ...   STA &0F00,X
9840  8E 00 0F     ...   STX &0F00
9843  EC 1C 0E     ...   CPX &0E1C
9846  90 E6        ..    BCC &982E
9848  60           `     RTS

; -----------------------------------------------------------------------------
; Check if the 'use timeouts' flag is set
; -----------------------------------------------------------------------------
.
9849  A0 01        ..    LDY #&01
984B  B1 C6        ..    LDA (&C6),Y
984D  29 02        ).    AND #&02                 ; Is bit 1 of (&C6),1 set?
984F  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
9850  A9 FF        ..    LDA #&FF
9852  8D 11 0E     ...   STA &0E11
.
9855  A2 12        ..    LDX #&12
9857  A0 0E        ..    LDY #&0E
9859  A9 03        ..    LDA #&03
985B  20 F1 FF      ..   JSR osword               ; Read interval timer; parameterblock is at &0E12
985E  60           `     RTS

; -----------------------------------------------------------------------------
; Write string stored in &0F01 with length &0F00 to the IEEE488 bus
; -----------------------------------------------------------------------------
.
985F  AE 00 0F     ...   LDX &0F00
.
9862  BD 00 0F     ...   LDA &0F00,X
9865  8D 27 FC     .'.   STA datout
9868  8E 1D 0E     ...   STX &0E1D
986B  20 A4 97      ..   JSR &97A4
986E  AE 1D 0E     ...   LDX &0E1D
9871  CA           .     DEX
9872  D0 EE        ..    BNE &9862
9874  A0 00        ..    LDY #&00
9876  B1 C0        ..    LDA (&C0),Y              ; Get number of EOS bytes
9878  A8           .     TAY
.
9879  C0 01        ..    CPY #&01
987B  D0 05        ..    BNE &9882
987D  A9 08        ..    LDA #feoi                ; Load the mnemonic for Send EOI with next byte
987F  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
.
9882  B1 C0        ..    LDA (&C0),Y              ; Send EOS byte to the bus
9884  8D 27 FC     .'.   STA datout
9887  8C 1D 0E     ...   STY &0E1D
988A  20 A4 97      ..   JSR &97A4
988D  AC 1D 0E     ...   LDY &0E1D
9890  88           .     DEY
9891  D0 E6        ..    BNE &9879
9893  60           `     RTS

; -----------------------------------------------------------------------------
; Set Talk only & Go to standby
; -----------------------------------------------------------------------------
.
9894  A9 8A        ..    LDA #set+ton             ; Load the mnemonic for 'Set Talk only'
9896  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
9899  A9 0B        ..    LDA #gts                 ; Load the mnemonic for 'Go to standby'
989B  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
989E  20 A4 97      ..   JSR &97A4
98A1  60           `     RTS

; -----------------------------------------------------------------------------
; Take control asynchronously & Clear Talk only
; -----------------------------------------------------------------------------
.
98A2  A9 0C        ..    LDA #tca                 ; Load the mnemonic for Take control asynchronously
98A4  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
98A7  20 A4 97      ..   JSR &97A4
98AA  A9 0A        ..    LDA #clr+ton             ; Load the mnemonic for Clear Talk only
98AC  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
98AF  60           `     RTS

; -----------------------------------------------------------------------------
; Send PPC (Parallel Poll Configure) to the GPIB bus
; -----------------------------------------------------------------------------
.
98B0  A9 05        ..    LDA #&05                 ; PPC (Parallel Poll Configure)
98B2  8D 27 FC     .'.   STA datout
98B5  20 A4 97      ..   JSR &97A4
98B8  EA           .     NOP
98B9  EA           .     NOP
98BA  EA           .     NOP
98BB  EA           .     NOP
98BC  EA           .     NOP
98BD  EA           .     NOP
98BE  60           `     RTS

; -----------------------------------------------------------------------------
; Check if the escape flag is set, and if it is, exit
; -----------------------------------------------------------------------------
.
98BF  A5 FF        ..    LDA &FF                  ; Escape flag; bit 7 is set if an unserviced escape is pending
98C1  29 80        ).    AND #&80                 ; mask : 10000000
98C3  F0 03        ..    BEQ &98C8                ; No, it's not set
98C5  4C AF 99     L..   JMP &99AF                ; Yes, it's set, so exit IEEEFS with C set
.
98C8  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
98C9  20 D8 97      ..   JSR &97D8
98CC  B0 01        ..    BCS &98CF
98CE  60           `     RTS
.
98CF  A0 00        ..    LDY #&00
98D1  B1 C6        ..    LDA (&C6),Y
98D3  09 01        ..    ORA #&01                 ; Set bit 0 of (&C6),0 (timeout on output)
98D5  91 C6        ..    STA (&C6),Y
98D7  4C A7 99     L..   JMP &99A7                ; Exit with C set and set the 'non fatal error' flag

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
98DA  20 D8 97      ..   JSR &97D8
98DD  B0 01        ..    BCS &98E0
98DF  60           `     RTS
.
98E0  A0 00        ..    LDY #&00
98E2  B1 C6        ..    LDA (&C6),Y
98E4  09 02        ..    ORA #&02                 ; Set bit 1 of (&C6),0 (timeout on input)
98E6  91 C6        ..    STA (&C6),Y
98E8  4C A7 99     L..   JMP &99A7                ; Exit with C set and set the 'non fatal error' flag

; -----------------------------------------------------------------------------
; Check if the 'output error' flag is set
; -----------------------------------------------------------------------------
.
98EB  A0 02        ..    LDY #&02
98ED  B1 C6        ..    LDA (&C6),Y
98EF  29 02        ).    AND #&02                 ; Is bit 1 of (&C6),2 set?
98F1  60           `     RTS

; -----------------------------------------------------------------------------
; Check if the 'input error' flag is set
; -----------------------------------------------------------------------------
.
98F2  A0 02        ..    LDY #&02
98F4  B1 C6        ..    LDA (&C6),Y
98F6  29 01        ).    AND #&01                 ; Is bit 0 of (&C6),2 set?
98F8  60           `     RTS

; -----------------------------------------------------------------------------
; Write contents of &0E0E to the TMS9914A's 'Data out' register
; -----------------------------------------------------------------------------
.
98F9  EE 0A 0E     ...   INC &0E0A
98FC  D0 23        .#    BNE &9921
98FE  EE 0B 0E     ...   INC &0E0B
9901  D0 1E        ..    BNE &9921
9903  EE 0C 0E     ...   INC &0E0C
9906  D0 19        ..    BNE &9921
9908  EE 0D 0E     ...   INC &0E0D
990B  D0 14        ..    BNE &9921
990D  A9 08        ..    LDA #feoi                ; Send EOI with next byte
990F  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
9912  20 21 99      !.   JSR &9921
9915  20 A2 98      ..   JSR &98A2                ; Take control asynchronously & Clear Talk only
9918  A0 01        ..    LDY #&01
991A  B1 C6        ..    LDA (&C6),Y
991C  29 FE        ).    AND #&FE                 ; Clear bit 0 of (&C6),1 (binary coded data is being handled)
991E  91 C6        ..    STA (&C6),Y
9920  60           `     RTS
.
9921  AD 0E 0E     ...   LDA &0E0E
9924  8D 27 FC     .'.   STA datout
9927  20 A4 97      ..   JSR &97A4
992A  60           `     RTS

; -----------------------------------------------------------------------------
; Read byte from the TMS9914 'Data in' register and store it in &0E0E
; -----------------------------------------------------------------------------
.
992B  A0 03        ..    LDY #&03
992D  B1 C8        ..    LDA (&C8),Y              ; Is (&C8),3 = 0?
992F  F0 0A        ..    BEQ &993B
9931  A9 00        ..    LDA #&00
9933  91 C8        ..    STA (&C8),Y              ; (&C8),3 = 0
9935  20 C7 96      ..   JSR &96C7                ; Send auxiliary commands lon=1, hdfa=1, rhdf, gts
9938  4C 40 99     L@.   JMP &9940
.
993B  A9 02        ..    LDA #rhdf                ; Load the mnemonic for Release RFD Holdoff
993D  8D 26 FC     .&.   STA auxcmd               ; Send it to the TMS9914A's Auxiliary Command Register
.
9940  20 7D 97      }.   JSR &977D
9943  AD 27 FC     .'.   LDA datin
9946  8D 0E 0E     ...   STA &0E0E
9949  EE 0A 0E     ...   INC &0E0A
994C  D0 1A        ..    BNE &9968
994E  EE 0B 0E     ...   INC &0E0B
9951  D0 15        ..    BNE &9968
9953  EE 0C 0E     ...   INC &0E0C
9956  D0 10        ..    BNE &9968
9958  EE 0D 0E     ...   INC &0E0D
995B  D0 0B        ..    BNE &9968
995D  20 DC 96      ..   JSR &96DC                ; Send auxiliary commands tca, hdfa=0, lon=0
9960  A0 01        ..    LDY #&01
9962  B1 C6        ..    LDA (&C6),Y
9964  29 FE        ).    AND #&FE                 ; Clear bit 0 of (&C6),1 (binary coded data is being handled)
9966  91 C6        ..    STA (&C6),Y
.
9968  60           `     RTS

; -----------------------------------------------------------------------------
; Prints error &8C (Clear not executed) if the 'CLEAR executed' flag is not set
; -----------------------------------------------------------------------------
.
9969  A0 01        ..    LDY #&01
996B  B1 C6        ..    LDA (&C6),Y
996D  29 80        ).    AND #&80                 ; Is bit 7 of (&C6),1 set? (CLEAR executed)
996F  D0 0B        ..    BNE &997C
9971  A9 81        ..    LDA #&81                 ; No? Then print error message
9973  85 CB        ..    STA &CB
9975  A9 07        ..    LDA #&07
9977  85 CA        ..    STA &CA
9979  4C 0D 93     L..   JMP &930D                ; Print error &8C (Clear not executed)
.
997C  60           `     RTS

; -----------------------------------------------------------------------------
;
; -----------------------------------------------------------------------------
.
997D  20 69 99      i.   JSR &9969                ; Prints error &8C (Clear not executed) if the 'CLEAR executed' flag has not been set
9980  A0 00        ..    LDY #&00
9982  B1 C6        ..    LDA (&C6),Y
9984  29 0C        ).    AND #&0C                 ; Mask out the 'computer is controller in charge' and 'TRANSFER in progress' flags
9986  C9 04        ..    CMP #&04                 ; Is only the 'computer is controller in charge' flag set?
9988  D0 1D        ..    BNE &99A7                ; Exit with C set and set the 'non fatal error' flag
998A  A0 02        ..    LDY #&02
998C  B1 C6        ..    LDA (&C6),Y
998E  29 14        ).    AND #&14                 ; Mask out the 'computer in process of acknowledging an unidentified command from another device' and 'conflict for control of interface' flag
9990  D0 15        ..    BNE &99A7                ; Exit with C set and set the 'non fatal error' flag
9992  60           `     RTS

; -----------------------------------------------------------------------------
; Prints error &89 (No device talked) if the 'a device has been TALKed' is not set
; -----------------------------------------------------------------------------
.
9993  A0 01        ..    LDY #&01
9995  B1 C6        ..    LDA (&C6),Y
9997  29 10        ).    AND #&10                 ; Is bit 4 of (&C6),1 set?
9999  D0 0B        ..    BNE &99A6
.
999B  A9 80        ..    LDA #&80
999D  85 CB        ..    STA &CB
999F  A9 D0        ..    LDA #&D0
99A1  85 CA        ..    STA &CA
99A3  4C 0D 93     L..   JMP &930D                ; Print error &89 (No device talked)
.
99A6  60           `     RTS

; -----------------------------------------------------------------------------
; Exit with C set and set the 'non fatal error' flag
; -----------------------------------------------------------------------------
.
99A7  A0 03        ..    LDY #&03
99A9  B1 C6        ..    LDA (&C6),Y
99AB  09 80        ..    ORA #&80                 ; Set bit 7 of (&C6),3
99AD  91 C6        ..    STA (&C6),Y

; -----------------------------------------------------------------------------
; Exit with C set
; -----------------------------------------------------------------------------
.
99AF  AE 22 0E     .".   LDX &0E22                ; Restore the stack pointer
99B2  9A           .     TXS
99B3  AC 20 0E     . .   LDY &0E20                ; Restore the Y register
99B6  AE 1F 0E     ...   LDX &0E1F                ; Restore the X register
99B9  A9 00        ..    LDA #&00                 ; Return with A=0...
99BB  38           8     SEC                      ; ...and with the C flag set
99BC  60           `     RTS

; -----------------------------------------------------------------------------
; Prints error &89 (No device talked) if the 'a device has been TALKed' and error &8A (No device listened) if the 'a device or devices have been LISTENed' flags are not set
; -----------------------------------------------------------------------------
.
99BD  A0 01        ..    LDY #&01
99BF  B1 C6        ..    LDA (&C6),Y
99C1  29 10        ).    AND #&10                 ; Is bit 4 of (&C6),1 set?
99C3  F0 D6        ..    BEQ &999B                ; Print error &89 (No device talked)
99C5  B1 C6        ..    LDA (&C6),Y
99C7  29 20        )     AND #&20                 ; Is bit 5 of (&C6),1 set?
99C9  F0 01        ..    BEQ &99CC                ; Print error &8A (No device listened)
99CB  60           `     RTS
.
99CC  A9 80        ..    LDA #&80
99CE  85 CB        ..    STA &CB
99D0  A9 E2        ..    LDA #&E2
99D2  85 CA        ..    STA &CA
99D4  4C 0D 93     L..   JMP &930D                ; Print error &8A (No device listened)

; -----------------------------------------------------------------------------
; Prints error &8A (No device listened) if the 'a device or devices have been LISTENed' flag is not set
; -----------------------------------------------------------------------------
.
99D7  A0 01        ..    LDY #&01
99D9  B1 C6        ..    LDA (&C6),Y
99DB  29 20        )     AND #&20                 ; Is bit 5 of (&C6),1 set?
99DD  F0 ED        ..    BEQ &99CC                ; Print error &8A (No device listened)
99DF  60           `     RTS

; -----------------------------------------------------------------------------
; If the 'computer is controller in charge' flag is not set then exit with C set and set the 'non fatal error' flag
; -----------------------------------------------------------------------------
.
99E0  A0 00        ..    LDY #&00
99E2  B1 C6        ..    LDA (&C6),Y
99E4  29 04        ).    AND #&04                 ; Is bit 2 of (&C6),0 clear?
99E6  F0 BF        ..    BEQ &99A7                ; Exit with C set and set the 'non fatal error' flag
99E8  60           `     RTS

; -----------------------------------------------------------------------------
; If bits 4, 3 or 2 of (&C6),2 are set then exit with C set and set the 'non fatal error' flag
; -----------------------------------------------------------------------------
.
99E9  A0 02        ..    LDY #&02
99EB  B1 C6        ..    LDA (&C6),Y
99ED  29 1C        ).    AND #&1C                 ; Are bits 4, 3 and 2 of (&C6),2 set?
99EF  D0 B6        ..    BNE &99A7                ; Exit with C set and set the 'non fatal error' flag
99F1  60           `     RTS

; -----------------------------------------------------------------------------
; If the 'non fatal error' flag is set then exit with C set and set the 'non fatal error' flag
; -----------------------------------------------------------------------------
.
99F2  A0 03        ..    LDY #&03
99F4  B1 C6        ..    LDA (&C6),Y
99F6  29 80        ).    AND #&80                 ; Is bit 7 of (&C6),3 set?
99F8  D0 AD        ..    BNE &99A7                ; Exit with C set and set the 'non fatal error' flag
99FA  60           `     RTS

; -----------------------------------------------------------------------------
; If the 'computer is controller in charge' flag is set then exit with C set and set the 'non fatal error' flag
; -----------------------------------------------------------------------------
.
99FB  A0 00        ..    LDY #&00
99FD  B1 C6        ..    LDA (&C6),Y
99FF  29 04        ).    AND #&04                 ; Is bit 2 of (&C6),0 set?
9A01  D0 A4        ..    BNE &99A7                ; Exit with C set and set the 'non fatal error' flag
9A03  60           `     RTS

; -----------------------------------------------------------------------------
; If the 'incomplete source handshake' flag is set then exit with C set and set the 'non fatal error' flag
; -----------------------------------------------------------------------------
.
9A04  A0 00        ..    LDY #&00
9A06  B1 C6        ..    LDA (&C6),Y
9A08  29 80        ).    AND #&80                 ; Is bit 7 of (&C6),0 set?
9A0A  D0 9B        ..    BNE &99A7                ; Exit with C set and set the 'non fatal error' flag
9A0C  60           `     RTS

; -----------------------------------------------------------------------------
; OSWORD call &80 command &01
; -----------------------------------------------------------------------------
.
9A0D  A0 00        ..    LDY #&00
9A0F  AD 26 FC     .&.   LDA busstatus
9A12  29 04        ).    AND #&04                 ; Is bit 2 (NDAC) set in the TMS9914A's Bus Status register?
9A14  D0 07        ..    BNE &9A1D                ; No? Then jump to &9A1D
.
9A16  B1 C6        ..    LDA (&C6),Y
9A18  29 DF        ).    AND #&DF                 ; Clear bit 5 of (&C6),0 (SRQ service request remote message received)
9A1A  91 C6        ..    STA (&C6),Y
9A1C  60           `     RTS
.
9A1D  B1 C6        ..    LDA (&C6),Y
9A1F  29 04        ).    AND #&04                 ; Is the 'TRANSFER in progress' flag set?
9A21  F0 F3        ..    BEQ &9A16                ; No? Then clear bit 5 of (&C6),0
9A23  B1 C6        ..    LDA (&C6),Y              ; Yes? Then set bit 5 of (&C6),0
9A25  09 20        .     ORA #&20                 ; Set bit 5 of (&C6),0 (SRQ service request remote message received)
9A27  91 C6        ..    STA (&C6),Y
9A29  60           `     RTS

; -----------------------------------------------------------------------------
; End of code
; -----------------------------------------------------------------------------

9A2A  00           .     BRK
9A2B  00           .     BRK
9A2C  A0 11        ..    LDY #&11
9A2E  C8           .     INY
9A2F  00           .     BRK
9A30  FF           .     ...
9A31  9F           .     ...
9A32  F6 7F        .    INC &7F,X
9A34  FB           .     ...
9A35  5F           _     ...
9A36  FB           .     ...
9A37  FF           .     ...
9A38  E1 85        ..    SBC (&85,X)
9A3A  10 02        ..    BPL &9A3E
9A3C  80           .     ...
9A3D  04           .     ...
9A3E  A2 44        .D    LDX #&44
9A40  7B           {     ...
9A41  AF           .     ...
9A42  BD DF FB     ...   LDA &FBDF,X
9A45  FF           .     ...
9A46  EF           .     ...
9A47  FF           .     ...
9A48  80           .     ...
9A49  1E 12 00     ...   ASL &0012,Y
9A4C  80           .     ...
9A4D  02           .     ...
9A4E  11 0A        ..    ORA (&0A),Y
9A50  FF           .     ...
9A51  6F           o     ...
9A52  F9 FF FB     ...   SBC &FBFF,Y
9A55  EE F3 EF     ...   INC &EFF3
9A58  20 24 58      $X   JSR &5824
9A5B  04           .     ...
9A5C  04           .     ...
9A5D  08           .     PHP
9A5E  01 11        ..    ORA (&11,X)
9A60  FF           .     ...
9A61  7F                ...
9A62  DF           .     ...
9A63  FF           .     ...
9A64  FF           .     ...
9A65  FF           .     ...
9A66  AF           .     ...
9A67  FB           .     ...
9A68  20 30 50      0P   JSR &5030
9A6B  00           .     BRK
9A6C  00           .     BRK
9A6D  2B           +     ...
9A6E  10 00        ..    BPL &9A70
9A70  FB           .     ...
9A71  7F                ...
9A72  EE FF DB     ...   INC &DBFF
9A75  AF           .     ...
9A76  FF           .     ...
9A77  FF           .     ...
9A78  00           .     BRK
9A79  04           .     ...
9A7A  00           .     BRK
9A7B  00           .     BRK
9A7C  01 00        ..    ORA (&00,X)
9A7E  20 01 FE      ..   JSR &FE01
9A81  CF           .     ...
9A82  FF           .     ...
9A83  DF           .     ...
9A84  FB           .     ...
9A85  5F           _     ...
9A86  DF           .     ...
9A87  FF           .     ...
9A88  00           .     BRK
9A89  CA           .     DEX
9A8A  04           .     ...
9A8B  00           .     BRK
9A8C  00           .     BRK
9A8D  29 94        ).    AND #&94
9A8F  00           .     BRK
9A90  9F           .     ...
9A91  FF           .     ...
9A92  BE FB FF     ...   LDX &FFFB,Y
9A95  7F                ...
9A96  FE EF 00     ...   INC &00EF,X
9A99  04           .     ...
9A9A  50 00        P.    BVC &9A9C
9A9C  04           .     ...
9A9D  02           .     ...
9A9E  00           .     BRK
9A9F  00           .     BRK
9AA0  FF           .     ...
9AA1  3E F8 FB     >..   ROL &FBF8,X
9AA4  EE 7F EA     ..   INC &EA7F
9AA7  F7           .     ...
9AA8  00           .     BRK
9AA9  08           .     PHP
9AAA  41 00        ..    EOR (&00,X)
9AAC  26 08        &.    ROL &08
9AAE  80           .     ...
9AAF  20 FE E7      ..   JSR &E7FE
9AB2  9F           .     ...
9AB3  FF           .     ...
9AB4  DE AD AF     ...   DEC &AFAD,X
9AB7  EF           .     ...
9AB8  00           .     BRK
9AB9  46 41        FA    LSR &41
9ABB  00           .     BRK
9ABC  00           .     BRK
9ABD  01 84         .    ORA (&84,X)
9ABF  00           .     BRK
9AC0  FB           .     ...
9AC1  DE BF DF     ...   DEC &DFBF,X
9AC4  DE 3F FD     .?.   DEC &FD3F,X
9AC7  FF           .     ...
9AC8  88           .     DEY
9AC9  0E 01 40     ..@   ASL &4001
9ACC  12           .     ...
9ACD  00           .     BRK
9ACE  22           "     ...
9ACF  08           .     PHP
9AD0  F7           .     ...
9AD1  1F           .     ...
9AD2  F7           .     ...
9AD3  DF           .     ...
9AD4  FE FF F4     ...   INC &F4FF,X
9AD7  FB           .     ...
9AD8  08           .     PHP
9AD9  00           .     BRK
9ADA  00           .     BRK
9ADB  09 82        ..    ORA #&82
9ADD  00           .     BRK
9ADE  1A           .     ...
9ADF  09 FB        ..    ORA #&FB
9AE1  AF           .     ...
9AE2  EF           .     ...
9AE3  FB           .     ...
9AE4  FB           .     ...
9AE5  B7           .     ...
9AE6  FF           .     ...
9AE7  FF           .     ...
9AE8  08           .     PHP
9AE9  40           @     RTI
9AEA  00           .     BRK
9AEB  00           .     BRK
9AEC  80           .     ...
9AED  29 1A        ).    AND #&1A
9AEF  00           .     BRK
9AF0  FB           .     ...
9AF1  AB           .     ...
9AF2  F6 5F        ._    INC &5F,X
9AF4  5F           _     ...
9AF5  2F           /     ...
9AF6  F3           .     ...
9AF7  FF           .     ...
9AF8  00           .     BRK
9AF9  02           .     ...
9AFA  4B           K     ...
9AFB  00           .     BRK
9AFC  80           .     ...
9AFD  20 10 00      ..   JSR &0010
9B00  80           .     ...
9B01  0D 00 00     ...   ORA &0000
9B04  00           .     BRK
9B05  AB           .     ...
9B06  80           .     ...
9B07  00           .     BRK
9B08  BB           .     ...
9B09  27           '     ...
9B0A  3B           ;     ...
9B0B  6F           o     ...
9B0C  FF           .     ...
9B0D  9F           .     ...
9B0E  F6 FF         ..   INC &FF,X
9B10  80           .     ...
9B11  07           .     ...
9B12  10 00        ..    BPL &9B14
9B14  20 01 12      ..   JSR &1201
9B17  00           .     BRK
9B18  BE 8F FE     ...   LDX &FE8F,Y
9B1B  FB           .     ...
9B1C  FF           .     ...
9B1D  FF           .     ...
9B1E  F6 7F        .    INC &7F,X
9B20  04           .     ...
9B21  09 00        ..    ORA #&00
9B23  40           @     RTI
9B24  20 00 20      .    JSR &2000
9B27  00           .     BRK
9B28  FF           .     ...
9B29  FF           .     ...
9B2A  FB           .     ...
9B2B  DF           .     ...
9B2C  FB           .     ...
9B2D  9F           .     ...
9B2E  74           t     ...
9B2F  FF           .     ...
9B30  38           8     SEC
9B31  00           .     BRK
9B32  00           .     BRK
9B33  01 00         .    ORA (&00,X)
9B35  0D E0 00     ...   ORA &00E0
9B38  FE 4F F5     .O.   INC &F54F,X
9B3B  EE F3 37     ..7   INC &37F3
9B3E  F7           .     ...
9B3F  7F                ...
9B40  10 22        ."    BPL &9B64
9B42  10 09        ..    BPL &9B4D
9B44  01 0E         .    ORA (&0E,X)
9B46  81 02         .    STA (&02,X)
9B48  FF           .     ...
9B49  1F           .     ...
9B4A  B5 DF         ..   LDA &DF,X
9B4C  FE 3F F7     .?.   INC &F73F,X
9B4F  FF           .     ...
9B50  00           .     BRK
9B51  00           .     BRK
9B52  00           .     BRK
9B53  42           B     ...
9B54  40           @     RTI
9B55  10 24        .$    BPL &9B7B
9B57  00           .     BRK
9B58  FF           .     ...
9B59  EF           .     ...
9B5A  FD FF FE     ...   SBC &FEFF,X
9B5D  EF           .     ...
9B5E  FB           .     ...
9B5F  FF           .     ...
9B60  21 89         .    AND (&89,X)
9B62  10 86        ..    BPL &9AEA
9B64  22           "     ...
9B65  47           G     ...
9B66  50 00        P.    BVC &9B68
9B68  FB           .     ...
9B69  7F                ...
9B6A  E9 AB         ..   SBC #&AB
9B6C  76 7F         v   ROR &7F,X
9B6E  B1 FF         ..   LDA (&FF),Y
9B70  11 07         ..   ORA (&07),Y
9B72  00           .     BRK
9B73  00           .     BRK
9B74  20 01 20      .    JSR &2001
9B77  00           .     BRK
9B78  F3           .     ...
9B79  3F           ?     ...
9B7A  F7           .     ...
9B7B  BF           .     ...
9B7C  FE 3F 77     .?w   INC &773F,X
9B7F  BF           .     ...
9B80  A0 00        ..    LDY #&00
9B82  04           .     ...
9B83  08           .     PHP
9B84  20 22 42      "B   JSR &4222
9B87  01 EF         .    ORA (&EF,X)
9B89  77           w     ...
9B8A  FD CF FA     ...   SBC &FACF,X
9B8D  BF           .     ...
9B8E  FF           .     ...
9B8F  EB           .     ...
9B90  00           .     BRK
9B91  28           (     PLP
9B92  40           @     RTI
9B93  10 24        .$    BPL &9BB9
9B95  82           .     ...
9B96  82           .     ...
9B97  00           .     BRK
9B98  FB           .     ...
9B99  6F           o     ...
9B9A  B7           .     ...
9B9B  DF           .     ...
9B9C  7F                ...
9B9D  7F                ...
9B9E  F7           .     ...
9B9F  EF           .     ...
9BA0  A0 0D        ..    LDY #&0D
9BA2  08           .     PHP
9BA3  00           .     BRK
9BA4  58           X     CLI
9BA5  0A           .     ASL A
9BA6  15 01         ..   ORA &01,X
9BA8  7F                ...
9BA9  DF           .     ...
9BAA  FD 7E FE     .~.   SBC &FE7E,X
9BAD  AF           .     ...
9BAE  F6 FF         ..   INC &FF,X
9BB0  00           .     BRK
9BB1  00           .     BRK
9BB2  10 00        ..    BPL &9BB4
9BB4  20 00 82      ..   JSR &8200
9BB7  41 FF         .    EOR (&FF,X)
9BB9  EF           .     ...
9BBA  75 3F         u?   ADC &3F,X
9BBC  FF           .     ...
9BBD  3F           ?     ...
9BBE  F6 FF         ..   INC &FF,X
9BC0  29 01        ).    AND #&01
9BC2  01 00         .    ORA (&00,X)
9BC4  80           .     ...
9BC5  05 C1        ..    ORA &C1
9BC7  40           @     RTI
9BC8  DB           .     ...
9BC9  FF           .     ...
9BCA  FF           .     ...
9BCB  7F                ...
9BCC  F7           .     ...
9BCD  BF           .     ...
9BCE  BF           .     ...
9BCF  FF           .     ...
9BD0  20 08 02      ..   JSR &0208
9BD3  00           .     BRK
9BD4  44           D     ...
9BD5  10 02        ..    BPL &9BD9
9BD7  95 FF         ..   STA &FF,X
9BD9  FF           .     ...
9BDA  FE FD FE     ...   INC &FEFD,X
9BDD  5F           _     ...
9BDE  FE FF 00     ...   INC &00FF,X
9BE1  51 10         Q.   EOR (&10),Y
9BE3  00           .     BRK
9BE4  84 00        ..    STY &00
9BE6  40           @     RTI
9BE7  80           .     ...
9BE8  FF           .     ...
9BE9  1F           .     ...
9BEA  EB           .     ...
9BEB  FF           .     ...
9BEC  FF           .     ...
9BED  5F           _     ...
9BEE  B7           .     ...
9BEF  BF           .     ...
9BF0  B0 02        ..    BCS &9BF4
9BF2  00           .     BRK
9BF3  02           .     ...
9BF4  80           .     ...
9BF5  03           .     ...
9BF6  50 00        P.    BVC &9BF8
9BF8  FF           .     ...
9BF9  5F           _     ...
9BFA  F7           .     ...
9BFB  7B           {     ...
9BFC  FF           .     ...
9BFD  0F           .     ...
9BFE  FC           .     ...
9BFF  BF           .     ...
9C00  FF           .     ...
9C01  FF           .     ...
9C02  FF           .     ...
9C03  FF           .     ...
9C04  FF           .     ...
9C05  EF           .     ...
9C06  F7           .     ...
9C07  FE 06 0B     ...   INC &0B06,X
9C0A  C1 00         ..   CMP (&00,X)
9C0C  0F           .     ...
9C0D  00           .     BRK
9C0E  B0 00        ..    BCS &9C10
9C10  FE FF FE     ...   INC &FEFF,X
9C13  FF           .     ...
9C14  FF           .     ...
9C15  2F           /     ...
9C16  FF           .     ...
9C17  FE 00 02     ...   INC &0200,X
9C1A  A8           .     TAY
9C1B  00           .     BRK
9C1C  00           .     BRK
9C1D  08           .     PHP
9C1E  08           .     PHP
9C1F  04           .     ...
9C20  F7           .     ...
9C21  FF           .     ...
9C22  FF           .     ...
9C23  FF           .     ...
9C24  7F                ...
9C25  AF           .     ...
9C26  FD FF 00     ...   SBC &00FF,X
9C29  90 20        .     BCC &9C4B
9C2B  08           .     PHP
9C2C  04           .     ...
9C2D  0A           .     ASL A
9C2E  20 40 FF      @.   JSR &FF40
9C31  9F           .     ...
9C32  FB           .     ...
9C33  FF           .     ...
9C34  FF           .     ...
9C35  FF           .     ...
9C36  FF           .     ...
9C37  FF           .     ...
9C38  00           .     BRK
9C39  19 8C 00     ...   ORA &008C,Y
9C3C  20 11 10      ..   JSR &1011
9C3F  10 FF        ..    BPL &9C40
9C41  AF           .     ...
9C42  FF           .     ...
9C43  FF           .     ...
9C44  FF           .     ...
9C45  FF           .     ...
9C46  EF           .     ...
9C47  FE 00 02     ...   INC &0200,X
9C4A  28           (     PLP
9C4B  28           (     PLP
9C4C  19 00 02     ...   ORA &0200,Y
9C4F  00           .     BRK
9C50  FF           .     ...
9C51  7F                ...
9C52  F5 7F         .   SBC &7F,X
9C54  FF           .     ...
9C55  ED 76 F3     .v.   SBC &F376
9C58  40           @     RTI
9C59  88           .     DEY
9C5A  8A           .     TXA
9C5B  00           .     BRK
9C5C  80           .     ...
9C5D  28           (     PLP
9C5E  B4 90         ..   LDY &90
9C60  FF           .     ...
9C61  7F                ...
9C62  FE FF FE     ...   INC &FEFF,X
9C65  FF           .     ...
9C66  F5 FF         ..   SBC &FF,X
9C68  00           .     BRK
9C69  44           D     ...
9C6A  60           `     RTS
9C6B  48           H     PHA
9C6C  01 0A         .    ORA (&0A,X)
9C6E  20 04 FF      ..   JSR &FF04
9C71  FB           .     ...
9C72  F7           .     ...
9C73  7F                ...
9C74  FF           .     ...
9C75  EF           .     ...
9C76  FD FF 00     ...   SBC &00FF,X
9C79  08           .     PHP
9C7A  A0 00        ..    LDY #&00
9C7C  02           .     ...
9C7D  00           .     BRK
9C7E  A6 00         ..   LDX &00
9C80  FF           .     ...
9C81  FF           .     ...
9C82  FF           .     ...
9C83  FE FF 7F     ..   INC &7FFF,X
9C86  FB           .     ...
9C87  FF           .     ...
9C88  10 28        .(    BPL &9CB2
9C8A  15 00         ..   ORA &00,X
9C8C  00           .     BRK
9C8D  98           .     TYA
9C8E  28           (     PLP
9C8F  20 FF FF      ..   JSR &FFFF
9C92  EB           .     ...
9C93  FF           .     ...
9C94  FF           .     ...
9C95  DF           .     ...
9C96  FD FF 00     ...   SBC &00FF,X
9C99  03           .     ...
9C9A  D0 00        ..    BNE &9C9C
9C9C  01 04         .    ORA (&04,X)
9C9E  02           .     ...
9C9F  00           .     BRK
9CA0  FF           .     ...
9CA1  FF           .     ...
9CA2  FB           .     ...
9CA3  FF           .     ...
9CA4  FF           .     ...
9CA5  FD 7F FF     ..   SBC &FF7F,X
9CA8  A0 20         .    LDY #&20
9CAA  02           .     ...
9CAB  68           h     PLA
9CAC  00           .     BRK
9CAD  09 11        ..    ORA #&11
9CAF  20 FF EF      ..   JSR &EFFF
9CB2  F7           .     ...
9CB3  FF           .     ...
9CB4  FF           .     ...
9CB5  BF           .     ...
9CB6  D9 EF 00     ...   CMP &00EF,Y
9CB9  A0 A0         ..   LDY #&A0
9CBB  40           @     RTI
9CBC  02           .     ...
9CBD  08           .     PHP
9CBE  20 00 FF      ..   JSR &FF00
9CC1  5F           _     ...
9CC2  FF           .     ...
9CC3  3B           ;     ...
9CC4  D7           .     ...
9CC5  2F           /     ...
9CC6  FE FE 00     ...   INC &00FE,X
9CC9  00           .     BRK
9CCA  D0 00        ..    BNE &9CCC
9CCC  10 00        ..    BPL &9CCE
9CCE  01 04         .    ORA (&04,X)
9CD0  FF           .     ...
9CD1  7B           {     ...
9CD2  F7           .     ...
9CD3  FF           .     ...
9CD4  FF           .     ...
9CD5  FF           .     ...
9CD6  FF           .     ...
9CD7  DE 02 82     ...   DEC &8202,X
9CDA  82           .     ...
9CDB  10 02        ..    BPL &9CDF
9CDD  02           .     ...
9CDE  40           @     RTI
9CDF  00           .     BRK
9CE0  EF           .     ...
9CE1  73           s     ...
9CE2  FF           .     ...
9CE3  FF           .     ...
9CE4  FF           .     ...
9CE5  EF           .     ...
9CE6  FF           .     ...
9CE7  DE 00 40     ..@   DEC &4000,X
9CEA  82           .     ...
9CEB  20 04 81      ..   JSR &8104
9CEE  00           .     BRK
9CEF  00           .     BRK
9CF0  FF           .     ...
9CF1  4F           O     ...
9CF2  AE FB FF     ...   LDX &FFFB
9CF5  CF           .     ...
9CF6  F9 FF 08     ...   SBC &08FF,Y
9CF9  5B           [     ...
9CFA  01 00         .    ORA (&00,X)
9CFC  00           .     BRK
9CFD  1E 48 00     .H.   ASL &0048,Y
9D00  44           D     ...
9D01  05 D0        ..    ORA &D0
9D03  01 00         .    ORA (&00,X)
9D05  07           .     ...
9D06  81 00         .    STA (&00,X)
9D08  FF           .     ...
9D09  77           w     ...
9D0A  BB           .     ...
9D0B  FF           .     ...
9D0C  FF           .     ...
9D0D  BF           .     ...
9D0E  FA           .     ...
9D0F  BF           .     ...
9D10  00           .     BRK
9D11  05 70        .p    ORA &70
9D13  02           .     ...
9D14  00           .     BRK
9D15  0A           .     ASL A
9D16  00           .     BRK
9D17  00           .     BRK
9D18  FF           .     ...
9D19  9D DD BF     ...   STA &BFDD,X
9D1C  FF           .     ...
9D1D  BF           .     ...
9D1E  F5 7E         .~   SBC &7E,X
9D20  12           .     ...
9D21  26 48        &H    ROL &48
9D23  00           .     BRK
9D24  20 0A 11      ..   JSR &110A
9D27  00           .     BRK
9D28  FF           .     ...
9D29  DF           .     ...
9D2A  F3           .     ...
9D2B  FF           .     ...
9D2C  FF           .     ...
9D2D  DF           .     ...
9D2E  FE FF 00     ...   INC &00FF,X
9D31  01 11         .    ORA (&11,X)
9D33  00           .     BRK
9D34  01 88         .    ORA (&88,X)
9D36  F0 00        ..    BEQ &9D38
9D38  FF           .     ...
9D39  7E FF FF     ~..   ROR &FFFF,X
9D3C  FF           .     ...
9D3D  7F                ...
9D3E  F3           .     ...
9D3F  FF           .     ...
9D40  04           .     ...
9D41  0A           .     ASL A
9D42  A0 00        ..    LDY #&00
9D44  02           .     ...
9D45  00           .     BRK
9D46  40           @     RTI
9D47  00           .     BRK
9D48  FF           .     ...
9D49  DF           .     ...
9D4A  F6 FF         ..   INC &FF,X
9D4C  FF           .     ...
9D4D  EF           .     ...
9D4E  F1 FB         ..   SBC (&FB),Y
9D50  40           @     RTI
9D51  0B           .     ...
9D52  32           2     ...
9D53  02           .     ...
9D54  09 0E        ..    ORA #&0E
9D56  20 80 FF      ..   JSR &FF80
9D59  6F           o     ...
9D5A  BF           .     ...
9D5B  FD FF EF     ...   SBC &EFFF,X
9D5E  DF           .     ...
9D5F  FF           .     ...
9D60  00           .     BRK
9D61  04           .     ...
9D62  50 00        P.    BVC &9D64
9D64  84 87        ..    STY &87
9D66  01 80         .    ORA (&80,X)
9D68  DF           .     ...
9D69  7F                ...
9D6A  FF           .     ...
9D6B  FF           .     ...
9D6C  FF           .     ...
9D6D  EF           .     ...
9D6E  BF           .     ...
9D6F  FF           .     ...
9D70  00           .     BRK
9D71  21 41         A    AND (&41,X)
9D73  00           .     BRK
9D74  00           .     BRK
9D75  29 10        ).    AND #&10
9D77  00           .     BRK
9D78  FA           .     ...
9D79  3F           ?     ...
9D7A  FF           .     ...
9D7B  FF           .     ...
9D7C  FF           .     ...
9D7D  FF           .     ...
9D7E  FD FC 06     ...   SBC &06FC,X
9D81  25 A9        %.    AND &A9
9D83  02           .     ...
9D84  22           "     ...
9D85  08           .     PHP
9D86  21 00         .    AND (&00,X)
9D88  FF           .     ...
9D89  FF           .     ...
9D8A  D9 FF 7F     ..   CMP &7FFF,Y
9D8D  4E F6 FF     N..   LSR &FFF6
9D90  49 22        I"    EOR #&22
9D92  12           .     ...
9D93  08           .     PHP
9D94  02           .     ...
9D95  4A           J     LSR A
9D96  33           3     ...
9D97  00           .     BRK
9D98  FF           .     ...
9D99  6F           o     ...
9D9A  DF           .     ...
9D9B  FF           .     ...
9D9C  FD BF B2     ...   SBC &B2BF,X
9D9F  FE 80 94     ...   INC &9480,X
9DA2  02           .     ...
9DA3  00           .     BRK
9DA4  40           @     RTI
9DA5  40           @     RTI
9DA6  88           .     DEY
9DA7  00           .     BRK
9DA8  FF           .     ...
9DA9  AF           .     ...
9DAA  FE FF FF     ...   INC &FFFF,X
9DAD  3F           ?     ...
9DAE  F7           .     ...
9DAF  FD 00 04     ...   SBC &0400,X
9DB2  80           .     ...
9DB3  40           @     RTI
9DB4  00           .     BRK
9DB5  08           .     PHP
9DB6  20 00 FF      ..   JSR &FF00
9DB9  ED F0 BF     ...   SBC &BFF0
9DBC  FF           .     ...
9DBD  7F                ...
9DBE  FD DF 44     ..D   SBC &44DF,X
9DC1  00           .     BRK
9DC2  C2           .     ...
9DC3  00           .     BRK
9DC4  00           .     BRK
9DC5  0D 00 00     ...   ORA &0000
9DC8  FB           .     ...
9DC9  FF           .     ...
9DCA  FD FF FD     ...   SBC &FDFF,X
9DCD  FF           .     ...
9DCE  FE FF 58     ..X   INC &58FF,X
9DD1  80           .     ...
9DD2  98           .     TYA
9DD3  02           .     ...
9DD4  44           D     ...
9DD5  00           .     BRK
9DD6  51 00         Q.   EOR (&00),Y
9DD8  FF           .     ...
9DD9  9D EF FB     ...   STA &FBEF,X
9DDC  FF           .     ...
9DDD  F7           .     ...
9DDE  FD EE 00     ...   SBC &00EE,X
9DE1  08           .     PHP
9DE2  39 00 00     9..   AND &0000,Y
9DE5  C0 80         ..   CPY #&80
9DE7  00           .     BRK
9DE8  FD DF FF     ...   SBC &FFDF,X
9DEB  FF           .     ...
9DEC  FF           .     ...
9DED  DF           .     ...
9DEE  FD FE 80     ...   SBC &80FE,X
9DF1  00           .     BRK
9DF2  20 02 00      ..   JSR &0002
9DF5  00           .     BRK
9DF6  90 00        ..    BCC &9DF8
9DF8  FF           .     ...
9DF9  BD FE FF     ...   LDA &FFFE,X
9DFC  FB           .     ...
9DFD  DF           .     ...
9DFE  FF           .     ...
9DFF  FE FF 7F     ..   INC &7FFF,X
9E02  F2           .     ...
9E03  BF           .     ...
9E04  FF           .     ...
9E05  FF           .     ...
9E06  FB           .     ...
9E07  FF           .     ...
9E08  80           .     ...
9E09  00           .     BRK
9E0A  80           .     ...
9E0B  08           .     PHP
9E0C  21 44         D    AND (&44,X)
9E0E  40           @     RTI
9E0F  00           .     BRK
9E10  FF           .     ...
9E11  EF           .     ...
9E12  FF           .     ...
9E13  BF           .     ...
9E14  FF           .     ...
9E15  DF           .     ...
9E16  EF           .     ...
9E17  BF           .     ...
9E18  42           B     ...
9E19  18           .     CLC
9E1A  48           H     PHA
9E1B  00           .     BRK
9E1C  22           "     ...
9E1D  24 04        $.    BIT &04
9E1F  00           .     BRK
9E20  FB           .     ...
9E21  6F           o     ...
9E22  FE FF FF     ...   INC &FFFF,X
9E25  AF           .     ...
9E26  FF           .     ...
9E27  BF           .     ...
9E28  00           .     BRK
9E29  0B           .     ...
9E2A  A0 00        ..    LDY #&00
9E2C  14           .     ...
9E2D  02           .     ...
9E2E  50 01        P.    BVC &9E31
9E30  FF           .     ...
9E31  57           W     ...
9E32  FF           .     ...
9E33  BF           .     ...
9E34  FF           .     ...
9E35  F7           .     ...
9E36  75 FB         u.   ADC &FB,X
9E38  80           .     ...
9E39  26 80        &.    ROL &80
9E3B  24 20        $     BIT &20
9E3D  20 A2 24      .$   JSR &24A2
9E40  FF           .     ...
9E41  4F           O     ...
9E42  F5 FF         ..   SBC &FF,X
9E44  FF           .     ...
9E45  0F           .     ...
9E46  EE FF 00     ...   INC &00FF
9E49  06 10        ..    ASL &10
9E4B  00           .     BRK
9E4C  00           .     BRK
9E4D  65 D0        e.    ADC &D0
9E4F  20 FF FC      ..   JSR &FCFF
9E52  FF           .     ...
9E53  FF           .     ...
9E54  FF           .     ...
9E55  FF           .     ...
9E56  FF           .     ...
9E57  FF           .     ...
9E58  00           .     BRK
9E59  01 30         0    ORA (&30,X)
9E5B  00           .     BRK
9E5C  80           .     ...
9E5D  00           .     BRK
9E5E  0A           .     ASL A
9E5F  00           .     BRK
9E60  F7           .     ...
9E61  7F                ...
9E62  F3           .     ...
9E63  FF           .     ...
9E64  FF           .     ...
9E65  7F                ...
9E66  FF           .     ...
9E67  7F                ...
9E68  01 06         .    ORA (&06,X)
9E6A  B0 01        ..    BCS &9E6D
9E6C  00           .     BRK
9E6D  02           .     ...
9E6E  44           D     ...
9E6F  20 FF EF      ..   JSR &EFFF
9E72  FF           .     ...
9E73  FF           .     ...
9E74  FF           .     ...
9E75  8F           .     ...
9E76  F3           .     ...
9E77  BF           .     ...
9E78  01 35         5    ORA (&35,X)
9E7A  50 01        P.    BVC &9E7D
9E7C  08           .     PHP
9E7D  08           .     PHP
9E7E  80           .     ...
9E7F  00           .     BRK
9E80  FF           .     ...
9E81  7F                ...
9E82  DB           .     ...
9E83  FF           .     ...
9E84  FF           .     ...
9E85  BF           .     ...
9E86  F5 FF         ..   SBC &FF,X
9E88  00           .     BRK
9E89  90 41        .A    BCC &9ECC
9E8B  01 40         @    ORA (&40,X)
9E8D  47           G     ...
9E8E  80           .     ...
9E8F  09 FF        ..    ORA #&FF
9E91  7F                ...
9E92  FD FF FF     ...   SBC &FFFF,X
9E95  FF           .     ...
9E96  FF           .     ...
9E97  FF           .     ...
9E98  00           .     BRK
9E99  50 84        P.    BVC &9E1F
9E9B  20 40 10      @.   JSR &1040
9E9E  21 00         .    AND (&00,X)
9EA0  FF           .     ...
9EA1  5D 7F FF     ].   EOR &FF7F,Y
9EA4  FB           .     ...
9EA5  DF           .     ...
9EA6  B7           .     ...
9EA7  FE 00 24     ..$   INC &2400,X
9EAA  30 00        0.    BMI &9EAC
9EAC  04           .     ...
9EAD  80           .     ...
9EAE  21 00         .    AND (&00,X)
9EB0  FB           .     ...
9EB1  FF           .     ...
9EB2  FF           .     ...
9EB3  EF           .     ...
9EB4  FF           .     ...
9EB5  6F           o     ...
9EB6  FF           .     ...
9EB7  FF           .     ...
9EB8  00           .     BRK
9EB9  60           `     RTS
9EBA  02           .     ...
9EBB  00           .     BRK
9EBC  0A           .     ASL A
9EBD  81 00         .    STA (&00,X)
9EBF  00           .     BRK
9EC0  FD 7E F6     .~.   SBC &F67E,X
9EC3  DF           .     ...
9EC4  FF           .     ...
9EC5  BE FF FE     ...   LDX &FEFF,Y
9EC8  00           .     BRK
9EC9  00           .     BRK
9ECA  0C           .     ...
9ECB  08           .     PHP
9ECC  00           .     BRK
9ECD  05 14        ..    ORA &14
9ECF  20 F7 6D      .m   JSR &6DF7
9ED2  FD FF FF     ...   SBC &FFFF,X
9ED5  1F           .     ...
9ED6  BF           .     ...
9ED7  6F           o     ...
9ED8  40           @     RTI
9ED9  00           .     BRK
9EDA  01 00         .    ORA (&00,X)
9EDC  00           .     BRK
9EDD  21 C8         .    AND (&C8,X)
9EDF  20 FF 7E      .~   JSR &7EFF
9EE2  BF           .     ...
9EE3  BB           .     ...
9EE4  DF           .     ...
9EE5  FF           .     ...
9EE6  F6 FD         ..   INC &FD,X
9EE8  00           .     BRK
9EE9  00           .     BRK
9EEA  28           (     PLP
9EEB  00           .     BRK
9EEC  00           .     BRK
9EED  41 00        ..    EOR (&00,X)
9EEF  00           .     BRK
9EF0  FF           .     ...
9EF1  7D F3 FF     }..   ADC &FFF3,X
9EF4  FF           .     ...
9EF5  DF           .     ...
9EF6  FF           .     ...
9EF7  FF           .     ...
9EF8  48           H     PHA
9EF9  C4 00         ..   CPY &00
9EFB  00           .     BRK
9EFC  0C           .     ...
9EFD  80           .     ...
9EFE  00           .     BRK
9EFF  00           .     BRK
9F00  00           .     BRK
9F01  1A           .     ...
9F02  30 04        0.    BMI &9F08
9F04  40           @     RTI
9F05  0C           .     ...
9F06  26 20        &     ROL &20
9F08  FF           .     ...
9F09  7F                ...
9F0A  F2           .     ...
9F0B  FF           .     ...
9F0C  FF           .     ...
9F0D  9B           .     ...
9F0E  EF           .     ...
9F0F  F7           .     ...
9F10  20 87 00      ..   JSR &0087
9F13  02           .     ...
9F14  84 09        ..    STY &09
9F16  82           .     ...
9F17  08           .     PHP
9F18  FF           .     ...
9F19  EF           .     ...
9F1A  FB           .     ...
9F1B  FF           .     ...
9F1C  FF           .     ...
9F1D  F7           .     ...
9F1E  FB           .     ...
9F1F  7E 00 2B     ~.+   ROR &2B00,X
9F22  90 10        ..    BCC &9F34
9F24  40           @     RTI
9F25  02           .     ...
9F26  00           .     BRK
9F27  00           .     BRK
9F28  FB           .     ...
9F29  FE A6 FF     ...   INC &FFA6,X
9F2C  FD F7 FD     ...   SBC &FDF7,X
9F2F  EF           .     ...
9F30  C0 8C         ..   CPY #&8C
9F32  40           @     RTI
9F33  14           .     ...
9F34  02           .     ...
9F35  02           .     ...
9F36  A0 04        ..    LDY #&04
9F38  FF           .     ...
9F39  DB           .     ...
9F3A  F3           .     ...
9F3B  FF           .     ...
9F3C  FF           .     ...
9F3D  7F                ...
9F3E  7B           {     ...
9F3F  FF           .     ...
9F40  00           .     BRK
9F41  41 A0         .    EOR (&A0,X)
9F43  00           .     BRK
9F44  40           @     RTI
9F45  02           .     ...
9F46  20 30 FF      0.   JSR &FF30
9F49  1E FB FF     ...   ASL &FFFB,Y
9F4C  FF           .     ...
9F4D  FF           .     ...
9F4E  E7           .     ...
9F4F  FB           .     ...
9F50  00           .     BRK
9F51  14           .     ...
9F52  30 00        0.    BMI &9F54
9F54  00           .     BRK
9F55  03           .     ...
9F56  70 00        p.    BCS &9F58
9F58  FF           .     ...
9F59  B7           .     ...
9F5A  FB           .     ...
9F5B  FF           .     ...
9F5C  FF           .     ...
9F5D  FF           .     ...
9F5E  BB           .     ...
9F5F  7F                ...
9F60  01 03         .    ORA (&03,X)
9F62  D0 01        ..    BNE &9F65
9F64  00           .     BRK
9F65  09 51        .Q    ORA #&51
9F67  00           .     BRK
9F68  FF           .     ...
9F69  FF           .     ...
9F6A  F3           .     ...
9F6B  FF           .     ...
9F6C  FB           .     ...
9F6D  DF           .     ...
9F6E  F2           .     ...
9F6F  DF           .     ...
9F70  10 02        ..    BPL &9F74
9F72  48           H     PHA
9F73  05 80        ..    ORA &80
9F75  5C           \     ...
9F76  58           X     CLI
9F77  00           .     BRK
9F78  FF           .     ...
9F79  FF           .     ...
9F7A  F9 FF FF     ...   SBC &FFFF,Y
9F7D  BF           .     ...
9F7E  FF           .     ...
9F7F  7F                ...
9F80  11 01         ..   ORA (&01),Y
9F82  86 01        ..    STX &01
9F84  20 03 40      .@   JSR &4003
9F87  08           .     PHP
9F88  FB           .     ...
9F89  6F           o     ...
9F8A  F7           .     ...
9F8B  FF           .     ...
9F8C  FF           .     ...
9F8D  EF           .     ...
9F8E  F8           .     SED
9F8F  FF           .     ...
9F90  41 00        ..    EOR (&00,X)
9F92  06 00        ..    ASL &00
9F94  80           .     ...
9F95  48           H     PHA
9F96  00           .     BRK
9F97  04           .     ...
9F98  FF           .     ...
9F99  FF           .     ...
9F9A  FE FF FE     ...   INC &FEFF,X
9F9D  2F           /     ...
9F9E  66 7F        f    ROR &7F
9FA0  00           .     BRK
9FA1  32           2     ...
9FA2  11 00         ..   ORA (&00),Y
9FA4  01 80         .    ORA (&80,X)
9FA6  10 24        .$    BPL &9FCC
9FA8  7F                ...
9FA9  5F           _     ...
9FAA  E9 FF         ..   SBC #&FF
9FAC  FF           .     ...
9FAD  1E FE 7F     ..   ASL &7FFE,Y
9FB0  10 00        ..    BPL &9FB2
9FB2  20 02 01      ..   JSR &0102
9FB5  06 0A        ..    ASL &0A
9FB7  00           .     BRK
9FB8  FB           .     ...
9FB9  5F           _     ...
9FBA  BF           .     ...
9FBB  FF           .     ...
9FBC  FF           .     ...
9FBD  B5 FA         ..   LDA &FA,X
9FBF  BF           .     ...
9FC0  10 13        ..    BPL &9FD5
9FC2  1C           .     ...
9FC3  08           .     PHP
9FC4  A1 07         ..   LDA (&07,X)
9FC6  98           .     TYA
9FC7  00           .     BRK
9FC8  FF           .     ...
9FC9  63           c     ...
9FCA  FE FF FF     ...   INC &FFFF,X
9FCD  3B           ;     ...
9FCE  F2           .     ...
9FCF  FF           .     ...
9FD0  00           .     BRK
9FD1  C2           .     ...
9FD2  04           .     ...
9FD3  40           @     RTI
9FD4  60           `     RTS
9FD5  0A           .     ASL A
9FD6  04           .     ...
9FD7  00           .     BRK
9FD8  FF           .     ...
9FD9  7F                ...
9FDA  F7           .     ...
9FDB  FF           .     ...
9FDC  FF           .     ...
9FDD  1F           .     ...
9FDE  FF           .     ...
9FDF  BF           .     ...
9FE0  80           .     ...
9FE1  01 04         .    ORA (&04,X)
9FE3  12           .     ...
9FE4  C0 02        ..    CPY #&02
9FE6  00           .     BRK
9FE7  30 FF        0.    BMI &9FE8
9FE9  5E BE FF     ^..   LSR &FFBE,Y
9FEC  FF           .     ...
9FED  BF           .     ...
9FEE  F5 7F         .   SBC &7F,X
9FF0  00           .     BRK
9FF1  00           .     BRK
9FF2  20 08 00      ..   JSR &0008
9FF5  40           @     RTI
9FF6  80           .     ...
9FF7  00           .     BRK
9FF8  FF           .     ...
9FF9  7F                ...
9FFA  FF           .     ...
9FFB  AF           .     ...
9FFC  FF           .     ...
9FFD  CF           .     ...
9FFE  FF           .     ...
9FFF  FE           .     EQUB &FE
