19781 > 6502.Serial65/srcTINTREM Generated from HostFS sourceTINTREMTINTREM Source for Singl
28496 rt Tube Client MOS for 6502TINT
8269 ===============================================TINTREM This code may
8293 freely reused, with acknowledgementsTINT:TINTREM This implements a Tube client communicating with a
29811 TINTREM via a single port, such as a serial port, a parallel port,TINTREM or even a single Tube register, all in
29555 than 2K.TINT:TINTREM The link is a text channel that escapes out to send commandsTINTREM and receive data
24946 nsfers. This version assumes a clean,TINTREM error-free link channelTINT:TINTREM Can be built as a BBC filing system, wit
28515 de to accessTINTREM BBC memory
11888 TINT:TINTREM v0.16 16-Nov-2010 J.G.HarstonTINTREM v0.17 09-Mar-2013 JGH: Added additional Tube entry p
29806 s,TINTREM EXECUTE enters code with A=0/1, SEC/CLC.TINTREM v0.18 07-Apr-2013 JGH: Mov
29472 ome code that overlapped I/O area.TINTREM 09-Nov-2016 JGH: Edited slightly to allow conversio
28532 as65 source.TINTREM v0.19 11-N
12845 016 JGH: Added conditionals for sideways ROM code.TINTREM v0.20 18-Mar-2017 JGH: Added option for local RDLINE, optim
25701 OSCLI.TINTREM v0.21 23-Feb-2018 JGH: *HOSTFS ON sets WRCHV/RDCHV.
REM Serv3 responds to re
28274 ed boot option.TINTREM To do:TINTREM TxRDY should also check for outgoing CTS/RTSTINT:TINTREM v0.22TINTtweek1%=FALSE:REM ReadDat
30580 eek2%=
21076 UE :REM Tube transferTINTtweek3%=0*TRUE :
8269 Load to I/O accesses hardware directlyTINTtweek4%=FALSETINTtweek%=tweek
20256 R tweek2% OR tweek3% OR tweek4%TINT:
21002 EM Specify targetTINTREM ==============TINTver$="0.21":date$
10272 23 Feb 2018)"
IF tweek%:ver$="
12850 ":date$=" (13 Jan 2020)"
SWROM% =TRUE :REM
26997 ld sideways ROM filing systemTINTSWROM% =FALSE:REM Build 6502 Cli
8308 ROMTINTRDLINE%=TRUE :REM Implement RDLINE locallyTINTRDLINE%=FALSE:REM Pass RDLINE to hostTINT:TINTREM BoilerplateTINTREM
15677 ========TINTIF HIMEM>&FFFF:SYS "OS_GetEnv"TOA$:IFLEFT$(A$,5)
16930 6502":OSCLI"B6502"+MID$(A$,INSTR(A$," "))
ON ERROR REPORT:
20041 T" at line ";ERL:ENDTINTDEFFNif(A%):IFA%:z%=-1:=opt% ELSE z%=P%:=opt%TINTDEFFNendif:
9594 =-1:=opt% ELSE z%=P%-z%:P%=P%-z%:O%=O%-z%:=opt%TINTDEFFNelse:IFz%=-1:
20541 %:=opt% ELSE z%=P%-z%:P%=P%-z%:O%
11557 z%:z%=-1:=opt%TINTDIM mcode% &FFF, L% &7FTINT:TINTREM System vectorsTINTREM ===========
2621 USERV=&200:BRKV =&202:IRQ1V=&204:IRQ2V=&206:CLIV =&208:BY
15702 &20ATINTWORDV=&20C:WRCHV=&20E:RDCHV=&210:FILEV=&212:ARGSV=&214:BGetV
12594 6TINTBPutV=&218:GBPBV=&21A:FINDV=&21C
17235 V =&21E:EVNTV=&220TINT:TINTREM System addressesTINTREM ================TINTROM
21057 T%=&F800 :REM Start of ROM code to copy to RAMTINTIOSPACE% =&FEF0 :
8269 Start of I/O spaceTINTERRBUF=&236 :REM Error bufferTINTINPB
9789 236:INPEND=&300 :REM Supervisor string bufferTINT:TINTPROG =&EE:REM &E
8262 = PROG - Current programTINTNUM =&F0:REM
12080 1 = NUM - hex accumulatorTINTMEMTOP =&F2:REM &F2/3 = MEMTOP - top
27936 emoryTINTTRANS =&F4:REM &F4/5 = ADDR - Data transfer address (assembler doesn't like 'INC ADDR')TINTT
21326 hi=&F6:REM &F6/7 = ADDR+2 - Data transfer address high wordTINTL
8274 =&F8:REM &F8/9 = String pointer, OSWORD control blockTINTCTRL =&FA:REM &FA/B =
19538 - OSFILE, OSGBPB control blockTINTCMD =&FA:REM CMD - Address of co
28257 d line parametersTINTTEXT =&FA:REM &FA/B = TEXT - PrText string pointerTINTIRQA =&FC:REM &FC = IRQ A st
2661 FAULT =&FD:REM &FD/E => last errorTINTESCFLG =&FF:REM &FF = Escape flagTINT:TINTREM I/O values, these are suitable f
24864 6850TINTREM =========================================TINTTxStatus=&FEF0:TxRDY=2:TxData=&FEF1:TxInit=&13:RxStop=&55:
8269 &13=Reset ACIA, &55=8N1, clock/16, RTS highTINTRxStatus=&FEF0:RxRDY=
30802 Data=&FEF1:RxInit=&55:RxCont=&15:REM &55=RTS high, &15
21332 lowTINT:TINTREM Serial Tube system valuesTINTREM =========================TINTesc=&9BTINT:TINTR
17440 eclare code start and spaceTINTREM ============================TINTIF SWROM%=0:
25957 k3%=0TINTIF SWROM%=0:load%=&F800:name$="Serial65"TINTIF SWROM% :load%=&8000:name$="HostFS"TINT:TINTIF tweek%:name$=name$+"v"+M
10276 ver$,3,2)TINTFOR P=0 TO 1:opt%=P*3+4TINTP%=load%:O%=mcode%TINTPROCasmROMH
25956 rTINTPROCasmTubeCodeTINTNEXT:IF O%>L%:PRINT "ERROR: Code overrun"TINTOSCLI"Save "+LEFT$(name$,10)+" "+
9298 ~mcode%+" "+STR$~O%+" "+STR$~load%+" "+STR$~load%TINTON ERROR ON ERROR OFF:ENDTINTIF S
19791 %:OSCLI"SetType "+name$+" BBC"TINT*QuitTINTENDTINT:TINT:TINTDEFFNerror:IF SWROM%:[OPT P*3+4:J
17696 rror:]:=opt% ELSE [OPT P*3+4:BRK:]:=opt%TINT:TINTDEFPROCasmTubeCodeTINT[OPT opt%TINT\ Star
26223 Tube system codeTINT\ ========
15677 =============TINT\ On hardware reset all of memory reads com
29286 om ROM, all writes go to RAM
8284 Access
8295 any I/O location pages ROM out of memory map, thence all readsTINT\ come from RAM.TINT\TINT.LF800TINTJMP RESETTINT.PrBann
18954 SR PrTextTINT.BANNERTINTEQUB 13:EQUS "SERIAL TUBE 6502 64K ":EQUS LEFT$(ver$+" ",5)TINTEQUB 13:EQUB 0TINTRTSTINTTINT\ Tube Clien
29779 artup CodeTINT\ ===============
15677 =====TINT.RESETTINTSEI:LDX #&00 :\ Disable interu
2675 .LF802TINTLDA &FF00,X:STA &FF00,X :\ Copy entry block to RAMTINTDEX:BNE LF802TINTTINT\ The following code copies the page
29801 h the I/O registers inTINT\ it without accessing the I/O registers. Modify IOSPACE% accordingTINT\ to where the I/O regis
29554 actually are.TINTTINTLDX #IOSPACE% AND 255TINT.LF819TINTLDA &FDFF,X:STA &FDFF,X :\ Copy &FE00-&FEEF to RA
24864 voidingTINTDEX:BNE LF819 :\ I
28787 ace at &FEFxTINT:TINTLDY #ROMSTART
20033 D 255:STY LPTR+0 :\ Point to
24948 rt of ROMTINTLDA #ROMSTART% DIV 256:STA LPTR+1TINT.LF82A :\ Copy rest of ROM to RAMTINTLDA (LPTR),Y:
8257 (LPTR),Y :\ Copy a page to RAMTINTINY:BNE LF82A :\ Loop for 256 bytes
17230 LPTR+1:LDA LPTR+1 :\ Inc. address high byteTINTCMP #&FE:BNE LF82A
8224 :\ Loop up to &FDFFTINT:TINT.S
21586 UPTINTSEI:LDX #&35TINT.LF80DTINTLDA LFF00,X:STA USERV,X :\ Set up d
30049 lt vectorsTINTDEX:BPL LF80D:TXS :\ and clear stackTINTLDA TxInit:STA TxStatus :\ Initialise
29295 t and page ROM outTINTLDA RxInit:STA RxStatusTINT :\ Accessing I/O registers will page R
28448 ut if runningTINT :\ from RAM. Once ROM is paged o
30496 e can do subroutineTINT :\ calls as we can now read from stack in RAM.TINTTINTLDA #&00:STA ESCF
21306 TA MEMTOP+0 :\ Clear Escape flagTINTLDA #ROMSTART% DIV 256:STA MEMT
12587 :\ Set memtop to start of ROMTINTJSR InitError :\ Claim
28530 r handlerTINTLDA PROG+0:STA TRANS+0 :\ Copy PROG to TRANS addressTINTLDA PROG+1:STA TRANS+1TINTTINT\ Tell the
29551 t that we've restartedTINT\ ----------------------------------TINT\ Tube d
8289 &18 &00 &FF &FF -- Cy Y XTINT\ followed by stringTINT\TINT\ Note for Host authors, Host MUST NOT respond by
26723 oing back a SoftResetTINT\ as the Client will be trapped in an infinite STARTUP loop. If Host wantsTINT
28532 read Client to determine CP
26740 is will change TRANS so must
27758 y beTINT\ done if a later transaction will set TRANS after a language transfer, egTINT\ on Hard Reset.TINT\TINTLDX #0:L
8992 &FF:TAY :\ As we are using a serial link, send Soft Re
2676 JSR osFSC:TXA :\ Sends A=&FF, X=0 Soft Reset, Y=&FF no bootTINT.STARTUP2TINTPHA
8224 :\ Save returned Ac
31074 te, will be &00 if no respon
18954 SR PrBanner:JSR OSNEWL :\ Display startup bannerTINTLDA #CmdPrompt AND 255 :\ Next time RESET
8307 soft entered,TINTSTA LF800+1 :\ banner not printedTINTLDA #CmdPrompt DIV 256TINTSTA LF800+2TINTPL
19523 C:JSR WaitCheckCode :\ Check Ack code, if &80 enter c
11365 TINT: :\ else enter command prompt loopTINTTINTTINT\ Supervisor Command promptTINT\ =
15677 ====================TINT.CmdPromptTINTLDX #&FF:TXS:JSR InitErro
8224 :\ Reset stack, claim e
29295 handlerTINTLDA #CmdPrompt AND 255:STA PROG+0 :\ Make Command Prompt the current programTINTLDA #CmdPrompt DIV 256:S
20512 ROG+1TINT.CmdOSLoopTINTLDA #ASC"*":JSR OSWRCH :\ Print '*' prom
19466 DX #LF95D AND 255TINTLDY #LF95D DIV 256TINTLDA #&00:JSR OSWORD :\ Read line to INPBUFTINTBCS CmdOSEscapeTINTLDX #INPB
16672 ND 255TINTLDY #INPBUF DIV 256 :\ Execute commandTINTJSR OS_CLI:JM
27971 dOSLoop :\ and loop back
8306 anotherTINT.CmdOSEscapeTINTLDA #&7E:JSR OSBYTE :\ Acknowledge Escape stateTINTOPT FNerror:EQUB 17:EQUS "Escap
16954 RKTINTTINT\ Control block for comman
29296 ompt inputTINT\ ---------------
11565 -------------------TINT.LF95DTINTEQUW INPBUF
8224 :\ Input text to IN
18005 TINTEQUB INPEND-INPBUF :\ Maximum number of charactersTINTEQ
9760 20:EQUB &FF :\ Min=&20, Max=&FFTINTTINTTINT\ Error handlerTINT\ =
15677 ========TINT.InitErrorTINTLDA #ErrorHandler AND 255:STA BRKV+0
17184 laim error handlerTINTLDA #ErrorHandler DIV 256:STA BRKV+1TINTRTSTINTTINT.ErrorHandlerTINTLDX #&FF:TXS
8224 :\ Reset stackTINTJSR
20051 EWLTINTLDX FAULT+0:LDY FAULT+1TINTINX:BNE P%+3:INY :\ XY=>error stringTINT
8274 PRSTRNG :\ Print error stringTINTJSR OSNEWL:JMP CmdPrompt :\ Jump
8303 command promptTINTTINTTINT\ Interrupt handlersTINT\ ==================TINT.IRQHandlerTINTSTA IRQA:PLA:PHA :\ Save A, get
24940 gs from stackTINTAND #&10:BNE BRKHandler :\ If BRK, jump to BRK handlerTINTJMP (IRQ1V)
8284 Continue via IRQ1V handlerTINT.IRQ1HandlerTINTJMP (IRQ2V)
8224 :\ Pass on to IRQ2V
21058 KHandlerTINTTXA:PHA :\ Sav
2648 TSX:LDA &0103,X :
25927 t address from stackTINTCLD:SEC
17218 #&01:STA FAULT+0TINTLDA &0104,XTINTSBC #&00:STA FAULT+1 :\ &FD/E=>after BRK op
25956 TINTPLA:TAX:LDA IRQA :\ Restore X, get saved ATINTCLI:JMP (BRKV) :\ Restore IRQs, jump to E
29295 HandlerTINT.IRQ2HandlerTINTLDA IRQA :\ Restore saved ATINT.NMIHandlerTINTRTITINTTINTTINT\ Skip SpacesTINT\ ========
2621 .SkipSpaces1TINTINYTINT.SkipSpacesTINTLDA (LPTR),Y:CMP #&20:BEQ Sk
28755 aces1TINT.NullReturnTINTRTSTINTTINT\ Scan hexTINT\ ========TINT.ScanHexTINTLDX #&00:STX NUM+0:STX NUM+1 :\ Clear hex accumulatorTINT
14662 8CTINTLDA (LPTR),Y :\ Get current characterTINTCMP #&30:BCC LF9
8224 :\ <'0', exitTINTCMP #&3A:BCC LF9A0
8224 :\ '0'..'9', add to accumul
29295 TINTAND #&DF:SBC #&07:BCC LF9B1 :\ Convert letter, if <'A', exitTINTCMP #&40:BCS LF9B1 :\ >'F', exitTINT.LF9A0TINTA
16672 :ASL A:ASL A:ASL A :\ *16TINTLDX #&03 :\ Prepare to
25974 3+1 bitsTINT.LF9A6TINTASL A:ROL NUM+0:ROL NUM+1 :\ Move bits into accumulatorTINTDEX:BPL LF9A6 :\ L
8304 for four bits, no overflow checkTINTINY:BNE LF98C :\ Move to next characterTINT.LF9B1TINTRTSTINTTINTTINT\ MOS I
21061 FACETINT\ ~~~~~~~~~~~~~TINT\TINT\TINT\ OSRDCH - Wait for character from input streamTINT\ =====
15677 ====================================TINT\ On exit, A =char,
17725 scape flagTINT\TINT.osRDCHTINTJSR WaitByte:PHA :\ Wait for characterTINTLDA ESCFLG:ASL A :\ Get Escape flag t
24931 rryTINTPLA:RTS
14880 \ Get character to A and ret
2670 TINTTINT\ OSRDCH - Request character via TubeTINT\ ===================================TINT\ On exit, A =char, Cy=Escape fl
23562 TINT\ Tube data &00 -- Carry CharTINT\TINT.osRDCH_IOTINTLDA #&00:JSR SendCommand :\ Send command &00 - OSR
2632 .WaitCarryChar :\ Wait for Carry and ATINTJSR WaitByte
19539 A :\ Wait for carryTINTJMP WaitByteTINTTINTTINT\ OSCLI - Execute
28015 mandTINT\ =======================TINT\ On entry, XY=>command stringTINT\ On exit, All registers corrupt
2570 \ Local *commandsTINT\ ---------------TINT.CmdTableTINTEQUS "GO":EQUB &80TINTEQUS "HELP":EQUB &81TINTEQUB 0TINTTINT.o
18764 TINTSTX LPTR+0:STY LPTR+1 :\ LPTR=>command stringTINTLDY #&FFTINT.o
18764 lp0TINTJSR SkipSpaces1TINTCMP #ASC"*":BEQ osCLIlp0 :\ Skip spaces a
29472 tarsTINTCMP #ASC"A":BCC osCLI_IO :\ Doesn't start with a letterTINTLDX #&FF:DEY :\ Poi
29728 o before start of stringsTINT.osCLIlp1TINTTYA:PHA :\ Save start of command lineTINT.osCLIlp2TINTINX:INY
8224 :\ Step to
29816 charactersTINTLDA CmdTable,X:BMI osCLImatch :\ Check for end of commandTINTLDA (LPTR),YTINTCMP #ASC".":BE
29551 CLIskip :\ EQ+CS = abbre
29793 ed commandTINTAND #&DF :\ Force upper caseTINTCMP CmdTable,X:BEQ osCLIlp2 :\ Check m
8293 charactersTINTCLC :\ CC=skip this commandTINT.osCLIskipTINTINXTINTLDA CmdTable,X:BPL osCLIskip
21280 tep to end of entryTINTBCS osCLIdot :\ CS=abbreviated commandTINT.osCLInomatc
19536 A:TAY
8224 :\ Restore
28265 e pointerTINTLDA CmdTable+1,X:BNE osCLIlp1 :\ Not at end of tableTINTBEQ osCLI_IO :\ End of t
25964 , pass to TubeTINT.osCLImatchTINTLDA (LPTR),YTINTCMP #ASC"A":BCS osCLInomatch :\ More letters, check n
8308 entryTINTDEY :\ Prepare to skip any spacesTINT.osCLIdotTINTPLA:JSR SkipSpaces1 :\ Drop saved
26991 nter, step past dot, skip spacesTINTLDA CmdTable,X :\ Get command byteTINTCMP #&81:BEQ CmdHelp :
14374 1, jump to *HelpTINT
8224 :\ Fall through
10784 GoTINTTINT\ *GO - call machine codeTINT\ -----------------------TINT.CmdGoTINTJSR ScanHex:JSR SkipSpaces :\ Read hex val
24864 nd move past spacesTINTCMP #&0D:BNE osCLI_IO :\ More parameters, pass to Tube to deal withTINTTX
17730 Q CmdGo2:LDX #NUM-PROG :\ If no parameters, jump to PR
8236 else jump to NUMTINT.CmdGo2TINTLDA PROG+0,X:STA TRANS+0 :\ Set address
27168 ump toTINTLDA PROG+1,X:STA TRANS+1TINTBCS SaveEnterCode :\ CS set from CMP earlierTINTTINT\ *Help - Display he
26912 nformationTINT\ --------------------------------TINT.CmdHelpTINTJSR PrBanner :\ Print help messageTINT
8224 :\ Contin
29728 o pass '*Help' command to TubeTINTTINT\ OSCLI - Send command line to hostTINT\ ===========================
15677 ==TINT\ On entry, &F8/9=>command stringTINT\TINT\ Tube data &02 s
28265 g &0D -- &7F or &80TINT\TINT.osCLI_IOTINTLDA #&02:JSR SendCommand :\ Send command &02 - OSCLITINTJSR SendStringF8
8224 :\ Send command string at
21076 TINT: :\ Drop through to wait for Ack and enter codeTINTTINT
26977 tEnterCodeTINTJSR WaitByte:SEC :\ Wait for Ack from TubeTINT.WaitCheckCodeTINTROL
17218 C SaveEnterDone :\ If <&80, exitTINTROR A
8224 :\ Restore Carry, CC=RE
11348 CS=OSCLITINT.SaveEnterCodeTINTLDA PROG+1:PHA:LDA PROG+0:PHA :\ Save cu
28261 t programTINTJSR EnterCode:\TAX :\ Enter code, save return valueTINTPLA:STA PROG+0:STA MEMTOP+0 :\ Rest
8293 current programTINTPLA:STA PROG+1:STA MEMTOP+1 :\ and set top of memory to itTINTLDA #0:\TXA :\
29245 eturn valueTINT.SaveEnterDoneTINTRTSTINTTINTTINT\ FSC - FSC FunctionsTINT\ ====
15677 ===========TINT\ On entry, A, X, Y=FSC parametersTINT\ On exit,
11329 X, Y=return valuesTINT\TINT\ Tube
29793 a &18 X Y A -- &FF Y X orTINT\ &7F then string -- respsonseTINT\TINT.osFSCTINTP
19514 DA #&18:SEC:BCS ByteHi2TINTTINTTINT\ OSBYTE - Byte MOS functionsTINT\ ===
15677 ====================TINT\ On entry, A, X, Y=OSBYTE parameter
8284 On exi
8224 A preservedTINT\ If A<&80, X=ret
25966 d valueTINT\ If A>&7F, X, Y, Carry=returned valuesTINT\TINT.osBYTETINTCMP #&80:BCS ByteHigh :\ Jump for lon
21327 BYTEsTINT\TINT\ BYTELOTINT\ Tube data
12326 4 X A -- XTINT\TINTPHA:LDA #&0
21322 R SendCommand :\ Send command &04 - BYTELOTINTTXA:JSR Se
31042 te :\ Send single parameterTINTPLA:PHA:JSR SendByte :\ Send functionTINTJSR WaitByte:T
8224 :\ Get return valueTINTPLA:RTS :\ Restore A and returnTINTTINT.By
26952 ghTINTCMP #&82:BEQ Byte82 :\ Read memory high wordTINTCMP #&83:BEQ Byte83 :\ Read bottom
27936 emoryTINTCMP #&84:BEQ Byte84 :\ Read top of memoryTINT\TINT\ BYTEHITINT\ Tube data &06 X Y A -- Cy Y
23562 TINTPHA:LDA #&06:CLCTINT.ByteHi2TINTPHP:JSR SendCommand:PLP :\ Send command &06 or &18 - B
18501 I or FSCTINTTXA:JSR SendByte :\ Send first parameterTINTTYA:JSR SendByte
8224 :\ Send second parameterTINT
14913 JSR SendByte :\ Send functionTINTBCS ByteHi3 :\ Sk
20256 SBYTE checksTINTCMP #&8E:BEQ WaitEnterCode :\ If select language, check to enter codeTINTCMP #&9D:BEQ LFAEF:CLC
23610 Fast return with Fast BPUTTINT
29817 eHi3TINTPHA:JSR WaitByte:BCC ByteHi4 :\ Get Carry or byte/string
28787 onseTINTASL A:BCC FSCString :\ Jump to send FSC stringTINT.ByteHi4TINTASL A:JSR WaitByte:TAY
18208 et return high byteTINTJSR WaitByte:TAX:PLA :\ Get return low byteTINT.LFAEFTINTRTSTINTTINT.Byte8
17484 X MEMTOP+0:LDY MEMTOP+1:RTS :\ Read top of memoryTINT.Byt
14899 LDX #&00:LDY #&08:RTS :\ Read bottom of memoryTINT.Byt
14898 LDX #&00:LDY #&00:RTS :\ Return &0000 as memory hig
28535 rdTINTTINT.FSCStringTINTPLA:JSR SendS
28265 g :\ Send stringTINTLDY #&FFTINT.FSCStrLp2TINTINY:LDA (LPTR),YTINTCMP #ASC"!":BCS FSCStrLp2 :\ Skip to ' ' or <cr
17732 YTINT\ Ch
8299 - does this cope with *cmd *RUN */ *space/space ?TINT.FSCStrLp3TINTINY:LDA (LPTR),YTINTCMP #ASC" ":BEQ F
29779 rLp3 :\ Skip to non-' 'TINTTYA:CLC:ADC LPTR+0:STA CMD+0TINTLDA LPTR+
17473 C #0:STA CMD+1:\ Point to command parametersTINTJSR WaitE
29285 Code :\ Wait for Ack, enter code if neededTINTBPL LFAEF :\ Response=<&40, all done, retur
25970 sponseTINT:
8224 :\ Response=&40 (&80 at th
28704 oint), print textTINT.FSCStrChrTINTJSR WaitByte :\ Wait for a characterTINTCMP #&00:BEQ LFAEF :\ &
29728 erminates stringTINTJSR OSWRCH:JMP FSCStrChr
20512 rint characterTINTTINTTINT\ OSWORD - Various functionsTINT\ ==========================TINT\ On entry, A
30054 nctionTINT\ XY=>control blockTINT\TINT.osWORDTINTSTX LPTR+0
22868 LPTR+1 :\ LPTR=>control blockTINTTAY:BEQ RDLINE :\ OSWORD 0, jum
28532 read lineTINT\TINT\ Tube data &0
8257 in_length block out_length
8224 blockTINT\TINTPHA:PHA :\ Sav
30054 nctionTINTLDA #&08:JSR SendComm
8292 :\ Send command &08 - OSWORDTINTPLA:JSR SendByte :\ Send functionTINTTAX:BPL WordSendLow :\ J
8304 with functions<&80TINTLDY #&00:LDA (LPTR),Y :\ Get send block length from control blockTINTTAY:JMP WordSen
8224 :\ Jump to send cont
8300 blockTINTTINT.WordSendLowTINTLDY WordLengthsTx-1,X :\ Get send block length from tableTINTCPX #&15:BCC WordSend
14880 \ Use this length for OSWORD
29728 o &14TINTLDY #&10 :\ Send 16 b
29541 for OSWORD &15 to &7FTINT.WordSendTINTTYA:JSR SendByte :\ Send send block lengthTINTDEY:BMI LFB45
8284 Zero or &81..&FF length, nothing to sendTINT.LFB38TINTLDA (L
10578 ,Y:JSR SendByte :\ Send byte from control blockTINTDEY:BPL LFB38 :\ L
8304 for number to be sentTINT.LFB45TINTTXA:BPL WordRecvLow :\ Jump with functions<&80TINTLDY #&01:LDA (LPTR),Y
14880 \ Get receive block length f
8301 control blockTINTTAY:JMP WordRecv :\ Jump to receive control blockTINTTINT.WordRecvLowTINTLDY WordLengthsRx-1
8224 :\ Get receive length from tableTINTCPX #&15:BCC WordRecv :\ Use this length f
20256 SWORD 1 to &14TINTLDY #&10 :\ Receive 16 bytes for OSWORD &15 to &7FTINT.WordRecvTINTTYA:JSR SendByte
8224 :\ Send receive block
28261 gthTINTDEY:BMI LFB71 :\ Zero of &81..&FF length, nothing to receiveTINT.LFB64TINTJSR WaitByte:STA (L
10578 ,Y :\ Get byte to control blockTINTDEY:BPL LFB64 :\ Loop for number t
25970 ceiveTINT.LFB71TINTLDY LPTR+1:LDX
21076 +0:PLA :\ Restore registersTINTRTSTINTTINTTINT\ RDLINE - Read a line of textTINT\ ========
15677 ================TINT\ On entry, A =0TINT\ XY=>control
28524 ckTINT\ On exit, A =undefinedTINT\ Y =length of returned stringTINT\ Cy=0 ok, Cy=1
25459 apeTINT\TINT\ Tube data &0A block -- &FF or &7F string &0DTINT\TINT.RDLINE
21584 FNif(RDLINE%) :\ Perform RDLINE locallyTINT LDY #2TINT LDA (LPTR),Y:
8257 LPTR+2 :\ Copy control block to w/sTINT DEY:LDA (LPTR),Y:TAXTINT DEY:LDA (LPTR),YTINT
21587 A LPTR+0:STX LPTR+1 :\ (
21076 )=>string buffer, LPTR+2=max lengthTINT .Word00Lp1TINT JSR OSRDCH:BCS Word00Esc
8284 Wait for characterTINT CMP #&7F:BNE Word00Char :\ Not
25964 teTINT .Word00DeleteTINT TYA:BEQ Word00Lp1 :\ Nothing to deleteTINT LDA #&7F:JSR OSWRCH :
17494 U 127TINT DEY:JMP Word00Lp1
8224 :\ Dec. counter, loop back
11808 Word00CharTINT CMP #&08:BEQ Wo
12336 Delete :\ BS is also DeleteTINT CMP #&15:BNE Word00Ins :\ Not Ctrl-UTINT TYA:BEQ Word00Lp1
23610 Nothing to deleteTINT LDA #&7
8224 .Word0
12912 TINT JSR OSWRCH:DEY :\ Delete charactersTINT BNE Word00Lp2TINT BEQ
25714 00Lp1 :\ Jump back to startTINT .Word00InsTINT STA (LPTR),Y :\ Store characterTINT CMP #
14916 CLC:BEQ Word00cr :\ Return - finishTINT CPY LP
12843 :BCS Word00max :\ Maximum lengthTINT CMP #&20:BCS Word00ctrl :\ Control chara
29285 TINT DEY :\ Cancel following INYTINT .Word00ctrlTINT INY:JSR OSWRCH :\ Inc. counter,
28265 t characterTINT .Word00maxTINT JMP Word00Lp1 :\ Loop for moreTINT .Word00crTINT JSR OSNEWL:CLC
21024 eturn with CC, Y=lengthTINT .Word00EscTINT RTSTINTOPT FNelseTINT LDA #&0A:JSR SendCommand :\ Sen
28515 mmand &0A - RDLINETINT LDY #&0
8224 .LFB7E
19488 DA (LPTR),Y:JSR SendByte :\
25710 control blockTINT DEY:CPY #&01:BNE LFB7E :\ Loop for 4, 3, 2TINT LDA #&07:JSR SendByte :\ Sen
12326 7 as address high byteTINT LDA
20556 TR),Y:PHA :\ Get text buffe
25697 dress high byteTINT DEY:TYA:JS
25939 ndByte :\ Send &00 as a
25970 ss low byteTINT LDA (LPTR),Y:PHA :\ Get text buffer address low byteTINT LDX #&FF:JSR WaitB
8293 :\ Wait for responseTINT ASL A:BCS RdLineEscape :\ Jump if Escape returnedTINT PLA:STA LPTR+0:PLATINT STA LPTR+
17484 Y #&00 :\ Set &F8/9=>text bufferTINT .RdLineLpTINT J
22304 aitByte:STA (LPTR),Y :\ Store returned characterTINT INY:CMP #&0D:BNE RdLineLp :
28492 op until <cr>TINT LDA #&00:DEY
17228 :INX :\ Return A=0, Y=len, X=00, Cy=0TINT RTSTINT .RdLineEscap
8224 PLA:PL
17484 A #&00 :\ Return A=0, Y=len, X=FF, Cy=1TINT RTS
21584 FNendifTINTTINT\ OSWORD control block lengthsTINT\ ----------------------------TINT.Wo
25932 ngthsTxTINTEQUB &00:EQUB &05:EQUB &00:EQUB &05TINTEQUB &04:EQUB &05:EQUB &08:EQUB &0ETINTEQUB &04:EQUB &0
20805 UB &01:EQUB &05TINTEQUB &00:EQUB &08:EQUB &20:EQUB &10TINTEQ
9760 0D:EQUB &00:EQUB &04:EQUB &80TINT.WordLengthsRxTINTEQUB &05:EQUB &00
21841 B &05:EQUB &00TINTEQUB &05:EQUB &00:EQUB &00:EQUB &00TINTEQUB &05:EQUB
14905 EQUB &05:EQUB &00TINTEQUB &08:EQUB &19:EQUB &00
21841 B &01TINTEQUB &0D:EQUB &80:EQUB &04:EQUB &80TINTTINTTINT\ OSARGS - Read info
28448 pen fileTINT\ ===============================TINT\ On entry, A =functionTINT\ X =>data word in zero pageTINT
8224 Y =handleTINT\ On exit,
8257 =returned valueTINT\
28704 reservedTINT\ Y pres
25974 dTINT\TINT\ Tube data &0C handle block function -- result blockTINT\TINT.osARGSTINTPHA:LDA #&0C:JSR SendCommand :\ Send co
28257 d &0C - OSARGSTINTTYA:JSR SendByte :\ Send handleTINTLDA &03,X:JSR SendByte :\ Send data wordTINTLDA
12848 ,X:JSR SendByteTINTLDA &01,X:JSR Send
25972 TINTLDA &00,X:JSR SendByteTINTPLA:JSR SendByte :\ Send functionTINTJSR WaitByte:PHA :\ Get and save result
21075 WaitByte:STA &03,X :\ Receive data wordTINTJSR WaitByte:STA &02,XTINTJS
24919 itByte:STA &01,XTINTJSR WaitByt
21587 A &00,XTINTPLA:RTS :\ Get result back
8292 returnTINTTINTTINT\ OSBGET - Get a byte from open fileTINT\ ==================================TINT\ On entry, Y =handleTINT\
8302 exit, A =byte ReadTINT\ Y =preservedTINT\ Cy set if EOFTINT\TINT\
25954 data &0E handle -- Carry byteTINT\TINT.osBGETTINTLDA #&0E:JSR SendCommand :\ Send command &0E - OSBGETTINTTYA:JSR SendBy
8224 :\ Send handleTINTJMP WaitCarryChar :\ Jump to wait for Carry and byteTINTTINTTINT\ OSBPUT
30032 t a byte to an open fileTINT\ =
15677 ==============================TINT\ On entry, A =byte to wri
23562 Y =handleTINT\ On exit, A =preservedTINT\ Y =preservedTINT\TINT\ Tube data &10 handle
25972 -- &7FTINT\TINT.osBPUTTINTPHA:LDA #&10:JSR SendCommand :\ Send command &10 - OSBPUTTINTTYA:JSR SendByte :\ Send hand
20490 LA:JSR SendByte :\ Send byteTINTPHA:JSR WaitByte:PLA:RTS :\ Wait for acknowledge and ret
2670 TINTTINT\ OSFIND - Open or Close a fileTINT\ =============================TINT\ On entry, A =functionTINT\ Y =handl
29295 XY=>filenameTINT\ On exit, A
29285 o or handleTINT\TINT\ Tube data &12 function string &0D -- handleTINT\ &12 &00 handle -- &7FTINT\TINT.osFINDTINTPHA:LDA
12849 :JSR SendCommand :\ Send command &
11552 OSFINDTINTPLA:JSR SendByte :\ Send fun
28521 nTINTCMP #&00:BNE OPEN :\ If <>0, jump to do OPENTINT\ CLOSETINTPHA:TYA:JSR SendByte :\ Send handleTINTJSR Wa
31042 te:PLA:RTS :\ Wait for acknowledge, restore regs and returnTINT.OPENTINTJSR SendString :\ Send pathn
2661 JMP WaitByte :\ Wait for and return handleTINTTINTTINT\ OSFILE - Operate on whole filesTINT\ ==========
15677 =================TINT\ On entry, A =functionTINT\ XY=
28271 trol blockTINT\ On exit, A =resultTINT\ control block updatedTINT\TINT\ Tube data &14 block str
8295 <cr> function -- result blockTINT\TINT.osFILETINTSTX CTRL+0:STY CTRL+1 :\ CTRL=>control blockTINTPHA:LDA #&14
21075 SendCommand :\ Send command &14 - OSFILETINTLDY #&11TINT.LFC5FTINTLDA (CTRL),Y
21075 SendByte :\ Send control blockTINTDEY:CPY #&01:BNE LFC5F :\ Loop fo
12582 1..&02TINTDEY:LDA (CTRL),Y:TAXTINT
14937 LDA (CTRL),Y:TAY :\ Get pathname address to XYTINTJSR SendString
8224 :\ Send pathnameTINTPLA:JSR S
16996 yte :\ Send functionTINTJSR WaitByte:PHA :\ Wait for resultTINTLDY #&11TINT.LFC7ETINTJSR WaitByte:
8257 (CTRL),Y :\ Get control block backTINTDEY:CPY #&01:BNE LFC7E :\ Loop for &11..
2610 LDY CTRL+1:LDX CTRL+0 :\ Restore regist
2675 PLA:RTS :\ Get result and returnTINTTINTTINT\ OSGBPB - Multiple byte Read and writeTINT\ ==============
15677 ===================TINT\ On entry, A =functionTINT\ X
25406 ontrol blockTINT\ On exit, A =returned valueTINT\
28271 trol block updatedTINT\TINT\ Tube data &16 block function -- block Carry resultTINT\TINT.osGBPBTINTSTX CTR
14896 STY CTRL+1 :\ CTRL=>control bloc
18512 A:LDA
13873 :JSR SendCommand :\ Send command &
11552 OSGBPBTINTLDY #&0CTINT.LFC9ATINTLDA (CTRL),Y:JSR SendByte
8284 Send control blockTINTDEY:BPL LFC9A :\ Loop
8306 &0C..&00TINTPLA:JSR SendByte :\ Send functionTINTLDY #&0CTINT.LFCA8TINTJSR WaitByte:STA (CTRL),Y :\ Get cont
8300 block backTINTDEY:BPL LFCA8 :\ Loop for &0C..&00TINTLDY CTRL+1:LDX CTRL+0 :\ Restore registersTINT
8272 WaitCarryChar :\ Jump to get Carry and resultTINTTINTTINT\ Tube I/O routi
2675 \ =================TINTTINT\ Send a stringTINT\ -------------TINT.SendStringTINTSTX LPTR+0:STY LPTR+1 :\ Se
20556 TR=>stringTINT.SendStringF8TINTLDY
12326 0TINT.LF9B8TINTLDA (LPTR),Y:JSR SendB
8293 :\ Send character to I/OTINTINY:CMP #&0D:BNE LF9B8 :\ Loop until <cr> sentTINTLDY LPTR+1:RTS :\ Resto
22816 from &F9 and returnTINTTINTTINT\ OSWRCH - Send character to output streamTINT\ =============================
15677 =======TINT\ On entry, A =characterTINT\ On exit, A =preserved
23562 Tube data character --TINT\TINT.osWRCH :\ WRCH is simply SendByteTINTTINTTINT\ Tu
17184 ore I/O RoutinesTINT\ ======================TINT\ Characters and commands are sent over the same single
29295 tTINT\ Outward commands are escaped, and inward responses are escapedTINT\TINT\ OutwardTINT\ x VDU xTINT\
25888 sc,esc VDU escTINT\
25459 ,n MOS function, control block followsTINT\TINT\ InwardTINT\ x char/byte xTINT\
25888 sc,esc char/byte e
23562 esc,&00 BRK, error number+text+null followsTINT\ esc,<&80 read returned co
28530 l block set lengthTINT\ esc,&8n Escape change, b0=new stateTINT\ esc,&9x,Y,X,A EventTINT\ esc,&Ax
8224 reserved for networkingTINT\
25888 sc,&Bx end transfe
8284 esc,
11384 addr set addressTINT\ esc,&Dx,addr execute addressTINT\
25459 ,&Ex,addr start load from addressTINT\ esc,&Fx,addr start save from addressTINT\ All comm
29540 are data inward, except esc,&Fx which is data outwardTINTTINTTINT\ Send a byte, escaping it if neededTINT\ ----------
11565 --------------------TINT\ On entry, A=byte t
25971 ndTINT\ On exit, A,P preserved
11786 SendByteTINTPHP:JSR SendData :\ Send byteTINTCMP #esc:BNE SendByte2 :\ If not es
25632 oneTINTJSR SendData :\ If esc
25971 nd twice to prefix itTINT.SendB
12901 TINTPLP:RTSTINTTINT\ Send an escaped commandTINT\ -----------------------TINT\ On entry, A=commandTINT\ On exit, A,X,Y preserved,
25376 orruptedTINT.SendCommandTINTPHATINT.SendCmdLpTINTJSR ReadByte:BCS SendCmdLp :\ Flush inp
19466 DA #esc:JSR SendData :\ Send esc prefixTINTPLA:JMP SendData :\ Send command byte (always <&80)TINTTINT\ Ch
8299 if a byte is waiting, and read it if thereTINT\ ------------------------------------------------TINT\
8302 exit, P=EQ CC - nothing waitingTINT\ P=NE CS - byte waiting, returned
8302 ATINT\TINT.ReadByteTINTJSR ReadData :\ See if data presentTINTPHP:BCS WaitByte2 :\ Data pr
28261 t, continue with itTINTPLP:LDA #0:RTS :\ No data presentTINTTINT\ Wait for a byte, decoding escaped dataTINT\ -
11565 ---------------------------------TINT\ On ex
8236 A =byteTINT\ P =preservedTINT\TINT.WaitByteTINTPHPTINT.WaitByteLpTINTJSR WaitData :\ Wait for data presentTINT
26977 tByte2TINTBNE WaitByteOk :\ Not esc, return itTINTJSR WaitData:BEQ WaitByteOk
25888 sc,esc, return as escTINTPHA:TYA:PHA:TXA:PHA:TSX :\ Save registersTINTLDA &103,X:JSR WaitCo
28257 d :\ Decode escaped commandTINTPLA:TAX:PLA:TAY:PLA :\ Restore registersTINTJMP WaitByteLp :\
28527 p back to wait for a byteTINT.WaitByteOkTINTPLP :\ Rest
8293 flagsTINT.WaitByteOk2TINTRTS :\ Return byteTINTTINT\ Wait for raw byte of dataTINT\ ------------------
11565 ---TINT\ On exit, A =byteTINT\ P =EQ b
15717 esc, NE byte<>escTINT\TINT.WaitDataTINTJSR ReadData:BCC WaitData :\ Loop until data presentTINTRTSTINTTINT\ Decode escaped comman
8284 ------
11565 ------------TINT\ On entry, A=command, P set
25443 ordinglyTINT\ All registers can be trashedTINT\TINT.WaitCommandTINTBEQ WaitError :\ esc,&00
29285 rorTINTBMI WaitTransfer
14880 \ esc,>&7F - data transferTINTTINT
29541 c,1..127 - read a control bl
2667 \ ---------------------------------TINTTAY :\ Move count to YTINT.WaitLengthTINTJ
22304 aitByte :\ Wait for a byteTINTDEY:STA (CTRL),Y :\ Store i
20546 L Wait
26478 th:RTSTINTTINT\ esc,&00 - errorTINT\ ---------------TINT.WaitErrorTINTSTA ERRBUF:TAY :\ Store error
2635 JSR WaitByte:STA ERRBUF+1 :\ Store error numberTINT.WaitErrorLpTINTJSR WaitByte:STA
21074 BUF+2,Y:\ Store error characterTINTINY:CMP #0:BNE WaitErrorLp :\ Loo
28277 til final &00TINT:TINT\\ This does
8308 workTINT\\ .WaitErr1TINT\\ LDA #&1E:\JSR
25710 Command :\ Send a SYNC commandTINT\\ JSR ReadByte:\BCC WaitErr1 :\ Wait until Host respondsTINT\\ .W
17780 rr2TINT\\ JSR ReadByte:\BCS WaitErr2 :\ Flush everything from hostTINT:TINTLDX #16:TAYTINT.WaitErr1TINTDEY:BNE Wait
12658 :\ Pause a while to let HostTINTDEX:BNE WaitErr1 :\ reconnect after an errorTINT:TINTJSR WaitExit
25964 ase :\ Release Tube, restore ScreenTINTLDA ERRBUF+1:ORA ERRBUF+2 :\ Check for error 0,""TINTBEQ
11045 5:JMP ERRBUF :\ Jump to error, no returnTINTJMP STARTUP2 :
29253 ror 0,"" is RESETTINTTINT\ esc,&8n
17696 scape changeTINT\ -----------------------TINT.W
21620 ransferTINTCMP #&C0:BCS WaitStartTINTCMP #&A0:BCS WaitEndTINTCMP #&90:BCS WaitEventTINTLSR A:ROR ESCFLG:RTS
8284 Set error flag from b0TINTTINT\ esc,&9x - EventTINT\ ----------
11565 -TINT.WaitEventTINTJSR WaitByte:TAY :
25926 tch event Y parameterTINTJSR Wa
31042 te:TAX :\ Fetch event X parameterTINTJSR WaitByte :\ Fetch event A parameterTINTJMP (EVNTV)
8224 :\ Dispatch to even
25974 ctorTINTTINT\ esc,&Ax - ReservedTINT\
11565 ---------------TINT.WaitEndTINTCMP #&B0:BCC Wai
27000 t :\ Return to WaitByteTINTTINT\ esc,&Bx - End transferTINT\ --------
11565 ----------TINTPLA:PLA:PLA:PLA:PLA:PLA :\
8304 JSR WaitCommand, A,Y,X,ATINTPLA:PLA :\ Pop JSR Wait/ReadByte in Load/SaveLoopTINT.WaitExitSave
16716 :BPL WaitExitRelease :\ Pop transfer flag, b0=0 - Tube releaseTINTROR A:BCS
29801 ExitScreen :\ b0=1, Screen releaseTINT.WaitExitTINTRTSTINT.WaitExitReleaseTINT.WaitExitScreenTINTRTSTINTTINT\ es
17190 0+ - Start transferTINT\ ------------------
11565 ---TINT.WaitStartTINTPHA:LDY #4
8284 Save command, point to TRANSTINT.WaitStartLpTINTJSR WaitByte
16724 TRANS-1,Y :\ Wait for 4-byte data addressTINTDEY:BNE WaitStartLpTINTPLA:CMP #&D0:BCC
26977 tExit :\ esc,&Cx - set address for later entryTINTCMP #&E0:BCS TransData :\ esc,&
11552 transfer dataTINTTINT\ esc,&D0+ - Enter codeTINT\ ---------------------TINT.CallCodeTINTLDA #&00:SEC:JMP (TRANS) :\ Enter code w
8296 A=0, SECTINTTINT\ Decide what local memory to transfer data to/fromTINT\ ------------------------------------------------
8284 A=&Ex/
8312 - Load/SaveTINT\TINT.TransDataTINT.WaitTransIOTINTAND #&F0 :
15681 transfer flag with b7=1 for
29728 ransferTINTPHA:LDY #0 :\ Stack IO/Screen flag, init Y=0TINTCMP #&
16954 CS WaitSaveIO :\ esc,&Fx - save dataTINTTINT\ L
8292 data from remote hostTINT\ --------------------------TINT.WaitLoadIO :\ esc,&Ex - lo
25632 ataTINTOPT FNif(tweek3%=0)TINT JSR WaitByte :\ Fetch byteTINTOPT FNelseTINT \ Within this loop
8257 and X are scratch registers
8292 can be trashedTINT JSR WaitLoadByteTINT BNE WaitLoadIOput :\ Not <esc>, raw byteTINT JSR WaitLoadByteTINT
17742 WaitLoadEscape :\ <esc><command>TINT .WaitLoadIOputTINTOPT
25934 ndifTINTSTA (TRANS),Y :\ Store in I/O memoryTINTINY:BNE Wai
24943 dIOTINTINC TRANS+1:JMP WaitLoadIO :\ Loop until terminated by esc,&BxTINTTINT.Wai
24943 dEscapeTINTTINT\ Save data to remote hostTINT\ ------------------------TINT.WaitSave
19466 DA (TRANS),Y:JSR SendByte :\ esc,&Fx - save dataTINTJSR ReadByte:BCS WaitS
17765 xit :\ Poll input for terminationTINTINY:BNE WaitSaveIO :\ Update checksum for 256 bytesTINTINC TRANS+1:JMP
26977 tSaveIO :\ Loop until terminated by esc,&BxTINT.WaitSaveExitTINTJMP WaitExitSaveTINTTINT.Wa
28492 adByteTINTTINTTINT\ Enter Code pointed to by TRANS transfer addressTINT\ ===============================================TINT\ C
27491 s to see if code has a ROM header, and verifies itTINT\ if it has. CC=entered from RESET, CS=entered
28530 m OSCLITINT.EnterCodeTINT.EnterCodeIOTINTPHP:LDY #&07:LDA (TRANS),Y :\ Get copyright offsetTINTCLD:CLC
17220 TRANS+0:STA FAULT+0TINTLDA #0:TAY:ADC TRANS+1:STA FAULT+1 :\ &F
15685 >copyright messageTINT\TINT\ Now check for &00,"(
2594 LDY #&00:LDX #3TINT.EnterCheckTINTLDA (FAUL
22828 :CMP CheckCopy,X:BNE LF8FATINTINY:DEX:BP
28229 terCheck :\ Chec
28518 r &00,"(C)"TINT\TINT\ &00,"(C)" ex
29556 , check ROM type byteTINT\ -------------------------------------TINTLDY #&06:LDA (TRANS),Y :\ Get ROM typ
20033 D #&4F
20557 #&40:BCC NotLanguage :\ b6=0, not a languageTINTAND #&0D:BNE Not
12848 Code :\ type<>0 and <>2, not 6502 codeTINT
14406 FATINTTXA:ROL A:ROL A:AND #1 :\ A=0 - raw, A=1 - headerTINTLDX TRA
12331 :LDY TRANS+1:BPL LF904 :\ Entered code<&8000, don't move memtopTINTSTX MEMTOP+0:S
19744 EMTOP+1 :\ Set memtop to current programTINTSTX PROG+0:STY PROG+1
21280 et current program to address enteredTINT.LF904TINTPLP:JMP (TRANS) :\ Enter
25711 e with A=raw/code, Cy=RESET/OSCLI flagTINT.CheckCopyTINTEQUS ")C(":EQUB 0TINT\TINT\ Any existing error hand
8306 will probably have been overwrittenTINT\ So, set up new error handler before generating an errorTINT.No
28257 guageTINTOPT FNif(SWROM%=0)TINT JSR InitErrorTINTOPT FNendifTINTOPT FNerror:EQUB 24
20805 US "This is not a language":EQUB 0TINTTINT.Not6502CodeTINTOPT F
10342 SWROM%=0)TINT JSR InitErrorTINTOPT FNendifTINTOPT FNerror:EQUB 249:EQUS "This is not 6502 code":EQUB 0TINTTINTTINT\ Lo
25964 vel I/O routinesTINT\ =========
15677 =========TINT\ This is where detailed playful frobbing is do
29728 o ensure a cleanTINT\ error-free reliable link channel. All calling code assumes theseTINT\ routines ar
12337 0% error-free and reliable.
8313 handshaking,TINT\ retries, error correction, etc must be done at this level.TINT\TINT\ Code can be made faster by m
24946 ting knowledge about the hardwareTINT\ up to the Tube I/O layer.TINT\TINTTINT\ Send a raw byte of dataTINT\ ------
11565 -------------TINT\ On entry, A=byte to sendTINT
28239 exit, A,X,Y preserved, P c
30066 ptedTINT\TINT.SendDataTINTPHATINT.SendWaitTINTLDA TxStatus :\ Get StatusTINTAND #TxRDY:BEQ SendWait :\ Wait unt
25632 ata can be sentTINTPLA:STA TxData:RTS :\ Send dataTINTTINT\ Read raw dataTINT\ -------------TINT\ On exit, P =C
28192 o dataTINT\ =CS, data present, E
29541 c, NE=not escTINT\TINT.ReadDataTINTOPT FNif(tweek1%)TINT\ Check if an
26984 ng squeezed in before we managed to raise RTSTINT LDA RxStatus :\ Get RxStatusTINT AND #RxRDY:BNE Read
24948 Rx :\ Data already presentTINTOPT FNendifTINTPHP:SEI:TYA:PHA :\ Speed up by disabling I
2675 LDY #RxCont:STY RxStatus :\ Lower RTS to allow inputTINTLDY #RxStop:LDA RxStat
8224 :\ Get RxStatusTINTAND #RxRDY:BNE ReadDataOk :\ Data presentTINTPLA:STY RxStatus:TAY:PLP :\ Raise RTS, restore Y,
19523 C:RTS
8224 :\ CC=No data
25970 sentTINT.ReadDataOkTINTPLA:STY RxStatus:TAY:PLP :\ Raise RTS, restore Y,PTINT.ReadDataRxTINTLDA RxData:CMP #esc:SEC:RT
8284 CS=Data present, EQ/NE=escTINTTINTTINT]:IF(P%>IOSPACE%)AND(SWRO
12349 ):ERROR 1,"Code overrun"TINT[OPT P*3
23562 Spare spaceTINT\ ===========TINTOPT FNif(SWROM%=0)TINTEQ
21280 TRING$((IOSPACE%-P%)AND255,CHR$255)TINTTINT\ I/O SpaceTINT\ =========TINTEQUS STRING$(8,CHR
2601 TINT\ Tube I/O RegistersTINT\ ==================TINT.
25954 S1 :\ &FEF8 :EQUB 0TINT.TubeR1 :\ &FEF9 :EQUB 0TINT.TubeS2 :\ &FEFA :EQUB 0TINT.TubeR2 :\ &FEFB :EQUB 0TINT.TubeS3 :\ &FEFC :
16981 0TINT.TubeR3 :\ &FEFD :EQUB 0TINT.TubeS4 :\ &FEFE :EQUB 0TINT.TubeR4 :\ &FEFF :EQUB 0
21584 FNendifTINTTINTTINT\ DEFAULT VECTOR TABLETINT\ ====================TINT.LFF00TINTEQUW NullRe
28274 :\ &200 - USERVTINTEQUW ErrorHandler :\ &202 - BRKVTINTEQUW IRQ1Handler :\ &204 - IRQ1VTINTEQUW IRQ2Handler
14880 \ &206 - IRQ2VTINTEQUW osCLI
8224 :\ &208 - CLIVTINTEQUW osBY
8224 :\ &20A - BYTEVTINTEQUW osWORD :\ &20C - WORDVTINTEQUW
22387 RCH :\ &20E - WRCHVTINTEQUW osRDCH :\ &210 - RDCHVTINTEQUW osFILE :\ &212 - FILEVTINTEQUW
16755 RGS :\ &214 - ARGSVTINTEQUW osBGET :\ &216 - BGetVTINTEQUW osBPUT :\ &218 - BPutVTINTEQUW
18291 BPB :\ &21A - GBPBVTINTEQUW osFIND :\ &21C - FINDVTINTEQUW NullReturn :\ &21E - FSCVTINTEQUW
27756 Return :\ &220 - EVNTVTINTEQUW NullReturn :\ &222 - UPTVTINTEQUW NullReturn :\ &224 - NETVTINTEQUW NullRetu
8224 :\ &226 - VduVTINTEQUW NullReturn :\ &228 - KEYVTINTEQUW NullReturn :\ &22A - INSVTINTEQUW NullReturn
8224 :\ &22C - RemVTINTEQUW NullRe
28274 :\ &22E - CNPVTINTEQUW NullReturn :\ &230 - IND1VTINTEQUW NullReturn :\ &232 - IND2VTINTEQUW NullReturn
14880 \ &234 - IND3VTINTTINT\ Print hex
25197 ersTINT\ =================TINT.PrHexXYTINTTYA:JSR PrHex:TXATINT.PrHexTINTPHA:LSR A:LSR A:LSR A:LSR ATINTJSR PrNybble:PLATINT.PrNybbleTINT
8260 #15:CMP #10:BCC PrDigit:ADC #6TINT.PrDigitTINTADC #ASC"0":JMP OSWRCHTINTTINT\ Print em
25700 ed stringTINT\ =====================TINT\ Mustn't use LPTR so can be called from OSCLITINT.PrTextTINTPLA:STA
21592 +0:PLA:STA TEXT+1 :\ CTRL=>embedded stringTINTJSR PrString2:JMP (TEX
8224 :\ Print string and jump back to
25956 TINT:TINT.PrStringTINTSTX TEXT+0:STY TEXT+1 :\ CTRL=>string at YXTINT.PrStringLpTINTLDY #&00:LDA (TEXT),Y :\ Get
24936 racterTINTBEQ PrString2:JSR OSASCI :\ Print character if not &00TINT.PrString2TINTINC TEXT+0:BNE LFEA6
17230 TEXT+1 :\ Increment addressTINT.LFEA6TINTTYA:BNE PrStringLp :\ Loo
24930 ck if not &00TINT.NullReturnTINTRT
2570 \ Stan
25714 Tube entry pointsTINT\ ==========================TINT\ NB! All API entry points must be called in
16718 RY modeTINT\TINTOPT FNif(SWROM%=0)TINTEQUS STRING$((&FF95-P%)AND255,CHR$255)TINTO
17952 NendifTINT.LFF95 :JMP NullReturn :\ &FF95TINT.LFF98 :JMP NullReturn :\
17990 98TINT.PRSTRNG :JMP PrString
9760 FF9B Print zero-terminated text at YX, returns A=0, Y corruptedTINT.LFF9E :JMP NullRetur
8224 :\ &FF9ETINT.SCANHEX :JMP S
18542 ex :\ &FFA1 Scan hex string at (&F8), returned in &F0/1TINT.DISKACC :JMP NullReturn
8224 :\ &FFA4TINT.DISKCCP :JMP NullR
29301 n :\ &FFA7 Quit current programTINT.PRHEX :JMP PrHex :\ &FFAA Print A in hex, A corruptedTINT.PR2
8280 :JMP PrHexXY :\ &FFAD Print YX in hex, A corruptedTINT.US
20041 T :JMP NullReturn :\ &FFB0TINT.PRTEXT :JMP PrText :\ &FFB3 Prin
25978 ro-terminated inline text, r
29301 ns A=0, Y corruptedTINT.VECDEF :EQUB &36:EQUW LFF00 :\ &FFB6TINT.OSQUIT :JMP CmdPrompt :\ &FFB9 Enter super
28531 r *command promptTINT.OSERROR :JMP NullReturn :\ &FFBCTINT.OSINIT :JMP InitError :\ &FFBF In
24937 lise MOS error handler, A corruptedTINT.DISKRST :JMP NullReturn :\ &FFC2TINT.LFFC5 :JMP NullReturn :\ &F
2613 .NVRDCH :JMP osRDCH :\ &FFC8TINT.NVWRCH :JMP osWRCH
8224 :\ &FFCBTINTTINT.OSFIND :JMP (
17486 V) :\ &FFCETINT.OSGBPB :JMP (GBPBV) :\ &FFD1TINT.OSBPUT
19786 P (BPutV) :\ &FFD4TINT.OSBGET :JMP (BGetV)
8224 :\ &FFD7TINT.OSARGS :JMP (ARG
8233 :\ &FFDATINT.OSFILE :JMP (FILEV) :\ &FFDDTINTTINT.OSRDCH :JMP (RDCHV)
8224 :\ &FFE0TINT.OSASCI :CMP #
14916 BNE _OSWRCH :\ &FFE3TINT.OSNEWL :LDA #&0A:JSR
21079 CH :\ &FFE7TINT.OSWRCR :LDA #&0D :\ &FFECTINT._OSWRCHTINT.OSWRCH :JMP (WR
10582 :\ &FFEETINT.OSWORD :JMP (WORDV) :\ &FFF1TINT.OSBYTE
20557 (BYTEV) :\ &FFF4TINT.OS_CLI :JMP (CLIV) :\ &FFF7TINTTINT.
22089 :EQUW NMIHandler :\ &FFFA NMI VectorTINT.RESETV :EQUW RESET
8224 :\ &FFFC RESET VectorTINT.IRQ
8224 :EQUW IRQHandler :\ &F
8261 IRQ VectorTINT]:ENDPROCTINT:TINT:TINTDEFPROCasmROMHeaderTINTENDPROCTINT