; ; ********************************************************************* ; ; The Command Subroutines for a Redefinable Telesoftware Decoder ; ; ; (C) C.J. Oswald 1982 ; -- rtf8 -- ; ; ********************************************************************* ; ; ; The Command Subroutine ; ; Destroys all registers & temporary zero page locations ; dco JSR opinfo ; get number of operans PHA ; save it CMP commle ; choose smaller of commle & number of operans BCC dco1 LDA commle ; dco1 LDY heapfr STY ztempa ; copy heapfr to zero page STY commen ; and to commen pointer LDY heapfr+1 STY ztempa+1 STY commen+1 JSR dd1 ; decode number of fields in A and put onto heap INC endofs ; set end of section flag PLA ; get number of operans SEC SBC commle ; subtract commle BCC dco2 ; all operans have now been decode TAX ; still X operans to decode! BEQ dco2 ; (that's none) JMP dig1 ; ignore remaining operans ( command) ; dco2 JSR chopqu ; ensure queue is emptied LDA disord BNE dco3 ; disordered file JSR printc ; ordered file - therefore send commen to osacsi ; dco3 CLC ; ensure carry is clear RTS ; ; Decode the number of operans given in A and put onto the heap ; pointed to by ztempadr (return length in A) ; dd1 LDYIM 0 ; offset of zero TAX ; put count of operans in X BEQ dd2 ; dd3 JSR opinfo ; get length of next operan STA ztempl ; store at ztempl CMPIM 0 BEQ dd4 ; dd5 JSR decode ; get next byte INY ; increment offset STAIY ztempa ; save in heap DEC ztempl BNE dd5 ; dd4 LDAIM &0D ; put CR at end of operan INY STAIY ztempa DEX BNE dd3 ; ; All relevant operans decode & now on heap ; length of decode data is in Y ; dd2 TYA ; length in A LDYIM 0 ; offset of zero STAIY ztempa ; put length as 1st byte of info in the heap RTS ; ; *********************************************************************** ; ; The Command Subroutine ; ; Destroys all registers & temporary zero page locations ; If two more zero page locations are now available, this subroutine ; should be rewritten using them (rather than copy onto & off the stack) ; dtl JSR opinfo ; get number of operans CMPIM 0 BEQ dtl10 LDY heapfr STY ztempa ; copy heapfr to zero page LDY heapfr+1 STY ztempa+1 JSR dd1 STA ztempl ; save length LDYIM 1 ; offset of one ; dtl3 LDAIY ztempa ; get byte of file title that block belongs to PHA ; save on stack for time being INY ; increment offset CMPIM &0D ; is it a CR? BNE dtl3 ; contin until end of file title DEY ; adjust Y for offset from title pointer DEY LDA title ; copy title pointer ot zero page STA ztempa LDA title+1 STA ztempa+1 TYA PHA LDYIM 0 ; Offset of 0 LDAIY ztempa CMPIM &0D ; See if wild? BEQ dtlwil PLA TAY ; dtl5 PLA ; get character from block's file title EORIY ztempa ; check that it is the same as the corresponding ; ; character in the requested file's title ANDIM 223 BNE dtl4 ; (mismatch) DEY BPL dtl5 ; ; File titles match ; ; Add length of title and version plus two to heapfr ; (to stop them being destroyed) ; JSR dtl9 ; do that LDA ztempa ; set tandv pointer STA tandv LDA ztempa+1 STA tandv+1 ; dtl10 CLC ; ensure carry is clear RTS ; ; File titles do not match ; dtl4 DEY ; balance stack BMI dtl8 PLA JMP dtl4 ; dtl8 LDA oldblo ; get the old (valid) value of blocks STA blocks LDAIM 0 STA pass ; on zeroth pass LDAIM nextpa ; block is not wanted, so get next block at head of chain JSR buffer CLC ; ensure carry is clear RTS ; ; File requested was wild ; dtlwil JSR dtl9 ; add length of title plus version plus two to heapfr ; (to keep them from being destroyed) LDA heapfr STA title ; copy heapfr to zero page STA ztempa ; and to title pointer LDA heapfr+1 STA title+1 STA ztempa+1 PLA ; restore length of filename (was in Y) TAY SEC ADC heapfr ; increment heapfr by length of filename plus one STA heapfr BCC dtlw1 INC heapfr+1 ; dtlw1 PLA ; copy filename from stack to heap STAIY ztempa DEY BPL dtlw1 JMP dtl10 ; return ; ; Add length of title plus version plus one to heapfr ; dtl9 LDA ztempl SEC ADC heapfr STA heapfr BCC dtl7 INC heapfr+1 ; dtl7 RTS ; ; *********************************************************************** ; ; The Command Subroutine ; ; Preserves all registers and temporary zero page locations ; dir INC norun ; set no run flag CLC ; ensure carry is clear RTS ; ; *********************************************************************** ; ; The Command Subroutine ; ; Destroys A ; ;.dac ;LDA heapfr ; store pointer into heap at bloc00 ;STA bloc00 ;LDA heapfr+1 ;STA bloc00+1 ; ;.dc1 ;JSR opinfo ; get length of operan ;JSR heapby ; decode operan and add to the heap ;CLC ; ensure carry is clear ;RTS ; ; The Command Subroutine ; ; Preserves all registers & temporary zero page locations ; ;.dnc ;LDA heapfr ; store pointer into heap at blockr pointer ;STA blockr ;LDA heapfr+1 ;STA blockr+1 ;JMP dc1 ; ; *********************************************************************** ; ; The command subroutine ; ; Destroys all registers & temporary zero page locations ; ulb JSR decode ; get next decode byte SEC SBCIM &58 ; subtract &58 from it JMP ub1 ; put it back at the head of the queue ; ; The command subroutine ; ; Preserves all registers & temporary zero page locations ; urb JSR decode ; get next decode byte CLC ADCIM &58 ; add &58 to it ; ; Put the byte in A back at the head of the queue ; ub1 INC headqu ; increment pointer BNE ub2 INC headqu+1 ; ub2 LDX headqu ; copy pointer to zero page STX ztempa LDX headqu+1 STX ztempa+1 LDYIM 0 STAIY ztempa ; store the byte at the head of the queue CLC ; ensure carry is clear RTS ; ; *********************************************************************** ; LNK RTF9