diff options
Diffstat (limited to 'docs/os12/mdfs.net/Docs/Comp/BBC/OS1-20/DF0C')
| -rw-r--r-- | docs/os12/mdfs.net/Docs/Comp/BBC/OS1-20/DF0C | 512 | 
1 files changed, 512 insertions, 0 deletions
| diff --git a/docs/os12/mdfs.net/Docs/Comp/BBC/OS1-20/DF0C b/docs/os12/mdfs.net/Docs/Comp/BBC/OS1-20/DF0C new file mode 100644 index 0000000..b273fa3 --- /dev/null +++ b/docs/os12/mdfs.net/Docs/Comp/BBC/OS1-20/DF0C @@ -0,0 +1,512 @@ +**** STRINGS **** + +DF0C	DB ')C)',0      ; Copyright string match + +**** COMMMANDS **** +;				  Command   Address       Call goes to +DF10	DB '.',E0,31,05		; *.       &E031, A=5     FSCV, XY=>String +DF14	DB 'FX',E3,42,FF	; *FX      &E342, A=&FF   Number paramters +DF19	DB 'BASIC',E0,18,00	; *BASIC   &E018, A=0     XY=>String +DF21	DB 'CAT',E0,31,05	; *CAT     &E031, A=5     FSCV, XY=>String +DF27	DB 'CODE',E3,48,88	; *CODE    &E348, A=&88   OSBYTE &88 +DF2E	DB 'EXEC',F6,8D,00	; *EXEC    &F68D, A=0     XY=>String +DF35	DB 'HELP',F0,B9,FF	; *HELP    &F0B9, A=&FF   F2/3=>String +DF3C	DB 'KEY',E3,27,FF	; *KEY     &E327, A=&FF   F2/3=>String +DF42	DB 'LOAD',E2,3C,00	; *LOAD    &E23C, A=0     XY=>String +DF49	DB 'LINE',E6,59,01	; *LINE    &E659, A=1     USERV, XY=>String +DF50	DB 'MOTOR',E3,48,89	; *MOTOR   &E348, A=&89   OSBYTE +DF58	DB 'OPT',E3,48,8B	; *OPT     &E348, A=&8B   OSBYTE +DF5E	DB 'RUN',E0,31,04	; *RUN     &E031, A=4     FSCV, XY=>String +DF64	DB 'ROM',E3,48,8D	; *ROM     &E348, A=&8D   OSBYTE +DF6A	DB 'SAVE',E2,3E,00	; *SAVE    &E23E, A=0     XY=>String +DF70	DB 'SPOOL',E2,81,00	; *SPOOL   &E281, A=0     XY=>String +DF79	DB 'TAPE',E3,48,8C	; *TAPE    &E348, A=&8C   OSBYTE +DF80	DB 'TV',E3,48,90	; *TV      &E348, A=&90   OSBYTE +DF85	DB E0			; Table end marker + +; Command routines are entered with XY=>command tail, A=table parameter, +; &F2/3,&E6=>start of command string +; If table parameter if <&80, F2/3,Y converted to XY before entering + + +DF86 31 03       1.   AND (&03),Y +DF88 00          .    BRK + +************************************************************************* +*                                                                       * +*   CLI - COMMAND LINE INTERPRETER                                      * +*                                                                       * +*   ENTRY: XY=>Command line                                             * +*   EXIT:  All registers corrupted                                      * +*   [ A=13 - unterminated string ] +************************************************************************* +; +DF89	STX &F2		; Store XY in &F2/3 +DF8B	STY &F3 +DF8D	LDA #&08 +DF8F	JSR &E031	; Inform filing system CLI being processed +DF92	LDY #&00	; Check the line is correctly terminated +DF94	LDA (&F2),Y +DF96	CMP #&0D	; Loop until CR is found +DF98	BEQ &DF9E +DF9A	INY		; Move to next character +DF9B	BNE &DF94	; Loop back if less than 256 bytes long +DF9D	RTS		; Exit if string > 255 characters + +; String is terminated - skip prepended spaces and '*'s +DF9E	LDY #&FF +DFA0	JSR &E039	; Skip any spaces +DFA3	BEQ &E017	; Exit if at CR +DFA5	CMP #&2A	; Is this character '*'? +DFA7	BEQ &DFA0	; Loop back to skip it, and check for spaces again + +DFA9	JSR &E03A	; Skip any more spaces +DFAC	BEQ &E017	; Exit if at CR +DFAE	CMP #&7C	; Is it '|' - a comment? +DFB0	BEQ &E017	; Exit if so +DFB2	CMP #&2F	; Is it '/' - pass straight to filing system? +DFB4	BNE &DFBE	; Jump forward if not +DFB6	INY		; Move past the '/' +DFB7	JSR &E009	; Convert &F2/3,Y->XY, ignore returned A +DFBA	LDA #&02	; 2=RunSlashCommand +DFBC	BNE &E031	; Jump to pass to FSCV +; +; Look command up in command table +DFBE 84 E6       .æ   STY &E6	; Store offset to start of command +DFC0 A2 00       ¢.   LDX #&00 +DFC2 F0 13       ð.   BEQ &DFD7 +; +DFC4 5D 10 DF    ].ß  EOR &DF10,X +DFC7 29 DF       )ß   AND #&DF +DFC9 D0 17       Ð.   BNE &DFE2 +DFCB C8          È    INY +DFCC 18          .    CLC +; +DFCD B0 25       °%   BCS &DFF4 +DFCF E8          è    INX +DFD0 B1 F2       ±ò   LDA (&F2),Y +DFD2 20 E3 E4     ãä  JSR &E4E3 +DFD5 90 ED       .í   BCC &DFC4 +; +DFD7 BD 10 DF    ½.ß  LDA &DF10,X +DFDA 30 16       0.   BMI &DFF2 +DFDC B1 F2       ±ò   LDA (&F2),Y +DFDE C9 2E       É.   CMP #&2E +DFE0 F0 04       ð.   BEQ &DFE6 +DFE2 18          .    CLC +DFE3 A4 E6       ¤æ   LDY &E6 +DFE5 88          .    DEY +DFE6 C8          È    INY +DFE7 E8          è    INX +DFE8 E8          è    INX +DFE9 BD 0E DF    ½.ß  LDA &DF0E,X +DFEC F0 33       ð3   BEQ &E021 +DFEE 10 F8       .ø   BPL &DFE8 +DFF0 30 DB       0Û   BMI &DFCD +; +DFF2 E8          è    INX +DFF3 E8          è    INX +; +DFF4 CA          Ê    DEX +DFF5 CA          Ê    DEX +DFF6 48          H    PHA +DFF7 BD 11 DF    ½.ß  LDA &DF11,X +DFFA 48          H    PHA +DFFB 20 3A E0     :à  JSR &E03A +DFFE 18          .    CLC +DFFF 08          .    PHP +E000 20 04 E0     .à  JSR &E004 +E003 40          @    RTI	; Jump to routine + +E004	LDA &DF12,X	; Get table parameter +E007	BMI &E017	; If >=&80, number follow +;                      ; else string follows + +E009	TYA		; Pass Y line offset to A for later +E00A	LDY &DF12,X	; Get looked-up parameter from table + +; Convert &F2/3,A to XY, put Y in A +E00D 18          .    CLC +E00E 65 F2       eò   ADC &F2 +E010 AA          ª    TAX +E011 98          .    TYA	; Pass supplied Y into A +E012 A4 F3       ¤ó   LDY &F3 +E014 90 01       ..   BCC &E017 +E016 C8          È    INY +; +E017 60          `    RTS + + +; *BASIC +E018	LDX &024B	; Get Basic rom number +E01B	BMI &E021       ; If none set, jump to pass command on +E01D	SEC             ; Set Carry = not entering from RESET +E01E	JMP &DBE7	; Enter language rom in X + +; Pass command on to other roms and to filing system +E021	LDY &E6		; Restore pointer to start of command +E023	LDX #&04	; 4=UnknownCommand +E025	JSR &F168	; Pass to sideways roms +E028	BEQ &E017	; If claimed, exit +E02A	LDA &E6		; Restore pointer to start of command +E02C	JSR &E00D	; Convert &F2/3,A to XY, ignore returned A +E02F	LDA #&03	; 3=PassCommandToFilingSystem + +; Pass to current filing system +E031	JMP (&021E) + +E034 0A          .    ASL A +E035 29 01       ).   AND #&01 +E037 10 F8       .ø   BPL &E031 + +; Skip spaces +E039 C8          È    INY +E03A B1 F2       ±ò   LDA (&F2),Y +E03C C9 20       É    CMP #&20 +E03E F0 F9       ðù   BEQ &E039 +E040 C9 0D       É.   CMP #&0D +E042 60          `    RTS + +; +E043 90 F5       .õ   BCC &E03A +E045 20 3A E0     :à  JSR &E03A +E048 C9 2C       É,   CMP #&2C +E04A D0 F4       Ðô   BNE &E040 +E04C C8          È    INY +E04D 60          `    RTS + +; +E04E 20 3A E0     :à  JSR &E03A +E051 20 7D E0     }à  JSR &E07D +E054 90 37       .7   BCC &E08D +E056 85 E6       .æ   STA &E6 +E058 20 7C E0     |à  JSR &E07C +E05B 90 19       ..   BCC &E076 +E05D AA          ª    TAX +E05E A5 E6       ¥æ   LDA &E6 +E060 0A          .    ASL A +E061 B0 2A       °*   BCS &E08D +E063 0A          .    ASL A +E064 B0 27       °'   BCS &E08D +E066 65 E6       eæ   ADC &E6 +E068 B0 23       °#   BCS &E08D +E06A 0A          .    ASL A +E06B B0 20       °    BCS &E08D +E06D 85 E6       .æ   STA &E6 +E06F 8A          .    TXA +E070 65 E6       eæ   ADC &E6 +E072 B0 19       °.   BCS &E08D +E074 90 E0       .à   BCC &E056 +E076 A6 E6       ¦æ   LDX &E6 +E078 C9 0D       É.   CMP #&0D +E07A 38          8    SEC +E07B 60          `    RTS + +E07C C8          È    INY +E07D B1 F2       ±ò   LDA (&F2),Y +E07F C9 3A       É:   CMP #&3A +E081 B0 0A       °.   BCS &E08D +E083 C9 30       É0   CMP #&30 +E085 90 06       ..   BCC &E08D +E087 29 0F       ).   AND #&0F +E089 60          `    RTS + +E08A 20 45 E0     Eà  JSR &E045 +E08D 18          .    CLC +E08E 60          `    RTS + +E08F 20 7D E0     }à  JSR &E07D +E092 B0 0E       °.   BCS &E0A2 +E094 29 DF       )ß   AND #&DF +E096 C9 47       ÉG   CMP #&47 +E098 B0 F0       °ð   BCS &E08A +E09A C9 41       ÉA   CMP #&41 +E09C 90 EC       .ì   BCC &E08A +E09E 08          .    PHP +E09F E9 37       é7   SBC #&37 +E0A1 28          (    PLP +E0A2 C8          È    INY +E0A3 60          `    RTS + +; WRCH control routine +; ==================== +E0A4 48          H    PHA          ; Save all registers +E0A5 8A          .    TXA +E0A6 48          H    PHA +E0A7 98          .    TYA +E0A8 48          H    PHA +E0A9 BA          º    TSX +E0AA BD 03 01    ½..  LDA &0103,X  ; Get A back from stack +E0AD 48          H    PHA          ; Save A +E0AE 2C 60 02    ,`.  BIT &0260    ; Check OSWRCH interception flag +E0B1 10 08       ..   BPL &E0BB    ; Not set, skip interception call +E0B3 A8          ¨    TAY          ; Pass character to Y +E0B4 A9 04       ©.   LDA #&04     ; A=4 for OSWRCH call +E0B6 20 7E E5     ~å  JSR &E57E    ; Call interception code +E0B9 B0 52       °R   BCS &E10D    ; If claimed, jump past to exit + +E0BB 18          .    CLC          ; Prepare to not send this to printer +E0BC A9 02       ©.   LDA #&02     ; Check output destination +E0BE 2C 7C 02    ,|.  BIT &027C    ; Is VDU driver disabled? +E0C1 D0 05       Ð.   BNE &E0C8    ; Yes, skip past VDU driver +E0C3 68          h    PLA          ; Get character back +E0C4 48          H    PHA          ; Resave character +E0C5 20 C0 C4     ÀÄ  JSR &C4C0    ; Call VDU driver +                                   ; On exit, C=1 if character to be sent to printer + +E0C8 A9 08       ©.   LDA #&08     ; Check output destination +E0CA 2C 7C 02    ,|.  BIT &027C    ; Is printer seperately enabled? +E0CD D0 02       Ð.   BNE &E0D1    ; Yes, jump to call printer driver +E0CF 90 05       ..   BCC &E0D6    ; Carry clear, don't sent to printer +E0D1 68          h    PLA          ; Get character back +E0D2 48          H    PHA          ; Resave character +E0D3 20 14 E1     .á  JSR &E114    ; Call printer driver + +E0D6 AD 7C 02    |.  LDA &027C    ; Check output destination +E0D9 6A          j    ROR A        ; Is serial output enabled? +E0DA 90 1B       ..   BCC &E0F7    ; No, skip past serial output +E0DC A4 EA       ¤ê   LDY &EA      ; Get serial timout counter +E0DE 88          .    DEY          ; Decrease counter +E0DF 10 16       ..   BPL &E0F7    ; Timed out, skip past serial code +E0E1 68          h    PLA          ; Get character back +E0E2 48          H    PHA          ; Resace character +E0E3 08          .    PHP          ; Save IRQs +E0E4 78          x    SEI          ; Disable IRQs +E0E5 A2 02       ¢.   LDX #&02     ; X=2 for serial output buffer +E0E7 48          H    PHA          ; Save character +E0E8 20 5B E4     [ä  JSR &E45B    ; Examine serial output buffer +E0EB 90 03       ..   BCC &E0F0    ; Buffer not full, jump to send character +E0ED 20 70 E1     pá  JSR &E170    ; Wait for buffer to empty a bit +E0F0 68          h    PLA          ; Get character back +E0F1 A2 02       ¢.   LDX #&02     ; X=2 for serial output buffer +E0F3 20 F8 E1     øá  JSR &E1F8    ; Send character to serial output buffer +E0F6 28          (    PLP          ; Restore IRQs + +E0F7 A9 10       ©.   LDA #&10     ; Check output destination +E0F9 2C 7C 02    ,|.  BIT &027C    ; Is SPOOL output disabled? +E0FC D0 0F       Ð.   BNE &E10D    ; Yes, skip past SPOOL output +E0FE AC 57 02    ¬W.  LDY &0257    ; Get SPOOL handle +E101 F0 0A       ð.   BEQ &E10D    ; If not open, skip past SPOOL output +E103 68          h    PLA          ; Get character back +E104 48          H    PHA          ; Resave character +E105 38          8    SEC +E106 66 EB       fë   ROR &EB      ; Set RFS/CFS's 'spooling' flag +E108 20 D4 FF     Ô.  JSR &FFD4    ; Write character to SPOOL channel +E10B 46 EB       Fë   LSR &EB      ; Reset RFS/CFS's 'spooling' flag + +E10D 68          h    PLA          ; Restore all registers +E10E 68          h    PLA +E10F A8          ¨    TAY +E110 68          h    PLA +E111 AA          ª    TAX +E112 68          h    PLA +E113 60          `    RTS          ; Exit + + +************************************************************************* +*                                                                       * +*       PRINTER DRIVER                                                  * +*                                                                       * +************************************************************************* + +;A=character to print + +E114	BIT &027C   ;if bit 6 of VDU byte =1 printer is disabled +E117	BVS &E139   ;so E139 + +E119	CMP &0286   ;compare with printer ignore character +E11C	BEQ &E139   ;if the same E139 + +E11E	PHP         ;else save flags +E11F	SEI         ;bar interrupts +E120	TAX         ;X=A +E121	LDA #&04    ;A=4 +E123	BIT &027C   ;read bit 2 'disable printer driver' +E126	BNE &E138   ;if set printer is disabled so exit E138 +E128	TXA         ;else A=X +E129	LDX #&03    ;X=3 +E12B	JSR &E1F8   ;and put character in printer buffer +E12E	BCS &E138   ;if carry set on return exit, buffer not full (empty?) + +E130	BIT &02D2   ;else check buffer busy flag if 0 +E133	BPL &E138   ;then E138 to exit +E135	JSR &E13A   ;else E13A to open printer cahnnel + +E138	PLP         ;get back flags +E139	RTS         ;and exit + +E13A	LDA &0285   ;check printer destination +E13D	BEQ &E1AD   ;if 0 then E1AD clear printer buffer and exit +E13F	CMP #&01    ;if parallel printer not selected +E141	BNE &E164   ;E164 +E143	JSR &E460   ;else read a byte from the printer buffer +E146	ROR &02D2   ;if carry is set then 2d2 is -ve +E149	BMI &E190   ;so return via E190 +E14B	LDY #&82    ;else enable interrupt 1 of the external VIA +E14D	STY &FE6E   ; +E150	STA &FE61   ;pass code to centronics port +E153	LDA &FE6C   ;pulse CA2 line to generate STROBE signal +E156	AND #&F1    ;to advise printer that +E158	ORA #&0C    ;valid data is +E15A	STA &FE6C   ;waiting +E15D	ORA #&0E    ; +E15F	STA &FE6C   ; +E162	BNE &E190   ;then exit + +*********:serial printer ********************************************* + +E164	CMP #&02    ;is it Serial printer?? +E166	BNE &E191   ;if not E191 +E168	LDY &EA     ;else is RS423 in use by cassette?? +E16A	DEY         ; +E16B	BPL &E1AD   ;if so E1AD to flush buffer + +E16D	LSR &02D2   ;else clear buffer busy flag +E170	LSR &024F   ;and RS423 busy flag +E173	JSR &E741   ;count buffer if C is clear on return +E176	BCC &E190   ;no room in buffer so exit +E178	LDX #&20    ;else +E17A	LDY #&9F    ; + + + + +************************************************************************* +*                                                                       * +*       OSBYTE 156 update ACIA setting and RAM copy                     * +*                                                                       * +************************************************************************* +;on entry + +E17C	PHP         ;push flags +E17D	SEI         ;bar interrupts +E17E	TYA         ;A=Y +E17F	STX &FA     ;&FA=X +E181	AND &0250   ;A=old value AND Y EOR X +E184	EOR &FA     ; +E186	LDX &0250   ;get old value in X +E189	STA &0250   ;put new value in +E18C	STA &FE08   ;and store to ACIA control register +E18F	PLP         ;get back flags +E190	RTS         ;and exit + + + +************ printer is neither serial or parallel so its user type ***** + +E191	CLC         ;clear carry +E192	LDA #&01    ;A=1 +E194	JSR &E1A2   ; + + +************************************************************************* +*                                                                       * +*       OSBYTE 123 Warn printer driver going dormant                    * +*                                                                       * +************************************************************************* + +E197	ROR &02D2   ;mark printer buffer empty for osbyte +E19A	RTS         ;and exit + +E19B	BIT &02D2   ;if bit 7 is set buffer is empty +E19E	BMI &E19A   ;so exit + +E1A0	LDA #&00    ;else A=0 + +E1A2	LDX #&03    ;X=3 +E1A4	LDY &0285   ;Y=printer destination +E1A7	JSR &E57E   ;to JMP (NETV) +E1AA	JMP (&0222) ;jump to PRINT VECTOR for special routines + + +*************** Buffer handling ***************************************** +    	            ;X=buffer number +    	;Buffer number  Address         Flag    Out pointer     In pointer +    	;0=Keyboard     3E0-3FF         2CF     2D8             2E1 +    	;1=RS423 Input  A00-AFF         2D0     2D9             2E2 +    	;2=RS423 output 900-9BF         2D1     2DA             2E3 +    	;3=printer      880-8BF         2D2     2DB             2E4 +    	;4=sound0       840-84F         2D3     2DC             2E5 +    	;5=sound1       850-85F         2D4     2DD             2E6 +    	;6=sound2       860-86F         2D5     2DE             2E7 +    	;7=sound3       870-87F         2D6     2DF             2E8 +    	;8=speech       8C0-8FF         2D7     2E0             2E9 + + +E1AD	CLC         ;clear carry +E1AE	PHA         ;save A +E1AF	PHP         ;save flags +E1B0	SEI         ;set interrupts +E1B1	BCS &E1BB   ;if carry set on entry then E1BB +E1B3	LDA &E9AD,X ;else get byte from baud rate/sound data table +E1B6	BPL &E1BB   ;if +ve the E1BB +E1B8	JSR &ECA2   ;else clear sound data + +E1BB	SEC         ;set carry +E1BC	ROR &02CF,X ;rotate buffer flag to show buffer empty +E1BF	CPX #&02    ;if X>1 then its not an input buffer +E1C1	BCS &E1CB   ;so E1CB + +E1C3	LDA #&00    ;else Input buffer so A=0 +E1C5	STA &0268   ;store as length of key string +E1C8	STA &026A   ;and length of VDU queque +E1CB	JSR &E73B   ;then enter via count purge vector any user routines +E1CE	PLP         ;restore flags +E1CF	PLA         ;restore A +E1D0	RTS         ;and exit + + + +************************************************************************* +*                                                                       * +*       COUNT PURGE VECTOR      DEFAULT ENTRY                           * +*                                                                       * +*                                                                       * +************************************************************************* +;on entry if V set clear buffer +;   	  if C set get space left +;   	  else get bytes used + +E1D1	BVC &E1DA   ;if bit 6 is set then E1DA +E1D3	LDA &02D8,X ;else start of buffer=end of buffer +E1D6	STA &02E1,X ; +E1D9	RTS         ;and exit + +E1DA	PHP         ;push flags +E1DB	SEI         ;bar interrupts +E1DC	PHP         ;push flags +E1DD	SEC         ;set carry +E1DE	LDA &02E1,X ;get end of buffer +E1E1	SBC &02D8,X ;subtract start of buffer +E1E4	BCS &E1EA   ;if carry caused E1EA +E1E6	SEC         ;set carry +E1E7	SBC &E447,X ;subtract buffer start offset (i.e. add buffer length) +E1EA	PLP         ;pull flags +E1EB	BCC &E1F3   ;if carry clear E1F3 to exit +E1ED	CLC         ;clear carry +E1EE	ADC &E447,X ;adc to get bytes used +E1F1	EOR #&FF    ;and invert to get space left +E1F3	LDY #&00    ;Y=0 +E1F5	TAX         ;X=A +E1F6	PLP         ;get back flags +E1F7	RTS         ;and exit + + + +********** enter byte in buffer, wait and flash lights if full ********** + +E1F8	SEI         ;prevent interrupts +E1F9	JSR &E4B0   ;entera byte in buffer X +E1FC	BCC &E20D   ;if successful exit +E1FE	JSR &E9EA   ;else switch on both keyboard lights +E201	PHP         ;push p +E202	PHA         ;push A +E203	JSR &EEEB   ;switch off unselected LEDs +E206	PLA         ;get back A +E207	PLP         ;and flags +E208	BMI &E20D   ;if return is -ve Escape pressed so exit +E20A	CLI         ;else allow interrupts +E20B	BCS &E1F8   ;if byte didn't enter buffer go and try it again +E20D	RTS         ;then return + + | 
