REM > CUBEMOS/S
REM Source for EuroCUBE-65/EuroBEEB MOS
 
OS_CLI=&FFF7:OSBYTE=&FFF4:OSWORD=&FFF1:OSWRCH=&FFEE
OSWRCR=&FFEC:OSNEWL=&FFE7:OSASCI=&FFE3:OSRDCH=&FFE0

load%=&C000
DIM mcode% &4014
FOR P=0 TO 1
P%=load%:O%=mcode%
[OPT P*3+4
\ &6F - used by MOS code at &E000
\
\ Workspace locations that differ from BBC MOS
\ &0247 (OSBYTE &B7) - b7=1 - no serial commands, *SERIAL not selected
\ &0248 (OSBYTE &B8) - b7=C000 ROM absent
\ &024F (OSBYTE &BF) - 6551 ACIA Command register copy
\ &0250 (OSBYTE &C0) - 6551 ACIA Control register copy
\ &0283 (OSBYTE &F3) - high byte of RAM-based sideways ROM program
\ &0284 (OSBYTE &F4) - b7=CU-Key absent
\ &0287 (OSBYTE &F7)
\ &0289 (OSBYTE &F9) - Processor speed, MHz
\ &02A0 ROM flag for ROM -1 - the MOS ROM at &E000
\ &02B7 - b7=CUBAN-12B absent
\ &02B9 - b7=CUNAB-8 absent
\ &0328 - b7=CU-Graph absent
\ &0329 - b7=Rack Print absent

.LC000:JMP LC0B0	:\ Language entry
.LC003:JMP LC043	:\ Service entry
EQUB &C2		:\ Service, Language, 6502 code
.LC007
EQUB LC028-LC000	:\ Offset to (C)
EQUB &00		:\ Binary version number
EQUS "CU-Graph"		:\ Title
EQUB &00
EQUS "Issue X4.16  23 MAY 86"	:\ Version string
.LC028
EQUB &00		:\ Copyright message
EQUS "(C) Control Universal Ltd"
EQUB &00

\ SERVICE HANDLER
\ ===============
.LC043
CMP #&03:BEQ LC056      :\ Jump with Boot FS
CMP #&09:BEQ LC06B      :\ Jump with *Help
JSR LC128               :\ Check some service calls
BIT &0284:BMI LC06A     :\ If OSBYTE &F4 b7 set, jump to exit
JMP LCD0C               :\ Jump to...


\ SERVICE 3 - BOOT FS
\ ===================
\ Check various things and set some flags
.LC056
JSR LC175:ROR &0328     :\ Find if CU-Graph present, copy result to &0328 flag
JSR LCD32:ROR &0284     :\ Find if CU-Key present, copy result to OSBYTE &F4 flag
JSR LCCB9:ROR &0329     :\ Find if Rack Print present, copy result to &0329 flag
LDA #&03                :\ Return unclaimed
.LC06A
RTS

 
\ SERVICE 9 - *Help
\ =================
.LC06B
LDA (&F2),Y             :\ Get current character
CMP #&0D:BNE LC0AD      :\ Not at <cr>, jump to exit with nothing printed
BIT &0328:BMI LC084     :\ If VDU flag set, don't print CU-graph
JSR LFFB3               :\ Print inline text
.LC079
EQUB 13:EQUS "CU-graph":EQUB 13
NOP
.LC084
BIT &0284:BMI LC098     :\ If OSBYTE &F4 flag set, don't print CU-key
JSR LFFB3               :\ Print inline text
EQUB 13:EQUS "CU-key 99":EQUB 13
NOP
.LC098
BIT &0329:BMI LC0AD     :\ If VDU flag set, don't print Rack
JSR LFFB3               :\ Print inline text
EQUB 13:EQUS "Rack Print":EQUB 13
NOP
.LC0AD
LDA #&09:RTS            :\ Return unclaimed


\ LANGUAGE STARTUP
\ ================
.LC0B0
LDA #&01:STA &0245      :\ Set non-raw serial input
LDA #&00:STA &027C      :\ Set output to VDU, etc
LDA #&7F:STA LFE0E      :\ Disable all VIA interupts
LDA #&09:STA LFE12      :\ Set ACIA Command Register
                        :\ Enable Rx, RxIRQs, disable TxIRQs, no echo, no parity
LDA LFE01:AND #&0F      :\ Read from port A
CMP #&0E:BCC LC0CF      :\ If <14, jump to use it
LDA #&0E                :\ Replace 15 (19,200) with 14 (9,600)
.LC0CF
ORA #&10:STA LFE13      :\ Set 6551 ACIA Control Register
                        :\ Set baud rate, external clock, 8bit, 1stop
LDA #&0C:STA &0300
LDA #&04:STA &0301
LDA &028F:JSR LC6A8     :\ Get startup options, select screen mode
JSR LFFB3               :\ Print inline text
EQUB 15:EQUB 12
EQUS "CU-graph Graphic Terminal":EQUB 13:EQUB 13
NOP
.LC105
JSR OSRDCH:JSR OSWRCH   :\ Read character, print it
JMP LC105               :\ Loop back
 
.LC10E
TSB &00          :\ C10E= 07 00       ..
BRK              :\ C110= 00          .
BRK              :\ C111= 00          .
SED              :\ C112= F8          x
ORA (&00),Y      :\ C113= 11 00       ..
BVS LC117        :\ C115= 70 00       p.
.LC117
BRK              :\ C117= 00          .
BRK              :\ C118= 00          .
BRK              :\ C119= 00          .
BRK              :\ C11A= 00          .
ORA (&00),Y      :\ C11B= 11 00       ..
BVS LC11F        :\ C11D= 70 00       p.
.LC11F
BRK              :\ C11F= 00          .
BRK              :\ C120= 00          .
BRK              :\ C121= 00          .
BRK              :\ C122= 00          .
BRK              :\ C123= 00          .
BRK              :\ C124= 00          .
BRK              :\ C125= 00          .
BRK              :\ C126= 00          .
BBS 7,&2C,&C152  :\ C127= FF

.LC128
C128 2C 28 03    ,(.  BIT &0328		Check a flag
C12B 30 15       0.   BMI &C142		Exit if b7 set
C12D C9 05       �.   CMP #&05
C12F F0 23       �#   BEQ &C154		Jump with Interrupts
PHA              :\ C131= 48          H
LDA &027C        :\ C132= AD 7C 02    -|.
AND #&02         :\ C135= 29 02       ).
BNE LC143        :\ C137= D0 0A       P.
PLA              :\ C139= 68          h
CMP #&07:BEQ LC145  :\ 	Jump with OSBYTE
CMP #&08:BEQ LC151  :\ Jump with OSWORD
.LC142
RTS              :\ C142= 60          `
 
.LC143
PLA              :\ C143= 68          h
RTS              :\ C144= 60          `
 
OSBYTE
======
.LC145
LDX &F0          :\ C145= A6 F0       &p
LDA &EF          :\ C147= A5 EF       %o
JSR LCB8C        :\ C149= 20 8C CB     .K
STX &F0          :\ C14C= 86 F0       .p
LDA #&00         :\ C14E= A9 00       ).
RTS              :\ C150= 60          `

\ OSWORD
\ ====== 
.LC151
JMP LCC58        :\ C151= 4C 58 CC    LXL
 
.LC154
LDA LDF00        :\ C154= AD 00 DF    -._
AND &032A        :\ C157= 2D 2A 03    -*.
BEQ LC172        :\ C15A= F0 16       p.
JSR LC16C        :\ C15C= 20 6C C1     lA
CLI              :\ C15F= 58          X
JSR LC915        :\ C160= 20 15 C9     .I
SEI              :\ C163= 78          x
.LC164
LDA #&20         :\ C164= A9 20       ) 
STA &032A        :\ C166= 8D 2A 03    .*.
LDA #&00         :\ C169= A9 00       ).
RTS              :\ C16B= 60          `
 
.LC16C
LDA #&00         :\ C16C= A9 00       ).
STA &032A        :\ C16E= 8D 2A 03    .*.
RTS              :\ C171= 60          `
 
.LC172
LDA #&05         :\ C172= A9 05       ).
RTS              :\ C174= 60          `
 
.LC175
LDA LDF02        :\ C175= AD 02 DF    -._
AND #&F0         :\ C178= 29 F0       )p
BNE LC1AB        :\ C17A= D0 2F       P/
JSR LC164        :\ C17C= 20 64 C1     dA
LDA &D0          :\ C17F= A5 D0       %P
AND #&04         :\ C181= 29 04       ).
LDX &028D        :\ C183= AE 8D 02    ...
BEQ LC192        :\ C186= F0 0A       p.
LDA &028E        :\ C188= AD 8E 02    -..
SBC #&14         :\ C18B= E9 14       i.
STA &0300        :\ C18D= 8D 00 03    ...
LDA #&04         :\ C190= A9 04       ).
.LC192
STA &D0          :\ C192= 85 D0       .P
LDA #&0C         :\ C194= A9 0C       ).
STA &0301        :\ C196= 8D 01 03    ...
LDA &028F        :\ C199= AD 8F 02    -..
JSR LC6A8        :\ C19C= 20 A8 C6     (F
CLC              :\ C19F= 18          .
.LC1A0
LDA #&B2         :\ C1A0= A9 B2       )2
STA &0226        :\ C1A2= 8D 26 02    .&.
LDA #&C1         :\ C1A5= A9 C1       )A
STA &0227        :\ C1A7= 8D 27 02    .'.
RTS              :\ C1AA= 60          `
 
.LC1AB
LDA #&00         :\ C1AB= A9 00       ).
STA &D0          :\ C1AD= 85 D0       .P
SEC              :\ C1AF= 38          8
BCS LC1A0        :\ C1B0= B0 EE       0n
PHP              :\ C1B2= 08          .
CLD              :\ C1B3= D8          X
PHA              :\ C1B4= 48          H
STA &D2          :\ C1B5= 85 D2       .R
LDA #&02         :\ C1B7= A9 02       ).
BIT &027C        :\ C1B9= 2C 7C 02    ,|.
BNE LC1C5        :\ C1BC= D0 07       P.
LDA &D2          :\ C1BE= A5 D2       %R
JSR LC229        :\ C1C0= 20 29 C2     )B
BCS LC1E9        :\ C1C3= B0 24       0$
.LC1C5
LDA #&08         :\ C1C5= A9 08       ).
BIT &027C        :\ C1C7= 2C 7C 02    ,|.
BVS LC1E9        :\ C1CA= 70 1D       p.
BNE LC1D3        :\ C1CC= D0 05       P.
LDA &D0          :\ C1CE= A5 D0       %P
LSR A            :\ C1D0= 4A          J
BCC LC1E9        :\ C1D1= 90 16       ..
.LC1D3
LDA &D2          :\ C1D3= A5 D2       %R
CMP &0286        :\ C1D5= CD 86 02    M..
BEQ LC1E9        :\ C1D8= F0 0F       p.
CMP #&20         :\ C1DA= C9 20       I 
BCS LC1E6        :\ C1DC= B0 08       0.
CMP #&07         :\ C1DE= C9 07       I.
BCC LC1E9        :\ C1E0= 90 07       ..
CMP #&0E         :\ C1E2= C9 0E       I.
BCS LC1E9        :\ C1E4= B0 03       0.
.LC1E6
JSR LC1EC        :\ C1E6= 20 EC C1     lA
.LC1E9
PLA              :\ C1E9= 68          h
PLP              :\ C1EA= 28          (
.LC1EB
RTS              :\ C1EB= 60          `
 
.LC1EC
LDA #&04         :\ C1EC= A9 04       ).
BIT &027C        :\ C1EE= 2C 7C 02    ,|.
BNE LC1EB        :\ C1F1= D0 F8       Px
LDX &0285        :\ C1F3= AE 85 02    ...
CPX #&04         :\ C1F6= E0 04       `.
BCS LC206        :\ C1F8= B0 0C       0.
LDA LC20F,X      :\ C1FA= BD 0F C2    =.B
PHA              :\ C1FD= 48          H
LDA LC20B,X      :\ C1FE= BD 0B C2    =.B
PHA              :\ C201= 48          H
LDA &D2          :\ C202= A5 D2       %R
PHP              :\ C204= 08          .
RTI              :\ C205= 40          @
 
.LC206
LDA &D2          :\ C206= A5 D2       %R
JMP (&0222)      :\ C208= 6C 22 02    l".
 
.LC20B
EQUB &EB         :\ C20B= EB          k
JSR LEE13        :\ C20C= 20 13 EE     .n
.LC20F
CMP (&C2,X)      :\ C20F= C1 C2       AB
EQUB &C2         :\ C211= C2          B
CPY &7CAD        :\ C212= CC AD 7C    L-|
EQUB &02         :\ C215= 02          .
LSR A            :\ C216= 4A          J
BCS LC228        :\ C217= B0 0F       0.
LDX #&02         :\ C219= A2 02       ".
LDA &D2          :\ C21B= A5 D2       %R
JMP LFFB0        :\ C21D= 4C B0 FF    L0.
 
.LC220
BIT LDF13        :\ C220= 2C 13 DF    ,._
BMI LC220        :\ C223= 30 FB       0{
STA LDF13        :\ C225= 8D 13 DF    .._
.LC228
RTS              :\ C228= 60          `
 
.LC229
STA &D2          :\ C229= 85 D2       .R
CLC              :\ C22B= 18          .
LDA &027C        :\ C22C= AD 7C 02    -|.
AND #&02         :\ C22F= 29 02       ).
BNE LC228        :\ C231= D0 F5       Pu
LDX &026A        :\ C233= AE 6A 02    .j.
BEQ LC239        :\ C236= F0 01       p.
SEC              :\ C238= 38          8
.LC239
PHP              :\ C239= 08          .
CLD              :\ C23A= D8          X
LDA &D2          :\ C23B= A5 D2       %R
BCC LC269        :\ C23D= 90 2A       .*
STA &0330,X      :\ C23F= 9D 30 03    .0.
JMP LC31C        :\ C242= 4C 1C C3    L.C
 
.LC245
LDX #&0B         :\ C245= A2 0B       ".
LDA &0313        :\ C247= AD 13 03    -..
BNE LC251        :\ C24A= D0 05       P.
LDY #&81         :\ C24C= A0 81        .
JSR LC7C0        :\ C24E= 20 C0 C7     @G
.LC251
LDY &0310        :\ C251= AC 10 03    ,..
JSR LC7C0        :\ C254= 20 C0 C7     @G
JSR LC8E3        :\ C257= 20 E3 C8     cH
LDA #&20         :\ C25A= A9 20       ) 
STA LDF00        :\ C25C= 8D 00 DF    .._
JSR LC9EE        :\ C25F= 20 EE C9     nI
JMP LC2CA        :\ C262= 4C CA C2    LJB
 
.LC265
LDA #&0D         :\ C265= A9 0D       ).
BNE LC2A9        :\ C267= D0 40       P@
.LC269
CMP #&06         :\ C269= C9 06       I.
BEQ LC271        :\ C26B= F0 04       p.
BIT &D0          :\ C26D= 24 D0       $P
BMI LC2CD        :\ C26F= 30 5C       0\
.LC271
LDA &D2          :\ C271= A5 D2       %R
CMP #&20         :\ C273= C9 20       I 
BCC LC2F3        :\ C275= 90 7C       .|
BIT &0328        :\ C277= 2C 28 03    ,(.
BMI LC2CD        :\ C27A= 30 51       0Q
CMP #&7F         :\ C27C= C9 7F       I.
BCS LC2D1        :\ C27E= B0 51       0Q
.LC280
STA &D3          :\ C280= 85 D3       .S
LDA &D0          :\ C282= A5 D0       %P
AND #&20         :\ C284= 29 20       ) 
BNE LC245        :\ C286= D0 BD       P=
LDA &0309        :\ C288= AD 09 03    -..
AND #&70         :\ C28B= 29 70       )p
EOR #&70         :\ C28D= 49 70       Ip
EOR &0308        :\ C28F= 4D 08 03    M..
STA &DB          :\ C292= 85 DB       .[
JSR LC4C3        :\ C294= 20 C3 C4     CD
BNE LC2B2        :\ C297= D0 19       P.
JSR LC16C        :\ C299= 20 6C C1     lA
LDA &D2          :\ C29C= A5 D2       %R
CMP #&20         :\ C29E= C9 20       I 
BEQ LC265        :\ C2A0= F0 C3       pC
LDY &D8          :\ C2A2= A4 D8       $X
JSR LC909        :\ C2A4= 20 09 C9     .I
LDA &D2          :\ C2A7= A5 D2       %R
.LC2A9
LDY &D8          :\ C2A9= A4 D8       $X
STA (&D4),Y      :\ C2AB= 91 D4       .T
INY              :\ C2AD= C8          H
LDA &DB          :\ C2AE= A5 DB       %[
STA (&D4),Y      :\ C2B0= 91 D4       .T
.LC2B2
JSR LC7B7        :\ C2B2= 20 B7 C7     7G
BCS LC2C7        :\ C2B5= B0 10       0.
LDY #&81         :\ C2B7= A0 81        .
JSR LC81A        :\ C2B9= 20 1A C8     .H
LDY &0309        :\ C2BC= AC 09 03    ,..
JSR LC81A        :\ C2BF= 20 1A C8     .H
LDY &DB          :\ C2C2= A4 DB       $[
JSR LC7C0        :\ C2C4= 20 C0 C7     @G
.LC2C7
JSR LC47A        :\ C2C7= 20 7A C4     zD
.LC2CA
JSR LC164        :\ C2CA= 20 64 C1     dA
.LC2CD
PLP              :\ C2CD= 28          (
LDA &D2          :\ C2CE= A5 D2       %R
RTS              :\ C2D0= 60          `
 
.LC2D1
BNE LC2DF        :\ C2D1= D0 0C       P.
LDA &D0          :\ C2D3= A5 D0       %P
AND #&20         :\ C2D5= 29 20       ) 
BNE LC2DF        :\ C2D7= D0 06       P.
JSR LC3F2        :\ C2D9= 20 F2 C3     rC
JMP LC2CA        :\ C2DC= 4C CA C2    LJB
 
.LC2DF
CMP #&81         :\ C2DF= C9 81       I.
BEQ LC2EF        :\ C2E1= F0 0C       p.
CMP #&83         :\ C2E3= C9 83       I.
BCC LC280        :\ C2E5= 90 99       ..
CMP #&E0         :\ C2E7= C9 E0       I`
BCS LC280        :\ C2E9= B0 95       0.
LDA #&7F         :\ C2EB= A9 7F       ).
BNE LC280        :\ C2ED= D0 91       P.
.LC2EF
LDA #&0A         :\ C2EF= A9 0A       ).
BNE LC280        :\ C2F1= D0 8D       P.
.LC2F3
TAY              :\ C2F3= A8          (
LDA LC36B,Y      :\ C2F4= B9 6B C3    9kC
BEQ LC2CD        :\ C2F7= F0 D4       pT
BPL LC301        :\ C2F9= 10 06       ..
LDA &D0          :\ C2FB= A5 D0       %P
AND #&20         :\ C2FD= 29 20       ) 
BNE LC2CD        :\ C2FF= D0 CC       PL
.LC301
LDA LC36B,Y      :\ C301= B9 6B C3    9kC
BIT &0328        :\ C304= 2C 28 03    ,(.
BPL LC30D        :\ C307= 10 04       ..
ROL A            :\ C309= 2A          *
BPL LC2CD        :\ C30A= 10 C1       .A
ROR A            :\ C30C= 6A          j
.LC30D
AND #&0F         :\ C30D= 29 0F       ).
TAX              :\ C30F= AA          *
LDA LC32B,Y      :\ C310= B9 2B C3    9+C
STA &032F        :\ C313= 8D 2F 03    ./.
LDA LC34B,Y      :\ C316= B9 4B C3    9KC
STA &0330        :\ C319= 8D 30 03    .0.
.LC31C
DEX              :\ C31C= CA          J
STX &026A        :\ C31D= 8E 6A 02    .j.
BNE LC325        :\ C320= D0 03       P.
JSR LC328        :\ C322= 20 28 C3     (C
.LC325
JMP LC2CA        :\ C325= 4C CA C2    LJB
 
.LC328
JMP (&032F)      :\ C328= 6C 2F 03    l/.
 
.LC32B
EQUB &63         :\ C32B= 63          c
CPX &5946        :\ C32C= EC 46 59    lFY
EOR (&3E),Y      :\ C32F= 51 3E       Q>
EOR &2B72,X      :\ C331= 5D 72 2B    ]r+
EQUB &77         :\ C334= 77          w
LDX &5B          :\ C335= A6 5B       &[
EQUB &8B         :\ C337= 8B          .
CLC              :\ C338= 18          .
EQUB &42         :\ C339= 42          B
EOR &1E,X        :\ C33A= 55 1E       U.
SBC (&C2),Y      :\ C33C= F1 C2       qB
STZ &BB          :\ C33E= 64 BB       d;
LSR A            :\ C340= 4A          J
LDA &02          :\ C341= A5 02       %.
EQUB &63         :\ C343= 63          c
ROL &6312        :\ C344= 2E 12 63    ..c
EQUB &63         :\ C347= 63          c
EQUB &03         :\ C348= 03          .
AND LC556,Y      :\ C349= 39 56 C5    9VE
CMP (&C5,X)      :\ C34C= C1 C5       AE
CMP &C5          :\ C34E= C5 C5       EE
CMP &C5          :\ C350= C5 C5       EE
CPY &C4          :\ C352= C7 C4       GD
CPY &C4          :\ C354= C4 C4       DD
CPY &C3          :\ C356= C4 C3       DC
CPY &C5          :\ C358= C4 C5       DE
CMP &C6          :\ C35A= C5 C6       EF
CMP &C5          :\ C35C= C5 C5       EE
CMP &C5          :\ C35E= C5 C5       EE
CMP &C6          :\ C360= C5 C6       EF
CMP &C5          :\ C362= C5 C5       EE
DEX              :\ C364= CA          J
DEC &C5          :\ C365= C6 C5       FE
CMP &C6          :\ C367= C5 C6       EF
DEC &C6          :\ C369= C6 C6       FF
.LC36B
BRK              :\ C36B= 00          .
EQUB &42         :\ C36C= 42          B
EOR (&41,X)      :\ C36D= 41 41       AA
ORA (&01,X)      :\ C36F= 01 01       ..
ORA (&01,X)      :\ C371= 01 01       ..
STA (&81,X)      :\ C373= 81 81       ..
STA (&81,X)      :\ C375= 81 81       ..
ORA (&81,X)      :\ C377= 01 81       ..
STA (&81,X)      :\ C379= 81 81       ..
ORA (&02,X)      :\ C37B= 01 02       ..
EQUB &03         :\ C37D= 03          .
EQUB &03         :\ C37E= 03          .
EQUB &03         :\ C37F= 03          .
ORA (&02,X)      :\ C380= 01 02       ..
ASL A            :\ C382= 0A          .
BRK              :\ C383= 00          .
ASL &02          :\ C384= 06 02       ..
BRK              :\ C386= 00          .
BRK              :\ C387= 00          .
ORA &81          :\ C388= 05 81       ..
EQUB &83         :\ C38A= 83          .

.LC38B
LDX #&03         :\ C38B= A2 03       ".
STX LDF01        :\ C38D= 8E 01 DF    .._
LDA &0325        :\ C390= AD 25 03    -%.
.LC393
STA &0303,X      :\ C393= 9D 03 03    ...
LDA #&00         :\ C396= A9 00       ).
DEX              :\ C398= CA          J
BPL LC393        :\ C399= 10 F8       .x
STX &031B        :\ C39B= 8E 1B 03    ...
STA &D8          :\ C39E= 85 D8       .X
STA &DA          :\ C3A0= 85 DA       .Z
LDX #&03         :\ C3A2= A2 03       ".
JSR LC3C6        :\ C3A4= 20 C6 C3     FC
JSR LC9E3        :\ C3A7= 20 E3 C9     cI
JSR LC3B3        :\ C3AA= 20 B3 C3     3C
JSR LC551        :\ C3AD= 20 51 C5     QE
JMP LC798        :\ C3B0= 4C 98 C7    L.G
 
.LC3B3
JSR LC4C3        :\ C3B3= 20 C3 C4     CD
BNE LC3C5        :\ C3B6= D0 0D       P.
LDX &0321        :\ C3B8= AE 21 03    .!.
DEX              :\ C3BB= CA          J
.LC3BC
JSR LC3E4        :\ C3BC= 20 E4 C3     dC
JSR LC9CA        :\ C3BF= 20 CA C9     JI
DEX              :\ C3C2= CA          J
BPL LC3BC        :\ C3C3= 10 F7       .w
.LC3C5
RTS              :\ C3C5= 60          `
 
.LC3C6
LDY #&81         :\ C3C6= A0 81        .
JSR LC8F5        :\ C3C8= 20 F5 C8     uH
LDA #&04         :\ C3CB= A9 04       ).
STA LDF00        :\ C3CD= 8D 00 DF    .._
LDY &0306,X      :\ C3D0= BC 06 03    <..
JSR LC5FD        :\ C3D3= 20 FD C5     }E
BEQ LC3E3        :\ C3D6= F0 0B       p.
JSR LCA26        :\ C3D8= 20 26 CA     &J
JSR LC8F5        :\ C3DB= 20 F5 C8     uH
LDA #&0C         :\ C3DE= A9 0C       ).
STA LDF00        :\ C3E0= 8D 00 DF    .._
.LC3E3
RTS              :\ C3E3= 60          `
 
.LC3E4
LDY #&00         :\ C3E4= A0 00        .
.LC3E6
LDA #&0D         :\ C3E6= A9 0D       ).
STA (&D4),Y      :\ C3E8= 91 D4       .T
INY              :\ C3EA= C8          H
INY              :\ C3EB= C8          H
CPY &0320        :\ C3EC= CC 20 03    L .
BCC LC3E6        :\ C3EF= 90 F5       .u
RTS              :\ C3F1= 60          `
 
.LC3F2
JSR LC42B        :\ C3F2= 20 2B C4     +D
LDY #&81         :\ C3F5= A0 81        .
JSR LC81A        :\ C3F7= 20 1A C8     .H
LDY &0309        :\ C3FA= AC 09 03    ,..
JSR LC81A        :\ C3FD= 20 1A C8     .H
JSR LC4C3        :\ C400= 20 C3 C4     CD
BNE LC415        :\ C403= D0 10       P.
LDY &D8          :\ C405= A4 D8       $X
INY              :\ C407= C8          H
INY              :\ C408= C8          H
LDA (&D4),Y      :\ C409= B1 D4       1T
CMP #&0D         :\ C40B= C9 0D       I.
BEQ LC411        :\ C40D= F0 02       p.
LDA #&20         :\ C40F= A9 20       ) 
.LC411
LDY &D8          :\ C411= A4 D8       $X
STA (&D4),Y      :\ C413= 91 D4       .T
.LC415
JMP LC798        :\ C415= 4C 98 C7    L.G
 
JSR LC798        :\ C418= 20 98 C7     .G
.LC41B
LDY #&00         :\ C41B= A0 00        .
STY &D8          :\ C41D= 84 D8       .X
STY &0303        :\ C41F= 8C 03 03    ...
STY &0304        :\ C422= 8C 04 03    ...
JSR LC798        :\ C425= 20 98 C7     .G
JMP LCBE5        :\ C428= 4C E5 CB    LeK
 
.LC42B
JSR LC798        :\ C42B= 20 98 C7     .G
LDY &D8          :\ C42E= A4 D8       $X
BEQ LC447        :\ C430= F0 15       p.
DEY              :\ C432= 88          .
DEY              :\ C433= 88          .
STY &D8          :\ C434= 84 D8       .X
SEC              :\ C436= 38          8
LDA &0304        :\ C437= AD 04 03    -..
SBC &0322        :\ C43A= ED 22 03    m".
STA &0304        :\ C43D= 8D 04 03    ...
BCS LC465        :\ C440= B0 23       0#
DEC &0303        :\ C442= CE 03 03    N..
BCC LC465        :\ C445= 90 1E       ..
.LC447
LDA &DA          :\ C447= A5 DA       %Z
BEQ LC465        :\ C449= F0 1A       p.
JSR LC468        :\ C44B= 20 68 C4     hD
.LC44E
LDA (&D4),Y      :\ C44E= B1 D4       1T
CMP #&0D         :\ C450= C9 0D       I.
BEQ LC465        :\ C452= F0 11       p.
JSR LC48B        :\ C454= 20 8B C4     .D
BCC LC44E        :\ C457= 90 F5       .u
BCS LC465        :\ C459= B0 0A       0.
LDA &DA          :\ C45B= A5 DA       %Z
BEQ LC4A5        :\ C45D= F0 46       pF
JSR LC798        :\ C45F= 20 98 C7     .G
JSR LC468        :\ C462= 20 68 C4     hD
.LC465
JMP LC798        :\ C465= 4C 98 C7    L.G
 
.LC468
DEC &DA          :\ C468= C6 DA       FZ
CLC              :\ C46A= 18          .
LDA &0306        :\ C46B= AD 06 03    -..
ADC &0323        :\ C46E= 6D 23 03    m#.
STA &0306        :\ C471= 8D 06 03    ...
JMP LC9A3        :\ C474= 4C A3 C9    L#I
 
JSR LC798        :\ C477= 20 98 C7     .G
.LC47A
JSR LC48B        :\ C47A= 20 8B C4     .D
BCC LC4C0        :\ C47D= 90 41       .A
LDY #&00         :\ C47F= A0 00        .
STY &D8          :\ C481= 84 D8       .X
STY &0303        :\ C483= 8C 03 03    ...
STY &0304        :\ C486= 8C 04 03    ...
BEQ LC4A9        :\ C489= F0 1E       p.
.LC48B
LDY &D8          :\ C48B= A4 D8       $X
INY              :\ C48D= C8          H
INY              :\ C48E= C8          H
CPY &0320        :\ C48F= CC 20 03    L .
BCS LC4A5        :\ C492= B0 11       0.
STY &D8          :\ C494= 84 D8       .X
LDA &0304        :\ C496= AD 04 03    -..
ADC &0322        :\ C499= 6D 22 03    m".
STA &0304        :\ C49C= 8D 04 03    ...
BCC LC4A5        :\ C49F= 90 04       ..
INC &0303        :\ C4A1= EE 03 03    n..
CLC              :\ C4A4= 18          .
.LC4A5
RTS              :\ C4A5= 60          `
 
JSR LC798        :\ C4A6= 20 98 C7     .G
.LC4A9
JSR LC9CA        :\ C4A9= 20 CA C9     JI
LDX &DA          :\ C4AC= A6 DA       &Z
INX              :\ C4AE= E8          h
CPX &0321        :\ C4AF= EC 21 03    l!.
BCS LC4C8        :\ C4B2= B0 14       0.
STX &DA          :\ C4B4= 86 DA       .Z
SEC              :\ C4B6= 38          8
LDA &0306        :\ C4B7= AD 06 03    -..
SBC &0323        :\ C4BA= ED 23 03    m#.
STA &0306        :\ C4BD= 8D 06 03    ...
.LC4C0
JMP LC798        :\ C4C0= 4C 98 C7    L.G
 
.LC4C3
LDA &D0          :\ C4C3= A5 D0       %P
AND #&04         :\ C4C5= 29 04       ).
RTS              :\ C4C7= 60          `
 
.LC4C8
JSR LC4C3        :\ C4C8= 20 C3 C4     CD
BEQ LC4DA        :\ C4CB= F0 0D       p.
.LC4CD
LDA #&79         :\ C4CD= A9 79       )y
LDX #&80         :\ C4CF= A2 80       ".
JSR OSBYTE       :\ C4D1= 20 F4 FF     t.
TXA              :\ C4D4= 8A          .
BPL LC4CD        :\ C4D5= 10 F6       .v
JMP LC38B        :\ C4D7= 4C 8B C3    L.C
 
.LC4DA
JSR LC3E4        :\ C4DA= 20 E4 C3     dC
LDA &032E        :\ C4DD= AD 2E 03    -..
BEQ LC4E5        :\ C4E0= F0 03       p.
DEC &032E        :\ C4E2= CE 2E 03    N..
.LC4E5
LDA #&00         :\ C4E5= A9 00       ).
LDX #&03         :\ C4E7= A2 03       ".
.LC4E9
STA &0318,X      :\ C4E9= 9D 18 03    ...
DEX              :\ C4EC= CA          J
BPL LC4E9        :\ C4ED= 10 FA       .z
STA &D9          :\ C4EF= 85 D9       .Y
LDA &D4          :\ C4F1= A5 D4       %T
STA &D6          :\ C4F3= 85 D6       .V
LDA &D5          :\ C4F5= A5 D5       %U
STA &D7          :\ C4F7= 85 D7       .W
LDA #&23         :\ C4F9= A9 23       )#
STA LDF01        :\ C4FB= 8D 01 DF    .._
LDA LDF00        :\ C4FE= AD 00 DF    -._
RTS              :\ C501= 60          `
 
LDA &0339        :\ C502= AD 39 03    -9.
CMP #&E0         :\ C505= C9 E0       I`
BCC LC524        :\ C507= 90 1B       ..
ASL A            :\ C509= 0A          .
ASL A            :\ C50A= 0A          .
ASL A            :\ C50B= 0A          .
TAY              :\ C50C= A8          (
LDA &0301        :\ C50D= AD 01 03    -..
STA &DC          :\ C510= 85 DC       .\
LDX #&00         :\ C512= A2 00       ".
STX &DB          :\ C514= 86 DB       .[
.LC516
LDA &0331,X      :\ C516= BD 31 03    =1.
ASL A            :\ C519= 0A          .
ASL A            :\ C51A= 0A          .
STA (&DB),Y      :\ C51B= 91 DB       .[
INY              :\ C51D= C8          H
INX              :\ C51E= E8          h
CPX #&08         :\ C51F= E0 08       `.
BNE LC516        :\ C521= D0 F3       Ps
RTS              :\ C523= 60          `
 
.LC524
LDA &0338        :\ C524= AD 38 03    -8.
BEQ LC537        :\ C527= F0 0E       p.
LDA &D0          :\ C529= A5 D0       %P
AND #&10         :\ C52B= 29 10       ).
BEQ LC550        :\ C52D= F0 21       p!
LDA #&EF         :\ C52F= A9 EF       )o
JSR LC55F        :\ C531= 20 5F C5     _E
JMP LC798        :\ C534= 4C 98 C7    L.G
 
.LC537
JSR LC798        :\ C537= 20 98 C7     .G
LDA #&10         :\ C53A= A9 10       ).
BNE LC54C        :\ C53C= D0 0E       P.
.LC53E
LDA #&20         :\ C53E= A9 20       ) 
BNE LC54C        :\ C540= D0 0A       P.
LDA #&04         :\ C542= A9 04       ).
BNE LC54C        :\ C544= D0 06       P.
LDA #&01         :\ C546= A9 01       ).
BNE LC54C        :\ C548= D0 02       P.
LDA #&80         :\ C54A= A9 80       ).
.LC54C
ORA &D0          :\ C54C= 05 D0       .P
STA &D0          :\ C54E= 85 D0       .P
.LC550
RTS              :\ C550= 60          `
 
.LC551
LDA #&DF         :\ C551= A9 DF       )_
BNE LC55F        :\ C553= D0 0A       P.
LDA #&FB         :\ C555= A9 FB       ){
BNE LC55F        :\ C557= D0 06       P.
LDA #&FE         :\ C559= A9 FE       )~
BNE LC55F        :\ C55B= D0 02       P.
LDA #&7F         :\ C55D= A9 7F       ).
.LC55F
AND &D0          :\ C55F= 25 D0       %P
STA &D0          :\ C561= 85 D0       .P
RTS              :\ C563= 60          `
 
JSR LC551        :\ C564= 20 51 C5     QE
LDX #&03         :\ C567= A2 03       ".
.LC569
LDA &0331        :\ C569= AD 31 03    -1.
CMP #&04         :\ C56C= C9 04       I.
BCS LC580        :\ C56E= B0 10       0.
ASL A            :\ C570= 0A          .
ASL A            :\ C571= 0A          .
STA &0331        :\ C572= 8D 31 03    .1.
LDA &0307,X      :\ C575= BD 07 03    =..
AND #&03         :\ C578= 29 03       ).
ORA &0331        :\ C57A= 0D 31 03    .1.
STA &0307,X      :\ C57D= 9D 07 03    ...
.LC580
LDA &0332        :\ C580= AD 32 03    -2.
STA &0304,X      :\ C583= 9D 04 03    ...
CPX #&03         :\ C586= E0 03       `.
BNE LC5BA        :\ C588= D0 30       P0
PHA              :\ C58A= 48          H
AND #&0F         :\ C58B= 29 0F       ).
BNE LC591        :\ C58D= D0 02       P.
LDA #&10         :\ C58F= A9 10       ).
.LC591
LDX #&08         :\ C591= A2 08       ".
JSR LC746        :\ C593= 20 46 C7     FG
STA &0323        :\ C596= 8D 23 03    .#.
PLA              :\ C599= 68          h
LSR A            :\ C59A= 4A          J
LSR A            :\ C59B= 4A          J
LSR A            :\ C59C= 4A          J
LSR A            :\ C59D= 4A          J
BNE LC5A2        :\ C59E= D0 02       P.
LDA #&10         :\ C5A0= A9 10       ).
.LC5A2
PHA              :\ C5A2= 48          H
LDX #&06         :\ C5A3= A2 06       ".
JSR LC746        :\ C5A5= 20 46 C7     FG
STA &0322        :\ C5A8= 8D 22 03    .".
JSR LC798        :\ C5AB= 20 98 C7     .G
PLA              :\ C5AE= 68          h
LDX #&04         :\ C5AF= A2 04       ".
JSR LC746        :\ C5B1= 20 46 C7     FG
STA &0324        :\ C5B4= 8D 24 03    .$.
JSR LC798        :\ C5B7= 20 98 C7     .G
.LC5BA
RTS              :\ C5BA= 60          `
 
JSR LC53E        :\ C5BB= 20 3E C5     >E
LDX #&0B         :\ C5BE= A2 0B       ".
BNE LC569        :\ C5C0= D0 A7       P'
LDX #&0B         :\ C5C2= A2 0B       ".
LDY &0332        :\ C5C4= AC 32 03    ,2.
LDA &0331        :\ C5C7= AD 31 03    -1.
BMI LC5D1        :\ C5CA= 30 05       0.
STY &0313        :\ C5CC= 8C 13 03    ...
BPL LC5D2        :\ C5CF= 10 01       ..
.LC5D1
INX              :\ C5D1= E8          h
.LC5D2
CPY #&04         :\ C5D2= C0 04       @.
BCC LC5DA        :\ C5D4= 90 04       ..
LDY #&03         :\ C5D6= A0 03        .
LDA #&07         :\ C5D8= A9 07       ).
.LC5DA
ASL A            :\ C5DA= 0A          .
ASL A            :\ C5DB= 0A          .
ASL A            :\ C5DC= 0A          .
ASL A            :\ C5DD= 0A          .
AND #&70         :\ C5DE= 29 70       )p
ORA LC5ED,Y      :\ C5E0= 19 ED C5    .mE
DEY              :\ C5E3= 88          .
DEY              :\ C5E4= 88          .
BEQ LC5E9        :\ C5E5= F0 02       p.
EOR #&70         :\ C5E7= 49 70       Ip
.LC5E9
STA &0305,X      :\ C5E9= 9D 05 03    ...
RTS              :\ C5EC= 60          `
 
.LC5ED
BRK              :\ C5ED= 00          .
BRA LC5F1        :\ C5EE= 80 01       ..
 
BRK              :\ C5F0= 00          .
.LC5F1
LDX #&03         :\ C5F1= A2 03       ".
LDY #&00         :\ C5F3= A0 00        .
LDA &0331        :\ C5F5= AD 31 03    -1.
BPL LC5DA        :\ C5F8= 10 E0       .`
INX              :\ C5FA= E8          h
BNE LC5DA        :\ C5FB= D0 DD       P]
.LC5FD
TYA              :\ C5FD= 98          .
AND #&70         :\ C5FE= 29 70       )p
CMP #&70         :\ C600= C9 70       Ip
RTS              :\ C602= 60          `
 
LDX #&03         :\ C603= A2 03       ".
LDY #&00         :\ C605= A0 00        .
.LC607
LDA &0331,X      :\ C607= BD 31 03    =1.
STA &0314,Y      :\ C60A= 99 14 03    ...
INY              :\ C60D= C8          H
DEX              :\ C60E= CA          J
BPL LC607        :\ C60F= 10 F6       .v
RTS              :\ C611= 60          `
 
LDA &0331        :\ C612= AD 31 03    -1.
AND #&07         :\ C615= 29 07       ).
STA &0302        :\ C617= 8D 02 03    ...
STA LDF10        :\ C61A= 8D 10 DF    .._
RTS              :\ C61D= 60          `
 
LDX #&03         :\ C61E= A2 03       ".
STX LDF01        :\ C620= 8E 01 DF    .._
LDA #&00         :\ C623= A9 00       ).
.LC625
STA &030B,X      :\ C625= 9D 0B 03    ...
DEX              :\ C628= CA          J
BPL LC625        :\ C629= 10 FA       .z
STX &031B        :\ C62B= 8E 1B 03    ...
JSR LC3B3        :\ C62E= 20 B3 C3     3C
LDX #&0B         :\ C631= A2 0B       ".
JSR LC3C6        :\ C633= 20 C6 C3     FC
JMP LC798        :\ C636= 4C 98 C7    L.G
 
JSR LC798        :\ C639= 20 98 C7     .G
LDA &DA          :\ C63C= A5 DA       %Z
BEQ LC647        :\ C63E= F0 07       p.
.LC640
JSR LC9A3        :\ C640= 20 A3 C9     #I
DEC &DA          :\ C643= C6 DA       FZ
BNE LC640        :\ C645= D0 F9       Py
.LC647
LDA &0325        :\ C647= AD 25 03    -%.
STA &0306        :\ C64A= 8D 06 03    ...
JMP LC41B        :\ C64D= 4C 1B C4    L.D
 
.LC650
STX &0332        :\ C650= 8E 32 03    .2.
STY &0331        :\ C653= 8C 31 03    .1.
JSR LC798        :\ C656= 20 98 C7     .G
LDY &0326        :\ C659= AC 26 03    ,&.
CLC              :\ C65C= 18          .
LDA &0321        :\ C65D= AD 21 03    -!.
SBC &0331        :\ C660= ED 31 03    m1.
BCC LC68A        :\ C663= 90 25       .%
LDX LC6F8,X      :\ C665= BE F8 C6    >xF
JSR LC746        :\ C668= 20 46 C7     FG
STA &0306        :\ C66B= 8D 06 03    ...
STX &0305        :\ C66E= 8E 05 03    ...
.LC671
LDA &0331        :\ C671= AD 31 03    -1.
CMP &DA          :\ C674= C5 DA       EZ
BEQ LC68A        :\ C676= F0 12       p.
BCC LC682        :\ C678= 90 08       ..
JSR LC9CA        :\ C67A= 20 CA C9     JI
INC &DA          :\ C67D= E6 DA       fZ
JMP LC671        :\ C67F= 4C 71 C6    LqF
 
.LC682
JSR LC9A3        :\ C682= 20 A3 C9     #I
DEC &DA          :\ C685= C6 DA       FZ
JMP LC671        :\ C687= 4C 71 C6    LqF
 
.LC68A
LDA &0332        :\ C68A= AD 32 03    -2.
ASL A            :\ C68D= 0A          .
CMP &0320        :\ C68E= CD 20 03    M .
BCS LC6A2        :\ C691= B0 0F       0.
STA &D8          :\ C693= 85 D8       .X
LSR A            :\ C695= 4A          J
LDX LC6F7,X      :\ C696= BE F7 C6    >wF
JSR LC746        :\ C699= 20 46 C7     FG
STA &0304        :\ C69C= 8D 04 03    ...
STX &0303        :\ C69F= 8E 03 03    ...
.LC6A2
JMP LC798        :\ C6A2= 4C 98 C7    L.G
 
.LC645
LDA &0331
.LC6A8
AND #&07
.LC6AA
CMP #&07:BCC LC6B0        :\ If mode<7, jump past
LDA #&06                  :\ Replace MODE 7 with MODE 6
.LC6B0
STA &0327:JSR LC73D       :\ Store new MODE, ...
STX &0326:LDY #&19
.LC6BB
LDA LC10E,Y:STA &0302,Y   :\ Copy data to VDU workspace
DEY:BPL LC6BB             :\ Loop to copy 26 bytes
LDA LC6F0,X:STA &0307     :\
LDY #&00
.LC6CC
INX:LDA LC6F0,X
STA &031C,Y:INY
CPY #&0A:BNE LC6CC
LDX #&02
.LC6DA
CLC:LDA &031D,X
ADC &0300:STA &031D,X
DEX:DEX:BPL LC6DA
LDA #&EF:JSR LC55F        :\ Clear b4 of VDU flag
JMP LC38B

.LC6F0
ORA (&00),Y      :\ C6F0= 11 00       ..
BRK              :\ C6F2= 00          .
RTS              :\ C6F3= 60          `
 
EQUB &13         :\ C6F4= 13          .
LDY #&20         :\ C6F5= A0 20         
.LC6F7
ASL &08          :\ C6F7= 06 08       ..
TSB &F8          :\ C6F9= 04 F8       .x
AND (&00,X)      :\ C6FB= 21 00       !.
BRK              :\ C6FD= 00          .
BCS LC709        :\ C6FE= B0 09       0.
BVC LC722        :\ C700= 50 20       P 
TSB &0808        :\ C702= 0C 08 08    ...
SED              :\ C705= F8          x
EOR (&00,X)      :\ C706= 41 00       A.
BRK              :\ C708= 00          .
.LC709
CLD              :\ C709= D8          X
TSB &28          :\ C70A= 04 28       .(
JSR &0818        :\ C70C= 20 18 08     ..
BPL LC709        :\ C70F= 10 F8       .x
ORA (&00),Y      :\ C711= 11 00       ..
BRK              :\ C713= 00          .
BRK              :\ C714= 00          .
BBR 0,&A0,&C731  :\ C715= 0F A0 19    . .
ASL &0A          :\ C718= 06 0A       ..
TSB &F0          :\ C71A= 04 F0       .p
EQUB &42         :\ C71C= 42          B
BRK              :\ C71D= 00          .
BRK              :\ C71E= 00          .
CLI              :\ C71F= 58          X
EQUB &02         :\ C720= 02          .
PLP              :\ C721= 28          (
.LC722
BPL LC73C        :\ C722= 10 18       ..
BPL LC736        :\ C724= 10 10       ..
BEQ LC6AA        :\ C726= F0 82       p.
BRK              :\ C728= 00          .
BRK              :\ C729= 00          .
BIT &1401        :\ C72A= 2C 01 14    ,..
BPL LC75F        :\ C72D= 10 30       .0
BPL LC751        :\ C72F= 10 20       . 
BEQ LC754        :\ C731= F0 21       p!
BRK              :\ C733= 00          .
BRK              :\ C734= 00          .
BRA LC73E        :\ C735= 80 07       ..
 
BVC LC752        :\ C737= 50 19       P.
TSB &080A        :\ C739= 0C 0A 08    ...
.LC73C
BEQ LC767        :\ C73C= F0 29       p)
.LC73E
TSB &A2          :\ C73E= 07 A2       ."
ASL A            :\ C740= 0B          .
JSR LC746        :\ C741= 20 46 C7     FG
TAX              :\ C744= AA          *
RTS              :\ C745= 60          `
 
.LC746
STA &DB          :\ C746= 85 DB       .[
STX &DF          :\ C748= 86 DF       ._
LDA #&00         :\ C74A= A9 00       ).
STA &DC          :\ C74C= 85 DC       .\
STA &DD          :\ C74E= 85 DD       .]
STA &DE          :\ C750= 85 DE       .^
.LC752
BEQ LC758        :\ C752= F0 04       p.
.LC754
ASL &DB          :\ C754= 06 DB       .[
ROL &DC          :\ C756= 26 DC       &\
.LC758
LSR &DF          :\ C758= 46 DF       F_
BCC LC76B        :\ C75A= 90 0F       ..
CLC              :\ C75C= 18          .
LDA &DB          :\ C75D= A5 DB       %[
.LC75F
ADC &DD          :\ C75F= 65 DD       e]
STA &DD          :\ C761= 85 DD       .]
LDA &DC          :\ C763= A5 DC       %\
ADC &DE          :\ C765= 65 DE       e^
.LC767
STA &DE          :\ C767= 85 DE       .^
LDA &DF          :\ C769= A5 DF       %_
.LC76B
BNE LC754        :\ C76B= D0 E7       Pg
LDA &DD          :\ C76D= A5 DD       %]
LDX &DE          :\ C76F= A6 DE       &^
RTS              :\ C771= 60          `
 
.LC772
JSR LCA26        :\ C772= 20 26 CA     &J
PHP              :\ C775= 08          .
CLI              :\ C776= 58          X
LDA #&06         :\ C777= A9 06       ).
STA &032F        :\ C779= 8D 2F 03    ./.
.LC77C
LDY #&00         :\ C77C= A0 00        .
.LC77E
LDX #&80         :\ C77E= A2 80       ".
.LC780
DEX              :\ C780= CA          J
BNE LC780        :\ C781= D0 FD       P}
LDA &0302        :\ C783= AD 02 03    -..
EOR #&08         :\ C786= 49 08       I.
STA LDF10        :\ C788= 8D 10 DF    .._
STA &0302        :\ C78B= 8D 02 03    ...
DEY              :\ C78E= 88          .
BNE LC77E        :\ C78F= D0 ED       Pm
DEC &032F        :\ C791= CE 2F 03    N/.
BNE LC77C        :\ C794= D0 E6       Pf
PLP              :\ C796= 28          (
RTS              :\ C797= 60          `
 
.LC798
JSR LC16C        :\ C798= 20 6C C1     lA
JSR LC7B7        :\ C79B= 20 B7 C7     7G
BCS LC7B6        :\ C79E= B0 16       0.
.LC7A0
LDA &D0          :\ C7A0= A5 D0       %P
AND #&10         :\ C7A2= 29 10       ).
BNE LC7B6        :\ C7A4= D0 10       P.
LDY #&00         :\ C7A6= A0 00        .
.LC7A8
JSR LC8E3        :\ C7A8= 20 E3 C8     cH
LDA &0324        :\ C7AB= AD 24 03    -$.
STA LDF05        :\ C7AE= 8D 05 DF    .._
LDA #&10         :\ C7B1= A9 10       ).
.LC7B3
STA LDF00        :\ C7B3= 8D 00 DF    .._
.LC7B6
RTS              :\ C7B6= 60          `
 
.LC7B7
LDX #&03         :\ C7B7= A2 03       ".
LDA &0306        :\ C7B9= AD 06 03    -..
CMP &031B        :\ C7BC= CD 1B 03    M..
RTS              :\ C7BF= 60          `
 
.LC7C0
LDA &D3          :\ C7C0= A5 D3       %S
CMP #&80         :\ C7C2= C9 80       I.
BEQ LC81A        :\ C7C4= F0 54       pT
CMP #&82         :\ C7C6= C9 82       I.
BEQ LC7A8        :\ C7C8= F0 DE       p^
JSR LC8E3        :\ C7CA= 20 E3 C8     cH
LDA &D3          :\ C7CD= A5 D3       %S
CMP #&E0         :\ C7CF= C9 E0       I`
BCC LC7B3        :\ C7D1= 90 E0       .`
ASL A            :\ C7D3= 0A          .
ASL A            :\ C7D4= 0A          .
ASL A            :\ C7D5= 0A          .
TAY              :\ C7D6= A8          (
LDA &0304,X      :\ C7D7= BD 04 03    =..
PHA              :\ C7DA= 48          H
AND #&0F         :\ C7DB= 29 0F       ).
BNE LC7E1        :\ C7DD= D0 02       P.
LDA #&10         :\ C7DF= A9 10       ).
.LC7E1
STA &DF          :\ C7E1= 85 DF       ._
PLA              :\ C7E3= 68          h
LSR A            :\ C7E4= 4A          J
LSR A            :\ C7E5= 4A          J
LSR A            :\ C7E6= 4A          J
LSR A            :\ C7E7= 4A          J
BNE LC7EC        :\ C7E8= D0 02       P.
LDA #&10         :\ C7EA= A9 10       ).
.LC7EC
STA &DE          :\ C7EC= 85 DE       .^
TXA              :\ C7EE= 8A          .
PHA              :\ C7EF= 48          H
LDX #&3B         :\ C7F0= A2 3B       ";
JSR LC9EE        :\ C7F2= 20 EE C9     nI
LDA #&00         :\ C7F5= A9 00       ).
STA &DB          :\ C7F7= 85 DB       .[
LDA &0301        :\ C7F9= AD 01 03    -..
STA &DC          :\ C7FC= 85 DC       .\
LDA #&08         :\ C7FE= A9 08       ).
STA &DD          :\ C800= 85 DD       .]
.LC802
JSR LCA0A        :\ C802= 20 0A CA     .J
LDA (&DB),Y      :\ C805= B1 DB       1[
JSR LC87E        :\ C807= 20 7E C8     ~H
CLC              :\ C80A= 18          .
LDA &DF          :\ C80B= A5 DF       %_
ADC &033E        :\ C80D= 6D 3E 03    m>.
STA &033E        :\ C810= 8D 3E 03    .>.
INY              :\ C813= C8          H
DEC &DD          :\ C814= C6 DD       F]
BNE LC802        :\ C816= D0 EA       Pj
BEQ LC878        :\ C818= F0 5E       p^
.LC81A
JSR LC5FD        :\ C81A= 20 FD C5     }E
BEQ LC7B6        :\ C81D= F0 97       p.
JSR LC8E3        :\ C81F= 20 E3 C8     cH
LDA #&0A         :\ C822= A9 0A       ).
STA LDF00        :\ C824= 8D 00 DF    .._
LDA &0304,X      :\ C827= BD 04 03    =..
STA &DC          :\ C82A= 85 DC       .\
ASL A            :\ C82C= 0A          .
ASL A            :\ C82D= 0A          .
ASL A            :\ C82E= 0A          .
SEC              :\ C82F= 38          8
SBC #&01         :\ C830= E9 01       i.
AND #&7F         :\ C832= 29 7F       ).
STA LDF05        :\ C834= 8D 05 DF    .._
STA LDF07        :\ C837= 8D 07 DF    .._
LDA &0307,X      :\ C83A= BD 07 03    =..
AND #&08         :\ C83D= 29 08       ).
BEQ LC843        :\ C83F= F0 02       p.
LDA #&02         :\ C841= A9 02       ).
.LC843
TAY              :\ C843= A8          (
LDA &0307,X      :\ C844= BD 07 03    =..
AND #&04         :\ C847= 29 04       ).
BNE LC84E        :\ C849= D0 03       P.
STA LDF05,Y      :\ C84B= 99 05 DF    .._
.LC84E
TXA              :\ C84E= 8A          .
PHA              :\ C84F= 48          H
LDX #&3B         :\ C850= A2 3B       ";
JSR LC9EE        :\ C852= 20 EE C9     nI
.LC855
TYA              :\ C855= 98          .
TAX              :\ C856= AA          *
LDA &033C,X      :\ C857= BD 3C 03    =<.
BNE LC85F        :\ C85A= D0 03       P.
DEC &033B,X      :\ C85C= DE 3B 03    ^;.
.LC85F
DEC &033C,X      :\ C85F= DE 3C 03    ^<.
LDX #&3B         :\ C862= A2 3B       ";
JSR LCA0A        :\ C864= 20 0A CA     .J
LDA LC87B,Y      :\ C867= B9 7B C8    9{H
STA LDF00        :\ C86A= 8D 00 DF    .._
LDA &DC          :\ C86D= A5 DC       %\
SEC              :\ C86F= 38          8
SBC #&10         :\ C870= E9 10       i.
STA &DC          :\ C872= 85 DC       .\
CMP #&10         :\ C874= C9 10       I.
BCS LC855        :\ C876= B0 DD       0]
.LC878
PLA              :\ C878= 68          h
TAX              :\ C879= AA          *
RTS              :\ C87A= 60          `
 
.LC87B
ORA (&00),Y      :\ C87B= 11 00       ..
EQUB &13         :\ C87D= 13          .
.LC87E
STA &E0          :\ C87E= 85 E0       .`
.LC880
LDA #&00         :\ C880= A9 00       ).
STA LDF05        :\ C882= 8D 05 DF    .._
.LC885
ASL &E0          :\ C885= 06 E0       .`
BCS LC8A6        :\ C887= B0 1D       0.
LDA LDF05        :\ C889= AD 05 DF    -._
BEQ LC891        :\ C88C= F0 03       p.
JSR LC8B1        :\ C88E= 20 B1 C8     1H
.LC891
LDA &E0          :\ C891= A5 E0       %`
BNE LC896        :\ C893= D0 01       P.
RTS              :\ C895= 60          `
 
.LC896
CLC              :\ C896= 18          .
LDA LDF09        :\ C897= AD 09 DF    -._
ADC &DE          :\ C89A= 65 DE       e^
STA LDF09        :\ C89C= 8D 09 DF    .._
BCC LC880        :\ C89F= 90 DF       ._
INC LDF08        :\ C8A1= EE 08 DF    n._
BCS LC880        :\ C8A4= B0 DA       0Z
.LC8A6
CLC              :\ C8A6= 18          .
LDA LDF05        :\ C8A7= AD 05 DF    -._
ADC &DE          :\ C8AA= 65 DE       e^
STA LDF05        :\ C8AC= 8D 05 DF    .._
BNE LC885        :\ C8AF= D0 D4       PT
.LC8B1
LDA &DF          :\ C8B1= A5 DF       %_
STA &033F        :\ C8B3= 8D 3F 03    .?.
JSR LCA26        :\ C8B6= 20 26 CA     &J
LDA LDF0B        :\ C8B9= AD 0B DF    -._
PHA              :\ C8BC= 48          H
.LC8BD
LDA #&10         :\ C8BD= A9 10       ).
STA LDF00        :\ C8BF= 8D 00 DF    .._
JSR LCA26        :\ C8C2= 20 26 CA     &J
DEC &033F        :\ C8C5= CE 3F 03    N?.
BEQ LC8DE        :\ C8C8= F0 14       p.
INC LDF0B        :\ C8CA= EE 0B DF    n._
SEC              :\ C8CD= 38          8
LDA LDF09        :\ C8CE= AD 09 DF    -._
SBC LDF05        :\ C8D1= ED 05 DF    m._
STA LDF09        :\ C8D4= 8D 09 DF    .._
BCS LC8BD        :\ C8D7= B0 E4       0d
DEC LDF08        :\ C8D9= CE 08 DF    N._
BCC LC8BD        :\ C8DC= 90 DF       ._
.LC8DE
PLA              :\ C8DE= 68          h
STA LDF0B        :\ C8DF= 8D 0B DF    .._
RTS              :\ C8E2= 60          `
 
.LC8E3
JSR LC16C        :\ C8E3= 20 6C C1     lA
JSR LCA0A        :\ C8E6= 20 0A CA     .J
LDA &0307,X      :\ C8E9= BD 07 03    =..
STA LDF02        :\ C8EC= 8D 02 DF    .._
LDA &0304,X      :\ C8EF= BD 04 03    =..
STA LDF03        :\ C8F2= 8D 03 DF    .._
.LC8F5
TYA              :\ C8F5= 98          .
AND #&01         :\ C8F6= 29 01       ).
STA LDF00        :\ C8F8= 8D 00 DF    .._
TYA              :\ C8FB= 98          .
AND #&F0         :\ C8FC= 29 F0       )p
ORA &0302        :\ C8FE= 0D 02 03    ...
STA LDF10        :\ C901= 8D 10 DF    .._
RTS              :\ C904= 60          `
 
.LC905
LDA #&20         :\ C905= A9 20       ) 
STA (&D4),Y      :\ C907= 91 D4       .T
.LC909
TYA              :\ C909= 98          .
BEQ LC914        :\ C90A= F0 08       p.
DEY              :\ C90C= 88          .
DEY              :\ C90D= 88          .
LDA (&D4),Y      :\ C90E= B1 D4       1T
CMP #&0D         :\ C910= C9 0D       I.
BEQ LC905        :\ C912= F0 F1       pq
.LC914
RTS              :\ C914= 60          `
 
.LC915
CLD              :\ C915= D8          X
LDX &0327        :\ C916= AE 27 03    .'.
LDA LC998,X      :\ C919= BD 98 C9    =.I
STA &D1          :\ C91C= 85 D1       .Q
LDA &031B        :\ C91E= AD 1B 03    -..
BNE LC92D        :\ C921= D0 0A       P.
LSR &D1          :\ C923= 46 D1       FQ
LDX #&03         :\ C925= A2 03       ".
JSR LC3C6        :\ C927= 20 C6 C3     FC
JSR LC7A0        :\ C92A= 20 A0 C7      G
.LC92D
LDX #&18         :\ C92D= A2 18       ".
JSR LCA0A        :\ C92F= 20 0A CA     .J
LDY &D9          :\ C932= A4 D9       $Y
.LC934
LDA (&D6),Y      :\ C934= B1 D6       1V
BMI LC98C        :\ C936= 30 54       0T
CMP #&20         :\ C938= C9 20       I 
BCC LC990        :\ C93A= 90 54       .T
TAX              :\ C93C= AA          *
.LC93D
INY              :\ C93D= C8          H
.LC93E
LDA LDF00        :\ C93E= AD 00 DF    -._
AND #&04         :\ C941= 29 04       ).
BEQ LC93E        :\ C943= F0 F9       py
LDA (&D6),Y      :\ C945= B1 D6       1V
AND #&70         :\ C947= 29 70       )p
ORA &0302        :\ C949= 0D 02 03    ...
STA LDF10        :\ C94C= 8D 10 DF    .._
STX LDF00        :\ C94F= 8E 00 DF    .._
INY              :\ C952= C8          H
CPY &0320        :\ C953= CC 20 03    L .
BCC LC934        :\ C956= 90 DC       .\
.LC958
JSR LCA26        :\ C958= 20 26 CA     &J
LDA LDF0B        :\ C95B= AD 0B DF    -._
CMP &0325        :\ C95E= CD 25 03    M%.
BCS LC981        :\ C961= B0 1E       0.
ADC &0323        :\ C963= 6D 23 03    m#.
BCS LC981        :\ C966= B0 19       0.
STA LDF0B        :\ C968= 8D 0B DF    .._
JSR LC99F        :\ C96B= 20 9F C9     .I
LDY #&00         :\ C96E= A0 00        .
STY LDF08        :\ C970= 8C 08 DF    .._
STY LDF09        :\ C973= 8C 09 DF    .._
DEC &D1          :\ C976= C6 D1       FQ
BNE LC934        :\ C978= D0 BA       P:
STY &D9          :\ C97A= 84 D9       .Y
LDX #&18         :\ C97C= A2 18       ".
JMP LC9EE        :\ C97E= 4C EE C9    LnI
 
.LC981
LDA #&FF         :\ C981= A9 FF       ).
STA &031B        :\ C983= 8D 1B 03    ...
LDA #&03         :\ C986= A9 03       ).
STA LDF01        :\ C988= 8D 01 DF    .._
RTS              :\ C98B= 60          `
 
.LC98C
LDX #&7F         :\ C98C= A2 7F       ".
BNE LC93D        :\ C98E= D0 AD       P-
.LC990
LDX #&0A         :\ C990= A2 0A       ".
CMP #&0D         :\ C992= C9 0D       I.
BNE LC93D        :\ C994= D0 A7       P'
BEQ LC958        :\ C996= F0 C0       p@
.LC998
LDY #&50         :\ C998= A0 50        P
PLP              :\ C99A= 28          (
LDY #&14         :\ C99B= A0 14        .
ASL A            :\ C99D= 0A          .
BVC LC942        :\ C99E= 50 A2       P"
EQUB &02         :\ C9A0= 02          .
BNE LC9A5        :\ C9A1= D0 02       P.
.LC9A3
LDX #&00         :\ C9A3= A2 00       ".
.LC9A5
SEC              :\ C9A5= 38          8
LDA &031C        :\ C9A6= AD 1C 03    -..
SBC &D4,X        :\ C9A9= F5 D4       uT
LDA &031D        :\ C9AB= AD 1D 03    -..
SBC &D5,X        :\ C9AE= F5 D5       uU
BCS LC9BF        :\ C9B0= B0 0D       0.
SEC              :\ C9B2= 38          8
LDA &D4,X        :\ C9B3= B5 D4       5T
SBC &0320        :\ C9B5= ED 20 03    m .
STA &D4,X        :\ C9B8= 95 D4       .T
BCS LC9BE        :\ C9BA= B0 02       0.
DEC &D5,X        :\ C9BC= D6 D5       VU
.LC9BE
RTS              :\ C9BE= 60          `
 
.LC9BF
LDA &031E        :\ C9BF= AD 1E 03    -..
STA &D4,X        :\ C9C2= 95 D4       .T
LDA &031F        :\ C9C4= AD 1F 03    -..
STA &D5,X        :\ C9C7= 95 D5       .U
RTS              :\ C9C9= 60          `
 
.LC9CA
SEC              :\ C9CA= 38          8
LDA &D4          :\ C9CB= A5 D4       %T
SBC &031E        :\ C9CD= ED 1E 03    m..
LDA &D5          :\ C9D0= A5 D5       %U
SBC &031F        :\ C9D2= ED 1F 03    m..
BCS LC9E3        :\ C9D5= B0 0C       0.
LDA &0320        :\ C9D7= AD 20 03    - .
ADC &D4          :\ C9DA= 65 D4       eT
STA &D4          :\ C9DC= 85 D4       .T
BCC LC9E2        :\ C9DE= 90 02       ..
INC &D5          :\ C9E0= E6 D5       fU
.LC9E2
RTS              :\ C9E2= 60          `
 
.LC9E3
LDA &031C        :\ C9E3= AD 1C 03    -..
STA &D4          :\ C9E6= 85 D4       .T
LDA &031D        :\ C9E8= AD 1D 03    -..
STA &D5          :\ C9EB= 85 D5       .U
RTS              :\ C9ED= 60          `
 
.LC9EE
JSR LCA26        :\ C9EE= 20 26 CA     &J
LDA LDF08        :\ C9F1= AD 08 DF    -._
STA &0300,X      :\ C9F4= 9D 00 03    ...
LDA LDF09        :\ C9F7= AD 09 DF    -._
STA &0301,X      :\ C9FA= 9D 01 03    ...
LDA LDF0A        :\ C9FD= AD 0A DF    -._
STA &0302,X      :\ CA00= 9D 02 03    ...
LDA LDF0B        :\ CA03= AD 0B DF    -._
STA &0303,X      :\ CA06= 9D 03 03    ...
RTS              :\ CA09= 60          `
 
.LCA0A
JSR LCA26        :\ CA0A= 20 26 CA     &J
LDA &0300,X      :\ CA0D= BD 00 03    =..
STA LDF08        :\ CA10= 8D 08 DF    .._
LDA &0301,X      :\ CA13= BD 01 03    =..
STA LDF09        :\ CA16= 8D 09 DF    .._
LDA &0302,X      :\ CA19= BD 02 03    =..
STA LDF0A        :\ CA1C= 8D 0A DF    .._
LDA &0303,X      :\ CA1F= BD 03 03    =..
STA LDF0B        :\ CA22= 8D 0B DF    .._
RTS              :\ CA25= 60          `
 
.LCA26
LDA LDF00        :\ CA26= AD 00 DF    -._
AND #&04         :\ CA29= 29 04       ).
BEQ LCA26        :\ CA2B= F0 F9       py
RTS              :\ CA2D= 60          `
 
LDA &0333        :\ CA2E= AD 33 03    -3.
STA &033B        :\ CA31= 8D 3B 03    .;.
LDA &0334        :\ CA34= AD 34 03    -4.
STA &033C        :\ CA37= 8D 3C 03    .<.
LDA &0331        :\ CA3A= AD 31 03    -1.
STA &033D        :\ CA3D= 8D 3D 03    .=.
LDA &0332        :\ CA40= AD 32 03    -2.
STA &033E        :\ CA43= 8D 3E 03    .>.
LDA &0335        :\ CA46= AD 35 03    -5.
STA &DB          :\ CA49= 85 DB       .[
AND #&04         :\ CA4B= 29 04       ).
BNE LCA6D        :\ CA4D= D0 1E       P.
JSR LCB5F        :\ CA4F= 20 5F CB     _K
LDX #&02         :\ CA52= A2 02       ".
.LCA54
CLC              :\ CA54= 18          .
LDA &030C,X      :\ CA55= BD 0C 03    =..
ADC &033C,X      :\ CA58= 7D 3C 03    }<.
STA &033C,X      :\ CA5B= 9D 3C 03    .<.
LDA &030B,X      :\ CA5E= BD 0B 03    =..
ADC &033B,X      :\ CA61= 7D 3B 03    };.
STA &033B,X      :\ CA64= 9D 3B 03    .;.
DEX              :\ CA67= CA          J
DEX              :\ CA68= CA          J
BPL LCA54        :\ CA69= 10 E9       .i
BMI LCA70        :\ CA6B= 30 03       0.
.LCA6D
JSR LCB5C        :\ CA6D= 20 5C CB     \K
.LCA70
LDX #&0B         :\ CA70= A2 0B       ".
JSR LCA0A        :\ CA72= 20 0A CA     .J
LDY #&03         :\ CA75= A0 03        .
.LCA77
LDA &033B,Y      :\ CA77= B9 3B 03    9;.
STA &030B,Y      :\ CA7A= 99 0B 03    ...
DEY              :\ CA7D= 88          .
BPL LCA77        :\ CA7E= 10 F7       .w
LDA &DB          :\ CA80= A5 DB       %[
AND #&03         :\ CA82= 29 03       ).
BEQ LCA0A        :\ CA84= F0 84       p.
TAY              :\ CA86= A8          (
LDA &DB          :\ CA87= A5 DB       %[
LSR A            :\ CA89= 4A          J
LSR A            :\ CA8A= 4A          J
LSR A            :\ CA8B= 4A          J
LSR A            :\ CA8C= 4A          J
STA LDF02        :\ CA8D= 8D 02 DF    .._
LDA &0310        :\ CA90= AD 10 03    -..
DEY              :\ CA93= 88          .
BEQ LCAA1        :\ CA94= F0 0B       p.
DEY              :\ CA96= 88          .
BEQ LCA9F        :\ CA97= F0 06       p.
LDA &0311        :\ CA99= AD 11 03    -..
JMP LCAA1        :\ CA9C= 4C A1 CA    L!J
 
.LCA9F
EOR #&70         :\ CA9F= 49 70       Ip
.LCAA1
STA &DC          :\ CAA1= 85 DC       .\
TAY              :\ CAA3= A8          (
JSR LC8F5        :\ CAA4= 20 F5 C8     uH
LDA &DB          :\ CAA7= A5 DB       %[
AND #&40         :\ CAA9= 29 40       )@
BEQ LCAD8        :\ CAAB= F0 2B       p+
LDX #&3B         :\ CAAD= A2 3B       ";
JSR LCA0A        :\ CAAF= 20 0A CA     .J
.LCAB2
LDY #&80         :\ CAB2= A0 80        .
.LCAB4
LDA &0313        :\ CAB4= AD 13 03    -..
BNE LCAD4        :\ CAB7= D0 1B       P.
STY &DD          :\ CAB9= 84 DD       .]
LDX #&33         :\ CABB= A2 33       "3
JSR LC9EE        :\ CABD= 20 EE C9     nI
LDY #&81         :\ CAC0= A0 81        .
JSR LC8F5        :\ CAC2= 20 F5 C8     uH
LDY &DD          :\ CAC5= A4 DD       $]
STY LDF00        :\ CAC7= 8C 00 DF    .._
JSR LCA0A        :\ CACA= 20 0A CA     .J
LDY &DC          :\ CACD= A4 DC       $\
JSR LC8F5        :\ CACF= 20 F5 C8     uH
LDY &DD          :\ CAD2= A4 DD       $]
.LCAD4
STY LDF00        :\ CAD4= 8C 00 DF    .._
.LCAD7
RTS              :\ CAD7= 60          `
 
.LCAD8
CLC              :\ CAD8= 18          .
PHP              :\ CAD9= 08          .
LDY #&11         :\ CADA= A0 11        .
LDX #&02         :\ CADC= A2 02       ".
JSR LCA26        :\ CADE= 20 26 CA     &J
.LCAE1
SEC              :\ CAE1= 38          8
LDA &033C,X      :\ CAE2= BD 3C 03    =<.
SBC LDF09,X      :\ CAE5= FD 09 DF    }._
STA &0330,X      :\ CAE8= 9D 30 03    .0.
LDA &033B,X      :\ CAEB= BD 3B 03    =;.
SBC LDF08,X      :\ CAEE= FD 08 DF    }._
AND #&0F         :\ CAF1= 29 0F       ).
STA &032F,X      :\ CAF3= 9D 2F 03    ./.
AND #&08         :\ CAF6= 29 08       ).
BEQ LCB12        :\ CAF8= F0 18       p.
TYA              :\ CAFA= 98          .
ORA LCB59,X      :\ CAFB= 1D 59 CB    .YK
TAY              :\ CAFE= A8          (
SEC              :\ CAFF= 38          8
LDA #&00         :\ CB00= A9 00       ).
SBC &0330,X      :\ CB02= FD 30 03    }0.
STA &0330,X      :\ CB05= 9D 30 03    .0.
LDA #&00         :\ CB08= A9 00       ).
SBC &032F,X      :\ CB0A= FD 2F 03    }/.
AND #&0F         :\ CB0D= 29 0F       ).
STA &032F,X      :\ CB0F= 9D 2F 03    ./.
.LCB12
DEX              :\ CB12= CA          J
DEX              :\ CB13= CA          J
BPL LCAE1        :\ CB14= 10 CB       .K
.LCB16
LDA &032F        :\ CB16= AD 2F 03    -/.
ORA &0331        :\ CB19= 0D 31 03    .1.
BNE LCB48        :\ CB1C= D0 2A       P*
LDA &0330        :\ CB1E= AD 30 03    -0.
STA LDF05        :\ CB21= 8D 05 DF    .._
LDA &0332        :\ CB24= AD 32 03    -2.
STA LDF07        :\ CB27= 8D 07 DF    .._
JSR LCAB4        :\ CB2A= 20 B4 CA     4J
PLP              :\ CB2D= 28          (
BCS LCB3C        :\ CB2E= B0 0C       0.
LDA &DB          :\ CB30= A5 DB       %[
AND #&08         :\ CB32= 29 08       ).
BEQ LCAD7        :\ CB34= F0 A1       p!
.LCB36
JSR LCA26        :\ CB36= 20 26 CA     &J
JMP LCAB2        :\ CB39= 4C B2 CA    L2J
 
.LCB3C
LDA &0313        :\ CB3C= AD 13 03    -..
CMP #&03         :\ CB3F= C9 03       I.
BCC LCAD8        :\ CB41= 90 95       ..
JSR LCB36        :\ CB43= 20 36 CB     6K
BNE LCAD8        :\ CB46= D0 90       P.
.LCB48
LSR &032F        :\ CB48= 4E 2F 03    N/.
ROR &0330        :\ CB4B= 6E 30 03    n0.
LSR &0331        :\ CB4E= 4E 31 03    N1.
ROR &0332        :\ CB51= 6E 32 03    n2.
PLP              :\ CB54= 28          (
SEC              :\ CB55= 38          8
PHP              :\ CB56= 08          .
BCS LCB16        :\ CB57= B0 BD       0=
.LCB59
EQUB &02         :\ CB59= 02          .
BRK              :\ CB5A= 00          .
EQUB &04         :\ CB5B= 04          .

.LCB5C
JSR LCB72        :\ 33C,X=33C,X+314,X
.LCB5F
LSR &033B:ROR &033C  :\ 33B/C=33B/C DIV 2
LSR &033D:ROR &033E  :\ 33D/E=33D/E DIV 4
LSR &033D:ROR &033E
RTS

.LCB72
LDX #&02
.LCB74
CLC               :\ 33C/B,X = 33C/B,X + 314/5,X
LDA &0314,X:ADC &033C,X:STA &033C,X
LDA &0315,X:ADC &033B,X:STA &033B,X
DEX:DEX:BPL LCB74:RTS
 
\ OSBYTE, X=X parameter, Y=Y parameter (Y=0 if A<128)
.LCB8C
CMP #&86:BEQ LCBBB     :\ OSBYTE &86 - Read POS/VPOS
CMP #&87:BEQ LCBC2     :\ OSBYTE &87 - Read character/MODE
CMP #&05:BEQ LCBAA     :\ OSBYTE &05 - Select printer
CMP #&06:BEQ LCBA9     :\ OSBYTE &06 - Printer ignore character
CMP #&75:BEQ LCBB2     :\ OSBYTE &75 - Read VDU status
CMP #&A0:BEQ LCBB5     :\ OSBYTE &A0 - Read VDU variable
PLA:PLA:LDA #&07:RTS   :\ Pop return address, return unclaimed
 
\ OSBYTE &06 - Set printer ignore character
\ -----------------------------------------
.LCBA9
INY                    :\ Y=1

\ OSBYTE &05 - Set printer destination
\ ------------------------------------
.LCBAA
TXA:LDX &0285,Y        :\ Get old printer/ignore setting
STA &0285,Y:RTS        :\ Set new printer/ignore setting

\ OSBYTE &75 - Read VDU status
\ ----------------------------
.LCBB2
LDX &D0:RTS            :\ Get VDU status byte and return

\ OSBYTE &A0 - Read VDU variable
\ ------------------------------
.LCBB5
LDY &E2,X:LDA &E1,X    :\ Get Y,A from VDU variable at E1,X
TAX:RTS

\ OSBYTE &86 - Read POS/VPOS
\ --------------------------
.LCBBB
LDA &D8:LSR A:TAX      :\ X=&D8 DIV 2
LDY &DA:RTS            :\ Y=&DA

\ OSBYTE &87 - Read character/MODE
\ --------------------------------
.LCBC2
LDA #&04:BIT &D0:BNE LCBDE:\ If paged mode, jump to...
TXA
CMP #&8C:BCS LCBD1 
CMP #&87:BCS LCBDA        :\ If special read, jump to...
.LCBD1
LDY &D8:LDA (&D4),Y:TAX   :\ Get character from (&D4)+&D8
.LCBD6
LDY &0327:RTS             :\ Get MODE to Y and return

\ OSBYTE &87,&87..&8B
.LCBDA
BNE LCBF3:BVS LCBF3
.LCBDE
JSR LC772        :\ CBDE= 20 72 C7     rG
LDX #&00:BEQ LCBD6

.LCBE5
BIT &D0          :\ CBE5= 24 D0       $P
BVC LCBD6        :\ CBE7= 50 ED       Pm
LDA &D0          :\ CBE9= A5 D0       %P
AND #&BF         :\ CBEB= 29 BF       )?
STA &D0          :\ CBED= 85 D0       .P
LDX #&00         :\ CBEF= A2 00       ".
STX &F0          :\ CBF1= 86 F0       .p
.LCBF3
PHP              :\ CBF3= 08          .
SEI              :\ CBF4= 78          x
JSR LCBBB        :\ CBF5= 20 BB CB     ;K
TXA              :\ CBF8= 8A          .
PHA              :\ CBF9= 48          H
TYA              :\ CBFA= 98          .
PHA              :\ CBFB= 48          H
BVC LCC4A        :\ CBFC= 50 4C       PL
LDX &032D        :\ CBFE= AE 2D 03    .-.
LDY &032E        :\ CC01= AC 2E 03    ,..
JSR LC650        :\ CC04= 20 50 C6     PF
JSR LC798        :\ CC07= 20 98 C7     .G
.LCC0A
LDX #&00         :\ CC0A= A2 00       ".
LDA &F0          :\ CC0C= A5 F0       %p
BEQ LCC3C        :\ CC0E= F0 2C       p,
CMP #&87         :\ CC10= C9 87       I.
BNE LCC1B        :\ CC12= D0 07       P.
LDA #&09         :\ CC14= A9 09       ).
STA &F0          :\ CC16= 85 F0       .p
JSR LCBD1        :\ CC18= 20 D1 CB     QK
.LCC1B
STX &EF          :\ CC1B= 86 EF       .o
LDA &F0          :\ CC1D= A5 F0       %p
AND #&0F         :\ CC1F= 29 0F       ).
CMP #&0A         :\ CC21= C9 0A       I.
BNE LCC2D        :\ CC23= D0 08       P.
LDX &DA          :\ CC25= A6 DA       &Z
INX              :\ CC27= E8          h
CPX &0321        :\ CC28= EC 21 03    l!.
BCS LCC39        :\ CC2B= B0 0C       0.
.LCC2D
JSR LC229        :\ CC2D= 20 29 C2     )B
JSR LCBBB        :\ CC30= 20 BB CB     ;K
STX &032D        :\ CC33= 8E 2D 03    .-.
STY &032E        :\ CC36= 8C 2E 03    ...
.LCC39
JSR LC798        :\ CC39= 20 98 C7     .G
.LCC3C
PLA              :\ CC3C= 68          h
TAY              :\ CC3D= A8          (
PLA              :\ CC3E= 68          h
TAX              :\ CC3F= AA          *
JSR LC650        :\ CC40= 20 50 C6     PF
LDX &EF          :\ CC43= A6 EF       &o
LDY &0327        :\ CC45= AC 27 03    ,'.
PLP              :\ CC48= 28          (
RTS              :\ CC49= 60          `
 
.LCC4A
STX &032D        :\ CC4A= 8E 2D 03    .-.
STY &032E        :\ CC4D= 8C 2E 03    ...
LDA #&40         :\ CC50= A9 40       )@
ORA &D0          :\ CC52= 05 D0       .P
STA &D0          :\ CC54= 85 D0       .P
BNE LCC0A        :\ CC56= D0 B2       P2

\ OSWORD
\ ======
.LCC58
LDA &EF:CMP #&09:BEQ LCC61 :\ Jump with OSWORD &09
LDA #&08:RTS               :\ Return unclaimed

\ OSWORD &09
\ ========== 
.LCC61
LDY #&03:LDX #&02          :\ Point to XY+3
.LCC65
LDA (&F0),Y:STA &033B,X    :\ Copy XY+3/2/1/0 to &033B+2/1/0/3
INX:TXA:AND #&03:TAX       :\ X=(X+1) AND 3
DEY:BPL LCC65              :\ Loop for 4 bytes from control block
JSR LCB5C                  :\ Add and divide stuff
LDA &033B:CMP #&02:BCS LCCB5
LDA &033D:BNE LCCB5         
LDX #&3B:JSR LCA0A          
LDA #&0F:STA LDF00         :\ Store &0F in &DF00
JSR LCA26        :\ CC8B= 20 26 CA     &J
LDX #&02         :\ CC8E= A2 02       ".
.LCC90
LDA LDF10,X      :\ CC90= BD 10 DF    =._
STA &DB,X        :\ CC93= 95 DB       .[
DEX              :\ CC95= CA          J
BPL LCC90        :\ CC96= 10 F8       .x
LDA &033C        :\ CC98= AD 3C 03    -<.
AND #&07         :\ CC9B= 29 07       ).
TAX              :\ CC9D= AA          *
.LCC9E
ROR &DD          :\ CC9E= 66 DD       f]
ROL A            :\ CCA0= 2A          *
ROR &DC          :\ CCA1= 66 DC       f\
ROL A            :\ CCA3= 2A          *
ROR &DB          :\ CCA4= 66 DB       f[
ROL A            :\ CCA6= 2A          *
DEX              :\ CCA7= CA          J
BPL LCC9E        :\ CCA8= 10 F4       .t
AND #&07         :\ CCAA= 29 07       ).
EOR #&07         :\ CCAC= 49 07       I.
.LCCAE
LDY #&04         :\ CCAE= A0 04        .
STA (&F0),Y      :\ CCB0= 91 F0       .p
LDA #&00         :\ CCB2= A9 00       ).
RTS              :\ CCB4= 60          `
 
.LCCB5
LDA #&FF         :\ CCB5= A9 FF       ).
BNE LCCAE        :\ CCB7= D0 F5       Pu
.LCCB9
LDX #&10         :\ CCB9= A2 10       ".
JSR LCD00        :\ CCBB= 20 00 CD     .M
BCS LCCE5        :\ CCBE= B0 25       0%
LDA #&FF         :\ CCC0= A9 FF       ).
STA LDE12        :\ CCC2= 8D 12 DE    ..^
LDA LDE1C        :\ CCC5= AD 1C DE    -.^
AND #&0F         :\ CCC8= 29 0F       ).
ORA #&80         :\ CCCA= 09 80       ..
STA LDE1C        :\ CCCC= 8D 1C DE    ..^
LDA LDE10        :\ CCCF= AD 10 DE    -.^
LDA #&96         :\ CCD2= A9 96       ).
STA &00E7        :\ CCD4= 8D E7 00    .g.
.LCCD7
LDA LDE1D        :\ CCD7= AD 1D DE    -.^
AND #&10         :\ CCDA= 29 10       ).
BNE LCCE7        :\ CCDC= D0 09       P.
CLI              :\ CCDE= 58          X
SEI              :\ CCDF= 78          x
LDA &00E7        :\ CCE0= AD E7 00    -g.
BNE LCCD7        :\ CCE3= D0 F2       Pr
.LCCE5
SEC              :\ CCE5= 38          8
RTS              :\ CCE6= 60          `
 
.LCCE7
LDA #&03         :\ CCE7= A9 03       ).
STA &0285        :\ CCE9= 8D 85 02    ...
CLC              :\ CCEC= 18          .
RTS              :\ CCED= 60          `
 
BIT &0329        :\ CCEE= 2C 29 03    ,).
BMI LCCFF        :\ CCF1= 30 0C       0.
PHA              :\ CCF3= 48          H
.LCCF4
LDA LDE1D        :\ CCF4= AD 1D DE    -.^
AND #&10         :\ CCF7= 29 10       ).
BEQ LCCF4        :\ CCF9= F0 F9       py
PLA              :\ CCFB= 68          h
STA LDE10        :\ CCFC= 8D 10 DE    ..^
.LCCFF
RTS              :\ CCFF= 60          `
 
.LCD00
LDA #&5A         :\ CD00= A9 5A       )Z
STA LDE04,X      :\ CD02= 9D 04 DE    ..^
CMP LDE06,X      :\ CD05= DD 06 DE    ].^
BNE LCCE5        :\ CD08= D0 DB       P[
CLC              :\ CD0A= 18          .
RTS              :\ CD0B= 60          `
 
.LCD0C
BIT &0284        :\ CD0C= 2C 84 02    ,..
BMI LCD22        :\ CD0F= 30 11       0.
CMP #&05         :\ CD11= C9 05       I.
BEQ LCD23        :\ CD13= F0 0E       p.
LDX &0241        :\ CD15= AE 41 02    .A.
BEQ LCD1E        :\ CD18= F0 04       p.
CPX #&02         :\ CD1A= E0 02       `.
BNE LCD22        :\ CD1C= D0 04       P.
.LCD1E
CMP #&07         :\ CD1E= C9 07       I.
BEQ LCD26        :\ CD20= F0 04       p.
.LCD22
RTS              :\ CD22= 60          `
 
.LCD23
JMP LCD91        :\ CD23= 4C 91 CD    L.M
 
.LCD26
LDA &EF          :\ CD26= A5 EF       %o
LDX &F0          :\ CD28= A6 F0       &p
JSR LCFA5        :\ CD2A= 20 A5 CF     %O
STX &F0          :\ CD2D= 86 F0       .p
LDA #&00         :\ CD2F= A9 00       ).
RTS              :\ CD31= 60          `
 
.LCD32
LDA LFE01        :\ CD32= AD 01 FE    -.~
CMP #&7F         :\ CD35= C9 7F       I.
BNE LCD8D        :\ CD37= D0 54       PT
LDA #&7F         :\ CD39= A9 7F       ).
STA LFE03        :\ CD3B= 8D 03 FE    ..~
LDA #&0F         :\ CD3E= A9 0F       ).
STA LFE01        :\ CD40= 8D 01 FE    ..~
LDA LFE01        :\ CD43= AD 01 FE    -.~
AND #&7F         :\ CD46= 29 7F       ).
CMP #&0F         :\ CD48= C9 0F       I.
BNE LCD88        :\ CD4A= D0 3C       P<
LDA #&9A         :\ CD4C= A9 9A       ).
STA &023C        :\ CD4E= 8D 3C 02    .<.
LDA #&CD         :\ CD51= A9 CD       )M
STA &023D        :\ CD53= 8D 3D 02    .=.
LDA #&38         :\ CD56= A9 38       )8
STA &0228        :\ CD58= 8D 28 02    .(.
LDA #&CE         :\ CD5B= A9 CE       )N
STA &0229        :\ CD5D= 8D 29 02    .).
LDA &0279        :\ CD60= AD 79 02    -y.
AND #&FD         :\ CD63= 29 FD       )}
STA &0279        :\ CD65= 8D 79 02    .y.
LDA LFE0C        :\ CD68= AD 0C FE    -.~
ORA #&01         :\ CD6B= 09 01       ..
STA LFE0C        :\ CD6D= 8D 0C FE    ..~
LDA #&82         :\ CD70= A9 82       ).
STA LFE0E        :\ CD72= 8D 0E FE    ..~
DEC &0242        :\ CD75= CE 42 02    NB.
JSR LCE1A        :\ CD78= 20 1A CE     .N
BVC LCD86        :\ CD7B= 50 09       P.
TSX              :\ CD7D= BA          :
LDA &0105,X      :\ CD7E= BD 05 01    =..
EOR #&08         :\ CD81= 49 08       I.
STA &0105,X      :\ CD83= 9D 05 01    ...
.LCD86
CLC              :\ CD86= 18          .
RTS              :\ CD87= 60          `
 
.LCD88
LDA #&00         :\ CD88= A9 00       ).
STA LFE03        :\ CD8A= 8D 03 FE    ..~
.LCD8D
SEC              :\ CD8D= 38          8
RTS              :\ CD8E= 60          `
 
CLC              :\ CD8F= 18          .
RTS              :\ CD90= 60          `
 
.LCD91
LDA LFE0D        :\ CD91= AD 0D FE    -.~
BPL LCDA7        :\ CD94= 10 11       ..
AND LFE0E        :\ CD96= 2D 0E FE    -.~
AND #&02         :\ CD99= 29 02       ).
BEQ LCDA7        :\ CD9B= F0 0A       p.
CLC              :\ CD9D= 18          .
BIT LCE19        :\ CD9E= 2C 19 CE    ,.N
JSR LCFDC        :\ CDA1= 20 DC CF     \O
LDA #&00         :\ CDA4= A9 00       ).
RTS              :\ CDA6= 60          `
 
.LCDA7
LDA #&05         :\ CDA7= A9 05       ).
RTS              :\ CDA9= 60          `
 
ADC (&33),Y      :\ CDAA= 71 33       q3
BIT &35,X        :\ CDAC= 34 35       45
STY &38          :\ CDAE= 84 38       .8
STY &2D          :\ CDB0= 87 2D       .-
LSR &0D8C,X      :\ CDB2= 5E 8C 0D    ^..
ROL &39          :\ CDB5= 26 39       &9
BBR 2,&FF,&CDB9  :\ CDB7= 2F FF FF    /..
BRA LCE33        :\ CDBA= 80 77       .w
 
ADC &74          :\ CDBC= 65 74       et
BIT &39,X        :\ CDBE= 37 39       79
ADC #&30         :\ CDC0= 69 30       i0
BBR 5,&8E,&CDF8  :\ CDC2= 5F 8E 33    _.3
ROL &43,X        :\ CDC5= 36 43       6C
ROL A            :\ CDC7= 2B          +
BBS 7,&FF,&CDFC  :\ CDC8= FF FF 31    ..1
AND (&64)        :\ CDCB= 32 64       2d
ADC (&36)        :\ CDCD= 72 36       r6
ADC &6F,X        :\ CDCF= 75 6F       uo
BVS LCE2E        :\ CDD1= 70 5B       p[
BBS 0,&7F,&CE08  :\ CDD3= 8F 7F 32    ..2
SEC              :\ CDD6= 38          8
AND LFFFF        :\ CDD7= 2D FF FF    -..
BBS 7,&61,&CE55  :\ CDDA= FF 61 78    .ax
ROR &79          :\ CDDD= 66 79       fy
ROR A            :\ CDDF= 6A          j
ROR A            :\ CDE0= 6B          k
RTI              :\ CDE1= 40          @
 
DEC A            :\ CDE2= 3A          :
ORA &3530        :\ CDE3= 0D 30 35    .05
EQUB &42         :\ CDE6= 42          B
BBS 7,&FF,&CDE9  :\ CDE7= FF FF FF    ...
BBS 7,&73,&CE50  :\ CDEA= FF 73 63    .sc
EQUB &67         :\ CDED= 67          g
PLA              :\ CDEE= 68          h
ROR &3B6C        :\ CDEF= 6E 6C 3B    nl;
EOR &3D7F,X      :\ CDF2= 5D 7F 3D    ].=
ROL LFF41        :\ CDF5= 2E 41 FF    .A.
BBS 7,&FF,&CE04  :\ CDF8= FF FF 09    ...
PLY              :\ CDFB= 7A          z
JSR &6276        :\ CDFC= 20 76 62     vb
ADC &2E2C        :\ CDFF= 6D 2C 2E    m,.
BBR 2,&8B,&CE36  :\ CE02= 2F 8B 31    /.1
BIT &37,X        :\ CE05= 34 37       47
BBS 7,&FF,&CE09  :\ CE07= FF FF FF    ...
EQUB &1B         :\ CE0A= 1B          .
STA (&82,X)      :\ CE0B= 81 82       ..
EQUB &83         :\ CE0D= 83          .
STA &86          :\ CE0E= 85 86       ..
DEY              :\ CE10= 88          .
BIT #&5C         :\ CE11= 89 5C       .\
STA &4546        :\ CE13= 8D 46 45    .FE
EQUB &44         :\ CE16= 44          D
ROL A            :\ CE17= 2A          *
BBS 7,&FF,&CDC8  :\ CE18= FF FF AD    ..-
PHY              :\ CE1B= 5A          Z
EQUB &02         :\ CE1C= 02          .
AND #&B7         :\ CE1D= 29 B7       )7
LDX #&00         :\ CE1F= A2 00       ".
JSR LCE3F        :\ CE21= 20 3F CE     ?N
BPL LCE2B        :\ CE24= 10 05       ..
BIT LCE19        :\ CE26= 2C 19 CE    ,.N
ORA #&08         :\ CE29= 09 08       ..
.LCE2B
LDX #&01         :\ CE2B= A2 01       ".
JSR LCE3F        :\ CE2D= 20 3F CE     ?N
BPL LCE34        :\ CE30= 10 02       ..
ORA #&40         :\ CE32= 09 40       .@
.LCE34
STA &025A        :\ CE34= 8D 5A 02    .Z.
RTS              :\ CE37= 60          `
 
BVS LCE6C        :\ CE38= 70 32       p2
BCC LCE1A        :\ CE3A= 90 DE       .^
TXA              :\ CE3C= 8A          .
BPL LCE5D        :\ CE3D= 10 1E       ..
.LCE3F
STX LFE01        :\ CE3F= 8E 01 FE    ..~
LDX LFE01        :\ CE42= AE 01 FE    ..~
PHP              :\ CE45= 08          .
LDY #&0F         :\ CE46= A0 0F        .
STY LFE01        :\ CE48= 8C 01 FE    ..~
PLP              :\ CE4B= 28          (
RTS              :\ CE4C= 60          `
 
.LCE4D
INX              :\ CE4D= E8          h
TXA              :\ CE4E= 8A          .
AND #&0F         :\ CE4F= 29 0F       ).
CMP #&0E         :\ CE51= C9 0E       I.
BNE LCE5D        :\ CE53= D0 08       P.
INX              :\ CE55= E8          h
INX              :\ CE56= E8          h
BPL LCE5D        :\ CE57= 10 04       ..
LDX #&FF         :\ CE59= A2 FF       ".
BNE LCE65        :\ CE5B= D0 08       P.
.LCE5D
STX LFE01        :\ CE5D= 8E 01 FE    ..~
LDA LFE01        :\ CE60= AD 01 FE    -.~
BPL LCE4D        :\ CE63= 10 E8       .h
.LCE65
LDA #&0F         :\ CE65= A9 0F       ).
STA LFE01        :\ CE67= 8D 01 FE    ..~
TXA              :\ CE6A= 8A          .
RTS              :\ CE6B= 60          `
 
.LCE6C
BCS LCE87        :\ CE6C= B0 19       0.
LDX #&10         :\ CE6E= A2 10       ".
JSR LCE5D        :\ CE70= 20 5D CE     ]N
BMI LCE86        :\ CE73= 30 11       0.
STX &EC          :\ CE75= 86 EC       .l
LDA #&00         :\ CE77= A9 00       ).
STA &E7          :\ CE79= 85 E7       .g
LDA &0254        :\ CE7B= AD 54 02    -T.
STA &02C9        :\ CE7E= 8D C9 02    .I.
LDA #&02         :\ CE81= A9 02       ).
STA LFE0E        :\ CE83= 8D 0E FE    ..~
.LCE86
RTS              :\ CE86= 60          `
 
.LCE87
INC &0242        :\ CE87= EE 42 02    nB.
CLI              :\ CE8A= 58          X
JSR LCE93        :\ CE8B= 20 93 CE     .N
SEI              :\ CE8E= 78          x
DEC &0242        :\ CE8F= CE 42 02    NB.
RTS              :\ CE92= 60          `
 
.LCE93
JSR LCF7C        :\ CE93= 20 7C CF     |O
BVS LCE9E        :\ CE96= 70 06       p.
PHA              :\ CE98= 48          H
LDA #&00         :\ CE99= A9 00       ).
STA &ED          :\ CE9B= 85 ED       .m
PLA              :\ CE9D= 68          h
.LCE9E
BNE LCEAC        :\ CE9E= D0 0C       P.
BCS LCEBC        :\ CEA0= B0 1A       0.
STA &EC          :\ CEA2= 85 EC       .l
BVS LCEAB        :\ CEA4= 70 05       p.
LDA #&82         :\ CEA6= A9 82       ).
STA LFE0E        :\ CEA8= 8D 0E FE    ..~
.LCEAB
RTS              :\ CEAB= 60          `
 
.LCEAC
BCC LCEB4        :\ CEAC= 90 06       ..
BVS LCEBC        :\ CEAE= 70 0C       p.
LDX &EC          :\ CEB0= A6 EC       &l
STX &ED          :\ CEB2= 86 ED       .m
.LCEB4
STA &EC          :\ CEB4= 85 EC       .l
LDA &0254        :\ CEB6= AD 54 02    -T.
JMP LCECD        :\ CEB9= 4C CD CE    LMN
 
.LCEBC
LDA &E7          :\ CEBC= A5 E7       %g
BNE LCEAB        :\ CEBE= D0 EB       Pk
LDA &02C9        :\ CEC0= AD C9 02    -I.
CMP &0255        :\ CEC3= CD 55 02    MU.
BNE LCECD        :\ CEC6= D0 05       P.
LDX &0254        :\ CEC8= AE 54 02    .T.
BEQ LCEAB        :\ CECB= F0 DE       p^
.LCECD
STA &E7          :\ CECD= 85 E7       .g
LDA &0255        :\ CECF= AD 55 02    -U.
STA &02C9        :\ CED2= 8D C9 02    .I.
JSR LCE1A        :\ CED5= 20 1A CE     .N
LDY &EC          :\ CED8= A4 EC       $l
CPY #&40         :\ CEDA= C0 40       @@
BNE LCEF4        :\ CEDC= D0 16       P.
LDA &025A        :\ CEDE= AD 5A 02    -Z.
AND #&08         :\ CEE1= 29 08       ).
BEQ LCEE9        :\ CEE3= F0 04       p.
LDA #&A0         :\ CEE5= A9 A0       ) 
BNE LCEF0        :\ CEE7= D0 07       P.
.LCEE9
LDA &025A        :\ CEE9= AD 5A 02    -Z.
AND #&7F         :\ CEEC= 29 7F       ).
EOR #&10         :\ CEEE= 49 10       I.
.LCEF0
STA &025A        :\ CEF0= 8D 5A 02    .Z.
.LCEF3
RTS              :\ CEF3= 60          `
 
.LCEF4
PHP              :\ CEF4= 08          .
SEI              :\ CEF5= 78          x
LDA &023C        :\ CEF6= AD 3C 02    -<.
STA &FA          :\ CEF9= 85 FA       .z
LDA &023D        :\ CEFB= AD 3D 02    -=.
STA &FB          :\ CEFE= 85 FB       .{
LDA (&FA),Y      :\ CF00= B1 FA       1z
PLP              :\ CF02= 28          (
TAY              :\ CF03= A8          (
BPL LCF1D        :\ CF04= 10 17       ..
CPY #&FF         :\ CF06= C0 FF       @.
BEQ LCEF3        :\ CF08= F0 E9       pi
LDA #&08         :\ CF0A= A9 08       ).
BIT &025A        :\ CF0C= 2C 5A 02    ,Z.
BEQ LCF15        :\ CF0F= F0 04       p.
TYA              :\ CF11= 98          .
ORA #&90         :\ CF12= 09 90       ..
TAY              :\ CF14= A8          (
.LCF15
BVC LCF2C        :\ CF15= 50 15       P.
TYA              :\ CF17= 98          .
ORA #&A0         :\ CF18= 09 A0       . 
TAY              :\ CF1A= A8          (
BNE LCF2C        :\ CF1B= D0 0F       P.
.LCF1D
CPY #&21         :\ CF1D= C0 21       @!
BCC LCF2C        :\ CF1F= 90 0B       ..
CPY #&7F         :\ CF21= C0 7F       @.
BEQ LCF2C        :\ CF23= F0 07       p.
CPY #&30         :\ CF25= C0 30       @0
BEQ LCF2C        :\ CF27= F0 03       p.
JSR LCF33        :\ CF29= 20 33 CF     3O
.LCF2C
LDX #&00         :\ CF2C= A2 00       ".
LDA #&99         :\ CF2E= A9 99       ).
JMP OSBYTE       :\ CF30= 4C F4 FF    Lt.
 
.LCF33
BIT &025A        :\ CF33= 2C 5A 02    ,Z.
BVC LCF41        :\ CF36= 50 09       P.
CPY #&40         :\ CF38= C0 40       @@
BCC LCF5E        :\ CF3A= 90 22       ."
TYA              :\ CF3C= 98          .
AND #&1F         :\ CF3D= 29 1F       ).
TAY              :\ CF3F= A8          (
RTS              :\ CF40= 60          `
 
.LCF41
LDA &025A        :\ CF41= AD 5A 02    -Z.
AND #&10         :\ CF44= 29 10       ).
BNE LCF5E        :\ CF46= D0 16       P.
CPY #&61         :\ CF48= C0 61       @a
BCC LCF5E        :\ CF4A= 90 12       ..
CPY #&7B         :\ CF4C= C0 7B       @{
BCS LCF5E        :\ CF4E= B0 0E       0.
LDA &025A        :\ CF50= AD 5A 02    -Z.
AND #&88         :\ CF53= 29 88       ).
CMP #&88         :\ CF55= C9 88       I.
BEQ LCF7B        :\ CF57= F0 22       p"
TYA              :\ CF59= 98          .
AND #&DF         :\ CF5A= 29 DF       )_
TAY              :\ CF5C= A8          (
RTS              :\ CF5D= 60          `
 
.LCF5E
LDA #&08         :\ CF5E= A9 08       ).
BIT &025A        :\ CF60= 2C 5A 02    ,Z.
BEQ LCF7B        :\ CF63= F0 16       p.
CPY #&40         :\ CF65= C0 40       @@
BCS LCF6E        :\ CF67= B0 05       0.
TYA              :\ CF69= 98          .
EOR #&10         :\ CF6A= 49 10       I.
TAY              :\ CF6C= A8          (
RTS              :\ CF6D= 60          `
 
.LCF6E
BEQ LCF7B        :\ CF6E= F0 0B       p.
CPY #&5F         :\ CF70= C0 5F       @_
BNE LCF77        :\ CF72= D0 03       P.
LDY #&60         :\ CF74= A0 60        `
RTS              :\ CF76= 60          `
 
.LCF77
TYA              :\ CF77= 98          .
EOR #&20         :\ CF78= 49 20       I 
TAY              :\ CF7A= A8          (
.LCF7B
RTS              :\ CF7B= 60          `
 
.LCF7C
LDA #&00         :\ CF7C= A9 00       ).
STA &02CA        :\ CF7E= 8D CA 02    .J.
TAY              :\ CF81= A8          (
CLV              :\ CF82= B8          8
LDX #&0F         :\ CF83= A2 0F       ".
.LCF85
JSR LCE4D        :\ CF85= 20 4D CE     MN
BMI LCF9F        :\ CF88= 30 15       0.
CPX &EC          :\ CF8A= E4 EC       dl
BEQ LCF97        :\ CF8C= F0 09       p.
CPX &ED          :\ CF8E= E4 ED       dm
BEQ LCF9A        :\ CF90= F0 08       p.
STX &02CA        :\ CF92= 8E CA 02    .J.
BNE LCF85        :\ CF95= D0 EE       Pn
.LCF97
DEY              :\ CF97= 88          .
BMI LCF85        :\ CF98= 30 EB       0k
.LCF9A
BIT LCE19        :\ CF9A= 2C 19 CE    ,.N
BVS LCF85        :\ CF9D= 70 E6       pf
.LCF9F
TYA              :\ CF9F= 98          .
ROL A            :\ CFA0= 2A          *
LDA &02CA        :\ CFA1= AD CA 02    -J.
RTS              :\ CFA4= 60          `
 
.LCFA5
CMP #&0B         :\ CFA5= C9 0B       I.
BEQ LCFC2        :\ CFA7= F0 19       p.
CMP #&0C         :\ CFA9= C9 0C       I.
BEQ LCFC6        :\ CFAB= F0 19       p.
CMP #&78         :\ CFAD= C9 78       Ix
BEQ LCFD4        :\ CFAF= F0 23       p#
CMP #&79         :\ CFB1= C9 79       Iy
BEQ LCFDB        :\ CFB3= F0 26       p&
CMP #&7A         :\ CFB5= C9 7A       Iz
BEQ LCFD9        :\ CFB7= F0 20       p 
CMP #&81         :\ CFB9= C9 81       I.
BEQ LCFDF        :\ CFBB= F0 22       p"
PLA              :\ CFBD= 68          h
PLA              :\ CFBE= 68          h
LDA #&07         :\ CFBF= A9 07       ).
RTS              :\ CFC1= 60          `
 
.LCFC2
STX &0254        :\ CFC2= 8E 54 02    .T.
RTS              :\ CFC5= 60          `
 
.LCFC6
TXA              :\ CFC6= 8A          .
BNE LCFD0        :\ CFC7= D0 07       P.
LDX #&32         :\ CFC9= A2 32       "2
STX &0254        :\ CFCB= 8E 54 02    .T.
LDX #&08         :\ CFCE= A2 08       ".
.LCFD0
STX &0255        :\ CFD0= 8E 55 02    .U.
RTS              :\ CFD3= 60          `
 
.LCFD4
STX &ED          :\ CFD4= 86 ED       .m
STY &EC          :\ CFD6= 84 EC       .l
RTS              :\ CFD8= 60          `
 
.LCFD9
LDX #&10         :\ CFD9= A2 10       ".
.LCFDB
CLV              :\ CFDB= B8          8
.LCFDC
JMP (&0228)      :\ CFDC= 6C 28 02    l(.
 
.LCFDF
TXA              :\ CFDF= 8A          .
EOR #&7F         :\ CFE0= 49 7F       I.
TAX              :\ CFE2= AA          *
JSR LCFDB        :\ CFE3= 20 DB CF     [O
LDY #&FF         :\ CFE6= A0 FF        .
TXA              :\ CFE8= 8A          .
BMI LCFEC        :\ CFE9= 30 01       0.
INY              :\ CFEB= C8          H
.LCFEC
TYA              :\ CFEC= 98          .
TAX              :\ CFED= AA          *
RTS              :\ CFEE= 60          `
 
BBS 7,&FF,&CFF1  :\ CFEF= FF FF FF    ...
BBS 7,&FF,&CFF4  :\ CFF2= FF FF FF    ...    Unused space filled with &FF
BBS 7,&FF,&CFF7  :\ CFF5= FF FF FF    ...
BBS 7,&FF,&CFFA  :\ CFF8= FF FF FF    ...
BBS 7,&FF,&CFFD  :\ CFFB= FF FF FF    ...
BBS 7,&FF,&D000  :\ CFFE= FF FF FF    ...
BBS 7,&FF,&D003  :\ D001= FF FF FF    ...    Unused space filled with &FF

D000-DFFF paged out and BLK0 paged in

BBS 7,&FF,&DBF7  :\ DBF5= FF FF FF    ...
BBS 7,&FF,&DBFA  :\ DBF8= FF FF FF    ...
BBS 7,&FF,&DBFD  :\ DBFB= FF FF FF    ...
BBS 7,&FF,&DC00  :\ DBFE= FF FF FF    ...
.LDC01
BBS 7,&FF,&DC03  :\ DC01= FF FF FF    ...
BBS 7,&FF,&DC06  :\ DC04= FF FF FF    ...

BBS 7,&FF,&DCFC  :\ DCFA= FF FF FF    ...
BBS 7,&FF,&DCFF  :\ DCFD= FF FF FF    ...
.LDD00
BBS 7,&FF,&DD02  :\ DD00= FF FF FF    ...
.LDD03
BBS 7,&FF,&DD05  :\ DD03= FF FF FF    ...
BBS 7,&FF,&DD08  :\ DD06= FF FF FF    ...
BBS 7,&FF,&DE19  :\ DE17= FF FF FF    ...
BBS 7,&FF,&DE1C  :\ DE1A= FF FF FF    ...
.LDE1D
BBS 7,&FF,&DE1F  :\ DE1D= FF FF FF    ...
BBS 7,&FF,&DE22  :\ DE20= FF FF FF    ...
BBS 7,&FF,&DEFA  :\ DEF8= FF FF FF    ...
BBS 7,&FF,&DEFD  :\ DEFB= FF FF FF    ...
BBS 7,&FF,&DF00  :\ DEFE= FF FF FF    ...
.LDF01
BBS 7,&FF,&DF03  :\ DF01= FF FF FF    ...
BBS 7,&FF,&DF06  :\ DF04= FF FF FF    ...
.LDF07
BBS 7,&FF,&DF09  :\ DF07= FF FF FF    ...
.LDF0A
BBS 7,&FF,&DF0C  :\ DF0A= FF FF FF    ...
BBS 7,&FF,&DF0F  :\ DF0D= FF FF FF    ...
.LDF10
BBS 7,&FF,&DF12  :\ DF10= FF FF FF    ...
.LDF13
BBS 7,&FF,&DF15  :\ DF13= FF FF FF    ...
BBS 7,&FF,&DF18  :\ DF16= FF FF FF    ...
BBS 7,&FF,&DF1B  :\ DF19= FF FF FF    ...

BBS 7,&FF,&DFF9  :\ DFF7= FF FF FF    ...
BBS 7,&FF,&DFFC  :\ DFFA= FF FF FF    ...
BBS 7,&FF,&DFFF  :\ DFFD= FF FF FF    ...


\ E000 MOS ROM PROGRAM
\ ====================
.LE000:JMP LC0B0        :\ Language entry, jump to low ROM's language code
.LE003:JMP LE026        :\ Service entry
EQUB &C2                :\ Service, Language, 6502 code
.LE007
EQUB LE019-LE000        :\ Offset to (C)
EQUB &04		:\ Binary version number
EQUS "CU-Graph"		:\ Title
EQUB &00
EQUD 0			:\ No version string
EQUW 0:EQUB 0
.LE019
EQUB &00		:\ Copyright string
EQUS "(C) CU X4.8":EQUB &00


\ SERVICE ROUTINE
\ ===============
\ Do &E000 service calls, &C000 service calls, RAM-based service calls
\
.LE026
PHP:PHA:TXA:PHA:TYA:PHA  :\ Save registers
TSX:LDA &0103,X          :\ Get A from stack
JSR LE10A                :\ Call MOS service code
TAX:BEQ LE065            :\ If claimed, exit
CMP #&01:BNE LE03D       :\ If not Serv01, skip following
JSR LE06F                :\ Check if SROM exists at &C000
.LE03D
BIT &0248:BMI LE048      :\ If &C000 not present, skip
JSR LC003                :\ Call &C000 service entry
TAX:BEQ LE065            :\ If claimed, exit
.LE048
LDX &0283                :\ Get RAM-based SROM address
CPX #&E0:BEQ LE05B       :\ If &E0xx, that's me, skip to exit
STX &F7                  :\ Store RAM-SROM high address
LDX #&03:STX &F6         :\ Set low byte of address to service entry
JSR LE062                :\ Call RAM-based SROM's service entry
TAX:BEQ LE065            :\ if claimed, exit
.LE05B
PLA:TAY:PLA:TAX:PLA:PLP  :\ Restore all registers
RTS                      :\ Exit
.LE062
JMP (&00F6)              :\ Call service entry in RAM-based program
 
\ Service call claimed
\ --------------------
.LE065
PLA:PLA:TAX:PLA:ROR A:PLP:ROL A
LDA #&00:RTS             :\ A=0 - call claimed

\ On Service call 1, check if &C000 is a valid ROM
\ ------------------------------------------------
.LE06F
TYA:PHA                    :\ Save Y
LDY LC007:CPY LE007        :\ Compare &C000 and &E000 copyright pointers
BEQ LE08E                  :\ Same, disable &C000 ROM
.LE079
LDX #&00                   :\ Point to start of my copyright string
.LE07B
LDA LE019,X:CMP LC000,Y    :\ Compare copyright strings
BNE LE08E                  :\ Different, jump to enable &C000 SROM
INY:INX:CPX #&04:BCC LE07B :\ Loop for four characters
.LE089
PLA:TAY:LDA #&01:RTS       :\ Restore Y and A, return
.LE08E
ROR &0248:BMI LE089        :\ Set b7 to disable &C000, exit


\ COMMAND TABLE
\ =============
.LE093
EQUS "TURNOFF":EQUB LE206 DIV 256:EQUB LE206 AND 255
EQUS "TURNON" :EQUB &E2:EQUB &0A
EQUS "FLIP"   :EQUB &E2:EQUB &16
EQUS "OUTCH"  :EQUB &E2:EQUB &12
EQUS "DAC"    :EQUB &E2:EQUB &6C
EQUS "DELAY"  :EQUB &E1:EQUB E5
EQUS "INCH"   :EQUB &E2:EQUB &0E
EQUS "OUT"    :EQUB &E3:EQUB &0B
EQUS "CH"     :EQUB &E3:EQUB &0B
EQUS "IN"     :EQUB &E3:EQUB &0B
EQUS "CLOCK$" :EQUB &E3:EQUB &74
EQUS "DATE$"  :EQUB &E3:EQUB &97
EQUS "SAMPLE" :EQUB &E2:EQUB &81
EQUS "BASE"  : EQUB &E2:EQUB E9
EQUB 0

.LE0EE
LDA (&F2),Y                :\ Get current character
CMP #&0D:BNE LE107         :\ If not <cr>, exit
JSR LFFB3                  :\ Print inline text
EQUB 13:EQUS "Control BASIC":EQUB 13
NOP
.LE107
LDA #9:RTS                 :\ Exit unclaimed


\ MOS CODE SERVICE HANDLER
\ ========================
.LE10A
JSR LE47A                  :\ Call CUBAN service handler
TAX:BEQ LE120              :\ If claimed, exit
CMP #&03:BEQ LE121         :\ Service 3 - Boot FS
BIT &6F:BPL LE120          :\ If b7=0, skip Error and Help
                           :\ Need a Service 3 before 6 or 9 will respond
CMP #&06:BEQ LE140         :\ Service 6 - Error occured
CMP #&09:BEQ LE0EE         :\ Service 9 - *Help
.LE120
RTS                        :\ Exit

\ SERVICE 3 - BOOT FS
\ ===================
.LE121
LDX #&00:LDY #&D0
LDA #&17:JSR OSBYTE        :\ *FX23,0,&D0
CPX #&00:BNE LE13A         :\ If X=0, jump to set &6F flag
LDX &0241:BEQ LE13A        :\ If input source is keyboard, jump to set flag
LDX #&00:LDY #&FE
JSR OSBYTE                 :\ *FX23,0,&FE
.LE13A
SEC:ROR &6F                :\ Set b7 to allow Service 6 & 9 to respond
LDA #&03:RTS               :\ Return unclaimed
 
\ SERVICE 6 - ERROR OCCURED
\ =========================
.LE140
TYA:PHA                   :\ Save Y
LDX &F0:STX &6D           :\ Copy &F0 to &6D
LDX #&00:LDA (&FD,X):STA &6E :\ Store error number at &6E
CMP #&04:BEQ LE159        :\ Jump with Error 4
CMP #&1A:BEQ LE163        :\ Jump with Error 26
.LE154
PLA:TAY:LDA #&06:RTS      :\ Restore Y, A and return
                          :\ BUG? Should that be X saved & restored?

\ Error 4
\ -------
.LE159
CLI              :\ E159= 58          X
JSR LE1C0        :\ E15A= 20 C0 E1     @a
DEC &1B          :\ E15D= C6 1B       F.
LDX #&00         :\ E15F= A2 00       ".
BEQ LE170        :\ E161= F0 0D       p.

.LE163
CLI              :\ E163= 58          X
LDX #&35         :\ E164= A2 35       "5
BNE LE170        :\ E166= D0 08       P.
.LE168
INX              :\ E168= E8          h
LDA LE093,X      :\ E169= BD 93 E0    =.`
BPL LE168        :\ E16C= 10 FA       .z
INX              :\ E16E= E8          h
INX              :\ E16F= E8          h

.LE170
LDY &1B          :\ E170= A4 1B       $.
.LE172
LDA LE093,X      :\ E172= BD 93 E0    =.`
BEQ LE154        :\ E175= F0 DD       p]
BMI LE182        :\ E177= 30 09       0.
CMP (&19),Y      :\ E179= D1 19       Q.
BNE LE168        :\ E17B= D0 EB       Pk
INY              :\ E17D= C8          H
INX              :\ E17E= E8          h
BNE LE172        :\ E17F= D0 F1       Pq
.LE181
INY              :\ E181= C8          H
.LE182
LDA (&19),Y      :\ E182= B1 19       1.
CMP #&20         :\ E184= C9 20       I 
BEQ LE181        :\ E186= F0 F9       py
TXA              :\ E188= 8A          .
PHA              :\ E189= 48          H
LDX &6D          :\ E18A= A6 6D       &m
INX              :\ E18C= E8          h
INX              :\ E18D= E8          h
INX              :\ E18E= E8          h
INX              :\ E18F= E8          h
LDA &6E          :\ E190= A5 6E       %n
CMP #&1A         :\ E192= C9 1A       I.
BEQ LE199        :\ E194= F0 03       p.
INX              :\ E196= E8          h
INX              :\ E197= E8          h
CLC              :\ E198= 18          .
.LE199
STY &1B          :\ E199= 84 1B       ..
PLA              :\ E19B= 68          h
TXS              :\ E19C= 9A          .
TAX              :\ E19D= AA          *
LDA LE093,X:PHA    :\ Stack address high byte
LDA LE093+1,X:PHA  :\ Stack address low byte
PHP:RTI            :\ Jump to stacked address

.LE1A8
JSR &8AAE        :\ E1A8= 20 AE 8A     ..
.LE1AB
JSR &9B29        :\ E1AB= 20 29 9B     ).
.LE1AE
BEQ LE1B5        :\ E1AE= F0 05       p.
BPL LE1CC        :\ E1B0= 10 1A       ..
JMP &A3E4        :\ E1B2= 4C E4 A3    Ld#
 
.LE1B5
JMP &8C0E        :\ E1B5= 4C 0E 8C    L..
 
.LE1B8
INC &1B          :\ E1B8= E6 1B       f.
.LE1BA
JSR &ADEC        :\ E1BA= 20 EC AD     l-
JMP LE1AE        :\ E1BD= 4C AE E1    L.a
 
.LE1C0
LDA &0B          :\ E1C0= A5 0B       %.
STA &19          :\ E1C2= 85 19       ..
LDA &0C          :\ E1C4= A5 0C       %.
STA &1A          :\ E1C6= 85 1A       ..
LDA &0A          :\ E1C8= A5 0A       %.
STA &1B          :\ E1CA= 85 1B       ..
.LE1CC
RTS              :\ E1CC= 60          `
 
.LE1CD
INC &1B          :\ E1CD= E6 1B       f.
JSR &9841        :\ E1CF= 20 41 98     A.
JSR &9B29        :\ E1D2= 20 29 9B     ).
BNE LE1B5        :\ E1D5= D0 DE       P^
JMP &9852        :\ E1D7= 4C 52 98    LR.
 
.LE1DA
INC &1B          :\ E1DA= E6 1B       f.
.LE1DC
JSR &9841        :\ E1DC= 20 41 98     A.
JSR LE1AB        :\ E1DF= 20 AB E1     +a
JMP &9852        :\ E1E2= 4C 52 98    LR.
 
JSR LE1AB        :\ E1E5= 20 AB E1     +a
SEI              :\ E1E8= 78          x
LDA &2A          :\ E1E9= A5 2A       %*
STA &02B1        :\ E1EB= 8D B1 02    .1.
LDA &2B          :\ E1EE= A5 2B       %+
STA &02B2        :\ E1F0= 8D B2 02    .2.
CLI              :\ E1F3= 58          X
.LE1F4
BIT &FF          :\ E1F4= 24 FF       $.
BMI LE200        :\ E1F6= 30 08       0.
LDA &02B2        :\ E1F8= AD B2 02    -2.
ORA &02B1        :\ E1FB= 0D B1 02    .1.
BNE LE1F4        :\ E1FE= D0 F4       Pt
.LE200
JSR &9852        :\ E200= 20 52 98     R.
JMP &8B9B        :\ E203= 4C 9B 8B    L..
 
LDY #&00         :\ E206= A0 00        .
BEQ LE218        :\ E208= F0 0E       p.
LDY #&01         :\ E20A= A0 01        .
BNE LE218        :\ E20C= D0 0A       P.
LDY #&02         :\ E20E= A0 02        .
BNE LE218        :\ E210= D0 06       P.
LDY #&03         :\ E212= A0 03        .
BNE LE218        :\ E214= D0 02       P.
LDY #&04         :\ E216= A0 04        .
.LE218
STY &6D          :\ E218= 84 6D       .m
.LE21A
JSR &8A8C        :\ E21A= 20 8C 8A     ..
CMP #&3A         :\ E21D= C9 3A       I:
BEQ LE23E        :\ E21F= F0 1D       p.
CMP #&0D         :\ E221= C9 0D       I.
BEQ LE23E        :\ E223= F0 19       p.
CMP #&8B         :\ E225= C9 8B       I.
BEQ LE23E        :\ E227= F0 15       p.
DEC &1B          :\ E229= C6 1B       F.
JSR LE1AB        :\ E22B= 20 AB E1     +a
LDX &2A          :\ E22E= A6 2A       &*
JSR LE253        :\ E230= 20 53 E2     Sb
.LE233
JSR &8A8C        :\ E233= 20 8C 8A     ..
CMP #&2C         :\ E236= C9 2C       I,
BEQ LE21A        :\ E238= F0 E0       p`
CMP #&B8         :\ E23A= C9 B8       I8
BEQ LE243        :\ E23C= F0 05       p.
.LE23E
DEC &1B          :\ E23E= C6 1B       F.
JMP LE200        :\ E240= 4C 00 E2    L.b
 
.LE243
JSR LE1AB        :\ E243= 20 AB E1     +a
.LE246
LDX &6E          :\ E246= A6 6E       &n
CPX &2A          :\ E248= E4 2A       d*
BCS LE233        :\ E24A= B0 E7       0g
INX              :\ E24C= E8          h
JSR LE253        :\ E24D= 20 53 E2     Sb
JMP LE246        :\ E250= 4C 46 E2    LFb
 
.LE253
STX &6E          :\ E253= 86 6E       .n
LDY &6D          :\ E255= A4 6D       $m
.LE257
LDA #&16         :\ E257= A9 16       ).
JSR OSBYTE       :\ E259= 20 F4 FF     t.
BCS LE25F        :\ E25C= B0 01       0.
RTS              :\ E25E= 60          `
 
.LE25F
BRK              :\ E25F= 00          .
SEC              :\ E260= 38          8
LSR &206F        :\ E261= 4E 6F 20    No 
EQUB &73         :\ E264= 73          s
ADC &63,X        :\ E265= 75 63       uc
PLA              :\ E267= 68          h
JSR &4843        :\ E268= 20 43 48     CH
BRK              :\ E26B= 00          .
JSR LE369        :\ E26C= 20 69 E3     ic
STA &37          :\ E26F= 85 37       .7
LDX #&38         :\ E271= A2 38       "8
JSR &BE44        :\ E273= 20 44 BE     D>
DEX              :\ E276= CA          J
LDY #&00         :\ E277= A0 00        .
LDA #&12         :\ E279= A9 12       ).
JSR OSWORD       :\ E27B= 20 F1 FF     q.
JMP &8B9B        :\ E27E= 4C 9B 8B    L..
 
BCS LE2C5        :\ E281= B0 42       0B
JSR LE1AB        :\ E283= 20 AB E1     +a
LDX #&00         :\ E286= A2 00       ".
JSR LE33F        :\ E288= 20 3F E3     ?c
JSR LE1A8        :\ E28B= 20 A8 E1     (a
LDX #&04         :\ E28E= A2 04       ".
JSR LE33F        :\ E290= 20 3F E3     ?c
JSR LE1A8        :\ E293= 20 A8 E1     (a
LDX #&08         :\ E296= A2 08       ".
JSR LE33F        :\ E298= 20 3F E3     ?c
JSR LE1A8        :\ E29B= 20 A8 E1     (a
LDX #&0C         :\ E29E= A2 0C       ".
JSR LE33F        :\ E2A0= 20 3F E3     ?c
JSR &8A8C        :\ E2A3= 20 8C 8A     ..
CMP #&B8         :\ E2A6= C9 B8       I8
BNE LE2B4        :\ E2A8= D0 0A       P.
JSR LE1AB        :\ E2AA= 20 AB E1     +a
LDA &2A          :\ E2AD= A5 2A       %*
STA &02FB        :\ E2AF= 8D FB 02    .{.
INC &1B          :\ E2B2= E6 1B       f.
.LE2B4
DEC &1B          :\ E2B4= C6 1B       F.
JSR &9852        :\ E2B6= 20 52 98     R.
LDX #&EE         :\ E2B9= A2 EE       "n
LDY #&02         :\ E2BB= A0 02        .
LDA #&10         :\ E2BD= A9 10       ).
JSR OSWORD       :\ E2BF= 20 F1 FF     q.
JMP &8B9B        :\ E2C2= 4C 9B 8B    L..
 
.LE2C5
JSR LE1AB        :\ E2C5= 20 AB E1     +a
LDX #&00         :\ E2C8= A2 00       ".
JSR LE33F        :\ E2CA= 20 3F E3     ?c
JSR &8AAE        :\ E2CD= 20 AE 8A     ..
JSR LE1BA        :\ E2D0= 20 BA E1     :a
LDA &2A          :\ E2D3= A5 2A       %*
STA &02F2        :\ E2D5= 8D F2 02    .r.
LDX #&EE         :\ E2D8= A2 EE       "n
LDY #&02         :\ E2DA= A0 02        .
LDA #&11         :\ E2DC= A9 11       ).
JSR OSWORD       :\ E2DE= 20 F1 FF     q.
LDX #&05         :\ E2E1= A2 05       ".
JSR LE354        :\ E2E3= 20 54 E3     Tc
LDA #&40         :\ E2E6= A9 40       )@
RTS              :\ E2E8= 60          `
 
BCS LE2FA        :\ E2E9= B0 0F       0.
JSR LE1DA        :\ E2EB= 20 DA E1     Za
LDX &2A          :\ E2EE= A6 2A       &*
LDY &2B          :\ E2F0= A4 2B       $+
LDA #&17         :\ E2F2= A9 17       ).
JSR OSBYTE       :\ E2F4= 20 F4 FF     t.
JMP &8B9B        :\ E2F7= 4C 9B 8B    L..
 
.LE2FA
LDX #&00         :\ E2FA= A2 00       ".
LDY #&00         :\ E2FC= A0 00        .
LDA #&17         :\ E2FE= A9 17       ).
JSR OSBYTE       :\ E300= 20 F4 FF     t.
STX &2A          :\ E303= 86 2A       .*
STY &2B          :\ E305= 84 2B       .+
LDY #&00         :\ E307= A0 00        .
BEQ LE338        :\ E309= F0 2D       p-
BCS LE324        :\ E30B= B0 17       0.
JSR LE369        :\ E30D= 20 69 E3     ic
TAX              :\ E310= AA          *
LDY #&00         :\ E311= A0 00        .
LDA &2A          :\ E313= A5 2A       %*
ORA &2B          :\ E315= 05 2B       .+
ORA &2C          :\ E317= 05 2C       .,
ORA &2D          :\ E319= 05 2D       .-
BEQ LE31E        :\ E31B= F0 01       p.
INY              :\ E31D= C8          H
.LE31E
JSR LE257        :\ E31E= 20 57 E2     Wb
JMP &8B9B        :\ E321= 4C 9B 8B    L..
 
.LE324
JSR LE1BA        :\ E324= 20 BA E1     :a
LDX &2A          :\ E327= A6 2A       &*
LDY #&05         :\ E329= A0 05        .
JSR LE257        :\ E32B= 20 57 E2     Wb
LDY #&00         :\ E32E= A0 00        .
TXA              :\ E330= 8A          .
BEQ LE334        :\ E331= F0 01       p.
DEY              :\ E333= 88          .
.LE334
STY &2A          :\ E334= 84 2A       .*
STY &2B          :\ E336= 84 2B       .+
.LE338
STY &2C          :\ E338= 84 2C       .,
STY &2D          :\ E33A= 84 2D       .-
LDA #&40         :\ E33C= A9 40       )@
RTS              :\ E33E= 60          `
 
.LE33F
LDA &2A          :\ E33F= A5 2A       %*
STA &02EE,X      :\ E341= 9D EE 02    .n.
LDA &2B          :\ E344= A5 2B       %+
STA &02EF,X      :\ E346= 9D EF 02    .o.
LDA &2C          :\ E349= A5 2C       %,
STA &02F0,X      :\ E34B= 9D F0 02    .p.
LDA &2D          :\ E34E= A5 2D       %-
STA &02F1,X      :\ E350= 9D F1 02    .q.
RTS              :\ E353= 60          `
 
.LE354
LDA &02EE,X      :\ E354= BD EE 02    =n.
STA &2A          :\ E357= 85 2A       .*
LDA &02EF,X      :\ E359= BD EF 02    =o.
STA &2B          :\ E35C= 85 2B       .+
LDA &02F0,X      :\ E35E= BD F0 02    =p.
STA &2C          :\ E361= 85 2C       .,
LDA &02F1,X      :\ E363= BD F1 02    =q.
STA &2D          :\ E366= 85 2D       .-
RTS              :\ E368= 60          `
 
.LE369
JSR LE1B8        :\ E369= 20 B8 E1     8a
LDA &2A          :\ E36C= A5 2A       %*
PHA              :\ E36E= 48          H
JSR LE1DC        :\ E36F= 20 DC E1     \a
PLA              :\ E372= 68          h
RTS              :\ E373= 60          `
 
BCS LE3AA        :\ E374= B0 34       04
JSR LE1CD        :\ E376= 20 CD E1     Ma
LDX #&00         :\ E379= A2 00       ".
.LE37B
LDY #&03         :\ E37B= A0 03        .
LDA #&01         :\ E37D= A9 01       ).
PHA              :\ E37F= 48          H
STY &6D          :\ E380= 84 6D       .m
JSR LE433        :\ E382= 20 33 E4     3d
JSR LE3D2        :\ E385= 20 D2 E3     Rc
JSR LE43E        :\ E388= 20 3E E4     >d
PLA              :\ E38B= 68          h
STA &02FD        :\ E38C= 8D FD 02    .}.
LDA #&0F         :\ E38F= A9 0F       ).
JSR LE42C        :\ E391= 20 2C E4     ,d
JMP &8B9B        :\ E394= 4C 9B 8B    L..
 
BCS LE3A0        :\ E397= B0 07       0.
JSR LE1CD        :\ E399= 20 CD E1     Ma
LDX #&03         :\ E39C= A2 03       ".
BNE LE37B        :\ E39E= D0 DB       P[
.LE3A0
JSR LE42A        :\ E3A0= 20 2A E4     *d
JSR LE43E        :\ E3A3= 20 3E E4     >d
LDX #&05         :\ E3A6= A2 05       ".
BNE LE3AF        :\ E3A8= D0 05       P.
.LE3AA
JSR LE42A        :\ E3AA= 20 2A E4     *d
LDX #&02         :\ E3AD= A2 02       ".
.LE3AF
LDY #&03         :\ E3AF= A0 03        .
STY &6D          :\ E3B1= 84 6D       .m
LDY #&00         :\ E3B3= A0 00        .
BEQ LE3BD        :\ E3B5= F0 06       p.
.LE3B7
LDA #&3A         :\ E3B7= A9 3A       ):
STA &0600,Y      :\ E3B9= 99 00 06    ...
INY              :\ E3BC= C8          H
.LE3BD
LDA &02EE,X      :\ E3BD= BD EE 02    =n.
JSR LE418        :\ E3C0= 20 18 E4     .d
DEX              :\ E3C3= CA          J
DEC &6D          :\ E3C4= C6 6D       Fm
BNE LE3B7        :\ E3C6= D0 EF       Po
LDA #&0D         :\ E3C8= A9 0D       ).
STA &0600,Y      :\ E3CA= 99 00 06    ...
STY &36          :\ E3CD= 84 36       .6
LDA #&00         :\ E3CF= A9 00       ).
RTS              :\ E3D1= 60          `
 
.LE3D2
LDY &36          :\ E3D2= A4 36       $6
.LE3D4
DEY              :\ E3D4= 88          .
BMI LE415        :\ E3D5= 30 3E       0>
LDA &0600,Y      :\ E3D7= B9 00 06    9..
CMP #&20         :\ E3DA= C9 20       I 
BEQ LE3D4        :\ E3DC= F0 F6       pv
CMP #&3A         :\ E3DE= C9 3A       I:
BEQ LE3D4        :\ E3E0= F0 F2       pr
DEC &6D          :\ E3E2= C6 6D       Fm
BMI LE40C        :\ E3E4= 30 26       0&
JSR LE40F        :\ E3E6= 20 0F E4     .d
BCC LE40C        :\ E3E9= 90 21       .!
AND #&0F         :\ E3EB= 29 0F       ).
STA &6E          :\ E3ED= 85 6E       .n
DEY              :\ E3EF= 88          .
BMI LE403        :\ E3F0= 30 11       0.
LDA &0600,Y      :\ E3F2= B9 00 06    9..
JSR LE40F        :\ E3F5= 20 0F E4     .d
BCC LE403        :\ E3F8= 90 09       ..
ASL A            :\ E3FA= 0A          .
ASL A            :\ E3FB= 0A          .
ASL A            :\ E3FC= 0A          .
ASL A            :\ E3FD= 0A          .
ORA &6E          :\ E3FE= 05 6E       .n
STA &6E          :\ E400= 85 6E       .n
DEY              :\ E402= 88          .
.LE403
INY              :\ E403= C8          H
LDA &6E          :\ E404= A5 6E       %n
STA &02EE,X      :\ E406= 9D EE 02    .n.
INX              :\ E409= E8          h
BNE LE3D4        :\ E40A= D0 C8       PH
.LE40C
JMP &982A        :\ E40C= 4C 2A 98    L*.
 
.LE40F
CMP #&3A         :\ E40F= C9 3A       I:
BCS LE416        :\ E411= B0 03       0.
CMP #&30         :\ E413= C9 30       I0
.LE415
RTS              :\ E415= 60          `
 
.LE416
CLC              :\ E416= 18          .
RTS              :\ E417= 60          `
 
.LE418
PHA              :\ E418= 48          H
LSR A            :\ E419= 4A          J
LSR A            :\ E41A= 4A          J
LSR A            :\ E41B= 4A          J
LSR A            :\ E41C= 4A          J
JSR LE423        :\ E41D= 20 23 E4     #d
PLA              :\ E420= 68          h
AND #&0F         :\ E421= 29 0F       ).
.LE423
ORA #&30         :\ E423= 09 30       .0
STA &0600,Y      :\ E425= 99 00 06    ...
INY              :\ E428= C8          H
RTS              :\ E429= 60          `
 
.LE42A
LDA #&0E         :\ E42A= A9 0E       ).
.LE42C
LDX #&EE         :\ E42C= A2 EE       "n
LDY #&02         :\ E42E= A0 02        .
JMP OSWORD       :\ E430= 4C F1 FF    Lq.
 
.LE433
LDY #&0F         :\ E433= A0 0F        .
LDA #&FF         :\ E435= A9 FF       ).
.LE437
STA &02EE,Y      :\ E437= 99 EE 02    .n.
DEY              :\ E43A= 88          .
BPL LE437        :\ E43B= 10 FA       .z
RTS              :\ E43D= 60          `
 
.LE43E
LDA &02F1        :\ E43E= AD F1 02    -q.
LDX &02F3        :\ E441= AE F3 02    .s.
STX &02F1        :\ E444= 8E F1 02    .q.
STA &02F3        :\ E447= 8D F3 02    .s.
RTS              :\ E44A= 60          `

\ SERVICE 9 - *HELP
\ =================
.LE44B
LDA (&F2),Y               :\ Get current character
CMP #&0D:BNE LE477        :\ Exit if not <cr>
BIT &02B7:BMI LE465       :\ If CUBAN-12B absent, skip text
JSR LFFB3                 :\ Print inline text
EQUB 13:EQUS "CUBAN-12B":EQUB 13
NOP
.LE465
BIT &02B9:BMI LE477       :\ If CUNAB-8 absent, skip text
JSR LFFB3                 :\ Print inline text
EQUB 13:EQUS "CUBAN-8":EQUB 13
NOP
.LE477
LDA #&09:RTS              :\ Return unclaimed


\ CUBAN SERVICE HANDLER - CU ANalogue system
\ ==========================================
.LE47A
CMP #&07:BEQ LE4A4        :\ OSBYTE
CMP #&08:BEQ LE4B0        :\ OSWORD
CMP #&09:BEQ LE44B        :\ *HELP
CMP #&03:BNE LE49F        :\ Not BOOT FS, exit

\ SERVICE 3 - BOOT FS
\ ===================
LDA #LE71A AND 255:STA &0230 :\ Point INDV1 to LE71A
LDA #LE71A DIV 256:STA &0231
LDX #LE4A0 AND 255        :\ Point to control block
LDY #LE4A0 DIV 256
LDA #&14:JSR OSWORD       :\ Call OSWORD 20
LDA #&03
.LE49F
RTS
.LE4A0
EQUB &00:EQUB &20:EQUB &40
.LE4A3
EQUB &FF

\ SERVICE 7 - OSBYTE
\ ==================
.LE4A4
LDA &EF:LDX &F0:JSR LE4FF :\ Get A,X, call subhandler
.LE4AB
STX &F0:LDA #&00:RTS      :\ Store X, claim and return

\ SERVICE 8 - OSWORD
\ ==================
.LE4B0
LDA &EF:LDX &F0:JSR LE4BA :\ Get A,X, call subhandler
JMP LE4AB                 :\ Jump to store X, claim and return

\ OSWORD handler
\ ==============
.LE4BA
CMP #&12:BEQ LE4F5        :\ Jump with OSWORD 18
CMP #&14:BEQ LE4C7        :\ Jump with OSWORD 20
PLA:PLA:LDA #&08:RTS      :\ Drop return address and return unclaimed

\ OSWORD 20 (&14)
\ ===============
.LE4C7
LDY #&03
.LE4C9
TYA:PHA:BIT LE4A3         :\ Set M, set V
JSR LE52C        :\ E4CE= 20 2C E5     ,e
PLA              :\ E4D1= 68          h
TAY              :\ E4D2= A8          (
TXA              :\ E4D3= 8A          .
BEQ LE4F1        :\ E4D4= F0 1B       p.
CLC              :\ E4D6= 18          .
ADC (&F0),Y      :\ E4D7= 71 F0       qp
TAX              :\ E4D9= AA          *
LDA (&F0),Y      :\ E4DA= B1 F0       1p
.LE4DC
STA &02B7,Y      :\ E4DC= 99 B7 02    .7.
TXA              :\ E4DF= 8A          .
STA &02BB,Y      :\ E4E0= 99 BB 02    .;.
DEY              :\ E4E3= 88          .
BPL LE4C9        :\ E4E4= 10 E3       .c
LDY #&07         :\ E4E6= A0 07        .
.LE4E8
LDA &02B7,Y      :\ E4E8= B9 B7 02    97.
STA (&F0),Y      :\ E4EB= 91 F0       .p
DEY              :\ E4ED= 88          .
BPL LE4E8        :\ E4EE= 10 F8       .x
RTS              :\ E4F0= 60          `
 
.LE4F1
DEX              :\ E4F1= CA          J
TXA              :\ E4F2= 8A          .
BNE LE4DC        :\ E4F3= D0 E7       Pg

\ OSWORD 18 (&12)
\ ===============
.LE4F5
LDY #&00:LDA (&F0),Y      :\ Get byte from XY
JSR LE513:BCC LE52A:RTS


\ OSBYTE handler
\ ==============
.LE4FF
CMP #&80:BEQ LE508        :\ Jump to do OSBYTE &80 - ADVAL
PLA:PLA:LDA #&07:RTS      :\ Drop return address, return unclaimed

\ OSBYTE &80 - ADVAL
\ ==================
.LE508
TXA                       :\ Pass device number to A
.LE509
JSR LE513:BCC LE52B
LDX #&FF:LDY #&FF:RTS     :\ Return -1

.LE513
LDY #&00         :\ E513= A0 00        .
.LE515
CMP &02BB,Y      :\ E515= D9 BB 02    Y;.
BCS LE51F        :\ E518= B0 05       0.
CMP &02B7,Y      :\ E51A= D9 B7 02    Y7.
BCS LE525        :\ E51D= B0 06       0.
.LE51F
INY              :\ E51F= C8          H
CPY #&04         :\ E520= C0 04       @.
BCC LE515        :\ E522= 90 F1       .q
RTS              :\ E524= 60          `
 
.LE525
SBC &02B7,Y      :\ E525= F9 B7 02    y7.
CLC              :\ E528= 18          .
RTS              :\ E529= 60          `
 
.LE52A
SEC              :\ E52A= 38          8
.LE52B
CLV              :\ E52B= B8          8
.LE52C
TAX              :\ E52C= AA          *
LDA LE53B,Y      :\ E52D= B9 3B E5    9;e
PHA              :\ E530= 48          H
LDA LE537,Y      :\ E531= B9 37 E5    97e
PHA              :\ E534= 48          H
TXA              :\ E535= 8A          .
RTS              :\ E536= 60          `
 
.LE537
INX              :\ E537= E8          h
EQUB &9B         :\ E538= 9B          .
STA LE59B        :\ E539= 8D 9B E5    ..e
INC &E5          :\ E53C= E6 E5       fe
INC &AD          :\ E53E= E6 AD       f-
BIT #&02         :\ E540= 89 02       ..
CMP #&01         :\ E542= C9 01       I.
BEQ LE54B        :\ E544= F0 05       p.
INY              :\ E546= C8          H
TYA              :\ E547= 98          .
ASL A            :\ E548= 0A          .
TAY              :\ E549= A8          (
INY              :\ E54A= C8          H
.LE54B
DEY              :\ E54B= 88          .
BNE LE54B        :\ E54C= D0 FD       P}
RTS              :\ E54E= 60          `
 
.LE54F
STX &E8          :\ E54F= 86 E8       .h
STY &E9          :\ E551= 84 E9       .i
STA &FA          :\ E553= 85 FA       .z
LDX #&00         :\ E555= A2 00       ".
.LE557
JSR LE56B        :\ E557= 20 6B E5     ke
BNE LE56A        :\ E55A= D0 0E       P.
INX              :\ E55C= E8          h
CLC              :\ E55D= 18          .
LDA &E8          :\ E55E= A5 E8       %h
ADC &FA          :\ E560= 65 FA       ez
BCS LE56A        :\ E562= B0 06       0.
STA &E8          :\ E564= 85 E8       .h
CPX #&08         :\ E566= E0 08       `.
BCC LE557        :\ E568= 90 ED       .m
.LE56A
RTS              :\ E56A= 60          `
 
.LE56B
LDY #&06         :\ E56B= A0 06        .
LDA #&5A         :\ E56D= A9 5A       )Z
STA (&E8),Y      :\ E56F= 91 E8       .h
LDY #&04         :\ E571= A0 04        .
LDA #&00         :\ E573= A9 00       ).
STA (&E8),Y      :\ E575= 91 E8       .h
LDY #&06         :\ E577= A0 06        .
LDA (&E8),Y      :\ E579= B1 E8       1h
RTS              :\ E57B= 60          `
 
.LE57C
JSR LE54F        :\ E57C= 20 4F E5     Oe
TXA              :\ E57F= 8A          .
ASL A            :\ E580= 0A          .
ASL A            :\ E581= 0A          .
ASL A            :\ E582= 0A          .
ASL A            :\ E583= 0A          .
TAX              :\ E584= AA          *
RTS              :\ E585= 60          `
 
.LE586
LDX #&00         :\ E586= A2 00       ".
LDY #&DB         :\ E588= A0 DB        [
LDA #&40         :\ E58A= A9 40       )@
BNE LE57C        :\ E58C= D0 EE       Pn
BVS LE586        :\ E58E= 70 F6       pv
BCS LE5B6        :\ E590= B0 24       0$
JSR LE5A4        :\ E592= 20 A4 E5     $e
STA LDB10,X      :\ E595= 9D 10 DB    ..[
LDY #&10         :\ E598= A0 10        .
JSR LE53F        :\ E59A= 20 3F E5     ?e
LDY LDB10,X      :\ E59D= BC 10 DB    <.[
LDX #&00         :\ E5A0= A2 00       ".
CLC              :\ E5A2= 18          .
RTS              :\ E5A3= 60          `
 
.LE5A4
CMP #&10         :\ E5A4= C9 10       I.
BCC LE5B4        :\ E5A6= 90 0C       ..
TAX              :\ E5A8= AA          *
AND #&30         :\ E5A9= 29 30       )0
ASL A            :\ E5AB= 0A          .
ASL A            :\ E5AC= 0A          .
STA &F0          :\ E5AD= 85 F0       .p
TXA              :\ E5AF= 8A          .
AND #&0F         :\ E5B0= 29 0F       ).
ORA &F0          :\ E5B2= 05 F0       .p
.LE5B4
TAX              :\ E5B4= AA          *
RTS              :\ E5B5= 60          `
 
.LE5B6
ROR A            :\ E5B6= 6A          j
ROR A            :\ E5B7= 6A          j
ROR A            :\ E5B8= 6A          j
AND #&C0         :\ E5B9= 29 C0       )@
TAX              :\ E5BB= AA          *
LDY #&02         :\ E5BC= A0 02        .
LDA (&F0),Y      :\ E5BE= B1 F0       1p
STA LDB20,X      :\ E5C0= 9D 20 DB    . [
CLC              :\ E5C3= 18          .
RTS              :\ E5C4= 60          `
 
.LE5C5
LDX #&00         :\ E5C5= A2 00       ".
LDY #&DC         :\ E5C7= A0 DC        \
LDA #&10         :\ E5C9= A9 10       ).
JSR LE57C        :\ E5CB= 20 7C E5     |e
PHA              :\ E5CE= 48          H
.LE5CF
TXA              :\ E5CF= 8A          .
SEC              :\ E5D0= 38          8
SBC #&10         :\ E5D1= E9 10       i.
TAX              :\ E5D3= AA          *
BMI LE5E5        :\ E5D4= 30 0F       0.
LDA #&0F         :\ E5D6= A9 0F       ).
STA LDC00,X      :\ E5D8= 9D 00 DC    ..\
STA LDC02,X      :\ E5DB= 9D 02 DC    ..\
LDA #&05         :\ E5DE= A9 05       ).
STA LDC00,X      :\ E5E0= 9D 00 DC    ..\
BNE LE5CF        :\ E5E3= D0 EA       Pj
.LE5E5
PLA              :\ E5E5= 68          h
LSR A            :\ E5E6= 4A          J
TAX              :\ E5E7= AA          *
RTS              :\ E5E8= 60          `
 
BVS LE5C5        :\ E5E9= 70 DA       pZ
BCS LE5FE        :\ E5EB= B0 11       0.
JSR LE654        :\ E5ED= 20 54 E6     Tf
JSR LE660        :\ E5F0= 20 60 E6     `f
LDY #&03         :\ E5F3= A0 03        .
JSR LE53F        :\ E5F5= 20 3F E5     ?e
JSR LE673        :\ E5F8= 20 73 E6     sf
TAX              :\ E5FB= AA          *
CLC              :\ E5FC= 18          .
RTS              :\ E5FD= 60          `
 
.LE5FE
PHA              :\ E5FE= 48          H
ROR A            :\ E5FF= 6A          j
ROR A            :\ E600= 6A          j
ROR A            :\ E601= 6A          j
AND #&C0         :\ E602= 29 C0       )@
STA &FA          :\ E604= 85 FA       .z
PLA              :\ E606= 68          h
ASL A            :\ E607= 0A          .
ASL A            :\ E608= 0A          .
AND #&F0         :\ E609= 29 F0       )p
TAX              :\ E60B= AA          *
LDY #&00         :\ E60C= A0 00        .
STY &02B3        :\ E60E= 8C B3 02    .3.
INY              :\ E611= C8          H
LDA (&F0),Y      :\ E612= B1 F0       1p
LSR A            :\ E614= 4A          J
LSR A            :\ E615= 4A          J
LSR A            :\ E616= 4A          J
LSR A            :\ E617= 4A          J
STA &02B6        :\ E618= 8D B6 02    .6.
INY              :\ E61B= C8          H
LDA (&F0),Y      :\ E61C= B1 F0       1p
AND #&0F         :\ E61E= 29 0F       ).
STA &02B5        :\ E620= 8D B5 02    .5.
LDA (&F0),Y      :\ E623= B1 F0       1p
LSR A            :\ E625= 4A          J
LSR A            :\ E626= 4A          J
LSR A            :\ E627= 4A          J
LSR A            :\ E628= 4A          J
STA &02B4        :\ E629= 8D B4 02    .4.
LDA #&FF         :\ E62C= A9 FF       ).
STA LDC03,X      :\ E62E= 9D 03 DC    ..\
LDY #&03         :\ E631= A0 03        .
.LE633
LDA &02B3,Y      :\ E633= B9 B3 02    93.
ORA &FA          :\ E636= 05 FA       .z
STA LDC01,X      :\ E638= 9D 01 DC    ..\
LDA LDC00,X      :\ E63B= BD 00 DC    =.\
AND #&FE         :\ E63E= 29 FE       )~
STA LDC00,X      :\ E640= 9D 00 DC    ..\
ORA #&01         :\ E643= 09 01       ..
STA LDC00,X      :\ E645= 9D 00 DC    ..\
CLC              :\ E648= 18          .
LDA &FA          :\ E649= A5 FA       %z
ADC #&10         :\ E64B= 69 10       i.
STA &FA          :\ E64D= 85 FA       .z
DEY              :\ E64F= 88          .
BPL LE633        :\ E650= 10 E1       .a
CLC              :\ E652= 18          .
RTS              :\ E653= 60          `
 
.LE654
PHA              :\ E654= 48          H
ASL A            :\ E655= 0A          .
AND #&F0         :\ E656= 29 F0       )p
TAX              :\ E658= AA          *
PLA              :\ E659= 68          h
AND #&07         :\ E65A= 29 07       ).
STA LDC01,X      :\ E65C= 9D 01 DC    ..\
RTS              :\ E65F= 60          `
 
.LE660
LDA #&FF         :\ E660= A9 FF       ).
STA LDC03,X      :\ E662= 9D 03 DC    ..\
JSR LE672        :\ E665= 20 72 E6     rf
LDA LDC00,X      :\ E668= BD 00 DC    =.\
ORA #&0F         :\ E66B= 09 0F       ..
AND #&F1         :\ E66D= 29 F1       )q
STA LDC00,X      :\ E66F= 9D 00 DC    ..\
.LE672
RTS              :\ E672= 60          `
 
.LE673
LDA #&00         :\ E673= A9 00       ).
STA LDC03,X      :\ E675= 9D 03 DC    ..\
LDA LDC00,X      :\ E678= BD 00 DC    =.\
ORA #&0F         :\ E67B= 09 0F       ..
AND #&FB         :\ E67D= 29 FB       ){
STA LDC00,X      :\ E67F= 9D 00 DC    ..\
LDY LDC01,X      :\ E682= BC 01 DC    <.\
STY &F0          :\ E685= 84 F0       .p
AND #&F3         :\ E687= 29 F3       )s
STA LDC00,X      :\ E689= 9D 00 DC    ..\
LDY LDC01,X      :\ E68C= BC 01 DC    <.\
ORA #&07         :\ E68F= 09 07       ..
STA LDC00,X      :\ E691= 9D 00 DC    ..\
AND #&F5         :\ E694= 29 F5       )u
STA LDC00,X      :\ E696= 9D 00 DC    ..\
LDA &F0          :\ E699= A5 F0       %p
RTS              :\ E69B= 60          `
 
LDX #&00         :\ E69C= A2 00       ".
SEC              :\ E69E= 38          8
RTS              :\ E69F= 60          `
 
.LE6A0
AND #&3F         :\ E6A0= 29 3F       )?
ORA #&80         :\ E6A2= 09 80       ..
STA &0349        :\ E6A4= 8D 49 03    .I.
BNE LE6B9        :\ E6A7= D0 10       P.

\ IND1V &03
\ ---------
.LE6A9
LDA &0349        :\ E6A9= AD 49 03    -I.
LDX &034A        :\ E6AC= AE 4A 03    .J.
BNE LE6A0        :\ E6AF= D0 EF       Po
CMP #&C0         :\ E6B1= C9 C0       I@
BCS LE6F2        :\ E6B3= B0 3D       0=
CMP #&0E         :\ E6B5= C9 0E       I.
BCC LE6F2        :\ E6B7= 90 39       .9
.LE6B9
LDX #&02         :\ E6B9= A2 02       ".
.LE6BB
LDA &0348,X      :\ E6BB= BD 48 03    =H.
STA &0354,X      :\ E6BE= 9D 54 03    .T.
DEX              :\ E6C1= CA          J
BPL LE6BB        :\ E6C2= 10 F7       .w
LDA &0347        :\ E6C4= AD 47 03    -G.
ORA &0346        :\ E6C7= 0D 46 03    .F.
BNE LE6DD        :\ E6CA= D0 11       P.
SEC              :\ E6CC= 38          8
LDA &0344        :\ E6CD= AD 44 03    -D.
SBC &0263        :\ E6D0= ED 63 02    mc.
LDA &0345        :\ E6D3= AD 45 03    -E.
BEQ LE70B        :\ E6D6= F0 33       p3
SBC &0264        :\ E6D8= ED 64 02    md.
BCC LE712        :\ E6DB= 90 35       .5
.LE6DD
LDA &0289        :\ E6DD= AD 89 02    -..
CMP #&01         :\ E6E0= C9 01       I.
BEQ LE6F0        :\ E6E2= F0 0C       p.
ASL &0344        :\ E6E4= 0E 44 03    .D.
ROL &0345        :\ E6E7= 2E 45 03    .E.
ROL &0346        :\ E6EA= 2E 46 03    .F.
ROL &0347        :\ E6ED= 2E 47 03    .G.
.LE6F0
CLC              :\ E6F0= 18          .
RTS              :\ E6F1= 60          `
 
.LE6F2
BRK              :\ E6F2= 00          .
EQUB &FC         :\ E6F3= FC          |
EQUB &42         :\ E6F4= 42          B
ADC (&64,X)      :\ E6F5= 61 64       ad
JSR &6461        :\ E6F7= 20 61 64     ad
STZ &72          :\ E6FA= 64 72       dr
ADC &73          :\ E6FC= 65 73       es
EQUB &73         :\ E6FE= 73          s
BRK              :\ E6FF= 00          .
.LE700
BRK              :\ E700= 00          .
LSR &42          :\ E701= 46 42       FB
ADC (&64,X)      :\ E703= 61 64       ad
JSR &6172        :\ E705= 20 72 61     ra
STZ &65,X        :\ E708= 74 65       te
BRK              :\ E70A= 00          .
.LE70B
LDA &0344        :\ E70B= AD 44 03    -D.
CMP #&64         :\ E70E= C9 64       Id
BCC LE700        :\ E710= 90 EE       .n
.LE712
LDA &034D        :\ E712= AD 4D 03    -M.
BNE LE700        :\ E715= D0 E9       Pi
JMP LE873        :\ E717= 4C 73 E8    Lsh
 
\ IND1V pointed to here
\ =====================
.LE71A
CMP #&02:BEQ LE729  
CMP #&01:BEQ LE792  
CMP #&03:BNE LE766:JMP LE6A9

\ IND1V &02
\ ---------
.LE729
LDA &F4          :\ E729= A5 F4       %t
PHA              :\ E72B= 48          H
LDA &034C        :\ E72C= AD 4C 03    -L.
STA &0353        :\ E72F= 8D 53 03    .S.
JSR LE861        :\ E732= 20 61 E8     ah
.LE735
LDA &0353        :\ E735= AD 53 03    -S.
JSR LE509        :\ E738= 20 09 E5     .e
TYA              :\ E73B= 98          .
LDY #&01         :\ E73C= A0 01        .
STA (&FA),Y      :\ E73E= 91 FA       .z
DEY              :\ E740= 88          .
TXA              :\ E741= 8A          .
STA (&FA),Y      :\ E742= 91 FA       .z
JSR LE767        :\ E744= 20 67 E7     gg
INC &0353        :\ E747= EE 53 03    nS.
LDA &034D        :\ E74A= AD 4D 03    -M.
CMP &0353        :\ E74D= CD 53 03    MS.
BCS LE735        :\ E750= B0 E3       0c
.LE752
LDA &FA          :\ E752= A5 FA       %z
STA &0354        :\ E754= 8D 54 03    .T.
LDA &FB          :\ E757= A5 FB       %{
STA &0355        :\ E759= 8D 55 03    .U.
LDA &F4          :\ E75C= A5 F4       %t
STA &0356        :\ E75E= 8D 56 03    .V.
PLA              :\ E761= 68          h
JSR LE84A        :\ E762= 20 4A E8     Jh
SEC              :\ E765= 38          8
.LE766
RTS              :\ E766= 60          `
 
.LE767
CLC              :\ E767= 18          .
LDA #&02         :\ E768= A9 02       ).
ADC &FA          :\ E76A= 65 FA       ez
STA &FA          :\ E76C= 85 FA       .z
BCC LE783        :\ E76E= 90 13       ..
.LE770
INC &FB          :\ E770= E6 FB       f{
LDA &FB          :\ E772= A5 FB       %{
CMP #&C0         :\ E774= C9 C0       I@
BCC LE783        :\ E776= 90 0B       ..
INC &F4          :\ E778= E6 F4       ft
LDA &F4          :\ E77A= A5 F4       %t
STA LFE30        :\ E77C= 8D 30 FE    .0~
LDA #&80         :\ E77F= A9 80       ).
STA &FB          :\ E781= 85 FB       .{
.LE783
RTS              :\ E783= 60          `
 
.LE784
BRK              :\ E784= 00          .
EQUB &47         :\ E785= 47          G
EQUB &42         :\ E786= 42          B
ADC (&64,X)      :\ E787= 61 64       ad
JSR &6863        :\ E789= 20 63 68     ch
ADC (&6E,X)      :\ E78C= 61 6E       an
ROR &6C65        :\ E78E= 6E 65 6C    nel
BRK              :\ E791= 00          .

\ IND1V &01
\ ---------
.LE792
STX &E8          :\ E792= 86 E8       .h
STY &E9          :\ E794= 84 E9       .i
LDY #&04         :\ E796= A0 04        .
LDA (&E8),Y      :\ E798= B1 E8       1h
TAY              :\ E79A= A8          (
SEC              :\ E79B= 38          8
SBC &034C        :\ E79C= ED 4C 03    mL.
BEQ LE7AA        :\ E79F= F0 09       p.
BCC LE784        :\ E7A1= 90 E1       .a
CPY &034D        :\ E7A3= CC 4D 03    LM.
BEQ LE7AA        :\ E7A6= F0 02       p.
BCS LE784        :\ E7A8= B0 DA       0Z
.LE7AA
PHA              :\ E7AA= 48          H
CLC              :\ E7AB= 18          .
LDX #&02         :\ E7AC= A2 02       ".
LDY #&00         :\ E7AE= A0 00        .
.LE7B0
LDA (&E8),Y      :\ E7B0= B1 E8       1h
SBC #&00         :\ E7B2= E9 00       i.
STA &0357,Y      :\ E7B4= 99 57 03    .W.
STA &02B3,Y      :\ E7B7= 99 B3 02    .3.
INY              :\ E7BA= C8          H
DEX              :\ E7BB= CA          J
BPL LE7B0        :\ E7BC= 10 F2       .r
LDA &034D        :\ E7BE= AD 4D 03    -M.
SEC              :\ E7C1= 38          8
SBC &034C        :\ E7C2= ED 4C 03    mL.
BEQ LE7E1        :\ E7C5= F0 1A       p.
BCC LE7E1        :\ E7C7= 90 18       ..
STA &FA          :\ E7C9= 85 FA       .z
.LE7CB
LDX #&02         :\ E7CB= A2 02       ".
LDY #&00         :\ E7CD= A0 00        .
CLC              :\ E7CF= 18          .
.LE7D0
LDA &0357,Y      :\ E7D0= B9 57 03    9W.
ADC &02B3,Y      :\ E7D3= 79 B3 02    y3.
STA &0357,Y      :\ E7D6= 99 57 03    .W.
INY              :\ E7D9= C8          H
DEX              :\ E7DA= CA          J
BPL LE7D0        :\ E7DB= 10 F3       .s
DEC &FA          :\ E7DD= C6 FA       Fz
BNE LE7CB        :\ E7DF= D0 EA       Pj
.LE7E1
CLC              :\ E7E1= 18          .
PLA              :\ E7E2= 68          h
ADC &0357        :\ E7E3= 6D 57 03    mW.
STA &0357        :\ E7E6= 8D 57 03    .W.
BCC LE7F3        :\ E7E9= 90 08       ..
INC &0358        :\ E7EB= EE 58 03    nX.
BNE LE7F3        :\ E7EE= D0 03       P.
INC &0359        :\ E7F0= EE 59 03    nY.
.LE7F3
CLC              :\ E7F3= 18          .
ROL &0357        :\ E7F4= 2E 57 03    .W.
ROL &0358        :\ E7F7= 2E 58 03    .X.
ROL &0359        :\ E7FA= 2E 59 03    .Y.
LDA &F4          :\ E7FD= A5 F4       %t
PHA              :\ E7FF= 48          H
LDX #&08         :\ E800= A2 08       ".
JSR LE863        :\ E802= 20 63 E8     ch
CLC              :\ E805= 18          .
LDA &0357        :\ E806= AD 57 03    -W.
ADC &FA          :\ E809= 65 FA       ez
STA &FA          :\ E80B= 85 FA       .z
INC &0358        :\ E80D= EE 58 03    nX.
INC &0359        :\ E810= EE 59 03    nY.
BCC LE818        :\ E813= 90 03       ..
.LE815
JSR LE770        :\ E815= 20 70 E7     pg
.LE818
DEC &0358        :\ E818= CE 58 03    NX.
BNE LE815        :\ E81B= D0 F8       Px
DEC &0359        :\ E81D= CE 59 03    NY.
BNE LE815        :\ E820= D0 F3       Ps
SEC              :\ E822= 38          8
LDA &FA          :\ E823= A5 FA       %z
SBC &0354        :\ E825= ED 54 03    mT.
LDA &FB          :\ E828= A5 FB       %{
SBC &0355        :\ E82A= ED 55 03    mU.
LDA &F4          :\ E82D= A5 F4       %t
SBC &0356        :\ E82F= ED 56 03    mV.
BCS LE850        :\ E832= B0 1C       0.
LDA #&00         :\ E834= A9 00       ).
JSR LE857        :\ E836= 20 57 E8     Wh
LDY #&00         :\ E839= A0 00        .
LDA (&FA),Y      :\ E83B= B1 FA       1z
TAX              :\ E83D= AA          *
INY              :\ E83E= C8          H
LDA (&FA),Y      :\ E83F= B1 FA       1z
LDY #&06         :\ E841= A0 06        .
STA (&E8),Y      :\ E843= 91 E8       .h
DEY              :\ E845= 88          .
TXA              :\ E846= 8A          .
STA (&E8),Y      :\ E847= 91 E8       .h
.LE849
PLA              :\ E849= 68          h
.LE84A
STA &F4          :\ E84A= 85 F4       .t
STA LFE30        :\ E84C= 8D 30 FE    .0~
RTS              :\ E84F= 60          `
 
.LE850
LDA #&FF         :\ E850= A9 FF       ).
JSR LE857        :\ E852= 20 57 E8     Wh
BEQ LE849        :\ E855= F0 F2       pr
.LE857
LDY #&05         :\ E857= A0 05        .
.LE859
STA (&E8),Y      :\ E859= 91 E8       .h
INY              :\ E85B= C8          H
CPY #&09         :\ E85C= C0 09       @.
BNE LE859        :\ E85E= D0 F9       Py
RTS              :\ E860= 60          `
 
.LE861
LDX #&14         :\ E861= A2 14       ".
.LE863
LDA &0340,X      :\ E863= BD 40 03    =@.
STA &FA          :\ E866= 85 FA       .z
LDA &0341,X      :\ E868= BD 41 03    =A.
STA &FB          :\ E86B= 85 FB       .{
LDA &0342,X      :\ E86D= BD 42 03    =B.
JMP LE84A        :\ E870= 4C 4A E8    LJh
 
.LE873
JSR LE6DD        :\ E873= 20 DD E6     ]f
LDA &F4          :\ E876= A5 F4       %t
PHA              :\ E878= 48          H
LDA &0344        :\ E879= AD 44 03    -D.
STA LFE06        :\ E87C= 8D 06 FE    ..~
LDA &0345        :\ E87F= AD 45 03    -E.
STA LFE05        :\ E882= 8D 05 FE    ..~
LDA &0340        :\ E885= AD 40 03    -@.
ASL A            :\ E888= 0A          .
TAX              :\ E889= AA          *
LDA &0341        :\ E88A= AD 41 03    -A.
ROL A            :\ E88D= 2A          *
STA &EF          :\ E88E= 85 EF       .o
LDA &0342        :\ E890= AD 42 03    -B.
ROL A            :\ E893= 2A          *
STA &F0          :\ E894= 85 F0       .p
TXA              :\ E896= 8A          .
CLC              :\ E897= 18          .
ADC &0354        :\ E898= 6D 54 03    mT.
BCC LE8A3        :\ E89B= 90 06       ..
INC &EF          :\ E89D= E6 EF       fo
BNE LE8A3        :\ E89F= D0 02       P.
INC &F0          :\ E8A1= E6 F0       fp
.LE8A3
JSR LE861        :\ E8A3= 20 61 E8     ah
LDA &034C        :\ E8A6= AD 4C 03    -L.
JSR LE8B2        :\ E8A9= 20 B2 E8     2h
JMP LE752        :\ E8AC= 4C 52 E7    LRg
 
.LE8AF
JMP LE784        :\ E8AF= 4C 84 E7    L.g
 
.LE8B2
JSR LE513        :\ E8B2= 20 13 E5     .e
BCS LE8AF        :\ E8B5= B0 F8       0x
CPY #&02         :\ E8B7= C0 02       @.
LDY &FA          :\ E8B9= A4 FA       $z
LDX #&00         :\ E8BB= A2 00       ".
STX &FA          :\ E8BD= 86 FA       .z
INC &EF          :\ E8BF= E6 EF       fo
INC &F0          :\ E8C1= E6 F0       fp
BCS LE910        :\ E8C3= B0 4B       0K
JSR LE654        :\ E8C5= 20 54 E6     Tf
JSR LE660        :\ E8C8= 20 60 E6     `f
.LE8CB
BIT LFE0D        :\ E8CB= 2C 0D FE    ,.~
BVC LE8CB        :\ E8CE= 50 FB       P{
LDA LFE04        :\ E8D0= AD 04 FE    -.~
INC LDC03,X      :\ E8D3= FE 03 DC    ~.\
LDA #&F3         :\ E8D6= A9 F3       )s
STA LDC00,X      :\ E8D8= 9D 00 DC    ..\
LDA LDC01,X      :\ E8DB= BD 01 DC    =.\
PHA              :\ E8DE= 48          H
LDA #&FB         :\ E8DF= A9 FB       ){
STA LDC00,X      :\ E8E1= 9D 00 DC    ..\
LDA LDC01,X      :\ E8E4= BD 01 DC    =.\
PHA              :\ E8E7= 48          H
LDA #&F5         :\ E8E8= A9 F5       )u
STA LDC00,X      :\ E8EA= 9D 00 DC    ..\
DEC LDC03,X      :\ E8ED= DE 03 DC    ^.\
PLA              :\ E8F0= 68          h
STA (&FA),Y      :\ E8F1= 91 FA       .z
INY              :\ E8F3= C8          H
LDA #&F1         :\ E8F4= A9 F1       )q
STA LDC00,X      :\ E8F6= 9D 00 DC    ..\
PLA              :\ E8F9= 68          h
STA (&FA),Y      :\ E8FA= 91 FA       .z
INY              :\ E8FC= C8          H
BNE LE8CB        :\ E8FD= D0 CC       PL
JSR LE770        :\ E8FF= 20 70 E7     pg
DEC &EF          :\ E902= C6 EF       Fo
BNE LE8CB        :\ E904= D0 C5       PE
DEC &F0          :\ E906= C6 F0       Fp
BNE LE8CB        :\ E908= D0 C1       PA
LDA #&F5         :\ E90A= A9 F5       )u
STA LDC00,X      :\ E90C= 9D 00 DC    ..\
RTS              :\ E90F= 60          `
 
.LE910
JSR LE5A4        :\ E910= 20 A4 E5     $e
STA LDB10,X      :\ E913= 9D 10 DB    ..[
.LE916
LDA LFE0D        :\ E916= AD 0D FE    -.~
AND #&40         :\ E919= 29 40       )@
BEQ LE916        :\ E91B= F0 F9       py
LDA LFE04        :\ E91D= AD 04 FE    -.~
LDA #&00         :\ E920= A9 00       ).
STA (&FA),Y      :\ E922= 91 FA       .z
LDA LDB10,X      :\ E924= BD 10 DB    =.[
STA LDB10,X      :\ E927= 9D 10 DB    ..[
INY              :\ E92A= C8          H
STA (&FA),Y      :\ E92B= 91 FA       .z
INY              :\ E92D= C8          H
BNE LE916        :\ E92E= D0 E6       Pf
JSR LE770        :\ E930= 20 70 E7     pg
DEC &EF          :\ E933= C6 EF       Fo
BNE LE916        :\ E935= D0 DF       P_
DEC &F0          :\ E937= C6 F0       Fp
BNE LE916        :\ E939= D0 DB       P[
RTS              :\ E93B= 60          `
 
BBS 7,&FF,&E93E  :\ E93C= FF FF FF    ...
BBS 7,&20,&E97E  :\ E93F= FF


\ OSARGS
\ ======
.LE940
JSR LEA3C:PHA       :\ Check if Serial available, save A
LDA #&FB:JSR LF54A  :\ Send command &FB to Serial port
TYA:JSR LF53C       :\ Send Y to Serial port
PLA:JSR LF53C       :\ Send A to Serial port
STY &B0             :\ Save Y in FS workspace
LDY #&03            :\ Count 4 bytes to send
.LE955
LDA &00,X:JSR LF53C :\ Send byte from data word, lo..hi
INX:DEY:BPL LE955   :\ Loop for four bytes
JSR LEA44
JSR LF565:PHA       :\ Get returned A
LDY #&03            :\ Count 4 bytes to receive
.LE967
JSR LF565           :\ Get byte from serial port
DEX:STA &00,X       :\ Store byte in data word hi..lo
DEY:BPL LE967       :\ Loop for four bytes
LDY &B0             :\ Restore Y back
LSR &0245
PLA:RTS             :\ Get returned A back and return
 
\ OSBGET
\ ======
.LE977
JSR LEA3C           :\ Check if Serial available
LDA #&FD:JSR LF54A  :\ Send command &FD to serial port
TYA:JSR LF53C       :\ Send Y to serial port
JSR LEA44
JSR LF565:PHA
JSR LF565        :\ E98A= 20 65 F5     eu
LSR &0245        :\ E98D= 4E 45 02    NE.
ASL A            :\ E990= 0A          .
PLA              :\ E991= 68          h
RTS              :\ E992= 60          `
 
\ OSBPUT
\ ======
.LE993
JSR LEA3C:PHA       :\ Check is Serial available, save A
LDA #&FE:JSR LF54A  :\ Send command &FE to serial port
TYA:JSR LF53C       :\ Send Y to serial port
PLA:JMP LF53C       :\ Send A to serial port

\ OSFIND
\ ======
.LE9A4 
JSR LEA3C:PHA       :\ Check if serial available, save A
LDA #&FC:JSR LF54A  :\ Send command &FC to serial port
PLA:JSR LF53C       :\ Send A to command port
BEQ LE9C0        :\ E9B1= F0 0D       p.
JSR LEA2B        :\ E9B3= 20 2B EA     +j
JSR LEA44        :\ E9B6= 20 44 EA     Dj
JSR LF565        :\ E9B9= 20 65 F5     eu
LSR &0245        :\ E9BC= 4E 45 02    NE.
RTS              :\ E9BF= 60          `
 
.LE9C0
TYA:JSR LF53C       :\ Send Y to serial port
LDA #&00:RTS        :\ Restore A=0 and return
 

\ Send OSBYTE via serial port
\ ===========================
.LE9C7
LSR &0245           :\ Do something
.LE9CA
LDA #&FF:RTS        :\ Return with A=&FF - Failed
 
\ Send OSBYTE in &EF/F0/F1 to Serial port
\ ---------------------------------------
.LE9CD
BIT &0247:BMI LE9CA :\ If b7=1, exit failed
LDA &EF             :\ Get A paameter
LDY &F1:LDX &F0     :\ Get X,Y parameters
.LE9D8
PHA:CLI             :\ Save A, enable IRQs
LDA #&07:JSR LF54A  :\ Send command &07 to SerOut
PLA:JSR LF53C       :\ Send A to SerOut
TXA:JSR LF53C       :\ Send X to SerOut
TYA:JSR LF53C       :\ Send Y to SerOut
JSR LEA4F:BNE LE9C7 :\ If something<>0, quit
JSR LF565:TAX       :\ Get returned X
JSR LF565:TAY       :\ Get returned Y
JSR LF565           :\ Get returned Cy to A.b7
LSR &0245           :\ Do something to &0245
ROL A               :\ Move b7 to Cy
SEI:STX &F0         :\ Disable IRQs, store X
LDA #&00:RTS        :\ Return with A=0 - Ok
 
\ FSC
\ ===
.LEA05
CMP #&08:BEQ LEA3B  :\ Command starting, exit
.LEA09
CMP #&06:BEQ LEA3B  :\ New FS starting, exit
.LEA0D
JSR LEA3C           :\ Check serial available
CMP #&05:BEQ LEA28  :\ *CAT
CMP #&03:BEQ LEA28  :\ Unknown command
CMP #&00:BEQ LEA24  :\ *OPT
CMP #&01:BNE LEA41  :\ Not =EOF, give 'Bad command'
LDA #&7F:BNE LE9D8  :\ Do =EOF via OSBYTE 127
.LEA24
LDA #&8B:BNE LE9D8  :\ Do *OPT via OSBYTE 139

\ *CAT (A=5), *command (A=3)
.LEA28
JSR LF54A             :\ Send command to serial port
.LEA2B
STX &B4:STY &B5       :\ Store XY pointer to string
LDY #&FF              :\ Point to before string
.LEA31
INY                   :\ Point to current character
LDA (&B4),Y:JSR LF53C :\ Send character to serial port
CMP #&0D:BNE LEA31    :\ Loop until <cr> sent
.LEA3B
RTS
 
\ Check if serial commands can be sent
\ ====================================
.LEA3C
BIT &0247:BPL LEA3B :\ If b7=0, exit
.LEA41
JMP LFC05           :\ Jump to 'Bad command' error

 
.LEA44
JSR LEA4F        :\ EA44= 20 4F EA     Oj
BEQ LEA58        :\ EA47= F0 0F       p.
LSR &0245        :\ EA49= 4E 45 02    NE.
JMP LEF9E        :\ EA4C= 4C 9E EF    L.o
 
.LEA4F
SEC              :\ EA4F= 38          8
ROL &0245        :\ EA50= 2E 45 02    .E.
.LEA53
JSR LF565        :\ EA53= 20 65 F5     eu
BCC LEA53        :\ EA56= 90 FB       .{
.LEA58
RTS              :\ EA58= 60          `
 
\ OSGBPB
\ ======
.LEA59
JSR LEA3C           :\ Check if serial available
STA &B0             :\ Save A
STX &B1:STY &B2     :\ Save pointer to control block
LDA #&FA:JSR LF54A  :\ Send command &FA to serial port
LDA &B0:JSR LF53C   :\ Send A to serial port
LDY #&0C            :\ Control block is 13 bytes long
.LEA6E
LDA (&B1),Y:STA &00B3,Y :\ Copy control block to workspace
JSR LF53C               :\ Send control block to serial port
DEY:BPL LEA6E           :\ Loop for 13 bytes
INY:LDA &B0             :\ Y=0, Get A back
CMP #&03:BCC LEA9B      :\ If WriteData, jump...
                        :\ ReadData
JSR LEA44
.LEA83
JSR LF565:BCS LEAAB     :\ Get returned byte, jump if ended
STA (&B4),Y             :\ Store at data address
JSR LEBEA:BCC LEA83     :\ Inc addr, loop for next

.LEA8F
DEC &B9                 :\ Dec num.hi
.LEA91
DEC &B8                 :\ Dec num.lo
LDA (&B4),Y:JSR LF53C   :\ Send byte from data address
JSR LEBEA               :\ Inc addr

.LEA9B
LDA &B8:BNE LEA91       :\ If num.lo<>0, jump to send bytes
LDA &B9:BNE LEA8F       :\ If num.hi<>0. jump to send bytes
LDA #&04:JSR LF54A      :\ Num=0, send command &04 to serial port
JSR LEA44

.LEAAB
LDY #&0C              :\ Control block is 13 bytes long
.LEAAD
JSR LF565:STA (&B1),Y :\ Get byte and store in control block
DEY:BPL LEAAD         :\ Loop for whole control block
JSR LF565             :\ Get returned Cy
LSR &0245
ASL A                 :\ Move to Cy
LDA &B0:LDY &B2:RTS   :\ Get A and Y back, and return
 
.LEAC1
LDA #&FF         :\ EAC1= A9 FF       ).
STX &F2          :\ EAC3= 86 F2       .r
STY &F3          :\ EAC5= 84 F3       .s
STX &02EE        :\ EAC7= 8E EE 02    .n.
STY &02EF        :\ EACA= 8C EF 02    .o.
PHA              :\ EACD= 48          H
LDX #&02         :\ EACE= A2 02       ".
JSR LFC60        :\ EAD0= 20 60 FC     `|
LDY #&FF         :\ EAD3= A0 FF        .
STY &02F4        :\ EAD5= 8C F4 02    .t.
INY              :\ EAD8= C8          H
CLC              :\ EAD9= 18          .
JSR LFAED        :\ EADA= 20 ED FA     mz
.LEADD
JSR LFAFE        :\ EADD= 20 FE FA     ~z
BCC LEADD        :\ EAE0= 90 FB       .{
PLA              :\ EAE2= 68          h
PHA              :\ EAE3= 48          H
BEQ LEAF8        :\ EAE4= F0 12       p.
JSR LFC13        :\ EAE6= 20 13 FC     .|
BNE LEB2A        :\ EAE9= D0 3F       P?
BCC LEAF0        :\ EAEB= 90 03       ..
INC &02F4        :\ EAED= EE F4 02    nt.
.LEAF0
LDX #&EE         :\ EAF0= A2 EE       "n
LDY #&02         :\ EAF2= A0 02        .
PLA              :\ EAF4= 68          h
JMP OSFILE       :\ EAF5= 4C DD FF    L].
 
.LEAF8
LDX #&0A         :\ EAF8= A2 0A       ".
JSR LFC13        :\ EAFA= 20 13 FC     .|
BCC LEB2A        :\ EAFD= 90 2B       .+
LDX #&0E         :\ EAFF= A2 0E       ".
JSR LFC13        :\ EB01= 20 13 FC     .|
BCC LEB2A        :\ EB04= 90 24       .$
PHP              :\ EB06= 08          .
LDX #&03         :\ EB07= A2 03       ".
.LEB09
LDA &02F8,X      :\ EB09= BD F8 02    =x.
STA &02F4,X      :\ EB0C= 9D F4 02    .t.
STA &02F0,X      :\ EB0F= 9D F0 02    .p.
DEX              :\ EB12= CA          J
BPL LEB09        :\ EB13= 10 F4       .t
PLP              :\ EB15= 28          (
BEQ LEAF0        :\ EB16= F0 D8       pX
LDX #&06         :\ EB18= A2 06       ".
JSR LFC13        :\ EB1A= 20 13 FC     .|
BCC LEB2A        :\ EB1D= 90 0B       ..
BEQ LEAF0        :\ EB1F= F0 CF       pO
LDX #&02         :\ EB21= A2 02       ".
JSR LFC13        :\ EB23= 20 13 FC     .|
BCC LEB2A        :\ EB26= 90 02       ..
BEQ LEAF0        :\ EB28= F0 C6       pF
.LEB2A
BRK              :\ EB2A= 00          .
EQUB &FC         :\ EB2B= FC          |
EQUB &42         :\ EB2C= 42          B
ADC (&64,X)      :\ EB2D= 61 64       ad
JSR &6461        :\ EB2F= 20 61 64     ad
STZ &72          :\ EB32= 64 72       dr
ADC &73          :\ EB34= 65 73       es
EQUB &73         :\ EB36= 73          s
BRK              :\ EB37= 00          .

\ OSFILE
\ ======
.LEB38
JSR LEA3C:PHA
STX &B4:STY &B5          :\ Save XY pointer to control block
LDY #&11                 :\ Control block is &12 bytes long
.LEB42
LDA (&B4),Y:STA &02EE,Y  :\ Copy control block to system control block
DEY:BPL LEB42
LDX &02EE:LDY &02EF      :\ Get filename pointer
PLA:BEQ LEBB5            :\ If &00, jump to save
CMP #&FF:BEQ LEB5A       :\ If &FF, jump to load
JMP LFC05                :\ Jump to 'Bad command' error
 
\ OSFILE &FF - LOAD
\ =================
.LEB5A
JSR LEA28        :\ EB5A= 20 28 EA     (j
JSR LEA44        :\ EB5D= 20 44 EA     Dj
LDA &02F4        :\ EB60= AD F4 02    -t.
STA &B0          :\ EB63= 85 B0       .0
LDY #&0F         :\ EB65= A0 0F        .
.LEB67
JSR LF565        :\ EB67= 20 65 F5     eu
CPY #&05         :\ EB6A= C0 05       @.
BCS LEB72        :\ EB6C= B0 04       0.
LDX &B0          :\ EB6E= A6 B0       &0
BEQ LEB75        :\ EB70= F0 03       p.
.LEB72
STA &02F0,Y      :\ EB72= 99 F0 02    .p.
.LEB75
DEY              :\ EB75= 88          .
BPL LEB67        :\ EB76= 10 EF       .o
LDA &02F0        :\ EB78= AD F0 02    -p.
STA &B4          :\ EB7B= 85 B4       .4
LDA &02F1        :\ EB7D= AD F1 02    -q.
STA &B5          :\ EB80= 85 B5       .5
JMP LEB97        :\ EB82= 4C 97 EB    L.k
 
.LEB85
LDY #&00         :\ EB85= A0 00        .
STA (&B4),Y      :\ EB87= 91 B4       .4
JSR LEBEA        :\ EB89= 20 EA EB     jk
LDA &02F8        :\ EB8C= AD F8 02    -x.
BNE LEB94        :\ EB8F= D0 03       P.
DEC &02F9        :\ EB91= CE F9 02    Ny.
.LEB94
DEC &02F8        :\ EB94= CE F8 02    Nx.
.LEB97
JSR LF565        :\ EB97= 20 65 F5     eu
BCC LEB85        :\ EB9A= 90 E9       .i
LSR &0245        :\ EB9C= 4E 45 02    NE.
LDA &02F8        :\ EB9F= AD F8 02    -x.
ORA &02F9        :\ EBA2= 0D F9 02    .y.
BNE LEBA8        :\ EBA5= D0 01       P.
RTS              :\ EBA7= 60          `
 
.LEBA8
BRK              :\ EBA8= 00          .
BBS 7,&4C,&EC1B  :\ EBA9= FF 4C 6F    .Lo
ADC (&64,X)      :\ EBAC= 61 64       ad
JSR &7265        :\ EBAE= 20 65 72     er
ADC (&6F)        :\ EBB1= 72 6F       ro
ADC (&00)        :\ EBB3= 72 00       r.

\ OSFILE &00 - SAVE
\ =================
.LEBB5
JSR LEA28        :\ EBB5= 20 28 EA     (j
LDY #&0F         :\ EBB8= A0 0F        .
.LEBBA
LDA &02F0,Y      :\ EBBA= B9 F0 02    9p.
JSR LF53C        :\ EBBD= 20 3C F5     <u
DEY              :\ EBC0= 88          .
BPL LEBBA        :\ EBC1= 10 F7       .w
LDA &02F8        :\ EBC3= AD F8 02    -x.
STA &B4          :\ EBC6= 85 B4       .4
LDA &02F9        :\ EBC8= AD F9 02    -y.
STA &B5          :\ EBCB= 85 B5       .5
.LEBCD
LDY #&00         :\ EBCD= A0 00        .
LDA (&B4),Y      :\ EBCF= B1 B4       14
JSR LF53C        :\ EBD1= 20 3C F5     <u
JSR LEBEA        :\ EBD4= 20 EA EB     jk
LDA &B4          :\ EBD7= A5 B4       %4
CMP &02FC        :\ EBD9= CD FC 02    M|.
BNE LEBCD        :\ EBDC= D0 EF       Po
LDA &B5          :\ EBDE= A5 B5       %5
CMP &02FD        :\ EBE0= CD FD 02    M}.
BNE LEBCD        :\ EBE3= D0 E8       Ph
LDA #&04:JMP LF54A  :\ Send command &04 to serial port
 
.LEBEA
INC &B4          :\ EBEA= E6 B4       f4
BNE LEBF0        :\ EBEC= D0 02       P.
INC &B5          :\ EBEE= E6 B5       f5
.LEBF0
RTS              :\ EBF0= 60          `
 
.LEBF1
CMP #&8B         :\ EBF1= C9 8B       I.
BCC LEC12        :\ EBF3= 90 1D       ..
CMP #&90         :\ EBF5= C9 90       I.
BCS LEC12        :\ EBF7= B0 19       0.
LDX &027D        :\ EBF9= AE 7D 02    .}.
CPX #&02         :\ EBFC= E0 02       `.
BCS LEC12        :\ EBFE= B0 12       0.
SEC              :\ EC00= 38          8
SBC #&04         :\ EC01= E9 04       i.
CPX #&01         :\ EC03= E0 01       `.
BEQ LEC10        :\ EC05= F0 09       p.
TAX              :\ EC07= AA          *
LDA #&87         :\ EC08= A9 87       ).
JSR OSBYTE       :\ EC0A= 20 F4 FF     t.
TXA              :\ EC0D= 8A          .
BEQ LEC40        :\ EC0E= F0 30       p0
.LEC10
CLC              :\ EC10= 18          .
RTS              :\ EC11= 60          `
 
.LEC12
TAX              :\ EC12= AA          *
AND #&0F         :\ EC13= 29 0F       ).
STA &02C9        :\ EC15= 8D C9 02    .I.
TXA              :\ EC18= 8A          .
LSR A            :\ EC19= 4A          J
LSR A            :\ EC1A= 4A          J
LSR A            :\ EC1B= 4A          J
LSR A            :\ EC1C= 4A          J
AND #&07         :\ EC1D= 29 07       ).
EOR #&04         :\ EC1F= 49 04       I.
TAY              :\ EC21= A8          (
LDA &026D,Y      :\ EC22= B9 6D 02    9m.
BEQ LEC40        :\ EC25= F0 19       p.
CMP #&01         :\ EC27= C9 01       I.
BEQ LEC31        :\ EC29= F0 06       p.
CLC              :\ EC2B= 18          .
ADC &02C9        :\ EC2C= 6D C9 02    mI.
CLC              :\ EC2F= 18          .
RTS              :\ EC30= 60          `
 
.LEC31
LDY &02C9        :\ EC31= AC C9 02    ,I.
JSR LECF6        :\ EC34= 20 F6 EC     vl
STA &0268        :\ EC37= 8D 68 02    .h.
LDA &0B00,Y      :\ EC3A= B9 00 0B    9..
STA &02C9        :\ EC3D= 8D C9 02    .I.
.LEC40
SEC              :\ EC40= 38          8
RTS              :\ EC41= 60          `
 
.LEC42
LDA &0268        :\ EC42= AD 68 02    -h.
BEQ LEC40        :\ EC45= F0 F9       py
LDY &02C9        :\ EC47= AC C9 02    ,I.
LDA &0B01,Y      :\ EC4A= B9 01 0B    9..
INC &02C9        :\ EC4D= EE C9 02    nI.
DEC &0268        :\ EC50= CE 68 02    Nh.
CLC              :\ EC53= 18          .
RTS              :\ EC54= 60          `
 
JSR LFB5D        :\ EC55= 20 5D FB     ]{
BCC LECA0        :\ EC58= 90 46       .F
CPX #&10         :\ EC5A= E0 10       `.
BCS LECA0        :\ EC5C= B0 42       0B
JSR LFB49        :\ EC5E= 20 49 FB     I{
PHP              :\ EC61= 08          .
LDX &0B10        :\ EC62= AE 10 0B    ...
TYA              :\ EC65= 98          .
PHA              :\ EC66= 48          H
JSR LECAA        :\ EC67= 20 AA EC     *l
PLA              :\ EC6A= 68          h
TAY              :\ EC6B= A8          (
PLP              :\ EC6C= 28          (
BEQ LEC9F        :\ EC6D= F0 30       p0
SEC              :\ EC6F= 38          8
JSR LFAED        :\ EC70= 20 ED FA     mz
.LEC73
JSR LFAFE        :\ EC73= 20 FE FA     ~z
BCS LEC80        :\ EC76= B0 08       0.
INX              :\ EC78= E8          h
BEQ LECA0        :\ EC79= F0 25       p%
STA &0B00,X      :\ EC7B= 9D 00 0B    ...
BCC LEC73        :\ EC7E= 90 F3       .s
.LEC80
BNE LECA0        :\ EC80= D0 1E       P.
JSR LECAA        :\ EC82= 20 AA EC     *l
PHP              :\ EC85= 08          .
SEI              :\ EC86= 78          x
LDX #&10         :\ EC87= A2 10       ".
.LEC89
CPX &E6          :\ EC89= E4 E6       df
BEQ LEC9B        :\ EC8B= F0 0E       p.
LDA &0B00,X      :\ EC8D= BD 00 0B    =..
CMP &0B00,Y      :\ EC90= D9 00 0B    Y..
BNE LEC9B        :\ EC93= D0 06       P.
LDA &0B10        :\ EC95= AD 10 0B    -..
STA &0B00,X      :\ EC98= 9D 00 0B    ...
.LEC9B
DEX              :\ EC9B= CA          J
BPL LEC89        :\ EC9C= 10 EB       .k
PLP              :\ EC9E= 28          (
.LEC9F
RTS              :\ EC9F= 60          `
 
.LECA0
BRK              :\ ECA0= 00          .
EQUB &FB         :\ ECA1= FB          {
EQUB &42         :\ ECA2= 42          B
ADC (&64,X)      :\ ECA3= 61 64       ad
JSR &656B        :\ ECA5= 20 6B 65     ke
ADC &0800,Y      :\ ECA8= 79 00 08    y..
SEI              :\ ECAB= 78          x
TXA              :\ ECAC= 8A          .
PHA              :\ ECAD= 48          H
LDY &E6          :\ ECAE= A4 E6       $f
JSR LECF6        :\ ECB0= 20 F6 EC     vl
LDA &0B00,Y      :\ ECB3= B9 00 0B    9..
TAY              :\ ECB6= A8          (
CLC              :\ ECB7= 18          .
ADC &FB          :\ ECB8= 65 FB       e{
TAX              :\ ECBA= AA          *
STA &FA          :\ ECBB= 85 FA       .z
PLA              :\ ECBD= 68          h
SEC              :\ ECBE= 38          8
SBC &FA          :\ ECBF= E5 FA       ez
STA &FA          :\ ECC1= 85 FA       .z
BEQ LECD1        :\ ECC3= F0 0C       p.
.LECC5
LDA &0B01,X      :\ ECC5= BD 01 0B    =..
STA &0B01,Y      :\ ECC8= 99 01 0B    ...
INY              :\ ECCB= C8          H
INX              :\ ECCC= E8          h
DEC &FA          :\ ECCD= C6 FA       Fz
BNE LECC5        :\ ECCF= D0 F4       Pt
.LECD1
TYA              :\ ECD1= 98          .
PHA              :\ ECD2= 48          H
LDY &E6          :\ ECD3= A4 E6       $f
LDX #&10         :\ ECD5= A2 10       ".
.LECD7
LDA &0B00,X      :\ ECD7= BD 00 0B    =..
CMP &0B00,Y      :\ ECDA= D9 00 0B    Y..
BCC LECE6        :\ ECDD= 90 07       ..
BEQ LECE6        :\ ECDF= F0 05       p.
SBC &FB          :\ ECE1= E5 FB       e{
STA &0B00,X      :\ ECE3= 9D 00 0B    ...
.LECE6
DEX              :\ ECE6= CA          J
BPL LECD7        :\ ECE7= 10 EE       .n
LDA &0B10        :\ ECE9= AD 10 0B    -..
STA &0B00,Y      :\ ECEC= 99 00 0B    ...
PLA              :\ ECEF= 68          h
STA &0B10        :\ ECF0= 8D 10 0B    ...
TAX              :\ ECF3= AA          *
PLP              :\ ECF4= 28          (
RTS              :\ ECF5= 60          `
 
.LECF6
PHP              :\ ECF6= 08          .
SEI              :\ ECF7= 78          x
LDA &0B10        :\ ECF8= AD 10 0B    -..
SEC              :\ ECFB= 38          8
SBC &0B00,Y      :\ ECFC= F9 00 0B    y..
STA &FB          :\ ECFF= 85 FB       .{
TXA              :\ ED01= 8A          .
PHA              :\ ED02= 48          H
LDX #&10         :\ ED03= A2 10       ".
.LED05
LDA &0B00,X      :\ ED05= BD 00 0B    =..
SEC              :\ ED08= 38          8
SBC &0B00,Y      :\ ED09= F9 00 0B    y..
BCC LED16        :\ ED0C= 90 08       ..
BEQ LED16        :\ ED0E= F0 06       p.
CMP &FB          :\ ED10= C5 FB       E{
BCS LED16        :\ ED12= B0 02       0.
STA &FB          :\ ED14= 85 FB       .{
.LED16
DEX              :\ ED16= CA          J
BPL LED05        :\ ED17= 10 EC       .l
PLA              :\ ED19= 68          h
TAX              :\ ED1A= AA          *
LDA &FB          :\ ED1B= A5 FB       %{
PLP              :\ ED1D= 28          (
RTS              :\ ED1E= 60          `
 
LDX #&00         :\ ED1F= A2 00       ".
LDA #&10         :\ ED21= A9 10       ).
.LED23
STA &0B00,X      :\ ED23= 9D 00 0B    ...
DEX              :\ ED26= CA          J
BNE LED23        :\ ED27= D0 FA       Pz
RTS              :\ ED29= 60          `
 
Byte129 - INKEY
===============
ED2A 98          .    TYA		Check high byte
ED2B 30 13       0.   BMI &ED40		Jump with negative INKEY
ED2D 58          X    CLI		Allow IRQs
ED2E 8E B1 02    .�.  STX &02B1		Store countdown value
STY &02B2        :\ ED31= 8C B2 02    .2.
LDA #&FF         :\ ED34= A9 FF       ).
JSR LF311        :\ ED36= 20 11 F3     .s
BCS LED3E        :\ ED39= B0 03       0.
TAX              :\ ED3B= AA          *
LDA #&00         :\ ED3C= A9 00       ).
.LED3E
TAY              :\ ED3E= A8          (
RTS              :\ ED3F= 60          `
 
Negative INKEY
--------------
.LED40
ED40 4C 77 F8    Lw�  JMP &F877		Jump to unsupported OSBYTE

\ OSWord 14 (&0E) - Read block from M3002 RTC
\ ===========================================
\ Reads 16 bytes from M3002, returning them in the control block, high to low
.LED43
STX &E8:STY &E9:CLI   :\ Point &E8/9 to control block, enable IRQs
.LED48
LDY #&0F              :\ 16 bytes to fetch
.LED4A
JSR LEDA5             :\ Wait for zero bytes from M3002
JSR LED77:STA (&E8),Y :\ Fetch type nybbles from M3002 and store them
JSR LED9F:BNE LED48   :\ If not zero byte, jump back to restart all 16 bytes
DEY:BPL LED4A         :\ Loop for all 16 bytes
RTS

\ OsWord 15 (&0F) - Write block to M3002 RTC
\ ==========================================
\ Write 16 bytes to M3002, high to low
.LED5B
STX &E8:STY &E9:CLI   :\ Point &E8/9 to control block, enable IRQs
.LED60
LDY #&0F              :\ Loop through 16-byte control block
.LED62
JSR LEDA5:LDA (&E8),Y :\ Wait for zero from M3004, fetch byte from block
CMP #&FF:BEQ LED73    :\ If byte=&FF, skip to next byte
JSR LED8D             :\ Write byte to M3002
JSR LED9F:BNE LED60   :\ If result no zero, jump back to restart all 16 bytes
.LED73
DEY:BPL LED62:RTS     :\ Loop for all 16 bytes

\ Read a byte from M3004 RTC as two nybble reads
\ ----------------------------------------------
.LED77
SEI:STY LFE18             :\ Write register number in Y to M3002 RTC
LDA LFE18:ASL A:ASL A     :\ Get a nybble, move it to b7-b4
ASL A:ASL A:STA &FA       :\ Store top nybble in &FA
LDA LFE18:AND #&0F        :\ Get another nybble
ORA &FA:CLI:RTS           :\ Merge with top nybble and return

\ Write a byte from M3004 RTC as two nybble writes
\ ------------------------------------------------
.LED8D
SEI:STY LFE18             :\ Write register number in Y to M3002 RTS
PHA:LSR A:LSR A:LSR A     :\ Get top nybble
LSR A:STA LFE18           :\ Write top nybble
PLA:STA LFE18:CLI:RTS     :\ Write bottom nybble and return

.LED9F
LDA LFE18:AND #&0F:RTS    :\ Get byte from M3002

\ Wait for zero byte from M3002
\ -----------------------------
.LEDA5
JSR LED9F:BNE LEDA5       :\ Wait for zero byte from M3002
JSR LEDB3                 :\ Wait for 7 loops
JSR LED9F:BNE LEDA5       :\ Wait for zero byte again
RTS

.LEDB3
LDA #&07
.LEDB5
SEC:SBC #&01:BNE LEDB5:RTS

.LEDBB
LDX #&EE         :\ EDBB= A2 EE       "n
LDY #&02         :\ EDBD= A0 02        .
JSR LED43        :\ EDBF= 20 43 ED     Cm
LDA &02EE        :\ EDC2= AD EE 02    -n.
RTS              :\ EDC5= 60          `
 
.LEDC6
JSR LED9F        :\ EDC6= 20 9F ED     .m
BNE LEE00        :\ EDC9= D0 35       P5
JSR LEDB3        :\ EDCB= 20 B3 ED     3m
JSR LED9F        :\ EDCE= 20 9F ED     .m
BNE LEE00        :\ EDD1= D0 2D       P-
LDA #&0F         :\ EDD3= A9 0F       ).
STA LFE18        :\ EDD5= 8D 18 FE    ..~
.LEDD8
LDY LFE18        :\ EDD8= AC 18 FE    ,.~
LDX LFE18        :\ EDDB= AE 18 FE    ..~
TXA              :\ EDDE= 8A          .
AND &0277        :\ EDDF= 2D 77 02    -w.
AND #&0C         :\ EDE2= 29 0C       ).
BEQ LEE00        :\ EDE4= F0 1A       p.
JSR LED9F        :\ EDE6= 20 9F ED     .m
BNE LEE00        :\ EDE9= D0 15       P.
LDA #&0F         :\ EDEB= A9 0F       ).
STA LFE18        :\ EDED= 8D 18 FE    ..~
STY LFE18        :\ EDF0= 8C 18 FE    ..~
TXA              :\ EDF3= 8A          .
AND #&03         :\ EDF4= 29 03       ).
STA LFE18        :\ EDF6= 8D 18 FE    ..~
LDY #&08         :\ EDF9= A0 08        .
JSR LFC8F        :\ EDFB= 20 8F FC     .|
CLC              :\ EDFE= 18          .
RTS              :\ EDFF= 60          `
 
.LEE00
SEC              :\ EE00= 38          8
RTS              :\ EE01= 60          `
 
.LEE02
CPX &9D          :\ EE02= E4 9D       d.
BCS LEE26        :\ EE04= B0 20       0 
CPY #&05         :\ EE06= C0 05       @.
BCS LEE3A        :\ EE08= B0 30       00
LDA LEE48,Y      :\ EE0A= B9 48 EE    9Hn
PHA              :\ EE0D= 48          H
JSR LEE4D        :\ EE0E= 20 4D EE     Mn
TAX              :\ EE11= AA          *
PLA              :\ EE12= 68          h
.LEE13
STA &EF          :\ EE13= 85 EF       .o
ROR A            :\ EE15= 6A          j
BIT &EF          :\ EE16= 24 EF       $o
BMI LEE27        :\ EE18= 30 0D       0.
BVS LEE2C        :\ EE1A= 70 10       p.
BCS LEE31        :\ EE1C= B0 13       0.
.LEE1E
TXA              :\ EE1E= 8A          .
EOR #&FF         :\ EE1F= 49 FF       I.
AND (&9E),Y      :\ EE21= 31 9E       1.
.LEE23
STA (&9E),Y      :\ EE23= 91 9E       ..
.LEE25
CLC              :\ EE25= 18          .
.LEE26
RTS              :\ EE26= 60          `
 
.LEE27
TXA              :\ EE27= 8A          .
EOR (&9E),Y      :\ EE28= 51 9E       Q.
BCC LEE23        :\ EE2A= 90 F7       .w
.LEE2C
JSR LEE35        :\ EE2C= 20 35 EE     5n
BCS LEE25        :\ EE2F= B0 F4       0t
.LEE31
INY              :\ EE31= C8          H
INY              :\ EE32= C8          H
BCS LEE1E        :\ EE33= B0 E9       0i
.LEE35
TXA              :\ EE35= 8A          .
ORA (&9E),Y      :\ EE36= 11 9E       ..
BVS LEE23        :\ EE38= 70 E9       pi
.LEE3A
BNE LEE26        :\ EE3A= D0 EA       Pj
JSR LEE4D        :\ EE3C= 20 4D EE     Mn
LDX #&00         :\ EE3F= A2 00       ".
AND (&9E),Y      :\ EE41= 31 9E       1.
BNE LEE25        :\ EE43= D0 E0       P`
INX              :\ EE45= E8          h
BNE LEE25        :\ EE46= D0 DD       P]
.LEE48
EOR (&00,X)      :\ EE48= 41 00       A.
ORA (&40,X)      :\ EE4A= 01 40       .@
BRA LEDD8        :\ EE4C= 80 8A       ..
 
AND #&F0         :\ EE4E= 29 F0       )p
TAY              :\ EE50= A8          (
TXA              :\ EE51= 8A          .
AND #&08         :\ EE52= 29 08       ).
BNE LEE57        :\ EE54= D0 01       P.
INY              :\ EE56= C8          H
.LEE57
TXA              :\ EE57= 8A          .
AND #&07         :\ EE58= 29 07       ).
TAX              :\ EE5A= AA          *
LDA LF4C4,X      :\ EE5B= BD C4 F4    =Dt
RTS              :\ EE5E= 60          `
 
.LEE5F
LDX &9E          :\ EE5F= A6 9E       &.
LDY &9F          :\ EE61= A4 9F       $.
RTS              :\ EE63= 60          `
 
\ OSBYTE &17
\ ==========
.LEE64
TXA              :\ EE64= 8A          .
ORA &F1          :\ EE65= 05 F1       .q
BEQ LEE5F        :\ EE67= F0 F6       pv
STX &FA          :\ EE69= 86 FA       .z
STY &FB          :\ EE6B= 84 FB       .{
LDX #&00         :\ EE6D= A2 00       ".
.LEE6F
JSR LEE9B        :\ EE6F= 20 9B EE     .n
BNE LEE88        :\ EE72= D0 14       P.
INX              :\ EE74= E8          h
LDA &FB          :\ EE75= A5 FB       %{
CMP #&FE         :\ EE77= C9 FE       I~
BEQ LEE88        :\ EE79= F0 0D       p.
CLC              :\ EE7B= 18          .
LDA &FA          :\ EE7C= A5 FA       %z
ADC #&10         :\ EE7E= 69 10       i.
BCS LEE88        :\ EE80= B0 06       0.
STA &FA          :\ EE82= 85 FA       .z
CPX #&0F         :\ EE84= E0 0F       `.
BCC LEE6F        :\ EE86= 90 E7       .g
.LEE88
TXA              :\ EE88= 8A          .
BEQ LEE9A        :\ EE89= F0 0F       p.
ASL A            :\ EE8B= 0A          .
ASL A            :\ EE8C= 0A          .
ASL A            :\ EE8D= 0A          .
ASL A            :\ EE8E= 0A          .
TAX              :\ EE8F= AA          *
LDA &F0          :\ EE90= A5 F0       %p
STA &9E          :\ EE92= 85 9E       ..
LDA &F1          :\ EE94= A5 F1       %q
STA &9F          :\ EE96= 85 9F       ..
STX &9D          :\ EE98= 86 9D       ..
.LEE9A
RTS              :\ EE9A= 60          `
 
.LEE9B
LDY #&06         :\ EE9B= A0 06        .
LDA #&5A         :\ EE9D= A9 5A       )Z
STA (&FA),Y      :\ EE9F= 91 FA       .z
LDY #&04         :\ EEA1= A0 04        .
LDA #&00         :\ EEA3= A9 00       ).
STA (&FA),Y      :\ EEA5= 91 FA       .z
LDY #&06         :\ EEA7= A0 06        .
LDA (&FA),Y      :\ EEA9= B1 FA       1z
RTS              :\ EEAB= 60          `
 
.LEEAC
LDA #&00         :\ EEAC= A9 00       ).
LDY #&01         :\ EEAE= A0 01        .
.LEEB0
STA &0D00,Y      :\ EEB0= 99 00 0D    ...
INY              :\ EEB3= C8          H
BNE LEEB0        :\ EEB4= D0 FA       Pz
STA &0288        :\ EEB6= 8D 88 02    ...
STA &E4          :\ EEB9= 85 E4       .d
LDA #&03         :\ EEBB= A9 03       ).
STA &E5          :\ EEBD= 85 E5       .e
.LEEBF
INC &E5          :\ EEBF= E6 E5       fe
BMI LEEDA        :\ EEC1= 30 17       0.
LDA (&E4),Y      :\ EEC3= B1 E4       1d
PHA              :\ EEC5= 48          H
LDA #&5A         :\ EEC6= A9 5A       )Z
STA (&E4),Y      :\ EEC8= 91 E4       .d
INY              :\ EECA= C8          H
LDA (&E4),Y      :\ EECB= B1 E4       1d
DEY              :\ EECD= 88          .
LDA #&5A         :\ EECE= A9 5A       )Z
CMP (&E4),Y      :\ EED0= D1 E4       Qd
BEQ LEED5        :\ EED2= F0 01       p.
CLC              :\ EED4= 18          .
.LEED5
PLA              :\ EED5= 68          h
STA (&E4),Y      :\ EED6= 91 E4       .d
BCS LEEBF        :\ EED8= B0 E5       0e
.LEEDA
LDA &E5          :\ EEDA= A5 E5       %e
STA &028E        :\ EEDC= 8D 8E 02    ...
DEY              :\ EEDF= 88          .
STY &028C        :\ EEE0= 8C 8C 02    ...
LDA LF000        :\ EEE3= AD 00 F0    -.p
STA &028F        :\ EEE6= 8D 8F 02    ...
LDA LF018        :\ EEE9= AD 18 F0    -.p
STA &0287        :\ EEEC= 8D 87 02    ...
LDA LF017        :\ EEEF= AD 17 F0    -.p
STA &0289        :\ EEF2= 8D 89 02    ...
RTS              :\ EEF5= 60          `
 
LDA #&F1         :\ EEF6= A9 F1       )q
BNE LEEFC        :\ EEF8= D0 02       P.
.LEEFA
ADC #&E8         :\ EEFA= 69 E8       ih
.LEEFC
TAY              :\ EEFC= A8          (
LDA &0190,Y      :\ EEFD= B9 90 01    9..
TAX              :\ EF00= AA          *
AND &F1          :\ EF01= 25 F1       %q
EOR &F0          :\ EF03= 45 F0       Ep
STA &0190,Y      :\ EF05= 99 90 01    ...
LDA &0191,Y      :\ EF08= B9 91 01    9..
TAY              :\ EF0B= A8          (
RTS              :\ EF0C= 60          `
 
TYA              :\ EF0D= 98          .
CPX #&0A         :\ EF0E= E0 0A       `.
BCS LEF19        :\ EF10= B0 07       0.
LDY &02BF,X      :\ EF12= BC BF 02    <?.
STA &02BF,X      :\ EF15= 9D BF 02    .?.
TYA              :\ EF18= 98          .
.LEF19
TAX              :\ EF19= AA          *
RTS              :\ EF1A= 60          `
 
LDA #&00         :\ EF1B= A9 00       ).
CPX #&08         :\ EF1D= E0 08       `.
BCS LEF2B        :\ EF1F= B0 0A       0.
STA &025D        :\ EF21= 8D 5D 02    .].
LDA LF4C4,X      :\ EF24= BD C4 F4    =Dt
STA &025C        :\ EF27= 8D 5C 02    .\.
RTS              :\ EF2A= 60          `
 
.LEF2B
STA &025C        :\ EF2B= 8D 5C 02    .\.
LDA LF4BC,X      :\ EF2E= BD BC F4    =<t
STA &025D        :\ EF31= 8D 5D 02    .].
RTS              :\ EF34= 60          `
 
Byte130 - Read memory high word
===============================
.LEF35
LDX #&FF         :\ EF35= A2 FF       ".
LDY #&FF         :\ EF37= A0 FF        .
RTS              :\ EF39= 60          `
 
Byte131 - Read bottom of memory
===============================
LDY &0244        :\ EF3A= AC 44 02    ,D.
LDX #&00         :\ EF3D= A2 00       ".
RTS              :\ EF3F= 60          `
 
Byte132, Byte133 - Read top of memory
=====================================
LDY &028E        :\ EF40= AC 8E 02    ,..
LDX #&00         :\ EF43= A2 00       ".
RTS              :\ EF45= 60          `

.LEF46
LDY LFE00,X      :\ EF46= BC 00 FE    <.~
RTS              :\ EF49= 60          `
 
.LEF4A
TYA              :\ EF4A= 98          .
STA LFE00,X      :\ EF4B= 9D 00 FE    ..~
RTS              :\ EF4E= 60          `
 
.LEF4F
JMP (&0200)      :\ EF4F= 6C 00 02    l..
 
.LEF52
LDX #&10         :\ EF52= A2 10       ".
JSR LFD4A        :\ EF54= 20 4A FD     J}
BEQ LEF7C        :\ EF57= F0 23       p#
JSR LEF7D        :\ EF59= 20 7D EF     }o
LDA #&00         :\ EF5C= A9 00       ).
PHP              :\ EF5E= 08          .
STY &E6          :\ EF5F= 84 E6       .f
LDY &0257        :\ EF61= AC 57 02    ,W.
STA &0257        :\ EF64= 8D 57 02    .W.
BEQ LEF6C        :\ EF67= F0 03       p.
JSR OSFIND       :\ EF69= 20 CE FF     N.
.LEF6C
LDY &E6          :\ EF6C= A4 E6       $f
PLP              :\ EF6E= 28          (
BEQ LEF7C        :\ EF6F= F0 0B       p.
LDA #&80         :\ EF71= A9 80       ).
JSR OSFIND       :\ EF73= 20 CE FF     N.
TAY              :\ EF76= A8          (
BEQ LEF9E        :\ EF77= F0 25       p%
STY &0257        :\ EF79= 8C 57 02    .W.
.LEF7C
RTS              :\ EF7C= 60          `
 
.LEF7D
LDA #&00         :\ EF7D= A9 00       ).
.LEF7F
PHP              :\ EF7F= 08          .
STY &E6          :\ EF80= 84 E6       .f
LDY &0256        :\ EF82= AC 56 02    ,V.
STA &0256        :\ EF85= 8D 56 02    .V.
BEQ LEF8D        :\ EF88= F0 03       p.
JSR OSFIND       :\ EF8A= 20 CE FF     N.
.LEF8D
LDY &E6          :\ EF8D= A4 E6       $f
PLP              :\ EF8F= 28          (
BEQ LEF7C        :\ EF90= F0 EA       pj
LDA #&40         :\ EF92= A9 40       )@
JSR OSFIND       :\ EF94= 20 CE FF     N.
TAY              :\ EF97= A8          (
BEQ LEF9E        :\ EF98= F0 04       p.
STY &0256        :\ EF9A= 8C 56 02    .V.
RTS              :\ EF9D= 60          `
 
.LEF9E
BRK              :\ EF9E= 00          .
DEC &46,X        :\ EF9F= D6 46       VF
ADC #&6C         :\ EFA1= 69 6C       il
ADC &20          :\ EFA3= 65 20       e 
ROR &746F        :\ EFA5= 6E 6F 74    not
JSR &6F66        :\ EFA8= 20 66 6F     fo
ADC &6E,X        :\ EFAB= 75 6E       un
STZ &00          :\ EFAD= 64 00       d.

\ OSWORD 19 (&13) - set buffer pointers?
\ ======================================
.LEFAF
LDY #&00:LDA (&F0),Y      :\ Get byte from XY
CMP #&10:BCS LEFDF        :\ If >15, jump to return
TAX:TYA:LDY #&03          :\ X=(XY), A=0, Y=3
SEC:SBC (&F0),Y           :\ A=0-XY?3
STA &03D0,X               :\ &03D0,X=-XY?3
LDY #&01:SEC:LDA (&F0),Y  :\ A=XY?1
SBC &03D0,X:STA &03B0,X   :\ &3B0,X=XY?1+XY?3
INY:LDA (&F0),Y           :\ A=XY?2
SBC #&00:STA &03C0,X      :\ A=XY?2-carry
LDA #&FF:STA &0380,X      
STA &0390,X:STA &03A0,X

\ 380,X = FF
\ 390,X = FF
\ 3A0,X = FF
\ 3B0,X = XY?1+XY?3
\ 3C0,X = XY?2-carry
\ 3D0,X = -(XY?3)

.LEFDF
RTS              :\ EFDF= 60          `
 
LDX #&00         :\ EFE0= A2 00       ".
BIT &FF          :\ EFE2= 24 FF       $.
BPL LEFFA        :\ EFE4= 10 14       ..
LDA &0276        :\ EFE6= AD 76 02    -v.
BNE LEFF8        :\ EFE9= D0 0D       P.
CLI              :\ EFEB= 58          X
STA &0269        :\ EFEC= 8D 69 02    .i.
JSR LEF7F        :\ EFEF= 20 7F EF     .o
JSR LF47A        :\ EFF2= 20 7A F4     zt
JSR LF290        :\ EFF5= 20 90 F2     .r
.LEFF8
LDX #&FF         :\ EFF8= A2 FF       ".
.LEFFA
CLC              :\ EFFA= 18          .
ROR &FF          :\ EFFB= 66 FF       f.
RTS              :\ EFFD= 60          `
 
BRK              :\ EFFE= 00          .
BRK              :\ EFFF= 00          .


\ DEFAULT SETTINGS
\ ================
.LF000:EQUB &09            :\ Default startup byte (OSBYTE &FF) - MODE 1, normal Shift-Break
.LF001:EQUW LF1A0          :\ Address to call to enter a language
.LF003                     :\ Startup text
EQUS "*D.":EQUB 13
EQUS "CH.""START""":EQUB 12 :\ CLS
EQUB 13
EQUB &FF                   :\ End marker
EQUB &FF:EQUB &FF:EQUB &FF :\ Padding
.LF017:EQUB &01            :\ Processor speed, 1MHz
.LF018:EQUB &00            :\ -> &0287

\ DEFAULT VECTORS AND SYSVAR VALUES FOR PAGE &02
\ ==============================================
.LF019
EQUW LFC05 FC    :\ USERV
EQUW LF1F0 F1    :\ BRKV
EQUW LF216 F2    :\ IRQ1V
EQUW LF227 F2    :\ IRQ2V
EQUW LFA5E FA    :\ CLIV  
EQUW LF82C F8    :\ BYTEV 
EQUW LF88A F8    :\ WORDV 
EQUW LF37E F3    :\ WRCHV 
EQUW LF30F F3    :\ RDCHV
.LF02A
EQUB &F3         :\ F02A= F3          s

SEC              :\ F02B= 38          8  FILEV
EQUB &EB         :\ F02C= EB          k
RTI              :\ F02D= 40          @  ARGSV
SBC #&77         :\ F02E= E9 77       iw BGETV
SBC #&93         :\ F030= E9 93       i. BPUTV
SBC #&59         :\ F032= E9 59       iY GBPBV
NOP              :\ F034= EA          j  
LDY &E9          :\ F035= A4 E9       $i FINDV
ORA &EA          :\ F037= 05 EA       .j FSCV
LDX #&FF         :\ F039= A2 FF       ".
LDX #&FF         :\ F03B= A2 FF       ".
LDX #&FF         :\ F03D= A2 FF       ".
LDX #&FF         :\ F03F= A2 FF       ".
LDX #&FF         :\ F041= A2 FF       ".
.LF043
ASL A            :\ F043= 0B          .
EQUB &F4         :\ F044= F4          t
CPY &F3          :\ F045= C7 F3       Gs
STY &A2F4        :\ F047= 8C F4 A2    .t"
BBS 7,&A2,&F04C  :\ F04A= FF A2 FF    .".
.LF04D
LDX #&FF         :\ F04D= A2 FF       ".
BCC LF052        :\ F04F= 90 01       ..
STZ &A10D,X      :\ F051= 9E 0D A1    ..!
EQUB &02         :\ F054= 02          .
BRK              :\ F055= 00          .
BRK              :\ F056= 00          .
BRK              :\ F057= 00          .
EQUB &03         :\ F058= 03          .
BBS 7,&01,&F05C  :\ F059= FF 01 00    ...
ASL &000E        :\ F05C= 0E 0E 00    ...
BRK              :\ F05F= 00          .
BBS 7,&00,&F063  :\ F060= FF 00 00    ...
BRK              :\ F063= 00          .
BBS 7,&04,&F06B  :\ F064= FF 04 04    ...
BRK              :\ F067= 00          .
ORA #&1E         :\ F068= 09 1E       ..
ORA &1919,Y      :\ F06A= 19 19 19    ...
AND (&08)        :\ F06D= 32 08       2.
BRK              :\ F06F= 00          .
BRK              :\ F070= 00          .
BRK              :\ F071= 00          .
BRK              :\ F072= 00          .
JSR &0409        :\ F073= 20 09 04     ..
BRK              :\ F076= 00          .
BRK              :\ F077= 00          .
BRK              :\ F078= 00          .
BRK              :\ F079= 00          .
BRK              :\ F07A= 00          .
BRK              :\ F07B= 00          .
BRK              :\ F07C= 00          .
TSB &64          :\ F07D= 04 64       .d
ASL &81          :\ F07F= 06 81       ..
BRK              :\ F081= 00          .
BRK              :\ F082= 00          .
BRK              :\ F083= 00          .
ORA #&1B         :\ F084= 09 1B       ..
CPY #&D0         :\ F086= C0 D0       @P
CPX #&F0         :\ F088= E0 F0       `p
ORA (&90,X)      :\ F08A= 01 90       ..
LDY #&00         :\ F08C= A0 00        .
BRK              :\ F08E= 00          .
BRK              :\ F08F= 00          .
BBS 7,&FF,&F092  :\ F090= FF FF FF    ...
BRK              :\ F093= 00          .
BRK              :\ F094= 00          .
BRK              :\ F095= 00          .
BRK              :\ F096= 00          .
BRK              :\ F097= 00          .
BRK              :\ F098= 00          .
BRK              :\ F099= 00          .
BRK              :\ F09A= 00          .
BRK              :\ F09B= 00          .
CPX #&FF         :\ F09C= E0 FF       `.
ORA (&0A,X)      :\ F09E= 01 0A       ..

DEFAULT VDU WORKSPACE VALUES
============================
.LF0A0
BRK              :\ F0A0= 00          .
BRA LF0A3        :\ F0A1= 80 00       ..
 
.LF0A3
BRA LF0A4        :\ F0A3= 80 FF       ..
 
BBS 7,&FF,&F0A7  :\ F0A5= FF FF FF    ...
JSR &6040        :\ F0A8= 20 40 60     @`
BRA LF04D        :\ F0AB= 80 A0       . 
 
CPY #&E0         :\ F0AD= C0 E0       @`
BRK              :\ F0AF= 00          .
EQUB &03         :\ F0B0= 03          .
TSB &08          :\ F0B1= 07 08       ..
EQUB &02         :\ F0B3= 02          .
BBS 7,&FF,&F0B6  :\ F0B4= FF FF FF    ...
BBS 7,&08,&F0C2  :\ F0B7= FF 08 08    ...
PHP              :\ F0BA= 08          .
PHP              :\ F0BB= 08          .
PHP              :\ F0BC= 08          .
PHP              :\ F0BD= 08          .
PHP              :\ F0BE= 08          .
ORA #&E0         :\ F0BF= 09 E0       .`
BRA LF043        :\ F0C1= 80 80       ..
 
CPX #&FF         :\ F0C3= E0 FF       `.
BBS 7,&FF,&F0C7  :\ F0C5= FF FF FF    ...
CPX #&E0         :\ F0C8= E0 E0       ``
CPX #&E0         :\ F0CA= E0 E0       ``
CPX #&E0         :\ F0CC= E0 E0       ``
CPX #&E0         :\ F0CE= E0 E0       ``

\ OSBYTE 0 - Read host type
\ =========================
.LF0D0
BNE LF0E7        :\ If X<>0, jump to return value
BRK:EQUB &F7     :\ Error &F7,version string
EQUS "MOSB X4.19-1CK99SB"
BRK
.LF0E7
LDX #&04:RTS     :\ Return host=4 - MOS 4.xx

\ RESET
\ =====
.LF0EA
LDA #&40
STA &0D00		Put RTI into NMI space
SEI		Disable IRQs
CLD		Put into binary mode
LDX #&FF
TXS		Clear stack
LDA #&40
STA &FE0B
LDA #&00
STA &FE02
STA &FE03
STA &028D		Reset type=0
LDX #&A0		Clear from &02A0 upwards
LDY #&7E		Initialise from &027E downwards
LDA &FE0E
ASL A
BNE &F115
INC &028D		Reset type=1
LDX #&90		Clear from &0290 upwards
LDY #&87		Initialise from &0287 downwards
.LF115
LDA #&00         :\ F115= A9 00       ).
.LF117
CPX #&CE         :\ F117= E0 CE       `N
BCC LF11D        :\ F119= 90 02       ..
LDA #&FF         :\ F11B= A9 FF       ).
.LF11D
STA &0200,X      :\ F11D= 9D 00 02    ...
INX              :\ F120= E8          h
BNE LF117        :\ F121= D0 F4       Pt
.LF123
LDA LF018,Y      :\ F123= B9 18 F0    9.p	Get default vector/sysvar value
STA &01FF,Y      :\ F126= 99 FF 01    ...	Store it
DEY              :\ F129= 88          .
BNE LF123        :\ F12A= D0 F7       Pw		Loop to initialise
TYA              :\ F12C= 98          .
LDX #&E2         :\ F12D= A2 E2       "b		Clear zero page MOS w/s
.LF12F
STA &00,X        :\ F12F= 95 00       ..
INX              :\ F131= E8          h
BNE LF12F        :\ F132= D0 FB       P{		Loop to clear
LDX #&2F         :\ F134= A2 2F       "/		Clear and initialise 
.LF136
LDA #&FF         :\ F136= A9 FF       ).
STA &0380,X      :\ F138= 9D 80 03    ...
LDA LF0A0,X      :\ F13B= BD A0 F0    = p
STA &03B0,X      :\ F13E= 9D B0 03    .0.
DEX              :\ F141= CA          J
BPL LF136        :\ F142= 10 F2       .r		Loop to initialise
LDA #&7F         :\ F144= A9 7F       ).
STA LFE0E        :\ F146= 8D 0E FE    ..~
STA LFE0D        :\ F149= 8D 0D FE    ..~
LDA #&A0         :\ F14C= A9 A0       ) 
STA LFE0E        :\ F14E= 8D 0E FE    ..~
STA LFE09        :\ F151= 8D 09 FE    ..~
JSR LF5F5        :\ F154= 20 F5 F5     uu
LDX &0241        :\ F157= AE 41 02    .A.
JSR LF62A        :\ F15A= 20 2A F6     *v
BIT &0247        :\ F15D= 2C 47 02    ,G.
BMI LF167        :\ F160= 30 05       0.
LDX #&01         :\ F162= A2 01       ".
JSR LF73B        :\ F164= 20 3B F7     ;w
.LF167
LDA &028D        :\ F167= AD 8D 02    -..
BEQ LF16F        :\ F16A= F0 03       p.
JSR LEEAC        :\ F16C= 20 AC EE     ,n
.LF16F
JSR LFCCC        :\ F16F= 20 CC FC     L|
LDY #&0E         :\ F172= A0 0E        .
LDX #&01         :\ F174= A2 01       ".
JSR LFD4A        :\ F176= 20 4A FD     J}
LDX #&02         :\ F179= A2 02       ".
JSR LFD4A        :\ F17B= 20 4A FD     J}
STY &0243        :\ F17E= 8C 43 02    .C.
STY &0244        :\ F181= 8C 44 02    .D.
BIT &02A0
BPL LF18E        :\ F187= 10 05       ..
LDA #&03         :\ F189= A9 03       ).		A=3 - Boot FS
JSR LE003        :\ F18B= 20 03 E0     .`		Call MOS's service entry
.LF18E
JSR LFDAA        :\ F18E= 20 AA FD     *}
F191 AD 8F 02    �..  LDA &028F		Get startup options
F194 29 08       ).   AND #&08		Get boot flag from bit 3
F196 A8          �    TAY		Pass to Y
F197 A2 03       �.   LDX #&03		Service call 3 - Boot FS
F199 20 4A FD     J�  JSR &FD4A		Pass to ROMs
F19C 58          X    CLI		Enable IRQs
F19D 6C 01 F0    l.�  JMP (LF001)	Jump to start a language
					Default is next location:
.LF1A0
LDA &028D:BEQ LF1FB :\ Jump past if soft Break
LDX #&0F            :\ Look for a language from ROM 15
.LF1A7
LDA &02A1,X      :\ F1A7= BD A1 02    =!.
ROL A            :\ F1AA= 2A          *
BMI LF1FE        :\ F1AB= 30 51       0Q
DEX              :\ F1AD= CA          J
BPL LF1A7        :\ F1AE= 10 F7       .w
LDX #&FF         :\ F1B0= A2 FF       ".
BIT &02A0        :\ F1B2= 2C A0 02    , .
BVS LF1FE        :\ F1B5= 70 47       pG
BRK              :\ F1B7= 00          .
SBC &614C,Y      :\ F1B8= F9 4C 61    yLa
ROR &7567        :\ F1BB= 6E 67 75    ngu
ADC (&67,X)      :\ F1BE= 61 67       ag
ADC &3F          :\ F1C0= 65 3F       e?
BRK              :\ F1C2= 00          .

.LF1C3
TXA              :\ F1C3= 8A          .
PHA              :\ F1C4= 48          H
TSX              :\ F1C5= BA          :
LDA &0103,X      :\ F1C6= BD 03 01    =..
CLD              :\ F1C9= D8          X
SEC              :\ F1CA= 38          8
SBC #&01         :\ F1CB= E9 01       i.
STA &FD          :\ F1CD= 85 FD       .}
LDA &0104,X      :\ F1CF= BD 04 01    =..
SBC #&00         :\ F1D2= E9 00       i.
STA &FE          :\ F1D4= 85 FE       .~
LDA &F4          :\ F1D6= A5 F4       %t
STA &024A        :\ F1D8= 8D 4A 02    .J.
STX &F0          :\ F1DB= 86 F0       .p
LDX #&06         :\ F1DD= A2 06       ".
JSR LFD4A        :\ F1DF= 20 4A FD     J}
LDA &028C        :\ F1E2= AD 8C 02    -..
JSR LFD92        :\ F1E5= 20 92 FD     .}
PLA              :\ F1E8= 68          h
TAX              :\ F1E9= AA          *
LDA &FC          :\ F1EA= A5 FC       %|
CLI              :\ F1EC= 58          X
JMP (&0202)      :\ F1ED= 6C 02 02    l..
 
.LF1F0
LDY #&00         :\ F1F0= A0 00        .
JSR LF205        :\ F1F2= 20 05 F2     .r
LDA &0267        :\ F1F5= AD 67 02    -g.
ROR A            :\ F1F8= 6A          j
.LF1F9
BCS LF1F9        :\ F1F9= B0 FE       0~

Enter a language
----------------
.LF1FB
LDX &028C        :\ F1FB= AE 8C 02    ...		Get language ROM
.LF1FE
CLC              :\ F1FE= 18          .
JMP LFD0B        :\ F1FF= 4C 0B FD    L.}
 
.LF202
JSR OSASCI       :\ F202= 20 E3 FF     c.
.LF205
INY              :\ F205= C8          H
LDA (&FD),Y      :\ F206= B1 FD       1}
BNE LF202        :\ F208= D0 F8       Px
RTS              :\ F20A= 60          `
 
IRQ Handler
===========
.LF20B
STA &FC          :\ F20B= 85 FC       .|
PLA              :\ F20D= 68          h
PHA              :\ F20E= 48          H
AND #&10         :\ F20F= 29 10       ).
BNE LF1C3        :\ F211= D0 B0       P0
JMP (&0204)      :\ F213= 6C 04 02    l..  BRKV
 
.LF216
LDA &FC          :\ F216= A5 FC       %|
PHA              :\ F218= 48          H
TYA              :\ F219= 98          .
PHA              :\ F21A= 48          H
TXA              :\ F21B= 8A          .
PHA              :\ F21C= 48          H
JSR LF228        :\ F21D= 20 28 F2     (r    IRQ1V
PLA              :\ F220= 68          h
TAX              :\ F221= AA          *
PLA              :\ F222= 68          h
TAY              :\ F223= A8          (
PLA              :\ F224= 68          h
STA &FC          :\ F225= 85 FC       .|
RTI              :\ F227= 40          @
 
.LF228
JSR LF65A        :\ F228= 20 5A F6     Zv
BCC LF241        :\ F22B= 90 14       ..
LDA LFE0D        :\ F22D= AD 0D FE    -.~
AND &0279        :\ F230= 2D 79 02    -y.
BMI LF24E        :\ F233= 30 19       0.
JSR LEDC6        :\ F235= 20 C6 ED     Fm
BCC LF241        :\ F238= 90 07       ..
.LF23A
LDX #&05         :\ F23A= A2 05       ".
JSR LFD4A        :\ F23C= 20 4A FD     J}
BNE LF242        :\ F23F= D0 01       P.
.LF241
RTS              :\ F241= 60          `
 
.LF242
PLA              :\ F242= 68          h
PLA              :\ F243= 68          h
PLA              :\ F244= 68          h
TAX              :\ F245= AA          *
PLA              :\ F246= 68          h
TAY              :\ F247= A8          (
PLA              :\ F248= 68          h
STA &FC          :\ F249= 85 FC       .|
JMP (&0206)      :\ F24B= 6C 06 02    l..
 
.LF24E
AND LFE0E        :\ F24E= 2D 0E FE    -.~
ASL A            :\ F251= 0A          .
BMI LF263        :\ F252= 30 0F       0.
ASL A            :\ F254= 0A          .
BMI LF299        :\ F255= 30 42       0B
AND #&08         :\ F257= 29 08       ).
BEQ LF23A        :\ F259= F0 DF       p_
LDX #&00         :\ F25B= A2 00       ".
LDY LFE01        :\ F25D= AC 01 FE    ,.~
JMP LF43D        :\ F260= 4C 3D F4    L=t
 
.LF263
LDA &0344        :\ F263= AD 44 03    -D.
BNE LF26B        :\ F266= D0 03       P.
DEC &0345        :\ F268= CE 45 03    NE.
.LF26B
DEC &0344        :\ F26B= CE 44 03    ND.
LDA &0344        :\ F26E= AD 44 03    -D.
ORA &0345        :\ F271= 0D 45 03    .E.
BNE LF295        :\ F274= D0 1F       P.
JSR LF9CE        :\ F276= 20 CE F9     Ny
LDA #&02         :\ F279= A9 02       ).
JSR LF9F7        :\ F27B= 20 F7 F9     wy
LDX #&09         :\ F27E= A2 09       ".
JSR LF301        :\ F280= 20 01 F3     .s
LDX #&03         :\ F283= A2 03       ".
.LF285
LDA &0340,X      :\ F285= BD 40 03    =@.
CMP &029B,X      :\ F288= DD 9B 02    ]..
BNE LF295        :\ F28B= D0 08       P.
DEX              :\ F28D= CA          J
BPL LF285        :\ F28E= 10 F5       .u

.LF290
LDA #&40:STA LFE0E        :\ Diable VIA Timer1 IRQs
.LF295
LDA LFE04:RTS             :\ Reset VIA Timer1 interupts
 
.LF299
LDY &0289        :\ F299= AC 89 02    ,..
.LF29C
LDX LFE09        :\ F29C= AE 09 FE    ..~
LDA LFE08        :\ F29F= AD 08 FE    -.~
CPX LFE09        :\ F2A2= EC 09 FE    l.~
BNE LF29C        :\ F2A5= D0 F5       Pu
CLC              :\ F2A7= 18          .
ADC LF2FC,Y      :\ F2A8= 79 FC F2    y|r
STA LFE08        :\ F2AB= 8D 08 FE    ..~
TXA              :\ F2AE= 8A          .
ADC LF2FE,Y      :\ F2AF= 79 FE F2    y~r
STA LFE09        :\ F2B2= 8D 09 FE    ..~
LDY #&05         :\ F2B5= A0 05        .
LDA #&00         :\ F2B7= A9 00       ).
JSR LFC8F        :\ F2B9= 20 8F FC     .|
LDA &02B1        :\ F2BC= AD B1 02    -1.
BNE LF2C9        :\ F2BF= D0 08       P.
LDA &02B2        :\ F2C1= AD B2 02    -2.
BEQ LF2CC        :\ F2C4= F0 06       p.
DEC &02B2        :\ F2C6= CE B2 02    N2.
.LF2C9
DEC &02B1        :\ F2C9= CE B1 02    N1.
.LF2CC
LDX #&FF         :\ F2CC= A2 FF       ".
JSR LF301        :\ F2CE= 20 01 F3     .s
LDX #&04         :\ F2D1= A2 04       ".
JSR LF301        :\ F2D3= 20 01 F3     .s
BCC LF2DF        :\ F2D6= 90 07       ..
LDY #&05         :\ F2D8= A0 05        .
LDA #&FF         :\ F2DA= A9 FF       ).
JSR LFC8F        :\ F2DC= 20 8F FC     .|
.LF2DF
LDA &ED          :\ F2DF= A5 ED       %m
ORA &EC          :\ F2E1= 05 EC       .l
AND &0242        :\ F2E3= 2D 42 02    -B.
BEQ LF2EF        :\ F2E6= F0 07       p.
SEC              :\ F2E8= 38          8
BIT LF09D        :\ F2E9= 2C 9D F0    ,.p
JSR LF2FA        :\ F2EC= 20 FA F2     zr
.LF2EF
LDA &E7          :\ F2EF= A5 E7       %g
BEQ LF2F5        :\ F2F1= F0 02       p.
DEC &E7          :\ F2F3= C6 E7       Fg
.LF2F5
LDA #&01         :\ F2F5= A9 01       ).
.LF2F7
JMP (&0224)      :\ F2F7= 6C 24 02    l$.
 
.LF2FA
JMP (&0228)      :\ F2FA= 6C 28 02    l(.
 
INC &06,X        :\ F2FD= F6 06       v.
ROL &4E          :\ F2FF= 26 4E       &N
.LF301
LDY #&FF         :\ F301= A0 FF        .
.LF303
INX              :\ F303= E8          h
INY              :\ F304= C8          H
CPY #&05         :\ F305= C0 05       @.
BCS LF30E        :\ F307= B0 05       0.
INC &0291,X      :\ F309= FE 91 02    ~..
BEQ LF303        :\ F30C= F0 F5       pu
.LF30E
RTS              :\ F30E= 60          `
 
.LF30F
LDA #&00         :\ F30F= A9 00       ).
.LF311
STA &E6          :\ F311= 85 E6       .f
TYA              :\ F313= 98          .
PHA              :\ F314= 48          H
TXA              :\ F315= 8A          .
PHA              :\ F316= 48          H
LDY &0256        :\ F317= AC 56 02    ,V.
BEQ LF329        :\ F31A= F0 0D       p.
JSR OSBGET       :\ F31C= 20 D7 FF     W.
BCC LF370        :\ F31F= 90 4F       .O
LDA #&00         :\ F321= A9 00       ).
STA &0256        :\ F323= 8D 56 02    .V.
JSR OSFIND       :\ F326= 20 CE FF     N.
.LF329
JSR LEC42        :\ F329= 20 42 EC     Bl
BCC LF370        :\ F32C= 90 42       .B
LDY &EB          :\ F32E= A4 EB       $k
LDA LF003,Y      :\ F330= B9 03 F0    9.p
CMP #&FF         :\ F333= C9 FF       I.
BEQ LF33B        :\ F335= F0 04       p.
INC &EB          :\ F337= E6 EB       fk
BNE LF366        :\ F339= D0 2B       P+
.LF33B
BIT &FF          :\ F33B= 24 FF       $.
BMI LF379        :\ F33D= 30 3A       0:
LDX &0241        :\ F33F= AE 41 02    .A.
CLV              :\ F342= B8          8
JSR LF3C4        :\ F343= 20 C4 F3     Ds
BCC LF356        :\ F346= 90 0E       ..
BIT &E6          :\ F348= 24 E6       $f
BVC LF33B        :\ F34A= 50 EF       Po
LDA &02B2        :\ F34C= AD B2 02    -2.
ORA &02B1        :\ F34F= 0D B1 02    .1.
BNE LF33B        :\ F352= D0 E7       Pg
BCS LF372        :\ F354= B0 1C       0.
.LF356
CPX #&00         :\ F356= E0 00       `.
BEQ LF366        :\ F358= F0 0C       p.
JSR LF73B        :\ F35A= 20 3B F7     ;w
CPX #&01         :\ F35D= E0 01       `.
BNE LF36F        :\ F35F= D0 0E       P.
LDY &0245        :\ F361= AC 45 02    ,E.
BNE LF36F        :\ F364= D0 09       P.
.LF366
CMP #&80         :\ F366= C9 80       I.
BCC LF370        :\ F368= 90 06       ..
JSR LEBF1        :\ F36A= 20 F1 EB     qk
BCS LF329        :\ F36D= B0 BA       0:
.LF36F
CLC              :\ F36F= 18          .
.LF370
STA &E6          :\ F370= 85 E6       .f
.LF372
PLA              :\ F372= 68          h
TAX              :\ F373= AA          *
PLA              :\ F374= 68          h
TAY              :\ F375= A8          (
LDA &E6          :\ F376= A5 E6       %f
RTS              :\ F378= 60          `
 
.LF379
SEC              :\ F379= 38          8
LDA #&1B         :\ F37A= A9 1B       ).
BCS LF370        :\ F37C= B0 F2       0r


\ OSWRCH - Send character to output stream
\ ========================================
.LF37E
PHA:TYA:PHA:TXA:PHA :\ Save registers
TSX:LDA &0103,X:PHA :\ Get A and save again
LDA &027C:AND #&4E  :\ Get output destination
EOR #&06:BEQ LF396  :\ If VDU and Printer both disabled, skip VDU driver
PLA:PHA:JSR LF3BB   :\ Send character to VDUV
.LF396
LDA &027C           :\ Get output destination
ROR A:BCC LF3A3     :\ If SerOut disabled, skip next
PLA:PHA:JSR LF4CC   :\ Send character
BCS LF3B4           :\ If something, skip to exit
.LF3A3
LDA #&10:BIT &027C  :\ Test output destination
BNE LF3B4           :\ If Spool disabled, skip to exit
LDY &0257:BEQ LF3B4 :\ Get Spool handle, if zero, exit
PLA:PHA:JSR OSBPUT  :\ Send character to Spool output
.LF3B4
PLA                 :\ Drop copy of A
PLA:TAX:PLA:TAY:PLA :\ Restore registers
RTS                 :\ Return
 
.LF3BB
JMP (&0226)         :\ Jump to VDUV, default is RTS
 
.LF3BE
BIT LF09D        :\ F3BE= 2C 9D F0    ,.p
BVS LF3C4        :\ F3C1= 70 01       p.
.LF3C3
CLV              :\ F3C3= B8          8
.LF3C4
JMP (&022C)      :\ F3C4= 6C 2C 02    l,.
 
PHP              :\ F3C7= 08          .
SEI              :\ F3C8= 78          x
LDA &0390,X      :\ F3C9= BD 90 03    =..
CMP &03A0,X      :\ F3CC= DD A0 03    ] .
BEQ LF43A        :\ F3CF= F0 69       pi
TAY              :\ F3D1= A8          (
JSR LF4B9        :\ F3D2= 20 B9 F4     9t
LDA (&FA),Y      :\ F3D5= B1 FA       1z
BVS LF3FA        :\ F3D7= 70 21       p!
PHA              :\ F3D9= 48          H
INY              :\ F3DA= C8          H
TYA              :\ F3DB= 98          .
BNE LF3E1        :\ F3DC= D0 03       P.
LDA &03D0,X      :\ F3DE= BD D0 03    =P.
.LF3E1
STA &0390,X      :\ F3E1= 9D 90 03    ...
CMP &03A0,X      :\ F3E4= DD A0 03    ] .
BNE LF3F8        :\ F3E7= D0 0F       P.
LDA #&FF         :\ F3E9= A9 FF       ).
STA &0380,X      :\ F3EB= 9D 80 03    ...
LDY LF5DD,X      :\ F3EE= BC DD F5    <]u
BPL LF3F8        :\ F3F1= 10 05       ..
LDY #&00         :\ F3F3= A0 00        .
JSR LFC8F        :\ F3F5= 20 8F FC     .|
.LF3F8
PLA              :\ F3F8= 68          h
TAY              :\ F3F9= A8          (
.LF3FA
PLP              :\ F3FA= 28          (
CLC              :\ F3FB= 18          .
RTS              :\ F3FC= 60          `
 
.LF3FD
LDY &026B        :\ F3FD= AC 6B 02    ,k.
.LF400
TYA              :\ F400= 98          .
LDY #&02         :\ F401= A0 02        .
JSR LFC8F        :\ F403= 20 8F FC     .|
TAY              :\ F406= A8          (
.LF407
TYA              :\ F407= 98          .
.LF408
JMP (&022A)      :\ F408= 6C 2A 02    l*.
 
PHP              :\ F40B= 08          .
SEI              :\ F40C= 78          x
PHA              :\ F40D= 48          H
LDY &03A0,X      :\ F40E= BC A0 03    < .
INY              :\ F411= C8          H
BNE LF417        :\ F412= D0 03       P.
LDY &03D0,X      :\ F414= BC D0 03    <P.
.LF417
TYA              :\ F417= 98          .
CMP &0390,X      :\ F418= DD 90 03    ]..
BEQ LF42F        :\ F41B= F0 12       p.
LDY &03A0,X      :\ F41D= BC A0 03    < .
STA &03A0,X      :\ F420= 9D A0 03    . .
JSR LF4B9        :\ F423= 20 B9 F4     9t
PLA              :\ F426= 68          h
STA (&FA),Y      :\ F427= 91 FA       .z
LSR &0380,X      :\ F429= 5E 80 03    ^..
PLP              :\ F42C= 28          (
CLC              :\ F42D= 18          .
RTS              :\ F42E= 60          `
 
.LF42F
PLA              :\ F42F= 68          h
LDY LF5DD,X      :\ F430= BC DD F5    <]u
BMI LF43A        :\ F433= 30 05       0.
LDY #&01         :\ F435= A0 01        .
JSR LFC8F        :\ F437= 20 8F FC     .|
.LF43A
PLP              :\ F43A= 28          (
SEC              :\ F43B= 38          8
RTS              :\ F43C= 60          `
 
.LF43D
TXA              :\ F43D= 8A          .
BEQ LF449        :\ F43E= F0 09       p.
CPX #&01         :\ F440= E0 01       `.
BNE LF407        :\ F442= D0 C3       PC
LDA &0245        :\ F444= AD 45 02    -E.
BNE LF407        :\ F447= D0 BE       P>
.LF449
TYA              :\ F449= 98          .
CMP #&09         :\ F44A= C9 09       I.
BEQ LF3FD        :\ F44C= F0 AF       p/
EOR &026C        :\ F44E= 4D 6C 02    Ml.
ORA &0275        :\ F451= 0D 75 02    .u.
BNE LF400        :\ F454= D0 AA       P*
LDA &0258        :\ F456= AD 58 02    -X.
ROR A            :\ F459= 6A          j
TYA              :\ F45A= 98          .
BCS LF466        :\ F45B= B0 09       0.
LDY #&06         :\ F45D= A0 06        .
JSR LFC8F        :\ F45F= 20 8F FC     .|
BCC LF466        :\ F462= 90 02       ..
ROR &FF          :\ F464= 66 FF       f.
.LF466
CLC              :\ F466= 18          .
RTS              :\ F467= 60          `
 
.LF468
JMP LF877        :\ F468= 4C 77 F8    Lwx
 
Byte128 - ADVAL
===============
BPL LF468        :\ If positive, jump to pass to unknown OSBYTE
TXA              :\ F46D= 8A          .
EOR #&FF         :\ F46E= 49 FF       I.
TAX              :\ F470= AA          *
LDA LF5DD,X      :\ F471= BD DD F5    =]u
ASL A            :\ F474= 0A          .
CLV              :\ F475= B8          8
BVC LF489        :\ F476= 50 11       P.
BNE LF483        :\ F478= D0 09       P.
.LF47A
LDX #&0F         :\ F47A= A2 0F       ".
.LF47C
JSR LF486        :\ F47C= 20 86 F4     .t
DEX              :\ F47F= CA          J
BPL LF47C        :\ F480= 10 FA       .z
RTS              :\ F482= 60          `
 
.LF483
LDX &0241        :\ F483= AE 41 02    .A.
.LF486
BIT LF09D        :\ F486= 2C 9D F0    ,.p
.LF489
JMP (&022E)      :\ F489= 6C 2E 02    l..
 
PHP              :\ F48C= 08          .
SEI              :\ F48D= 78          x
BVC LF49D        :\ F48E= 50 0D       P.
LDA &0390,X      :\ F490= BD 90 03    =..
STA &03A0,X      :\ F493= 9D A0 03    . .
LDA #&FF         :\ F496= A9 FF       ).
STA &0380,X      :\ F498= 9D 80 03    ...
PLP              :\ F49B= 28          (
RTS              :\ F49C= 60          `
 
.LF49D
PHP              :\ F49D= 08          .
SEC              :\ F49E= 38          8
LDA &03A0,X      :\ F49F= BD A0 03    = .
SBC &0390,X      :\ F4A2= FD 90 03    }..
BCS LF4AB        :\ F4A5= B0 04       0.
SEC              :\ F4A7= 38          8
SBC &03D0,X      :\ F4A8= FD D0 03    }P.
.LF4AB
PLP              :\ F4AB= 28          (
BCC LF4B4        :\ F4AC= 90 06       ..
CLC              :\ F4AE= 18          .
ADC &03D0,X      :\ F4AF= 7D D0 03    }P.
EOR #&FF         :\ F4B2= 49 FF       I.
.LF4B4
PLP              :\ F4B4= 28          (
LDY #&00         :\ F4B5= A0 00        .
TAX              :\ F4B7= AA          *
RTS              :\ F4B8= 60          `
 
.LF4B9
LDA &03B0,X      :\ F4B9= BD B0 03    =0.

.LF4BC
STA &FA          :\ F4BC= 85 FA       .z
LDA &03C0,X      :\ F4BE= BD C0 03    =@.
STA &FB          :\ F4C1= 85 FB       .{
RTS              :\ F4C3= 60          `
 
.LF4C4
ORA (&02,X)      :\ F4C4= 01 02       ..
TSB &08          :\ F4C6= 04 08       ..
.LF4C8
BPL LF4EA        :\ F4C8= 10 20       . 
RTI              :\ F4CA= 40          @
 
.LF4CB
EQUB &80

\ Send character to highest available buffer
\ ==========================================
.LF4CC
PHA:LDX #&0F        :\ Save A, start with X=15
.LF4CF
\ &25C/&25D are 16 bitflags for X=0..15
CPX #&08:BCC LF4DD  :\ If X<8, jump to...
LDA LF4BC,X         :\ Get bitmap &01 to &80
AND &025D:BEQ LF4EC :\ If bit clear, jump to try next one down
BNE LF4E5           :\ Bit set, try this one
.LF4DD
LDA LF4C4,X         :\ Get bitmap &01 to &80
AND &025C:BEQ LF4EC :\ If bit clear, jump to try next one down
                    :\ Bit set, try this one
.LF4E5
PLA:PHA:JSR LF4F1   :\ Send A somewhere
.LF4EA
BCS LF4EF           :\ If Cy set, sucessful, so exit
.LF4EC
DEX:BPL LF4CF       :\ Point to next one down, loop if still >=0
.LF4EF
PLA:RTS             :\ Restore A and return
 
\ Insert A into buffer specified by X
\ -----------------------------------
.LF4F1
CPX #&02:BEQ LF53C  :\ If X=SerOutput, check for escaped bytes

\ OS_INS - Insert byte into buffer
\ ================================
\ A=byte to enter, X=buffer
.LF4F5
PHP:SEI             :\ Save flags and disable IRQs
LDY &0380,X:PHP     :\ Get byte from &380-38F, save b7
.LF4FB
BIT &FF:BMI LF538   :\ If Escape set, exit with Cy set
JSR LF408:BCC LF507 :\ Insert into buffer X, jump if succeeded
CLI:BCS LF4FB       :\ Renable IRQs, loop to try again

.LF507
PLP:BPL LF529       :\ If buffer flag b7=0, jump to...
CPX #&02:BEQ LF52C  :\ If SerOut, jump to...
CPX #&08:BCC LF529  :\ If buffer<8, jump to exit
TXA:PHA:LSR A
.LF515
BCC LF527        :\ F515= 90 10       ..
AND #&03         :\ F517= 29 03       ).
TAX              :\ F519= AA          *
LDY LF5F1,X      :\ F51A= BC F1 F5    <qu
LDA &02D0,X      :\ F51D= BD D0 02    =P.
AND #&F3         :\ F520= 29 F3       )s
ORA #&04         :\ F522= 09 04       ..
STA LDD02,Y      :\ F524= 99 02 DD    ..]
.LF527
PLA:TAX             :\ Restore X
.LF529
PLP:CLC:RTS         :\ Restore IRQs and return with Cy=0

\ &Dxxx seems to be some sort of I/O space
\ ----------------------------------------
 
.LF52C
LDA &024F:AND #&F3  :\ Get fx191
ORA #&04:STA LFE12  :\ Write to ACIA command register
BNE LF529           :\ Jump to return

.LF538
PLP:PLP:SEC:RTS     :\ Restore IRQs and return with Cy=1

\ Send A to serial output
\ -----------------------
.LF53C
CMP #&9B:BNE LF551  :\ If A<>&9B, send direct
BIT &0247:BMI LF551 :\ If b7=1, SerialFS not selected, don't escape bytes
JSR LF551:BNE LF551 :\ Send &9B,&9B

\ Send escaped byte &9B,nn command byte
\ -------------------------------------
\ Escaped serial commands:
\ 03 *command
\ 04 End of data
\ 05 *CAT
\ 07 OSBYTE
\ 08 OSWORD
\ 
\ FA OSGBPB
\ FB OSARGS
\ FC OSFIND
\ FD OSBGET
\ FE OSBPUT
\ FF OSFILE LOAD
\ 00 OSFILE SAVE
\
.LF54A
PHA                 :\ Save byte
LDA #&9B:JSR LF551  :\ Send &9B prefix
PLA                 :\ Get byte back
.LF551
PHA:TYA:PHA:TXA:PHA :\ Save registers
TSX:LDA &0103,X     :\ Get A from stack
LDX #&02:JSR LF4F5  :\ Send to buffer 2
PLA:TAX:PLA:TAY:PLA :\ Restore registers
RTS                 :\ Return
 
.LF565
PHA              :\ F565= 48          H
TYA              :\ F566= 98          .
PHA              :\ F567= 48          H
TXA              :\ F568= 8A          .
PHA              :\ F569= 48          H
CLC              :\ F56A= 18          .
.LF56B
PHP              :\ F56B= 08          .
LDX #&01         :\ F56C= A2 01       ".
.LF56E
CLV              :\ F56E= B8          8
JSR LF3C4        :\ F56F= 20 C4 F3     Ds
BCS LF56E        :\ F572= B0 FA       0z
JSR LF73B        :\ F574= 20 3B F7     ;w
CMP #&9B         :\ F577= C9 9B       I.
BEQ LF586        :\ F579= F0 0B       p.
PLP              :\ F57B= 28          (
.LF57C
TSX              :\ F57C= BA          :
STA &0103,X      :\ F57D= 9D 03 01    ...
PLA              :\ F580= 68          h
TAX              :\ F581= AA          *
PLA              :\ F582= 68          h
TAY              :\ F583= A8          (
PLA              :\ F584= 68          h
RTS              :\ F585= 60          `
 
.LF586
PLP              :\ F586= 28          (
BCC LF58C        :\ F587= 90 03       ..
CLC              :\ F589= 18          .
BCC LF57C        :\ F58A= 90 F0       .p
.LF58C
SEC              :\ F58C= 38          8
BCS LF56B        :\ F58D= B0 DC       0\
TXA              :\ F58F= 8A          .
AND #&0F         :\ F590= 29 0F       ).
STA &F0          :\ F592= 85 F0       .p
LDY #&F0         :\ F594= A0 F0        p
STY &F1          :\ F596= 84 F1       .q

LDA #&C0         :\ F598= A9 C0       )@
BIT LF09D        :\ F59A= 2C 9D F0    ,.p
BVS LF5A2        :\ F59D= 70 03       p.
LDA #&BF         :\ F59F= A9 BF       )?
CLV              :\ F5A1= B8          8
.LF5A2
LDX &0241        :\ F5A2= AE 41 02    .A.
CPX #&01         :\ F5A5= E0 01       `.
BEQ LF5CD        :\ F5A7= F0 24       p$
CPX #&08         :\ F5A9= E0 08       `.
BCC LF5CC        :\ F5AB= 90 1F       ..
TXA              :\ F5AD= 8A          .
LSR A            :\ F5AE= 4A          J
AND #&03         :\ F5AF= 29 03       ).
TAX              :\ F5B1= AA          *
LDY LF5F1,X      :\ F5B2= BC F1 F5    <qu
BVC LF5BC        :\ F5B5= 50 05       P.
INY              :\ F5B7= C8          H
INX              :\ F5B8= E8          h
INX              :\ F5B9= E8          h
INX              :\ F5BA= E8          h
INX              :\ F5BB= E8          h
.LF5BC
LDA &02D0,X      :\ F5BC= BD D0 02    =P.
PHA              :\ F5BF= 48          H
AND &F1          :\ F5C0= 25 F1       %q
EOR &F0          :\ F5C2= 45 F0       Ep
STA &02D0,X      :\ F5C4= 9D D0 02    .P.
STA LDD02,Y      :\ F5C7= 99 02 DD    ..]
PLA              :\ F5CA= 68          h
TAX              :\ F5CB= AA          *
.LF5CC
RTS              :\ F5CC= 60          `
 
.LF5CD
JSR LEEFC        :\ F5CD= 20 FC EE     |n
.LF5D0
LDA &024F:STA LFE12        :\ ACIA Command
LDA &0250:STA LFE13        :\ ACIA Control
RTS              :\ F5DC= 60          `
 
.LF5DD
BRK              :\ F5DD= 00          .
BVC LF5B0        :\ F5DE= 50 D0       PP
BRA LF5E2        :\ F5E0= 80 00       ..
 
.LF5E2
BRA LF5E4        :\ F5E2= 80 00       ..
 
.LF5E4
BRA LF626        :\ F5E4= 80 40       .@
 
CPY #&44         :\ F5E6= C0 44       @D
CPY &48          :\ F5E8= C4 48       DH
INY              :\ F5EA= C8          H
JMP &08CC        :\ F5EB= 4C CC 08    LL.
 
ASL A            :\ F5EE= 0A          .
TSB &000E        :\ F5EF= 0C 0E 00    ...
TSB &08          :\ F5F2= 04 08       ..
TSB &00A2        :\ F5F4= 0C A2 00    .".
.LF5F7
LDY LF5F1,X      :\ F5F7= BC F1 F5    <qu
LDA &0250        :\ F5FA= AD 50 02    -P.
STA &02D4,X      :\ F5FD= 9D D4 02    .T.
STA LDD03,Y      :\ F600= 99 03 DD    ..]
LDA &024F        :\ F603= AD 4F 02    -O.
STA &02D0,X      :\ F606= 9D D0 02    .P.
AND #&F3         :\ F609= 29 F3       )s
STA LDD02,Y      :\ F60B= 99 02 DD    ..]
CMP LDD02,Y      :\ F60E= D9 02 DD    Y.]
BNE LF618        :\ F611= D0 05       P.
INX              :\ F613= E8          h
CPX #&04         :\ F614= E0 04       `.
BCC LF5F7        :\ F616= 90 DF       ._
.LF618
STX &0261        :\ F618= 8E 61 02    .a.
JSR LF5D0        :\ F61B= 20 D0 F5     Pu
.LF61E
JSR LF726        :\ F61E= 20 26 F7     &w
LDA #&F0         :\ F621= A9 F0       )p
STA LDD11        :\ F623= 8D 11 DD    ..]
.LF626
STA LDD13        :\ F626= 8D 13 DD    ..]
RTS              :\ F629= 60          `
 
.LF62A
TXA              :\ F62A= 8A          .
BEQ LF63F        :\ F62B= F0 12       p.
CPX #&02         :\ F62D= E0 02       `.
BEQ LF642        :\ F62F= F0 11       p.
CPX #&03         :\ F631= E0 03       `.
BEQ LF646        :\ F633= F0 11       p.
JSR LF73B        :\ F635= 20 3B F7     ;w
.LF638
LDX &0241        :\ F638= AE 41 02    .A.
STA &0241        :\ F63B= 8D 41 02    .A.
RTS              :\ F63E= 60          `
 
.LF63F
JSR LF61E        :\ F63F= 20 1E F6     .v
.LF642
LDA #&00         :\ F642= A9 00       ).
BEQ LF638        :\ F644= F0 F2       pr
.LF646
LDA &0279        :\ F646= AD 79 02    -y.
ORA #&02         :\ F649= 09 02       ..
STA &0279        :\ F64B= 8D 79 02    .y.
LDA #&82         :\ F64E= A9 82       ).
STA LFE0E        :\ F650= 8D 0E FE    ..~
LDA #&00         :\ F653= A9 00       ).
STA LFE03        :\ F655= 8D 03 FE    ..~
BEQ LF638        :\ F658= F0 DE       p^
.LF65A
LDX #&FF         :\ F65A= A2 FF       ".
SEC              :\ F65C= 38          8
LDA LFE11   :\ Read ACIA Status
AND &0278
BMI LF676        :\ F663= 30 11       0.
.LF665
INX              :\ F665= E8          h
CPX &0261        :\ F666= EC 61 02    la.
BCS LF680        :\ F669= B0 15       0.
LDY LF5F1,X      :\ F66B= BC F1 F5    <qu
LDA LDD01,Y      :\ F66E= B9 01 DD    9.]
AND &0278        :\ F671= 2D 78 02    -x.
BPL LF665        :\ F674= 10 EF       .o
.LF676
STX &F0          :\ F676= 86 F0       .p
STY &F1          :\ F678= 84 F1       .q
STA &FB          :\ F67A= 85 FB       .{
JSR LF681        :\ F67C= 20 81 F6     .v
CLC              :\ F67F= 18          .
.LF680
RTS              :\ F680= 60          `
 
.LF681
BCS LF6A7        :\ F681= B0 24       0$
AND #&08         :\ F683= 29 08       ).
BNE LF69C        :\ F685= D0 15       P.
LDA LF4C4,X      :\ F687= BD C4 F4    =Dt
AND LDD11        :\ F68A= 2D 11 DD    -.]
PHP              :\ F68D= 08          .
LDA LF5ED,X      :\ F68E= BD ED F5    =mu
TAX              :\ F691= AA          *
INX              :\ F692= E8          h
LDA &0380,X      :\ F693= BD 80 03    =..
BMI LF6DE        :\ F696= 30 46       0F
PLP              :\ F698= 28          (
BEQ LF6BA        :\ F699= F0 1F       p.
RTS              :\ F69B= 60          `
 
.LF69C
LDA LDD00,Y      :\ F69C= B9 00 DD    9.]
TAY              :\ F69F= A8          (
LDA LF5ED,X      :\ F6A0= BD ED F5    =mu
TAX              :\ F6A3= AA          *
JMP LF701        :\ F6A4= 4C 01 F7    L.w
 
.LF6A7
AND #&08         :\ F6A7= 29 08       ).
BNE LF6FC        :\ F6A9= D0 51       PQ
LDX #&02         :\ F6AB= A2 02       ".
LDA &0380,X      :\ F6AD= BD 80 03    =..
BMI LF6DF        :\ F6B0= 30 2D       0-
LDA &FB          :\ F6B2= A5 FB       %{
AND #&50         :\ F6B4= 29 50       )P
EOR #&10         :\ F6B6= 49 10       I.
BNE LF6D7        :\ F6B8= D0 1D       P.
.LF6BA
DEX              :\ F6BA= CA          J
TXA              :\ F6BB= 8A          .
INX              :\ F6BC= E8          h
CMP &0240        :\ F6BD= CD 40 02    M@.
BNE LF6CD        :\ F6C0= D0 0B       P.
LDA #&02         :\ F6C2= A9 02       ).
CLC              :\ F6C4= 18          .
CLV              :\ F6C5= B8          8
JSR LF2F7        :\ F6C6= 20 F7 F2     wr
BCS LF6D0        :\ F6C9= B0 05       0.
BVS LF6DF        :\ F6CB= 70 12       p.
.LF6CD
JSR LF3C3        :\ F6CD= 20 C3 F3     Cs
.LF6D0
CPX #&02         :\ F6D0= E0 02       `.
BNE LF6D8        :\ F6D2= D0 04       P.
STA LFE10        :\ Send to ACIA Data Register
.LF6D7
RTS              :\ F6D7= 60          `
 
.LF6D8
LDY &F1          :\ F6D8= A4 F1       $q
STA LDD00,Y      :\ F6DA= 99 00 DD    ..]
RTS              :\ F6DD= 60          `
 
.LF6DE
PLP              :\ F6DE= 28          (
.LF6DF
LDA &0380,X      :\ F6DF= BD 80 03    =..
CMP #&FD         :\ F6E2= C9 FD       I}
BEQ LF6EA        :\ F6E4= F0 04       p.
DEC &0380,X      :\ F6E6= DE 80 03    ^..
RTS              :\ F6E9= 60          `
 
.LF6EA
LDX &F0          :\ F6EA= A6 F0       &p
BMI LF6F5        :\ F6EC= 30 07       0.
LDA &02D0,X      :\ F6EE= BD D0 02    =P.
STA LDD02,Y      :\ F6F1= 99 02 DD    ..]
RTS              :\ F6F4= 60          `
 
.LF6F5
LDA &024F:STA LFE12    :\ ACIA Command Register
RTS              :\ F6FB= 60          `

\ Read byte from ACIA serial input
.LF6FC
LDY LFE10:LDX #&01     :\ Read from ACIA Data Registser
.LF701
LDA &FB          :\ F701= A5 FB       %{
AND #&07         :\ F703= 29 07       ).
BEQ LF70C        :\ F705= F0 05       p.
LDY #&07         :\ F707= A0 07        .
JMP LFC8F        :\ F709= 4C 8F FC    L.|
 
.LF70C
CPX &0240        :\ F70C= EC 40 02    l@.
BNE LF719        :\ F70F= D0 08       P.
LDA #&00         :\ F711= A9 00       ).
CLC              :\ F713= 18          .
JSR LF2F7        :\ F714= 20 F7 F2     wr
BCS LF72E        :\ F717= B0 15       0.
.LF719
JSR LF43D        :\ F719= 20 3D F4     =t
SEC              :\ F71C= 38          8
JSR LF768        :\ F71D= 20 68 F7     hw
BCS LF72E        :\ F720= B0 0C       0.
CPX #&01         :\ F722= E0 01       `.
BNE LF72F        :\ F724= D0 09       P.
.LF726
LDA LFE0C        :\ F726= AD 0C FE    -.~
ORA #&0E         :\ F729= 09 0E       ..
STA LFE0C        :\ F72B= 8D 0C FE    ..~
.LF72E
RTS              :\ F72E= 60          `
 
.LF72F
LDY &F0          :\ F72F= A4 F0       $p
LDA LF4C8,Y      :\ F731= B9 C8 F4    9Ht
ORA LDD11        :\ F734= 0D 11 DD    ..]
STA LDD11        :\ F737= 8D 11 DD    ..]
RTS              :\ F73A= 60          `
 
.LF73B
PHA              :\ F73B= 48          H
LDA LF5DD,X      :\ F73C= BD DD F5    =]u
BMI LF756        :\ F73F= 30 15       0.
ASL A            :\ F741= 0A          .
BPL LF756        :\ F742= 10 12       ..
CLC              :\ F744= 18          .
JSR LF768        :\ F745= 20 68 F7     hw
BCS LF756        :\ F748= B0 0C       0.
CPX #&01         :\ F74A= E0 01       `.
BNE LF758        :\ F74C= D0 0A       P.
LDA LFE0C        :\ F74E= AD 0C FE    -.~
AND #&FD         :\ F751= 29 FD       )}
STA LFE0C        :\ F753= 8D 0C FE    ..~
.LF756
PLA              :\ F756= 68          h
RTS              :\ F757= 60          `
 
.LF758
TXA              :\ F758= 8A          .
LSR A            :\ F759= 4A          J
TAY              :\ F75A= A8          (
LDA LF4C4,Y      :\ F75B= B9 C4 F4    9Dt
EOR #&FF         :\ F75E= 49 FF       I.
AND LDD11        :\ F760= 2D 11 DD    -.]
STA LDD11        :\ F763= 8D 11 DD    ..]
.LF766
PLA              :\ F766= 68          h
RTS              :\ F767= 60          `
 
.LF768
TXA              :\ F768= 8A          .
PHA              :\ F769= 48          H
CLV              :\ F76A= B8          8
JSR LF489        :\ F76B= 20 89 F4     .t
CMP &025B        :\ F76E= CD 5B 02    M[.
PLA              :\ F771= 68          h
TAX              :\ F772= AA          *
RTS              :\ F773= 60          `
 
.LF774
BYTE ACTION TABLE
=================
F774 D0 F0       ��   BNE &F766		Byte0 - Read host type
F776 F6 EE       ��   INC &EE,X		Byte1 - Read/Write user value
F778 2A F6       *�   INC &FA,X		Byte2
F77A FA EE       ��   INC &EEFA		Byte3
F77C FA EE       ��   INC &EEFA		Byte4
F77E 77 F8       w�   EQUW &F877	Byte5 - Unsupported
F780 77 F8       w�   EQUW &F877	Byte6 - Unsupported
F782 8F F5       .�   EQUW &F58F	Byte7 - Serial receive baud
F784 8F F5       .�   EQUW &F58F	Byte8 - Serial transmit baud
F786 77 F8       w�   EQUW &F877	Byte9 - Unsupported
F788 77 F8       w�   EQUW &F877	Byte10 - Unsupported
F78A 77 F8       w�   EQUW &F877	Byte11 - Unsupported
F78D 77 F8       w�   EQUW &F877	Byte12 - Unsupported
F78E 0D EF       .�   EQUW &EF0D	Byte13 - Enable event
F790 0E EF       .�   EQUW &EF0E	Byte14 - Disable event
F792 78 F4       x�   EQUW &F478	Byte15
F794 77 F8       w�   EQUW &F877	Byte16 - Unsupported
F796 77 F8       w�   EQUW &F877	Byte17 - Unsupported
F798 1F ED       .�   EQUW &ED1F	Byte18
F79A 77 F8       w�   EQUW &F877	Byte19 - Unsupported
F79C 77 F8       w�   EQUW &F877	Byte20 - Unsupported
F79E 86 F4       .�   EQUW &F486	Byte21
F7A0 02 EE       .�   EQUW &EE02	Byte22
F7A2 64 EE       d�   EQUW &EE64	Byte23
F7A4 1B EF       .�   EQUW &EF1B	Byte24
F7A6 77 F8       w�   EQUW &F877	Byte25 - Unsupported

F7A8 77 F8       w�   EQUW &F877	Byte117 - Unsupported
F7AA 77 F8       w�   EQUW &F877	Byte118 - Unsupported
F7AC 52 EF       R�   EQUW &EF52	Byte119
F7AE 77 F8       w�   EQUW &F877	Byte120 - Unsupported
F7B0 77 F8       w�   EQUW &F877	Byte121 - Unsupported
F7B2 77 F8       w�   EQUW &F877	Byte122 - Unsupported
F7B4 77 F8       w�   EQUW &F877	Byte123 - Unsupported
F7B6 FA EF       ��   EQUW &EFFA	Byte124
F7B8 FB EF       ��   EQUW &EFFB	Byte125 - Generate Escape state
F7BA E0 EF       ��   EQUW &EFE0	Byte126
F7BC 84 FA       .�   EQUW &FA84	Byte127 - Read EOF
F7BE 6B F4       k�   EQUW &F46B	Byte128 - ADVAL
F7C0 2A ED       *�   EQUW &ED2A	Byte129 - INKEY
F7C2 35 EF       5�   EQUW &EF35	Byte130 - Read memory high word
F7C4 3A EF       :�   EQUW &EF3A	Byte131 - Read bottom of memory
F7C6 40 EF       @�   EQUW &EF40	Byte132 - Read top of memory
F7C8 40 EF       @�   EQUW &EF40	Byte133 - Read memtop for screen
F7CA 77 F8       w�   EQUW &F877	Byte134 - Unsupported (Read POS and VPOS)
F7CC 77 F8       w�   EQUW &F877	Byte135 - Unsupported (Read character at cursor)
F7CE 4F EF       O�   EQUW &EF4F	Byte136 - Perform *CODE - jump to USERV
F7D0 77 F8       w�   EQUW &F877	Byte137 - Unsupported (Perform *MOTOR)
F7D2 07 F4       .�   EQUW &F407	Byte138 - Insert value into buffer
F7D4 88 FA       .�   EQUW &FA88	Byte139 - Perform *OPT
F7D6 35 FD       5�   EQUW &FD35	Byte140 - Perform *SERIAL (*TAPE)
F7D8 77 F8       w�   EQUW &F877	Byte141 - Unsupported (Perform *ROM)
F7DA 0B FD       .�   EQUW &FD0B	Byte142 - Enter language
F7DC 4A FD       J�   EQUW &FD4A	Byte143 - Issue service call
F7DE 77 F8       w�   EQUW &F877	Byte144 - Unsupported (Perform *TV)
F7E0 C3 F3       ��   EQUW &F3C3	Byte145 - Get character from buffer
F7E2 77 F8       w�   EQUW &F877	Byte146 - Unsupported (Read from Fred)
F7E4 77 F8       w�   EQUW &F877	Byte147 - Unsupported (Write to Fred)
F7E6 77 F8       w�   EQUW &F877	Byte148 - Unsupported (Read from Jim)
F7E8 77 F8       w�   EQUW &F877	Byte149 - Unsupported (Write to Jim)
F7EA 46 EF       F�   EQUW &EF46	Byte150 - Read from Sheila
F7EC 4A EF       J�   EQUW &EF4A	Byte151 - Write to Sheila
F7EE BE F3       ��   EQUW &F3BE	Byte152 - Examine buffer status
F7F0 3D F4       =�   EQUW &F43D	Byte153 - Insert character into buffer
F7F2 77 F8       w�   EQUW &F877	Byte154 - Unsupported (Write to video ULA control)
F7F4 9F F5       .�   EQUW &F59F	Byte155 - Write to video ULA palette
F7F6 98 F5       .�   EQUW &F598	Byte156 - Read/Write 6850 control
F7F8 77 F8       w�   EQUW &F877	Byte157 - Unsupported (Fast Tube BPUT)
F7FA 77 F8       w�   EQUW &F877	Byte158 - Unsupported (Read from Speech processor)
F7FC 77 F8       w�   EQUW &F877	Byte159 - Unsupported (Write to Speech processor)
F7FE 77 F8       w�   EQUW &F877	Byte160 - Unsupported (Read VDU variable)
F800 FC EE       ��   EQUW &EEFC	Byte166+ - Read/Write OS variable

F802 4F EF       O�   EQUW &EF4F - Jump to USERV

\ OSWORD entries
\ --------------
F804 AF F8       ��   EQUW &F8AF	Word0 - Read input line
F806 14 F9       .�   EQUW &F914	Word1 - Read TIME from &0291-&0295
F808 26 F9       &�   EQUW &F926	Word2 - Write TIME to &0291-&0295
F80A 10 F9       .�   EQUW &F910	Word3 - Read interval timer from &0296-&029A
F80C 22 F9       "�   EQUW &F922	Word4 - Write interval timer to &0296-&029A
F80E 34 F9       4�   EQUW &F934	Word5 - Read i/o memory
F810 42 F9       B�   EQUW &F942	Word6 - Write to i/o memory
F812 A0 F8    �   �   EQUW &F8A0	Word7 - Unsupported (SOUND)
F814 A0 F8       ��   EQUW &F8A0	Word8 - Unsupported (ENVELOPE)
F816 A0 F8       ��   EQUW &F8A0	Word9 - Unsupported (POINT)
F818 A0 F8       ��   EQUW &F8A0	Word10 - Unsupported (Read character definition)
F81A A0 F8       ��   EQUW &F8A0	Word11 - Unsupported (Read pallette)
F81C A0 F8       ��   EQUW &F8A0	Word12 - Unsupported (Write pallette)
F81E A0 F8       ��   EQUW &F8A0	Word13 - Unsupported (Read graphics position)
F820 43 ED       C�   EQUW &ED43	Word14 - Read Real-Time Clock
F822 5B ED       [�   EQUW &ED5B	Word15 - Write Real-Time Clock
F824 71 F9       q�   EQUW &F971	Word16 - Enable/Disable VIA Timer1
F826 DB F9       ��   EQUW &F9DB	Word17 - Read status of VIA Timer1
F828 A0 F8       ��   EQUW &F8A0	Word18 - Unsupported
F82A AF EF       ��   EQUW &EFAF	Word19 - Do something with &0380/90/A0/B0/C0/D0


BYTE - Perform byte operations
==============================
.LF82C
PHA:PHP:SEI:CLD  :\ Save registers, disable IRQs, set binary
STA &EF          :\ F830= 85 EF       .o
STX &F0          :\ F832= 86 F0       .p
STY &F1          :\ F834= 84 F1       .q
CMP #&75         :\ F836= C9 75       Iu
BCC LF869        :\ F838= 90 2F       ./
CMP #&A1         :\ F83A= C9 A1       I!
BCC LF847        :\ F83C= 90 09       ..
CMP #&A6         :\ F83E= C9 A6       I&
BCC LF879        :\ F840= 90 37       .7
CLC              :\ F842= 18          .
.LF843
LDA #&A1         :\ F843= A9 A1       )!
ADC #&00         :\ F845= 69 00       i.
.LF847
SEC              :\ F847= 38          8
SBC #&5B         :\ F848= E9 5B       i[
.LF84A
ASL A            :\ F84A= 0A          .
TAY              :\ F84B= A8          (
LDA LF774,Y      :\ F84C= B9 74 F7    9tw
STA &FA          :\ F84F= 85 FA       .z
LDA LF775,Y      :\ F851= B9 75 F7    9uw
STA &FB          :\ F854= 85 FB       .{
LDA &EF          :\ F856= A5 EF       %o
LDY &F1          :\ F858= A4 F1       $q
LDX &F0          :\ F85A= A6 F0       &p
SEC              :\ F85C= 38          8
JSR LF866        :\ F85D= 20 66 F8     fx
.LF860
ROR A            :\ F860= 6A          j
PLP              :\ F861= 28          (
ROL A            :\ F862= 2A          *
PLA              :\ F863= 68          h
CLV              :\ F864= B8          8
RTS              :\ F865= 60          `
 
.LF866
JMP (&00FA)      :\ F866= 6C FA 00    lz.
 
.LF869
CMP #&1A:BCS LF879
CMP #&16:BCS LF84A
LDY #&00:STY &F1   :\ Force Y to be zero
BEQ LF84A          :\ Jump...

\ Implement as Unknown OSBYTE
\ ---------------------------
.LF877
PLA:PLA            :\ Drop return address

\ Unknown OSBYTE
\ --------------
.LF879
LDX #&07:JSR LFD4A :\ Send OSBYTE to sideways ROMs
BEQ LF885          :\ Exit if claimed
JSR LE9CD          :\ Send OSBYTE to Serial port
BNE LF8A9          :\ Exit with V set if not claimed
.LF885
LDX &F0:JMP LF860  :\ Get X and return


\ OSWORD
\ ====== 
.LF88A
PHA:PHP:SEI:CLD    :\ Save registers, disable IRQs, set binary
STA &EF            :\ Store A
STX &F0:STY &F1    :\ Store X,Y pointer to control block
CMP #&E0:BCS LF843 :\ If A>=&E0, jump to do User OSWORD
CMP #&14:BCS LF8A2 :\ If A>=&14, jump to do unknown OSWORD
ADC #&48:BCC LF84A :\ Index into jump table

\ Implement as Unknown OSWORD
\ ---------------------------
.LF8A0
PLA:PLA            :\ Drop return address
.LF8A2
LDX #&08:JSR LFD4A :\ Send OSWORD to sideways ROMs
BEQ LF885          :\ Exit if claimed
.LF8A9
PLP:PLA            :\ Restore registers
BIT LF09D:RTS      :\ Set Overflow and return


\ OSWORD 0 - Read Input Line
\ ==========================
.LF8AF 
LDY #&04         :\ F8AF= A0 04        .
.LF8B1
LDA (&F0),Y      :\ F8B1= B1 F0       1p
STA &02B1,Y      :\ F8B3= 99 B1 02    .1.
DEY              :\ F8B6= 88          .
CPY #&02         :\ F8B7= C0 02       @.
BCS LF8B1        :\ F8B9= B0 F6       0v
LDA (&F0),Y      :\ F8BB= B1 F0       1p
STA &E9          :\ F8BD= 85 E9       .i
DEY              :\ F8BF= 88          .
LDA (&F0),Y      :\ F8C0= B1 F0       1p
STA &E8          :\ F8C2= 85 E8       .h
STY &0269        :\ F8C4= 8C 69 02    .i.
CLI              :\ F8C7= 58          X
BCC LF8D1        :\ F8C8= 90 07       ..
.LF8CA
LDA #&07         :\ F8CA= A9 07       ).
DEY              :\ F8CC= 88          .
.LF8CD
INY              :\ F8CD= C8          H
.LF8CE
JSR OSWRCH       :\ F8CE= 20 EE FF     n.
.LF8D1
JSR OSRDCH       :\ F8D1= 20 E0 FF     `.
BCS LF90F        :\ F8D4= B0 39       09
CMP #&7F         :\ F8D6= C9 7F       I.
BNE LF8E1        :\ F8D8= D0 07       P.
CPY #&00         :\ F8DA= C0 00       @.
BEQ LF8D1        :\ F8DC= F0 F3       ps
DEY              :\ F8DE= 88          .
BCS LF8CE        :\ F8DF= B0 ED       0m
.LF8E1
CMP #&15         :\ F8E1= C9 15       I.
BNE LF8F2        :\ F8E3= D0 0D       P.
TYA              :\ F8E5= 98          .
BEQ LF8D1        :\ F8E6= F0 E9       pi
LDA #&7F         :\ F8E8= A9 7F       ).
.LF8EA
JSR OSWRCH       :\ F8EA= 20 EE FF     n.
DEY              :\ F8ED= 88          .
BNE LF8EA        :\ F8EE= D0 FA       Pz
BEQ LF8D1        :\ F8F0= F0 DF       p_
.LF8F2
STA (&E8),Y      :\ F8F2= 91 E8       .h
CMP #&0D         :\ F8F4= C9 0D       I.
BEQ LF90B        :\ F8F6= F0 13       p.
CPY &02B3        :\ F8F8= CC B3 02    L3.
BCS LF8CA        :\ F8FB= B0 CD       0M
CMP &02B4        :\ F8FD= CD B4 02    M4.
BCC LF8CE        :\ F900= 90 CC       .L
CMP &02B5        :\ F902= CD B5 02    M5.
BEQ LF8CD        :\ F905= F0 C6       pF
BCC LF8CD        :\ F907= 90 C4       .D
BCS LF8CE        :\ F909= B0 C3       0C
.LF90B
JSR OSNEWL       :\ F90B= 20 E7 FF     g.
CLC              :\ F90E= 18          .
.LF90F
RTS              :\ F90F= 60          `

.LF910 
LDX #&09         :\ F910= A2 09       ".
BNE LF916        :\ F912= D0 02       P.
LDX #&04         :\ F914= A2 04       ".
.LF916
LDY #&04         :\ F916= A0 04        .
.LF918
LDA &0291,X      :\ F918= BD 91 02    =..
STA (&F0),Y      :\ F91B= 91 F0       .p
DEX              :\ F91D= CA          J
DEY              :\ F91E= 88          .
BPL LF918        :\ F91F= 10 F7       .w
RTS              :\ F921= 60          `
 
LDX #&09         :\ F922= A2 09       ".
BNE LF928        :\ F924= D0 02       P.
.LF926
LDX #&04         :\ F926= A2 04       ".
.LF928
LDY #&04         :\ F928= A0 04        .
.LF92A
LDA (&F0),Y      :\ F92A= B1 F0       1p
STA &0291,X      :\ F92C= 9D 91 02    ...
DEX              :\ F92F= CA          J
DEY              :\ F930= 88          .
BPL LF92A        :\ F931= 10 F7       .w
RTS              :\ F933= 60          `
 
.LF934
LDA &F4          :\ F934= A5 F4       %t
PHA              :\ F936= 48          H
JSR LF950        :\ F937= 20 50 F9     Py
LDA (&FA,X)      :\ F93A= A1 FA       !z
STA (&F0),Y      :\ F93C= 91 F0       .p
PLA              :\ F93E= 68          h
JMP LFD92        :\ F93F= 4C 92 FD    L.}
 
LDA &F4          :\ F942= A5 F4       %t
PHA              :\ F944= 48          H
JSR LF950        :\ F945= 20 50 F9     Py
LDA (&F0),Y      :\ F948= B1 F0       1p
STA (&FA,X)      :\ F94A= 81 FA       .z
PLA              :\ F94C= 68          h
JMP LFD92        :\ F94D= 4C 92 FD    L.}
 
.LF950
LDY #&00         :\ F950= A0 00        .
LDA (&F0),Y      :\ F952= B1 F0       1p
STA &FA          :\ F954= 85 FA       .z
INY              :\ F956= C8          H
LDA (&F0),Y      :\ F957= B1 F0       1p
STA &FB          :\ F959= 85 FB       .{
LDY #&05         :\ F95B= A0 05        .
LDA (&F0),Y      :\ F95D= B1 F0       1p
JSR LFD92        :\ F95F= 20 92 FD     .}
DEY              :\ F962= 88          .
LDX #&00         :\ F963= A2 00       ".
RTS              :\ F965= 60          `
 
.LF966
LDY #&03         :\ F966= A0 03        .
.LF968
LDA (&F0),Y      :\ F968= B1 F0       1p
BNE LF970        :\ F96A= D0 04       P.
DEY              :\ F96C= 88          .
BPL LF968        :\ F96D= 10 F9       .y
TAY              :\ F96F= A8          (
.LF970
RTS              :\ F970= 60          `

\ OSWord 16 (&10) - Enable/Disable VIA Timer1 IRQs
\ ================================================
.LD971
JSR LF966:BNE LF979       :\ If !XY<>0, jump to enable Timer1 IRQs

\ OSWORD 16,0 - Disable VIA Timer1 IRQs
\ -------------------------------------
JMP LF290                 :\ Jump to disable VIA Timer1 IRQs

\ OSWORD 16,<>0 - Enable VIA Timer1 every 1 count
\ -----------------------------------------------
.LF979
LDY #&0F                  :\ Copy 16-byte control block to &0340
.LF97B
LDA (&F0),Y:STA &0340,Y
DEY:BPL LF97B
LDX #&04:LDA #&00
.LF987
STA &029B,X               :\ Clear 5 bytes at &029B-F
DEX:BPL LF987
LDA #&03:JSR LF9F7        :\ Call IND1V pointing to &0340 with A=3
BCS LF970                 :\ If Carry set, call claimed, return
LDX #&01:STX &0350        :\ Set &350/1 to &0001
DEX:STX &0351             :\
BEQ LF9B1                 :\ Jump to set VIA Timer1 to &0001

.LF99F
ASL &0350        :\ F99F= 0E 50 03    .P.
ROL &0351        :\ F9A2= 2E 51 03    .Q.
LSR &0347        :\ F9A5= 4E 47 03    NG.
ROR &0346        :\ F9A8= 6E 46 03    nF.
ROR &0345        :\ F9AB= 6E 45 03    nE.
ROR &0344        :\ F9AE= 6E 44 03    nD.

.LF9B1
LDA &0346:ORA &0347:BNE LF99F
LDA &0344:STA LFE04       :\ Set VIA Timer1 with current counter value
LDA &0345:STA LFE05
JSR LF9CE                 :\ Copy initial value to current value
LDA #&C0:STA LFE0E:RTS    :\ Enable VIA Timer1 IRQs

.LF9CE
LDA &0350:STA &0344       :\ Copy initial value at &350/1 to &344/5
LDA &0351:STA &0345:RTS

\ OsWord 17 (&11)
\ ===============
JSR LF966:BNE LF9F1       :\ If !XY<>0, jump to pass to IND1V

\ OSWORD 17,0 - Is VIA Timer1 enabled?
\ ------------------------------------
BIT LFE0E:BVC LF9E7       :\ If VIA Timer1 disabled, jump to return &00000000
LDA #&FF                  :\ Return &FFFFFFFF
.LF9E7
LDY #&05                  :\ Return in XY+5..XY+8
.LF9E9
STA (&F0),Y:INY           :\ Store in control block
CPY #&09:BNE LF9E9:RTS    :\ Loop and return

\ OSWORD 17,<>0 - Pass to IND1V
\ -----------------------------
.LF9F1
LDY &F1                   :\ Restore XY=>control block
LDA #&01:BNE LF9FB        :\ Jump to INDV1

.LF9F7
LDX #&40:LDY #&03         :\ Point to &0340
.LF9FB
JMP (&0230)               :\ Jump to INDV1
 
.LF9FE
EQUB &43         :\ F9FE= 43          C		CAT
.LF9FF
EOR (&54,X)      :\ F9FF= 41 54       AT
PLX              :\ FA01= FA          z
STA (&05,X)      :\ FA02= 81 05       ..
LSR &58          :\ FA04= 46 58       FX		FX
EQUB &FB         :\ FA06= FB          {
EQUB &C3         :\ FA07= C3          C
BBS 7,&42,&FA4C  :\ FA08= FF 42 41    .BA	BASIC
EQUB &53         :\ FA0B= 53          S
EOR #&43         :\ FA0C= 49 43       IC
PLX              :\ FA0E= FA          z
CPX &00          :\ FA0F= E4 00       d.
EOR &58          :\ FA11= 45 58       EX		EXEC
EOR &43          :\ FA13= 45 43       EC
BBS 6,&7F,&FA18  :\ FA15= EF 7F 00    o..
PHA              :\ FA18= 48          H		HELP
EOR &4C          :\ FA19= 45 4C       EL
BVC LFA1A        :\ FA1B= 50 FD       P}
LDA &FF          :\ FA1D= A5 FF       %.
JMP &414F        :\ FA1F= 4C 4F 41    LOA		LOAD
 
EQUB &44         :\ FA22= 44          D
NOP              :\ FA23= EA          j
CMP (&00,X)      :\ FA24= C1 00       A.
EOR (&55)        :\ FA26= 52 55       RU		RUN
LSR &81FA        :\ FA28= 4E FA 81    Nz.
TSB &53          :\ FA2B= 04 53       .S		SAVE
EOR (&56,X)      :\ FA2D= 41 56       AV
EOR &EA          :\ FA2F= 45 EA       Ej
EQUB &C3         :\ FA31= C3          C
BRK              :\ FA32= 00          .
EQUB &53         :\ FA33= 53          S		SPOOL
BVC LFA85        :\ FA34= 50 4F       PO
BBR 4,&4C,&FA28  :\ FA36= 4F 4C EF    OLo
LSR &4B00,X      :\ FA39= 5E 00 4B    ^.K	KEY
EOR &59          :\ FA3C= 45 59       EY
CPX LFF55        :\ FA3E= EC 55 FF    lU.
BBR 4,&50,&FA98  :\ FA41= 4F 50 54    OPT	OPT
EQUB &FB         :\ FA44= FB          {
CMP #&8B         :\ FA45= C9 8B       I.
EQUB &53         :\ FA47= 53          S		SERIAL
EOR &52          :\ FA48= 45 52       ER
EOR #&41         :\ FA4A= 49 41       IA
JMP LC9FB        :\ FA4C= 4C FB C9    L{I
 
STY &4F52        :\ FA4F= 8C 52 4F    .RO		ROM
EOR LC9FB        :\ FA52= 4D FB C9    M{I
STA &4F43        :\ FA55= 8D 43 4F    .CO		CODE
EQUB &44         :\ FA58= 44          D
EOR &FB          :\ FA59= 45 FB       E{
CMP #&88         :\ FA5B= C9 88       I.
BRK              :\ FA5D= 00          .

\ OSCLI
\ =====
.LFA5E
STX &F2:STY &F3        :\ Store pointer to command string
LDA #&08:JSR LFA81     :\ Warn FSCV command about to be processed
LDY #&FF               :\ Set line pointer before start
.LFA69
JSR LFB48:BEQ LFAD1    :\ Skip spaces, exit if <cr>
CMP #ASC"*":BEQ LFA69  :\ Skip past '*'s
JSR LFB49:BEQ LFAD1    :\ Skip past any more spaces, exit if <cr>
CMP #ASC"/":BNE LFA8C  :\ Jump to internal commands if not */name
INY:JSR LFAC5          :\ Step past '/', convert F2,Y to XY
LDA #&02               :\ A=2 for */name
.LFA81
JMP (&021E)            :\ Jump to FSCV

.LFA84 
LDA #&01:BNE LFA81     :\ Call FSCV 1, =EOF
.LFA88
LDA #&00:BEQ LFA81     :\ Call FSCV 0, *OPT

\ Match to internal *commands
\ ---------------------------
.LFA8C
LDX #&FD         :\ FA8C= A2 FD       "}
STY &E6          :\ FA8E= 84 E6       .f
.LFA90
LDY &E6          :\ FA90= A4 E6       $f
DEY              :\ FA92= 88          .
INX              :\ FA93= E8          h
INX              :\ FA94= E8          h
.LFA95
INX              :\ FA95= E8          h
INY              :\ FA96= C8          H
LDA LF9FE,X      :\ FA97= BD FE F9    =~y
BEQ LFAD2        :\ FA9A= F0 36       p6
BMI LFAB2        :\ FA9C= 30 14       0.
CMP (&F2),Y      :\ FA9E= D1 F2       Qr
BEQ LFA95        :\ FAA0= F0 F3       ps
.LFAA2
INX              :\ FAA2= E8          h
LDA LF9FE,X      :\ FAA3= BD FE F9    =~y
BPL LFAA2        :\ FAA6= 10 FA       .z
LDA (&F2),Y      :\ FAA8= B1 F2       1r
CMP #&2E         :\ FAAA= C9 2E       I.
BNE LFA90        :\ FAAC= D0 E2       Pb
INY              :\ FAAE= C8          H
LDA LF9FE,X      :\ FAAF= BD FE F9    =~y
.LFAB2
PHA              :\ FAB2= 48          H
LDA LF9FF,X      :\ FAB3= BD FF F9    =.y
PHA              :\ FAB6= 48          H
JSR LFB49        :\ FAB7= 20 49 FB     I{
CLC              :\ FABA= 18          .
PHP              :\ FABB= 08          .
JSR LFAC0        :\ FABC= 20 C0 FA     @z
RTI              :\ FABF= 40          @
 
.LFAC0
LDA LFA00,X      :\ FAC0= BD 00 FA    =.z
BMI LFAD1        :\ FAC3= 30 0C       0.
.LFAC5
PHA              :\ FAC5= 48          H
CLC              :\ FAC6= 18          .
TYA              :\ FAC7= 98          .
ADC &F2          :\ FAC8= 65 F2       er
TAX              :\ FACA= AA          *
PLA              :\ FACB= 68          h
LDY &F3          :\ FACC= A4 F3       $s
BCC LFAD1        :\ FACE= 90 01       ..
INY              :\ FAD0= C8          H
.LFAD1
RTS              :\ FAD1= 60          `
 
.LFAD2
LDY &E6          :\ FAD2= A4 E6       $f
LDX #&04         :\ FAD4= A2 04       ".
JSR LFD4A        :\ FAD6= 20 4A FD     J}
BEQ LFAD1        :\ FAD9= F0 F6       pv
LDY &E6          :\ FADB= A4 E6       $f
JSR LFAC5        :\ FADD= 20 C5 FA     Ez
LDA #&03         :\ FAE0= A9 03       ).
BNE LFA81        :\ FAE2= D0 9D       P.

\ *BASIC
\ ======
LDX &024B        :\ FAE4= AE 4B 02    .K.
BMI LFAD2        :\ FAE7= 30 E9       0i
SEC              :\ FAE9= 38          8
JMP LFD0B        :\ FAEA= 4C 0B FD    L.}
 
.LFAED
ROR &E4          :\ FAED= 66 E4       fd
JSR LFB49        :\ FAEF= 20 49 FB     I{
INY              :\ FAF2= C8          H
CMP #&22         :\ FAF3= C9 22       I"
BEQ LFAF9        :\ FAF5= F0 02       p.
DEY              :\ FAF7= 88          .
CLC              :\ FAF8= 18          .
.LFAF9
ROR &E4          :\ FAF9= 66 E4       fd
CMP #&0D         :\ FAFB= C9 0D       I.
RTS              :\ FAFD= 60          `
 
.LFAFE
LDA (&F2),Y      :\ FAFE= B1 F2       1r
CMP #&0D         :\ FB00= C9 0D       I.
BNE LFB0A        :\ FB02= D0 06       P.
BIT &E4          :\ FB04= 24 E4       $d
BMI LFB3B        :\ FB06= 30 33       03
BPL LFB29        :\ FB08= 10 1F       ..
.LFB0A
CMP #&20         :\ FB0A= C9 20       I 
BCC LFB3B        :\ FB0C= 90 2D       .-
BNE LFB16        :\ FB0E= D0 06       P.
BIT &E4          :\ FB10= 24 E4       $d
BMI LFB37        :\ FB12= 30 23       0#
BVC LFB29        :\ FB14= 50 13       P.
.LFB16
CMP #&7C         :\ FB16= C9 7C       I|
BEQ LFB2E        :\ FB18= F0 14       p.
CMP #&22         :\ FB1A= C9 22       I"
BNE LFB37        :\ FB1C= D0 19       P.
BIT &E4          :\ FB1E= 24 E4       $d
BPL LFB37        :\ FB20= 10 15       ..
INY              :\ FB22= C8          H
LDA (&F2),Y      :\ FB23= B1 F2       1r
CMP #&22         :\ FB25= C9 22       I"
BEQ LFB37        :\ FB27= F0 0E       p.
.LFB29
JSR LFB49        :\ FB29= 20 49 FB     I{
SEC              :\ FB2C= 38          8
RTS              :\ FB2D= 60          `
 
.LFB2E
INY              :\ FB2E= C8          H
LDA (&F2),Y      :\ FB2F= B1 F2       1r
CMP #&20         :\ FB31= C9 20       I 
BCC LFB3B        :\ FB33= 90 06       ..
AND #&1F         :\ FB35= 29 1F       ).
.LFB37
CLV              :\ FB37= B8          8
INY              :\ FB38= C8          H
.LFB39
CLC              :\ FB39= 18          .
RTS              :\ FB3A= 60          `
 
.LFB3B
BRK              :\ FB3B= 00          .
SBC &6142,X      :\ FB3C= FD 42 61    }Ba
STZ &20          :\ FB3F= 64 20       d 
EQUB &73         :\ FB41= 73          s
STZ &72,X        :\ FB42= 74 72       tr
ADC #&6E         :\ FB44= 69 6E       in
EQUB &67         :\ FB46= 67          g
BRK              :\ FB47= 00          .
.LFB48
INY              :\ FB48= C8          H
.LFB49
LDA (&F2),Y      :\ FB49= B1 F2       1r
CMP #&20         :\ FB4B= C9 20       I 
BEQ LFB48        :\ FB4D= F0 F9       py
.LFB4F
CMP #&0D         :\ FB4F= C9 0D       I.
RTS              :\ FB51= 60          `
 
.LFB52
BCC LFB49        :\ FB52= 90 F5       .u
.LFB54
JSR LFB49        :\ FB54= 20 49 FB     I{
CMP #&2C         :\ FB57= C9 2C       I,
BNE LFB4F        :\ FB59= D0 F4       Pt
INY              :\ FB5B= C8          H
RTS              :\ FB5C= 60          `
 
.LFB5D
JSR LFB49        :\ FB5D= 20 49 FB     I{
JSR LFB8C        :\ FB60= 20 8C FB     .{
BCC LFB39        :\ FB63= 90 D4       .T
.LFB65
STA &E6          :\ FB65= 85 E6       .f
INY              :\ FB67= C8          H
JSR LFB8C        :\ FB68= 20 8C FB     .{
BCC LFB86        :\ FB6B= 90 19       ..
TAX              :\ FB6D= AA          *
LDA &E6          :\ FB6E= A5 E6       %f
ASL A            :\ FB70= 0A          .
BCS LFB39        :\ FB71= B0 C6       0F
ASL A            :\ FB73= 0A          .
BCS LFB39        :\ FB74= B0 C3       0C
ADC &E6          :\ FB76= 65 E6       ef
BCS LFB39        :\ FB78= B0 BF       0?
ASL A            :\ FB7A= 0A          .
BCS LFB39        :\ FB7B= B0 BC       0<
STA &E6          :\ FB7D= 85 E6       .f
TXA              :\ FB7F= 8A          .
ADC &E6          :\ FB80= 65 E6       ef
BCC LFB65        :\ FB82= 90 E1       .a
BCS LFB39        :\ FB84= B0 B3       03
.LFB86
LDX &E6          :\ FB86= A6 E6       &f
CMP #&0D         :\ FB88= C9 0D       I.
SEC              :\ FB8A= 38          8
RTS              :\ FB8B= 60          `
 
.LFB8C
LDA (&F2),Y      :\ FB8C= B1 F2       1r
CMP #&3A         :\ FB8E= C9 3A       I:
BCS LFB39        :\ FB90= B0 A7       0'
CMP #&30         :\ FB92= C9 30       I0
BCC LFB39        :\ FB94= 90 A3       .#
AND #&0F         :\ FB96= 29 0F       ).
RTS              :\ FB98= 60          `
 
.LFB99
JSR LFBAE        :\ FB99= 20 AE FB     .{
.LFB9C
PHA              :\ FB9C= 48          H
LSR A            :\ FB9D= 4A          J
LSR A            :\ FB9E= 4A          J
LSR A            :\ FB9F= 4A          J
LSR A            :\ FBA0= 4A          J
BEQ LFBA6        :\ FBA1= F0 03       p.
JSR LFBA9        :\ FBA3= 20 A9 FB     ){
.LFBA6
PLA              :\ FBA6= 68          h
AND #&0F         :\ FBA7= 29 0F       ).
.LFBA9
ORA #&30         :\ FBA9= 09 30       .0
JMP OSWRCH       :\ FBAB= 4C EE FF    Ln.
 
.LFBAE
LDY #&03         :\ FBAE= A0 03        .
.LFBB0
CMP #&50         :\ FBB0= C9 50       IP
BCC LFBB6        :\ FBB2= 90 02       ..
SBC #&50         :\ FBB4= E9 50       iP
.LFBB6
ROL A            :\ FBB6= 2A          *
DEY              :\ FBB7= 88          .
BPL LFBB0        :\ FBB8= 10 F6       .v
LDY #&03         :\ FBBA= A0 03        .
.LFBBC
ASL A            :\ FBBC= 0A          .
ADC #&00         :\ FBBD= 69 00       i.
DEY              :\ FBBF= 88          .
BPL LFBBC        :\ FBC0= 10 FA       .z
RTS              :\ FBC2= 60          `
 
JSR LFB5D        :\ FBC3= 20 5D FB     ]{
BCC LFBF8        :\ FBC6= 90 30       .0
TXA              :\ FBC8= 8A          .
PHA              :\ FBC9= 48          H
LDA #&00         :\ FBCA= A9 00       ).
STA &E4          :\ FBCC= 85 E4       .d
STA &E5          :\ FBCE= 85 E5       .e
JSR LFB52        :\ FBD0= 20 52 FB     R{
BEQ LFBED        :\ FBD3= F0 18       p.
JSR LFB5D        :\ FBD5= 20 5D FB     ]{
BCC LFBF8        :\ FBD8= 90 1E       ..
STX &E4          :\ FBDA= 86 E4       .d
JSR LFB52        :\ FBDC= 20 52 FB     R{
BEQ LFBED        :\ FBDF= F0 0C       p.
JSR LFB5D        :\ FBE1= 20 5D FB     ]{
BCC LFBF8        :\ FBE4= 90 12       ..
STX &E5          :\ FBE6= 86 E5       .e
JSR LFB49        :\ FBE8= 20 49 FB     I{
BNE LFC05        :\ FBEB= D0 18       P.
.LFBED
LDX &E4          :\ FBED= A6 E4       &d
LDY &E5          :\ FBEF= A4 E5       $e
PLA              :\ FBF1= 68          h
JSR OSBYTE       :\ FBF2= 20 F4 FF     t.
BVS LFC05        :\ FBF5= 70 0E       p.
RTS              :\ FBF7= 60          `
 
.LFBF8
BRK              :\ FBF8= 00          .
EQUB &FC         :\ FBF9= FC          |
EQUB &42         :\ FBFA= 42          B
ADC (&64,X)      :\ FBFB= 61 64       ad
JSR &756E        :\ FBFD= 20 6E 75     nu
ADC &6562        :\ FC00= 6D 62 65    mbe
ADC (&00)        :\ FC03= 72 00       r.

.LFC05
BRK              :\ FC05= 00          .
INC &6142,X      :\ FC06= FE 42 61    ~Ba
STZ &20          :\ FC09= 64 20       d 
EQUB &63         :\ FC0B= 63          c
BBR 6,&6D,&FC7C  :\ FC0C= 6F 6D 6D    omm
ADC (&6E,X)      :\ FC0F= 61 6E       an
STZ &00          :\ FC11= 64 00       d.

.LFC13
JSR LFB49        :\ FC13= 20 49 FB     I{
JSR LFC28        :\ FC16= 20 28 FC     (|
BCC LFC27        :\ FC19= 90 0C       ..
JSR LFC60        :\ FC1B= 20 60 FC     `|
.LFC1E
JSR LFC40        :\ FC1E= 20 40 FC     @|
JSR LFC28        :\ FC21= 20 28 FC     (|
BCS LFC1E        :\ FC24= B0 F8       0x
SEC              :\ FC26= 38          8
.LFC27
RTS              :\ FC27= 60          `
 
.LFC28
JSR LFB8C        :\ FC28= 20 8C FB     .{
BCS LFC39        :\ FC2B= B0 0C       0.
CMP #&47         :\ FC2D= C9 47       IG
BCS LFC3B        :\ FC2F= B0 0A       0.
CMP #&41         :\ FC31= C9 41       IA
BCC LFC3B        :\ FC33= 90 06       ..
PHP              :\ FC35= 08          .
SBC #&37         :\ FC36= E9 37       i7
PLP              :\ FC38= 28          (
.LFC39
INY              :\ FC39= C8          H
RTS              :\ FC3A= 60          `
 
.LFC3B
JSR LFB54        :\ FC3B= 20 54 FB     T{
CLC              :\ FC3E= 18          .
RTS              :\ FC3F= 60          `
 
.LFC40
STY &E6          :\ FC40= 84 E6       .f
ROL A            :\ FC42= 2A          *
ROL A            :\ FC43= 2A          *
ROL A            :\ FC44= 2A          *
ROL A            :\ FC45= 2A          *
LDY #&04         :\ FC46= A0 04        .
.LFC48
ROL A            :\ FC48= 2A          *
ROL &02EE,X      :\ FC49= 3E EE 02    >n.
ROL &02EF,X      :\ FC4C= 3E EF 02    >o.
ROL &02F0,X      :\ FC4F= 3E F0 02    >p.
ROL &02F1,X      :\ FC52= 3E F1 02    >q.
BCS LFC5D        :\ FC55= B0 06       0.
DEY              :\ FC57= 88          .
BNE LFC48        :\ FC58= D0 EE       Pn
LDY &E6          :\ FC5A= A4 E6       $f
RTS              :\ FC5C= 60          `
 
.LFC5D
JMP LEB2A        :\ FC5D= 4C 2A EB    L*k
 
.LFC60
PHA              :\ FC60= 48          H
LDA #&00         :\ FC61= A9 00       ).
STA &02EE,X      :\ FC63= 9D EE 02    .n.
STA &02EF,X      :\ FC66= 9D EF 02    .o.
STA &02F0,X      :\ FC69= 9D F0 02    .p.
STA &02F1,X      :\ FC6C= 9D F1 02    .q.
PLA              :\ FC6F= 68          h
RTS              :\ FC70= 60          `
 
\ Print inline text
\ =================
.LFC71
PLA:STA &FD
PLA:STA &FE
TYA:PHA
LDY #&00:BEQ LFC80
.LFC7D
JSR OSASCI
.LFC80
INC &FD:BNE LFC86:INC &FE
.LFC86
LDA (&FD),Y:BPL LFC7D
PLA:TAY:JMP (&00FD)
 
.LFC8F
PHP              :\ FC8F= 08          .
SEI              :\ FC90= 78          x
PHA              :\ FC91= 48          H
STA &FA          :\ FC92= 85 FA       .z
LDA &02BF,Y      :\ FC94= B9 BF 02    9?.
BEQ LFCA3        :\ FC97= F0 0A       p.
TYA              :\ FC99= 98          .
LDY &FA          :\ FC9A= A4 FA       $z
JSR LFCA7        :\ FC9C= 20 A7 FC     '|
PLA              :\ FC9F= 68          h
PLP              :\ FCA0= 28          (
CLC              :\ FCA1= 18          .
RTS              :\ FCA2= 60          `
 
.LFCA3
PLA              :\ FCA3= 68          h
PLP              :\ FCA4= 28          (
SEC              :\ FCA5= 38          8
RTS              :\ FCA6= 60          `
 
.LFCA7
JMP (&0220)      :\ FCA7= 6C 20 02    l .
 
.LFCAA
AND #&43         :\ FCAA= 29 43       )C
PLP              :\ FCAC= 28          (
BRK              :\ FCAD= 00          .
.LFCAE
JSR LFD91        :\ FCAE= 20 91 FD     .}
.LFCB1
LDX #&03         :\ FCB1= A2 03       ".
LDY #&07         :\ FCB3= A0 07        .
LDA (&F6),Y      :\ FCB5= B1 F6       1v
TAY              :\ FCB7= A8          (
.LFCB8
LDA (&F6),Y      :\ FCB8= B1 F6       1v
CMP LFCAA,X      :\ FCBA= DD AA FC    ]*|
BNE LFCCB        :\ FCBD= D0 0C       P.
INY              :\ FCBF= C8          H
DEX              :\ FCC0= CA          J
BPL LFCB8        :\ FCC1= 10 F5       .u
LDX &F4          :\ FCC3= A6 F4       &t
LDY #&06         :\ FCC5= A0 06        .
LDA (&F6),Y      :\ FCC7= B1 F6       1v
LDY #&00         :\ FCC9= A0 00        .
.LFCCB
RTS              :\ FCCB= 60          `
 
Compare ROMs for uniqueness
---------------------------
.LFCCC
LDX #&00         :\ FCCC= A2 00       ".
JSR LFD9C        :\ FCCE= 20 9C FD     .}
.LFCD1
LDY #&10         :\ FCD1= A0 10        .
.LFCD3
STX LFE30        :\ FCD3= 8E 30 FE    .0~
INX              :\ FCD6= E8          h
LDA (&F6),Y      :\ FCD7= B1 F6       1v
STX LFE30        :\ FCD9= 8E 30 FE    .0~
DEX              :\ FCDC= CA          J
CMP (&F6),Y      :\ FCDD= D1 F6       Qv
BNE LFCE9        :\ FCDF= D0 08       P.
DEY              :\ FCE1= 88          .
BNE LFCD3        :\ FCE2= D0 EF       Po
INX              :\ FCE4= E8          h
CPX #&0F         :\ FCE5= E0 0F       `.
BCC LFCD1        :\ FCE7= 90 E8       .h
.LFCE9
JSR LFCAE        :\ FCE9= 20 AE FC     .|
BNE LFCF8        :\ FCEC= D0 0A       P.
STA &02A1,X      :\ FCEE= 9D A1 02    .!.
AND #&8F         :\ FCF1= 29 8F       ).
BNE LFCF8        :\ FCF3= D0 03       P.
STX &024B        :\ FCF5= 8E 4B 02    .K.
.LFCF8
LDX &F4          :\ FCF8= A6 F4       &t
INX              :\ FCFA= E8          h
CPX #&10         :\ FCFB= E0 10       `.
BCC LFCE9        :\ FCFD= 90 EA       .j
JSR LFD98        :\ FCFF= 20 98 FD     .} - Point &F6/7 to &E000
JSR LFCB1        :\ FD02= 20 B1 FC     1| - Check for (C)
BNE LFD0A        :\ FD05= D0 03       P.  - None
STA &0        :\ FD07= 8D A0 02    . .    - Set 'ROM-1' romtype byte
.LFD0A
RTS              :\ FD0A= 60          `
 
.LFD0B
FD0B 08          .    PHP		Save CC/CS flag
FD0C 8E 8C 02    ...  STX &028C		Store as current language
FD0F 20 91 FD     .�  JSR &FD91		Select this ROM
FD12 20 9C FD     .�  JSR &FD9C		Set &F6/7=&8000
FD15 E0 FF       �.   CPX #&FF		Is ROM=&FF?
FD17 D0 04       �.   BNE &FD1D		No, jump ahead
FD19 A9 C0       ��   LDA #&C0		For ROM &FF, make &F6/7=&C000
FD1B 85 F7       .�   STA &F7
.LFD1D
LDA &F6          :\ FD1D= A5 F6       %v		Copy &F6/7 to &FD/E
STA &FD          :\ FD1F= 85 FD       .}
LDA &F7          :\ FD21= A5 F7       %w
STA &FE          :\ FD23= 85 FE       .~
FD25 A0 08       �.   LDY #&08		Point to ROM title
FD27 20 05 F2     .�  JSR &F205		Print title
FD2A 84 FD       .�   STY &FD		Point &FD/E to version string
FD2C 20 F5 FD     ��  JSR &FDF5		Print OSNEWL twice
FD2F 28          (    PLP		Restore CC/CS flag
FD30 A9 01       �.   LDA #&01		A=1 - start language
FD32 6C F6 00    l�.  JMP (&00F6)	Enter language at &8000 or &C000
 

\ Select *SERIAL filing system
\ ============================
.LFD35
LDA #&06:JSR LFA81:LDX #&0E      :\ Warn vectors about to change
.LFD3C
LDA LF02A,X:STA &0211,X          :\ Copy filing system vectors
DEX:BNE LFD3C:STX &0247          :\ Set 'serial commands allowed'
LDX #&0F                         :\ Fall through to do Service 15 - Vectors have changed

\ Service Call Dispatch
\ =====================
.LFD4A
FD4A A5 F4       ��   LDA &F4
FD4C 48          H    PHA		Save current ROM
FD4D 8A          .    TXA
FD4E 2C A0 02    ,�.  BIT &02A0		Check a flag
FD51 10 10       ..   BPL &FD63		If b7=0, jump to do ROMs
FD53 C9 03       �.   CMP #&03		Is call BootFS?
FD55 F0 0C       �.   BEQ &FD63		Jump to do ROMs
FD57 AE 8C 02    �..  LDX &028C
FD5A 8E 30 FE    .0�  STX &FE30
FD5D 20 03 E0     .�  JSR &E003		Call MOS's high service entry
					This will also call &C003 entry
FD60 AA          �    TAX		Check return value
FD61 F0 28       �(   BEQ &FD8B		Exit if claimed
.LFD63
FD63 A2 0F       �.   LDX #&0F		Start at ROM 15
.LFD65
FD65 FE A1 02    ��.  INC &02A1,X
FD68 DE A1 02    ޡ.  DEC &02A1,X
FD6B 10 0D       ..   BPL &FD7A		No service entry, skip this ROM
FD6D 86 F4       .�   STX &F4
FD6F 8E 30 FE    .0�  STX &FE30		Select this ROM
FD72 20 03 80     ..  JSR &8003		Call the service entry
FD75 AA          �    TAX               Check return value
FD76 F0 13       �.   BEQ &FD8B		Exit if claimed
FD78 A6 F4       ��   LDX &F4		Get current ROM
.LFD7A
FD7A CA          �    DEX		Move down to next ROM
FD7B 10 E8       .�   BPL &FD65		Loop while ROM>=0
FD7D 30 0C       0.   BMI &FD8B		Exit when all ROMs done


\ OSRDRM - Read a byte from a sideways ROM
\ ========================================
\ On entry &F6/7=address, Y=ROM. On exit X=byte read.
.LFD7F
FD7F A5 F4       ��   LDA &F4
FD81 48          H    PHA		Save current ROM
FD82 98          .    TYA		Get ROM number from Y
FD83 20 92 FD     .�  JSR &FD92		Select ROM
FD86 A0 00       �.   LDY #&00
FD88 B1 F6       ��   LDA (&F6),Y	Fetch a byte from ROM
FD8A AA          �    TAX		Pass byte to X and restore ROM
.LFD8B
FD8B 68          h    PLA		Get saved ROM
FD8C 20 92 FD     .�  JSR &FD92		Restore ROM
FD8F 8A          .    TXA		Pass returned value to A
FD90 60          `    RTS		And return
 
.LFD91
TXA              :\ FD91= 8A          .
.LFD92
STA &F4          :\ FD92= 85 F4       .t
STA LFE30        :\ FD94= 8D 30 FE    .0~
RTS              :\ FD97= 60          `
 
.LFD98
LDA #&E0         :\ FD98= A9 E0       )`
BNE LFD9E        :\ FD9A= D0 02       P.
.LFD9C
LDA #&80         :\ FD9C= A9 80       ).
.LFD9E
STA &F7          :\ FD9E= 85 F7       .w
LDA #&00         :\ FDA0= A9 00       ).
STA &F6          :\ FDA2= 85 F6       .v
RTS              :\ FDA4= 60          `
 
\ *HELP
\ =====
.LFDA5
LDX #&09:JSR LFD4A    :\ Send *HELP service call
.LFDAA
JSR LFC71
EQUB 13
EQUS "CUBE MOSB X4.19":EQUB 13
LDA &028E             :\ Get memory size
LSR A:LSR A:JSR LFB99 :\ Divide by 4, print it
JSR LFC71
EQUS "K  RAM":EQUB 13
LDA &0289             :\ Get processor speed
JSR LFB99             :\ Print it
JSR LFC71
EQUS "MHz "
LDX #&EE:LDY #&02     :\ Point to &02EE?
JSR LED43
LDX #&FD:BNE LFDEC    :\ Display bytes at &2F1..3

.LFDE8
JSR LFC71             :\ Print a colon
EQUS ":"
.LFDEC
LDA &01F4,X           :\ Get byte from &02F1/2/3
JSR LFB9C             :\ Print it in hex
INX:BMI LFDE8         :\ Loop until &02F3 done
.LFDF5
JSR OSNEWL:JMP OSNEWL :\ Print two <nl>s and return
 
BRK              :\ FDFB= 00          .
BRK              :\ FDFC= 00          .
BRK              :\ FDFD= 00          .
BRK              :\ FDFE= 00          .
BRK              :\ FDFF= 00          .
.LFE00
BBS 7,&FF,&FE02  :\ FE00= FF FF FF    ...    SHEILA I/O space filled with &FF
.LFE03
BBS 7,&FF,&FE05  :\ FE03= FF FF FF    ...
.LFE06
BBS 7,&FF,&FE08  :\ FE06= FF FF FF    ...
.LFE09
BBS 7,&FF,&FE0B  :\ FE09= FF FF FF    ...
.LFE0C
BBS 7,&FF,&FE0E  :\ FE0C= FF FF FF    ...
BBS 7,&FF,&FE11  :\ FE0F= FF FF FF    ...
.LFE12
BBS 7,&FF,&FE14  :\ FE12= FF FF FF    ...
BBS 7,&FF,&FE17  :\ FE15= FF FF FF    ...
.LFE18
BBS 7,&FF,&FE1A  :\ FE18= FF FF FF    ...
BBS 7,&FF,&FE1D  :\ FE1B= FF FF FF    ...
BBS 7,&FF,&FE20  :\ FE1E= FF FF FF    ...
BBS 7,&FF,&FE23  :\ FE21= FF FF FF    ...
BBS 7,&FF,&FE26  :\ FE24= FF FF FF    ...
BBS 7,&FF,&FE29  :\ FE27= FF FF FF    ...
BBS 7,&FF,&FE2C  :\ FE2A= FF FF FF    ...
BBS 7,&FF,&FE2F  :\ FE2D= FF FF FF    ...
.LFE30
BBS 7,&FF,&FE32  :\ FE30= FF FF FF    ...
BBS 7,&FF,&FE35  :\ FE33= FF FF FF    ...
BBS 7,&FF,&FE38  :\ FE36= FF FF FF    ...
BBS 7,&FF,&FE3B  :\ FE39= FF FF FF    ...
BBS 7,&FF,&FE3E  :\ FE3C= FF FF FF    ...
BBS 7,&FF,&FE41  :\ FE3F= FF FF FF    ...
BBS 7,&FF,&FE44  :\ FE42= FF FF FF    ...
BBS 7,&FF,&FE47  :\ FE45= FF FF FF    ...
BBS 7,&FF,&FE4A  :\ FE48= FF FF FF    ...
BBS 7,&FF,&FE4D  :\ FE4B= FF FF FF    ...
BBS 7,&FF,&FE50  :\ FE4E= FF FF FF    ...
BBS 7,&FF,&FE53  :\ FE51= FF FF FF    ...
BBS 7,&FF,&FE56  :\ FE54= FF FF FF    ...
BBS 7,&FF,&FE59  :\ FE57= FF FF FF    ...
BBS 7,&FF,&FE5C  :\ FE5A= FF FF FF    ...
BBS 7,&FF,&FE5F  :\ FE5D= FF FF FF    ...
BBS 7,&FF,&FE62  :\ FE60= FF FF FF    ...
BBS 7,&FF,&FE65  :\ FE63= FF FF FF    ...
BBS 7,&FF,&FE68  :\ FE66= FF FF FF    ...
BBS 7,&FF,&FE6B  :\ FE69= FF FF FF    ...
BBS 7,&FF,&FE6E  :\ FE6C= FF FF FF    ...
BBS 7,&FF,&FE71  :\ FE6F= FF FF FF    ...
BBS 7,&FF,&FE74  :\ FE72= FF FF FF    ...
BBS 7,&FF,&FE77  :\ FE75= FF FF FF    ...
BBS 7,&FF,&FE7A  :\ FE78= FF FF FF    ...
BBS 7,&FF,&FE7D  :\ FE7B= FF FF FF    ...
BBS 7,&FF,&FE80  :\ FE7E= FF FF FF    ...
BBS 7,&FF,&FE83  :\ FE81= FF FF FF    ...
BBS 7,&FF,&FE86  :\ FE84= FF FF FF    ...
BBS 7,&FF,&FE89  :\ FE87= FF FF FF    ...
BBS 7,&FF,&FE8C  :\ FE8A= FF FF FF    ...
BBS 7,&FF,&FE8F  :\ FE8D= FF FF FF    ...
BBS 7,&FF,&FE92  :\ FE90= FF FF FF    ...
BBS 7,&FF,&FE95  :\ FE93= FF FF FF    ...
BBS 7,&FF,&FE98  :\ FE96= FF FF FF    ...
BBS 7,&FF,&FE9B  :\ FE99= FF FF FF    ...
BBS 7,&FF,&FE9E  :\ FE9C= FF FF FF    ...
BBS 7,&FF,&FEA1  :\ FE9F= FF FF FF    ...
BBS 7,&FF,&FEA4  :\ FEA2= FF FF FF    ...
BBS 7,&FF,&FEA7  :\ FEA5= FF FF FF    ...
BBS 7,&FF,&FEAA  :\ FEA8= FF FF FF    ...
BBS 7,&FF,&FEAD  :\ FEAB= FF FF FF    ...
BBS 7,&FF,&FEB0  :\ FEAE= FF FF FF    ...
BBS 7,&FF,&FEB3  :\ FEB1= FF FF FF    ...
BBS 7,&FF,&FEB6  :\ FEB4= FF FF FF    ...
BBS 7,&FF,&FEB9  :\ FEB7= FF FF FF    ...
BBS 7,&FF,&FEBC  :\ FEBA= FF FF FF    ...
BBS 7,&FF,&FEBF  :\ FEBD= FF FF FF    ...
BBS 7,&FF,&FEC2  :\ FEC0= FF FF FF    ...
BBS 7,&FF,&FEC5  :\ FEC3= FF FF FF    ...
BBS 7,&FF,&FEC8  :\ FEC6= FF FF FF    ...
BBS 7,&FF,&FECB  :\ FEC9= FF FF FF    ...
BBS 7,&FF,&FECE  :\ FECC= FF FF FF    ...
BBS 7,&FF,&FED1  :\ FECF= FF FF FF    ...
BBS 7,&FF,&FED4  :\ FED2= FF FF FF    ...
BBS 7,&FF,&FED7  :\ FED5= FF FF FF    ...
BBS 7,&FF,&FEDA  :\ FED8= FF FF FF    ...
BBS 7,&FF,&FEDD  :\ FEDB= FF FF FF    ...
BBS 7,&FF,&FEE0  :\ FEDE= FF FF FF    ...
BBS 7,&FF,&FEE3  :\ FEE1= FF FF FF    ...
BBS 7,&FF,&FEE6  :\ FEE4= FF FF FF    ...
BBS 7,&FF,&FEE9  :\ FEE7= FF FF FF    ...
BBS 7,&FF,&FEEC  :\ FEEA= FF FF FF    ...
BBS 7,&FF,&FEEF  :\ FEED= FF FF FF    ...
BBS 7,&FF,&FEF2  :\ FEF0= FF FF FF    ...
BBS 7,&FF,&FEF5  :\ FEF3= FF FF FF    ...
BBS 7,&FF,&FEF8  :\ FEF6= FF FF FF    ...
BBS 7,&FF,&FEFB  :\ FEF9= FF FF FF    ...
BBS 7,&FF,&FEFE  :\ FEFC= FF FF FF    ...
BBS 7,&20,&FF53  :\ FEFF= FF 20 51    . Q

Extended vector jump block
==========================
FF00 20 51 FF     Q.  JSR &FF51
FF03 20 51 FF     Q.  JSR &FF51
FF06 20 51 FF     Q.  JSR &FF51
FF09 20 51 FF     Q.  JSR &FF51
FF0C 20 51 FF     Q.  JSR &FF51
FF0F 20 51 FF     Q.  JSR &FF51
FF12 20 51 FF     Q.  JSR &FF51
FF15 20 51 FF     Q.  JSR &FF51
FF18 20 51 FF     Q.  JSR &FF51
FF1B 20 51 FF     Q.  JSR &FF51
FF1E 20 51 FF     Q.  JSR &FF51
FF21 20 51 FF     Q.  JSR &FF51
FF24 20 51 FF     Q.  JSR &FF51
FF27 20 51 FF     Q.  JSR &FF51
FF2A 20 51 FF     Q.  JSR &FF51
FF2D 20 51 FF     Q.  JSR &FF51
FF30 20 51 FF     Q.  JSR &FF51
FF33 20 51 FF     Q.  JSR &FF51
FF36 20 51 FF     Q.  JSR &FF51
FF39 20 51 FF     Q.  JSR &FF51
FF3C 20 51 FF     Q.  JSR &FF51
FF3F 20 51 FF     Q.  JSR &FF51
.LFF41
FF42 20 51 FF     Q.  JSR &FF51
FF45 20 51 FF     Q.  JSR &FF51
FF48 20 51 FF     Q.  JSR &FF51
FF4B 20 51 FF     Q.  JSR &FF51
FF4E 20 51 FF     Q.  JSR &FF51

.LFF51
FF51 48          H    PHA
FF52 48          H    PHA
FF53 48          H    PHA
FF54 48          H    PHA
PHA              :\ FF55= 48          H
PHP              :\ FF56= 08          .
PHA              :\ FF57= 48          H
TYA              :\ FF58= 98          .
PHA              :\ FF59= 48          H
TXA              :\ FF5A= 8A          .
PHA              :\ FF5B= 48          H
TSX              :\ FF5C= BA          :
LDA #&FF         :\ FF5D= A9 FF       ).
STA &0108,X      :\ FF5F= 9D 08 01    ...
LDA #&86         :\ FF62= A9 86       ).
STA &0107,X      :\ FF64= 9D 07 01    ...
LDY &010A,X      :\ FF67= BC 0A 01    <..
LDA &0D9C,Y      :\ FF6A= B9 9C 0D    9..
STA &0105,X      :\ FF6D= 9D 05 01    ...
LDA &0D9D,Y      :\ FF70= B9 9D 0D    9..
STA &0106,X      :\ FF73= 9D 06 01    ...
LDA &F4          :\ FF76= A5 F4       %t
STA &0109,X      :\ FF78= 9D 09 01    ...
LDA &0D9E,Y      :\ FF7B= B9 9E 0D    9..
JSR LFD92        :\ FF7E= 20 92 FD     .}
PLA              :\ FF81= 68          h
TAX              :\ FF82= AA          *
PLA              :\ FF83= 68          h
TAY              :\ FF84= A8          (
PLA              :\ FF85= 68          h
RTI              :\ FF86= 40          @
 
PHP              :\ FF87= 08          .
PHA              :\ FF88= 48          H
TXA              :\ FF89= 8A          .
PHA              :\ FF8A= 48          H
TSX              :\ FF8B= BA          :
LDA &0102,X      :\ FF8C= BD 02 01    =..
STA &0105,X      :\ FF8F= 9D 05 01    ...
LDA &0103,X      :\ FF92= BD 03 01    =..
STA &0106,X      :\ FF95= 9D 06 01    ...
PLA              :\ FF98= 68          h
TAX              :\ FF99= AA          *
PLA              :\ FF9A= 68          h
PLA              :\ FF9B= 68          h
PLA              :\ FF9C= 68          h
JSR LFD92        :\ FF9D= 20 92 FD     .}
PLA              :\ FFA0= 68          h
PLP              :\ FFA1= 28          (
.LFFA2
RTS              :\ FFA2= 60          `
 
BRK              :\ FFA3= 00          .
BRK              :\ FFA4= 00          .
BRK              :\ FFA5= 00          .
BRK              :\ FFA6= 00          .
BRK              :\ FFA7= 00          .
BRK              :\ FFA8= 00          .
BRK              :\ FFA9= 00          .
BRK              :\ FFAA= 00          .
BRK              :\ FFAB= 00          .
BRK              :\ FFAC= 00          .
BRK              :\ FFAD= 00          .
BRK              :\ FFAE= 00          .
BRK              :\ FFAF= 00          .

.LFFB0:JMP LF4F5           :\ FFB0= 4C F5 F4    Lut
.LFFB3:JMP LFC71           :\ Print inline text
.LFFB6:EQUB &36:EQUW LF019 :\ Default vector table address
.LFFB9:JMP LFD7F           :\ OSRDRM
.LFFBC:JMP LFFA2           :\ nothing
.LFFBF:JMP LFC8F
.LFFC2:JMP LFAED
.LFFC5:JMP LFAFE
.LFFC8:JMP LF37E
.LFFCB:JMP LF30F

\ FILING SYSTEM ENTRY POINTS
\ --------------------------
.LFFCE:JMP (&021C)         :\ OSFIND
.LFFD1:JMP (&021A)         :\ OSBGET
.LFFD4:JMP (&0218)         :\ OSBPUT
.LFFD7:JMP (&0216)         :\ OSGBPB
.LFFDA:JMP (&0214)         :\ OSARGS
.LFFDD:JMP (&0212)         :\ OSFILE

\ CHARACTER I/O ENTRY POINTS
\ --------------------------
.LFFE0:JMP (&0210)         :\ OSRDCH
.LFFE3:CMP #&0D:BNE OSWRCH :\ OSASCI
.LFFE7:LDA #&0A:JSR OSWRCH :\ OSNEWL
.LFFEC:LDA #&0D            :\ OSWRCR
.LFFEE:JMP (&020E)         :\ OSWRCH

\ MOS ENTRY POINTS
\ ----------------
.LFFF1:JMP (&020C)         :\ OSWORD
.LFFF4:JMP (&020A)         :\ OSBYTE
.LFFF7:JMP (&0208)         :\ OS_CLI
 
\ HARDWARE VECTORS
\ ----------------
.NMIV :EQUW &0D00  :\  NMI Vector -> &0D00
.RSTV :EQUW LF0EA  :\  RST Vector -> &F0EA
.IRQV :EQUW LF20B  :\  IRQ Vector -> &F20B
.LFFFF
]NEXT
PRINT "*SAVE CUBEMOS ";~mcode%;" ";~O%;" ";~exec%;" ";~load%
