; ; File - DEC7 ; ; Various *COMMAND routines ; nostat = "No status broadcast." hdrs STA ARGcon+2 LDAIM &2C STA ARGcon+1 LDAIM &92 STA ARGcon+0 LDXIM :LSB: ARGcon LDYIM :MSB: ARGcon LDAIM &7A JMP osword ; startu LDXIM 20 LDYIM 0 wipeTS LDAAY nostat STAAY TSbuff+20 INY DeX BNE wipeTS LDA oldctr ANDIM 239 ; afc off STA oldctr STA ctrlre JSR stri02 = 22 = 7 = 10 = "Ch" = 0 Lda oldctr AndIM 3 Clc AdcIM "1" Jsr oswrch Jsr zursor ; Initiate rolling headers tuneag LDAIM &7C JSR hdrs LDAIM 0 STA errors STA errors+1 STA tests STA tests+1 STA ARGtst STA ARGerr ; clear master copy of error count ; (ought to be an osword call...) ; I disagree. ARG LDAIM 25 ; 25 fiftieths of a sec STA grains smooth LDAIM 19 ; Wait for Vsynch JSR osbyte LDY ARGerr LDX ARGtst LDAIM 0 STA ARGtst STA ARGerr Clc TYA ADC errors STA errors BCC stu1 INC errors+1 stu1 TXA ADC tests STA tests BCC stu2 INC tests+1 stu2 DEC grains BNE smooth ; go round a few times to smooth ; out irregularities ;\\\\\ DISPLAY TeleServiceDataPacket if available ////// ;TEMP FOR DEBUGGING... LDA tests BNE receiv LDA tests+1 BNE receiv ; Check BOTH bytes ;****** test for intsfrom decoder - on channel? JSR stri02 = 31 = 7 = 20 = "No teletext being received" = 31 = 4 = 1 = " " ; 32 Spaces = 31 = 10 = 8 = " " = 0 LDAIM &20 STA errors LDAIM 0 STA errors+1 JMP bargra receiv JSR stri02 = 31 = 7 = 20 = " Receiving teletext " = 31 = 10 = 8 = 0 LdxIM 20 LdyIM 20 TSstat LdaAX TSbuff ORAIM &80 Jsr oswrch Inx Dey Bne TSstat JSR multip JSR divide ;\\\ Calculate length = (errors*64) div tests //// bargra Jsr ruler ; Draw the scale. LdaIM 32 Sec Sbc errors Sta zp1 LdaIM 255 ; White block. LdxIM 0 bar1 Cpx zp1 Beq bar2 Jsr oswrch Inx Jmp bar1 bar2 LdaIM 32 CpxIM 32 Beq contin Jsr oswrch Inx Jmp bar2 ruler Jsr stri02 = 31 = 1 = 23 = "*** Space to continue" = 31 = 3 = 14 = 151 ;White = 234 = "```````" = 55 = "```````" = 55 = "```````" = 55 = "```````" = 235 = 31 = 4 = 15 = "0%" = 31 = 19 = 15 = "50%" = 31 = 35 = 15 = "100%" = 31 = 3 = 13 = 147 ;yellow - best on B/W Tvs = 106 ;HALF BAR SINISTER = 0 rts ;Lots of scope for folding above... contin LDAIM &81 LDXIM 0 LDYIM 0 JSR osbyte TYA BNE inerr TXA CMPIM 32 BEQ done JMP contin inerr CMPIM &1B ; = esc?? BEQ escape JMP tuneag escape done JSR stri02 = 31 = 1 = 24 = 13 = 0 LDAIM 0 JSR hdrs LDA oldctr ORAIM 16 ; afc on STA oldctr STA ctrlre Jsr Curs00 SEC rts TSgbpb ;cmp#4 ;bne TSerr ;stx zp0 ;sty zp1 ;ldYIM 0 ;LdaIY zp0 ;CmpIM &0E ; Telesoftware ;Bne TSerr ;Now repeated BGET ;SHOULD BE TUBED!!!!!! ;INY ;LdaIY zp0 ;PHA ;INY ;ldaIY zp0 ;Sta zp1 ;PLA ;STA zp0 ;.bgloop ;LdyIM 14 ;jsr osbget ;BCS bgdone ;tay ;Pla ;sta zp1 ;Pla ;sta zp0 ;ya ;LdyIM 0 ;StaIY zp0 ;Lda zp0 ;pha ;Lda zp1 ;pha ;jmp bgloop ;.bgdone ;pla ;pla ;rts ;.TSerr Jmp notimp ; ; ; ; ; **** *TELETEXT Command **** ; Reads previous language ROM number & store it whwer it can ; be read by an OSWORD call when restarting. ; Then starts language held in this ROM. ; ; startt Jsr starte LDAIM &FC LDXIM 0 LDYIM &FF ; Read modify, write type call - don't change it JSR osbyte STX prevla ; LDAIM &8E ; Select language LDX &F4 ; This ROM no. JSR osbyte ; NB never returns ... ; ; ; ; ******** *TELESOFT command ******** ; ; Changes all the indirection vectors, via the 3 byte indirections ; Also do workspace claiming if required ; starte ; LdaIM 0 Tay Jsr osargs Pha ; ; LDAIM 6 ; FS die code JSR dummyF ; Can't JSR indirect, so JSR to a JMP (osfscmd) ; ; LDAIM &A8 ; Find base of 3 byte vectors LDXIM 0 LDYIM &FF JSR osbyte STX zp0 STY zp1 ; LDXIM 12 ; (number of vectors to initialise -1)*2 LDYIM (&1E*3/2)+2 ; offset from &FF00 to MOS re-entry point for last vector ; Also used as offset into 3 byte vectors, +2 to reach last byte soft1 LDA &F4 ; Our ROM no. STAIY zp0 ; Save in 3 byte vector DEY ; to hi byte of addr LDAAX vector+1 STAIY zp0 DEY LDAAX vector STAIY zp0 ; ; Now do 2 byte vectors ; LDAIM &FF ; Hi byte of MOS re-entry addr STAAX &213 ; &212 is the lowest vector we want TYA ; Y is now correct offset in MOS (started off 2 too big) STAAX &212 DEY ; For next time round DEX DEX BPL soft1 ; ; LDAIM &8F ; Indicate vectors claimed LDXIM &F JSR osbyte ; ; LDX &F4 ; Our ROM no. LDAAX &DF0 ; Get page address of our private workspace. Top bit set ; => we need to claim the fixed workspace & copy out BPL ramdon ; ANDIM &7F PHA ; For use ~5 lines ahead, and a long way ahead ; ; LDAIM &8F LDXIM &0A ; Claim fixed workspace LDYIM &FF JSR osbyte ; ; ; LDX &F4 PLA PHA STAAX &DF0 ; ; PHP SEI ; \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ; ; ; First get as much as possible from the teletext unit ; LDAIM :LSB: starts ; Start of fixed workspace to save STA zp0 LDAIM :MSB: starts STA zp1 LDXIM &F ; Maximum row number for teletext unit RAM soft3 LDYIM 63 ; Number of bytes per row STX rowreg soft4 LDA datare STAIY zp0 DEY BPL soft4 ; LDA zp0 CLC ADCIM 64 STA zp0 BCC soft5 INC zp1 soft5 DEX BPL soft3 ; ; ; LDAIM 0 LDXIM &F ; Max row no. softA STX rowreg STA datare ; Zero 1st byte in each row - used as flag by IRQ rtn DEX BPL softA ; ; ; Now get the rest from private space ; ; P on stack - restore it PLA STA dmazp0 PLA STA dmazp1 LDA dmazp0 PHA LDAIM 0 STA dmazp0 ; already contains start of private space LDXIM :MSB: (endsav-starts-1024) ; size of private -1 soft7 LDYIM 0 soft8 LDAIY dmazp0 STAIY zp0 INY BNE soft8 INC zp1 INC dmazp1 DEX BPL soft7 ; ; Now initialise bits not saved and indicate control blocks now empty. ; PLP ;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LDXIM 7 LDAIM &FF soft2 STAAX magptr DEX BPL soft2 ; ; LDXIM 0 soft9 JSR zapf00 ;********* ; CB 0 SHOULD NOT BE FULL. ; REST SHOULD BE FULL ; ONLY IF THEY WERE INCONSISTENT ; AT THE TIME OF DESELECTING... ;********* ; (THE ABOVE IS TOO PESSIMISTIC) TXA CLC ADCIM CBlen TAX CPXIM :LSB: (nopage*CBlen) BNE soft9 ; ; Must remove wildcas from current page so that an identical page ; can be reloaded if we are doing a BGET. ; ; BGET code must have a flag to show what is going on, since we are ; about to un-hold the page for it to roll in again ; ; ********** NOT YET IMPLEMENTED *********** ; ; ; Finally, enable teletext again ramdon JSR enab ; ;Re-set max lines pointer in dynamic-space page buffer LDYIM 0 LdaAY ctrlbl Sta zp0 LdaAY ctrlbl+1 Sta zp1 LdaIM 32 StaIY zp0 ; ; ; ; ; ; Pla ; Old FS Sta prevfs ; ; ; SEC ; To indicate command recognised rts RTS ; ; vector ; Table of routines for all the vectors & doosfi & ourfs ; OSARGS - GIVE FS no. ;TO BE DONE. (ALSO CLI PTR) & doosbg & illega ; Osbput & TSgbpb & openor ; Actually in RTF code! & dofscm ; multip LDXIM 5 shiftm ASL errors ROL errors+1 DEX BNE shiftm RTS ; ; dummyF JMI fscmdv ; ourfs CmpIM 0 Bne rts CpyIM 0 Bne rts LdaIM 6 Rts ; Our FS no. ; ; ; ; ; TEMPORARY - PHEX for debugging... phex Tya Jsr outhex Txa outhex Pha LsrA LsrA LsrA LsrA Jsr outnib Pla AndIM &0F outnib CmpIM &0A Bcc noadd AdcIM 6 noadd AdcIM "0" Jmp oswrch ; divide LDAIM 0 STA zp0 STA zp1 CLC LDXIM 16 divlp ROL errors ROL errors+1 ROL zp0 ROL zp1 chklt SEC LDA zp0 SBC tests TAY LDA zp1 SBC tests+1 BCC deccnt STY zp0 STA zp1 deccnt DEX BNE divlp ROL errors ROL errors+1 RTS ; LNK DEC8