; ************************** ; ** ** ; ** TERM 0 ** ; ** ** ; ************************** ; ; termen Cli ; All this code is interrable ; Jsr GetO01 ; LdaIM 22 Jsr OSWRCH LdaIM 7 Jsr OSWRCH Jsr Init00 ; JSR GetOld Lda TOldFS CmpIM 6 ; TFS Beq nosele ; JSR TeleSe nosele Jsr InitTe ; Jsr GetO00 ; Jsr InitBR ; JMP Mast00 Master Jsr StrM00 = " *** Press SPACE to continue " NOP Mast01 LdaIM 19 Jsr OSBYTE ; Wait for Vsynch Dec Ttimer Bpl Mast00 Inc Ttimer ;.. Stop decrementing time-out at zero ; Mast00 Jsr TestCh Bcs EscAck Beq Execdo ; Jmp ExecCo ; Switch (=case) jump on Command Execdo ; Bit THoldf Bvs Master ; Don't accept updates, as page is held. ; ; Lda Ttimer Bne Mast01 Jsr zheckr Bpl Mast00 ; Nothing new arrived. ; Jsr Fetchp Execdi Jsr zzspla ; LdaIM Tdelay ; Time out Tdelay Sta Ttimer ; Jmp Mast00 ; ; ; ; ; ; EscAck ; Sort out the muddle and jump to Mast00 LdaIM &7E Jsr OSBYTE ; Acknowlege the escape condition. ; ; Re-zzspla the page Jmp Space ; ; ; ; ; ; ; Escwai ; This is jumped to by any call from Execute Command. Jsr StrMes = &88 = "*** Press ESCAPE to continue" NOP Escw00 Jsr TestCh Bcc Escw00 ; Jmp EscAck ; ; ; ; ; TestCh ; Return carry set if escape condition, ; 0 (No-op) if time-out, and char otherwise. LdaIM &81 LdxIM 0 LdyIM 0 Jsr OSBYTE ; Txa Bcc Getdon ; CpyIM &1B Sec Beq Getdon ; Timeout... Clc LdaIM 0 Getdon rts ; ; ; ; SendCT LdaIM &7A LdxIM :LSB: TCTRLB LdyIM :MSB: TCTRLB Jsr OSWORD rts ; GetOld LdaIM 0 TaY Jsr OSARGS Sta TOldFS rts ; GetO00 LdaIM &91 Sta TCTRLB+0 Jsr SendCT Lda TCTRLB+1 Sta TOldLA Lda TCTRLB+2 Sta TOldFS rts ; Init00 Jsr InitSo Jsr zursor rts ; InitTe LdaIM &8B ; Sel channel Sta TCTRLB+0 LdaIM 0 Sta TCTRLB+1 Jsr SendCT Jsr OfferS Jsr InitPa Jsr InitHe LdaIM 1 Sta TArrow LdaIM 0 Sta Ttimer Sta TConce Sta THoldf STA TCRCfl LdaIM "W" Sta TPhysp LdaIM "a" Sta TPhysp+1 LdaIM "i" Sta TPhysp+2 LdaIM "t" Sta TPhysp+3 LdaIM "i" Sta TPhysp+4 LdaIM "n" Sta TPhysp+5 LdaIM "g" Sta TPhysp+6 LdaIM 00 Sta TZP0 LdaIM &78 Sta TZP1 ldyIM 0 wipein LdaIM " " StaIY TZP0 Inc TZP0 Bne wlq1 Inc TZP1 wlq1 Lda TZP1 CmpIM &7C Bne wipein Rts ; TeleSe LdaIM &8F LdxIM &12 LdyIM 6 Jsr OSBYTE rts ; OldF01 Ldy TOldFS CpyIM 4 ; < 4 - Tape or Rom. - Special cases... Bpl zold00 CpyIM 3 ; *ROM ?? Bne OldF00 LdaIM &8D Jsr OSBYTE rts OldF00 LdaIM &8C ; *TAPE CpyIM 2 Bne zoldFS LdxIM 3 Jsr OSBYTE rts zoldFS LdxIM 12 ; *TAPE12 Jsr OSBYTE rts zold00 ; *ANYTHINGELSE CPYIM 4 ; DISK BNE monoto LDAIM "D" STA TCTRLB LDAIM "I" STA TCTRLB+1 LDAIM "S" STA TCTRLB+2 LDAIM "K" STA TCTRLB+3 LDAIM 13 STA TCTRLB+4 LDXIM :LSB: TCTRLB LDYIM :MSB: TCTRLB JSR OSCLI RTS monoto LdaIM &8F LdxIM &12 Jsr OSBYTE rts ; InitPa ; Ought to check TSDP first. ; - but actually selectsIM 00#### LdaIM &FF Sta TArrow LdxIM 7 InitPn LdaAX InitBl StaAX TCTRLB CpxIM 0 Beq zzin1 StaAX TMaste-1 zzin1 Dex Bpl InitPn LdaIM &A0 Sta TCTRLB+0 Jsr SendCT Jsr Disp04 pwait Jsr StrMes = " *** Waiting for page " NOP ; Could be removed - startup with JMP InitPa instead of SPACE JMP dispth ; *** Tim *** Display page number ; RTS ; *** Tim *** Old rts commented out ; InitBl = &85 = &FF = 0 = 0 = &FF = &FF = &FF = &FF ; CanHea LdaIM 0 Pha Jmp zeader ; InitHe LdaIM &7C Pha zeader LdaIM &92 Sta TCTRLB Pla Sta TCTRLB+2 LdaIM 8 Sta TCTRLB+1 LdaIM &FF Sta TCTRLB+4 LdaIM &FF Sta TCTRLB+3 Jsr SendCT rts ; ; InitBR LdaIM :LSB: Errorc Sta &202 LdaIM :MSB: Errorc Sta &203 rts ; ; InitSo LdxIM &90 LdyIM 0 LdaIM &E1 Jsr OSBYTE ; F0 = &90 LdaIM 4 LdxIM 1 ldyIM 0 Jsr OSBYTE ; zursor keys give ascii codes &87 to &8B LdaIM &E2 LdxIM &9A ldyIM 0 Jsr OSBYTE ; Shift keys follow on from F9. rts ; ; Curs00 LdyIM 1 Jmp zzrsor zursor LdyIM 0 zzrsor LdaIM 23 Jsr OSWRCH LdaIM 1 Jsr OSWRCH Tya Jsr OSWRCH LdaIM 0 LdyIM 7 Curse Jsr OSWRCH Dey Bne Curse rts ; ; zheckr ; Sets Neg flag if page ready, ; otherwise clears it. LdaIM &89 Sta TCTRLB+0 ; Jsr SendCT Bit TCTRLB+1 ;BMI chkmor rts chkmor ; return NEG if OK, PLUS LdaIM &8C Sta TCTRLB+0 Jsr SendCT Bit TCTRLB+1 Bvc chktes ; Bad CRC - now check last CRC LdaIM &FF Rts chktes Bit TCRCfl Bvs chkrej ; Last was ok - this bad, so reject LdaIM &FF Rts chkrej LdaIM 0 Rts ; Fetchp LdaIM &8C Sta TCTRLB+0 Jsr SendCT Lda TCTRLB+1 Sta TCRCfl ; LdaIM &A3 Sta TCTRLB+0 Jsr SendCT LdyIM 1 Copyke LdaAY TCTRLB StaAY TPhysp-1 Iny CpyIM 8 Bne Copyke ; LdaIM &8F Sta TCTRLB+0 LdaIM &78 Sta TCTRLB+2 LdaIM 0 Sta TCTRLB+1 LDAIM &82 JSR OSBYTE ; LdaIM 0 StY TCTRLB+4 ; LdaIM 0 StX TCTRLB+3 Jsr SendCT LdaIM &8A Sta TCTRLB+0 Jmp SendCT ; loadpa does an implicit UNLOCK rts ; zzspla ; Global conceal flag set before calling. Cleared by this code. WHY??? LDAIM 30 ; *** Tim *** JSR oswrch ; | JSR dispth ; *** Tim *** Display page number Jsr StrM00 = 30 = 10 NOP ; zursorA1 to 0 ; LdaIM 40 ; Skip zeader line Sta TZP0 ; when picking up page from ; fixed buffer at &7800 LdaIM &78 Sta TZP1 ; LdyIM 0 ; Y is always 0 in the Disp02 Disp02 LdaIY TZP0 ; Load character for zzspla CmpIM 152 ; Concea code? Bne Disp01 Ldx TConce Beq Disp01 ; Conceaed, - so replace by a space. LDAIM " " Disp01 ; Convert the BBCs coding of control chars into ours... ;SOMETIME, DO THIS ONLY FOR NON-ASCII OraIM &80 Jsr OSWRCH ; Text with the top bit set is still text... ; Inc TZP0 ; Move on to next char... Lda TZP0 CmpIM &C0 Bne Notend ; Check for end of page at &7BC0 Ldx TZP1 CpxIM &7B Beq Disp00 Notend Tax ; A was TZP0 after increment. Did we need a carry? Bne Disp02 ; No? - next char then... Inc TZP1 ; Yes... Jmp Disp02 Disp00 ; Page has now been zzsplaed. ; Now put out CRC message... ; 00 Not yet computed ; 01 Absent ; 10 Wrong ; 11 zzrrect BIT TCRCfl Bmi KnownC Bvs Absent ; Not yet computed... Jsr StrMes = " No check" ; String must be 39 chars NOP RTS zzrrec Jsr Flushr rts KnownC Bvs zzrrec ; Wrong... Jsr StrMes = " Bad data" ; String must be 39 chars NOP rts Absent Jsr StrMes = " No check" ; String must be 39 chars NOP rts ; Disp04 RTS ; *** Tim *** ; LdaIM 30 ; | ; Jsr OSWRCH ; *** Tim *** dispth ; *** Tim *** Display number without TAB(0,0) change LdxIM 6 Disp1 LdaAX TMaste StaAX TPagen Dex Bpl Disp1 Disp03 ; zzsplay page no in standard form. LdyIM 0 ; Use Y to step through Page no. block. LdxIM "#" Jsr Prwild Iny Jsr Prwild Iny Jsr Prwild Iny LdxIM "/" LdaAY TPagen+3 Bpl Prslas LdaAY TPagen+2 Bpl Prslas LdaAY TPagen+1 Bpl Prslas LdaAY TPagen+0 Bpl Prslas LdxIM " " Prslas Jsr Prwild CpxIM " " Beq Prblan LdxIM "#" Prblan Iny Jsr Prwild Iny Jsr Prwild Iny Jsr Prwild LdaIM " " Jsr OSWRCH rts ; Prwild LdaAY TPagen Bpl Prnotw Txa Jmp OSWRCH Prnotw Clc AdcIM "0" CmpIM "9"+1 Bcc Prnohe AdcIM 6 Prnohe Jmp OSWRCH ; ; ; ; ; ; ; ; ; ; ; ; Flushr Jsr StrM00 = " " ; 39 Spaces NOP rts ; StrMes Jsr Flushr ; and drop through StrM00 LdaIM 31 Jsr OSWRCH LdaIM 0 Tay Jsr OSWRCH Pla Sta TZP0 Pla Sta TZP1 LdaIM 24 StrDis Jsr OSWRCH Inc TZP0 Bne Str2 Inc TZP1 Str2 LdaIY TZP0 CmpIM &EA ; Using NOP as EOT Bne StrDis JmI TZP0 ; OfferS LdaIM &9B Sta TCTRLB+0 ; Offer max avail space Jsr SendCT rts Errorc LdxIM &FF ; reset stack Txs ; Jsr TeleSe Jsr Init00 LdaIM 13 Jsr OSASCI LdyIM 1 Err1 LdaIY &FD Beq Err2 Jsr OSASCI Iny Bne Err1 Err2 LdaIM 13 Jsr OSASCI Jmp Escwai ; LNK TERM1