; ; File - DEC2 ; ; Hamming decode table ; & Sideways front end ; ORG &8000 ; START JMP termen JMP servic ;Service ROM handler = &C2 ;Service & Language type ROM = copyr-START = 1 ;Version number titles = "TFS" BRK = "1.03" copyr BRK ;Copyright pointer points here = "(C)1982 Acorn" BRK ;End of sideways header. Hamming Decode table below ; hamtab = &41,&FF,&01,&41 ; 1 = &FF,&40,&41,&FF = &FF,&42,&41,&FF = &4A,&FF,&FF,&47 = &FF,&40,&41,&FF = &40,&00,&FF,&40 ; 0 = &46,&FF,&FF,&4B = &FF,&40,&43,&FF = &FF,&4C,&41,&FF = &44,&FF,&FF,&47 = &46,&FF,&FF,&47 = &FF,&47,&47,&07 ; 7 = &46,&FF,&FF,&45 = &FF,&40,&4D,&FF = &06,&46,&46,&FF ; 6 = &46,&FF,&FF,&47 = &FF,&42,&41,&FF = &44,&FF,&FF,&49 = &42,&02,&FF,&42 ; 2 = &FF,&42,&43,&FF = &48,&FF,&FF,&45 = &FF,&40,&43,&FF = &FF,&42,&43,&FF = &43,&FF,&03,&43 ; 3 = &44,&FF,&FF,&45 = &04,&44,&44,&FF ; 4 = &FF,&42,&4F,&FF = &44,&FF,&FF,&47 = &FF,&45,&45,&05 ; 5 = &44,&FF,&FF,&45 = &46,&FF,&FF,&45 = &FF,&4E,&43,&FF = &FF,&4C,&41,&FF = &4A,&FF,&FF,&49 = &4A,&FF,&FF,&4B = &0A,&4A,&4A,&FF ; 10 = &48,&FF,&FF,&4B = &FF,&40,&4D,&FF = &FF,&4B,&4B,&0B ; 11 = &4A,&FF,&FF,&4B = &4C,&0C,&FF,&4C ; 12 = &FF,&4C,&4D,&FF = &FF,&4C,&4F,&FF = &4A,&FF,&FF,&47 = &FF,&4C,&4D,&FF = &4D,&FF,&0D,&4D ; 13 = &46,&FF,&FF,&4B = &FF,&4E,&4D,&FF = &48,&FF,&FF,&49 = &FF,&49,&49,&09 ; 9 = &FF,&42,&4F,&FF = &4A,&FF,&FF,&49 = &08,&48,&48,&FF ; 8 = &48,&FF,&FF,&49 = &48,&FF,&FF,&4B = &FF,&4E,&43,&FF = &FF,&4C,&4F,&FF = &44,&FF,&FF,&49 = &4F,&FF,&0F,&4F ; 15 = &FF,&4E,&4F,&FF = &48,&FF,&FF,&45 = &FF,&4E,&4D,&FF = &FF,&4E,&4F,&FF = &4E,&0E,&FF,&4E ; 14 ; ; ; ; ; Table of routines to act on all of our oswords > &7F ; i.e. the buffer control ones. ; oswo01 & Mwait ; reloadpa\ &80 & markso ; &81 Mark start of block & gosob ; &82 Return to start of block & markeo ; &83 Mark end of block at last start of name & mark00 ; &84 Mark start of name & zelect ; abspage\ &85 Get absoloute page & Mwait ; &86 Get link 0 & notimp ; &87 Get previous page & Mwait ; nextfile\&88 Get next page which is start of chain & checkr ; &89 check if current page ready & unlock ; &8A re-enable page updating after a BGET & selcha ; &8B Select TV channel & return ; &8C Check if CRC ok & usrts ; notimp\ &8D Read TSDP & usrham ; notimp\ &8E Decode hammin & loadpa ; &8F Equivalemt to *TRANSFER command & notimp ; &90 Compute user CRC & rdprev ; &91 Read language before last *TELETEXT & movehe ; &92 Point rolling headers at that address & rdchan ; &93 Read current TV channel & OfferC ; &94 & OpenWa ; &95 Mwait, but accepts if present. & OSWsel ; &96 - select linked page for TELETEXT mode & badwor ; &97 & badwor ; time00 ; &98 - decode time from TSDP & badwor ; date01 ; &99 similarly for date (calls time) & unlo00 ; &9A clear full bit too. & OfferA ; &9B Offer All avail space, Wipe CBS, Init CB0 ; ifAX different from &DF0 & Herman ; &9C - Mark as KEEP page (If room - else 1) & DeHerm ; &9D - Kill 'Hermann'-bit in CB0. No errors? & Solidi ; &9E - make CB 'select' into CB 0. & Evapou ; &9F - set 'select' to 0. & Tsdpin ; &A0 - select initial page from TSDP & Reclai ; &A1 invaliate all CBS except CB0 & Jiggle ; &A2 - make CB0 point to private work-space, ; do NOT loose page in CB0. *********** & Where ; &A3 - Fill in page no to be displaed when asked for. & twl0 ; &A4 - disable all CBs VERY temporarily & trl0 ; &A5 - re-instate all CBs. oswo02 ; Where LdyIM 1 Ldx select Wherel LdaAX ctrlbl+2 AndIM &0F Clc AdcIM "0" StaIY &F0 Inx Iny CpyIM 8 Bne Wherel Jmp swexit ; return ; CRC passed back here LDX select LdaAX ctrlbl+crcpre AndIM flagbi AslA Sta zp0 LdaAX ctrlbl+crcok AndIM flagbi Ora zp0 LdyIM 1 StaIY &F0 JMP swexit ; doosfi CMPIM 5 BEQ tsw1 CMPIM 7 BEQ tsw2 CMPIM &FF BNE illega JMP starlo tsw1 JMP getadd tsw2 JMP opendi ; ; dooswo LDA &EF ; Get reg A CMPIM ourosw BEQ goodwo JMP ignore goodwo LDYIM 0 ; Offset LDAIY &F0 ; Get the opcode BMI oswo00 JMP getinf ; Jump to telesoftware module ; oswo00 ASLA ; Multiply by 2, incidently losing the top bit ; which we don't want anyway CMPIM oswo02-oswo01 ; Check for max number BCS badwor TAX LDAAX oswo01 STA zp0 LDAAX oswo01+1 ; Hi byte of routine address STA zp1 JMI zp0 ; Execute the appropriate routine for this OSWORD ; ; badwor JSR dobrk = &FF = "Bad OSWORD" BRK ; ; illega JSR dobrk ; Error message = 157 = "Illegal operation" BRK ; ; docomm ; Check for sideways command LDA &F2 ; get pointer to command STA zp0 LDA &F3 STA zp1 LDXIM swcmds-cmdtab ; Offset in cmdtab to the commands which are allowed ;in this context. Note Y still offset to offered command JSR cli ; Decode & execut command. Carry set if no command BCS swexit ;JMP ignore ; ; ignore ; Pull all registers off stack & return from sideways call ; NB also restores A, so does not claim call PLA TAX PLA TAY PLA RTS ; ; ; swexit ;Restore all registers except A which is set to 0 to claim PLA TAX PLA TAY PLA ; old A, so discard LDAIM 0 RTS ; ; ; ; ; ; ;Service call enters here ; ; Jumps out to various routines according to reason code in A ; Note that Y is preserved as it is sometimes a parameter ; all registers pushed on stack. ; servic PHA ; STA swzp0 TYA PHA TXA PHA ; LDA swzp0 TSX LDAAX &100+3 CmpIM swboot Bne Notins Jmp doboot Notins Lda &FC10 ; status AndIM &F ;CmpIM &F ; 0 - no power, &F (possibly)- power, else unplugged (???) Beq ignore LDAAX &100+3 CMPIM swstar BEQ dostar CMPIM (swtab1-swtab)/2 ; Number of entries in table BCS ignore ASLA TAX LDAAX swtab+1 PHA LDAAX swtab PHA RTS ; Not really ; ; ; ; ; dostar CPYIM 6 ; Check for our FS number - Y preserved at this point BNE ignore JSR starte JMP swexit ; ; ; dofixe ; Reverse appropriate amount of fixed workspace PLA TAX PLA TAY ; We need to change the original Y if too small CPYIM 1+(endfix/256) BCS fixed1 LDYIM 1+(endfix/256) fixed1 PLA ; original RTS ; this type of call should not be claimed ; ; ; dopriv LDX &F4 ; OUR ROM number TYA STAAX &0DF0 ; Save start of our private space in romnumber'th byte ; of space at 0DF0 (X contains ROM no.) ; Top bit of this is used to indicate whether ; we have the fixed workspace - not set here => we have it ; PHA ; Used later when storing in private space ; ; Now initialise the workspace ; JSR inital ; Initialise telesoftware ; LDX &F4 STX prevla ; If txt in RHS, exit exits to txt! ; LDXIM CBlen*nopage-1 ; Initialise the control blocks to empty LDAIM 0 memini STAAX ctrlbl DEX BNE memini ; STA head00+1 ; Point to zero page <=> turned off STA select ; Current control block STA eof0E STA eof0F STA ctrlbl ; lower half of address Pla Pha Sta ctrlbl+1 ;Top half ;LDAIM 0 ; STA CBswit LDAIM flagbi Sta ctrlbl+inuse LdaIM 1 Sta CRCsig LdaIM 128 Jsr messag LdaIM 0 jsr resetc LDAIM 1 STA TSbuff+1 ; Invalid init. page. ; ; ; Should initialise the BGET flag to indicate nothing going on ; when the flag is defined. ; ; BGET variables will be initialised by BGET when first activated ; ; LDAIM &1C ; Teletext enable, AFC on, IRQ enabled STA oldctr ; Only update soft copy, so that it enables when ; the next *TELESOFT reclaims memory ; ; PLA ; Start of private space JSR rele49 ; Store workspace in private & TTXT unit ; ; PLA TAX PLA ; Now got the original Y - the start of our private space CLC ADCIM 1+((endsav-starts-1024)/256) ; Size of fixed space which must ; be saved and won't fit in the teletext unit. TAY PLA RTS ; ; ; ; doboot ; Full boot not supported - auto select if T-Break or first ROM LDAIM &7A JSR osbyte TXA CMPIM &FF BEQ gotobr CMPIM 35 BNE gotoig gotobr JSR stri02 = "Acorn TFS",0 LDA &FC10 ANDIM &F BNE bootte JSR stri02 = " no power",13,10,10,0 LDAIM 21 LDXIM 0 LDYIM 0 JSR osbyte LDAIM 138 LDXIM 0 LDYIM &CA JSR osbyte LDAIM &78 LDXIM 35 LDYIM 0 JSR osbyte JMP swexit bootte JSR stri02 = 13,10,10,0 JSR starte LDAIM 21 LDXIM 0 LDYIM 0 JSR osbyte LDAIM 138 LDXIM 0 LDYIM &CA JSR osbyte LDAIM &78 LDXIM 35 LDYIM 0 JSR osbyte JMP swexit ; gotoig JMP ignore ; ; ; ; ; ; dohelp ; Enters here from MOS *HELP command JSR help ; In DEC2A ;**************************************************** JMP ignore ; ; ; ; dospac ; Enters here if space being claimed from us ; Hide all important variables in private space & TTXT unit ; LDX &F4 ; ROM no. LDAAX &DF0 ; Have we got the fixed workspace ? BPL rele48 JMP ignore ; No rele48 JSR rele49 JMP swexit ; ; Enters here to save up workspace after initialisation ; A contains start of private space ; rele49 LDX &F4 ; ROM no. (Wrongly assumed to be in X) STA dmazp1 ; Used later as pointer to workspace ORAIM &80 STAAX &0DF0 ; mark as saved ANDIM &7F ; remove top bit ; ; ; Put as much as possible into the teletext unit JSR fsdie ; PHP SEI ;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ; LDAIM :LSB: starts STA zp0 ; start of fixed workspace to save LDAIM :MSB: starts STA zp1 ; LDXIM &F ; Max row no. for teletext unit rele00 LDYIM 63 ; Number of bytes per row {-1} STX rowreg rele01 LDAIY zp0 STA datare DEY BPL rele01 ; LDA zp0 CLC ADCIM 64 STA zp0 BCC rele02 INC zp1 rele02 DEX BPL rele00 ; ; ; Now fit the rest into private RAM ; LDAIM 0 STA dmazp0 ; has already been initialised to the start ; of private space LDXIM (endsav-starts-1024)/256 rele50 LDYIM 0 rele51 LDAIY zp0 STAIY dmazp0 INY BNE rele51 INC zp1 INC dmazp1 ; Both high bytes, for the next page DEX BPL rele50 ; PLP ; \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ; RTS ; ; ; ; ; ; ; ; swtab & ignore-1 ; 0 NOP & dofixe-1 ; 1 reserve fixed space & dopriv-1 ; 2 reserve private space & doboot-1 ; 3 auto boot (we only support auto-select) & docomm-1 ; 4 unrecognised *COMMAND & interr-1 ; 5 unrecognised IRQ & ignore-1 ; 6 BRK - of no use to us & ignore-1 ; 7 unrecognised OSBYTE - of no use to us & dooswo-1 ; 8 unrecognised OSWORD & dohelp-1 ; *HELP command & dospac-1 ; &A fixed workspace is being claimed swtab1 ; ; ; doosbg ; Enters here direct ;WHY????? CPYIM &0F BEQ osbget1 CPYIM &0E BNE channe ; If not telesoftware osbget either JMP gettel osbget1 JMP bget ; channe JSR dobrk = 222 = "Channel" BRK ; ; ; ; ; ; LNK DEC2A ;