****************************************************************** * * * PR# AND IN# COMMANDS * * * *----------------------------------------------------------------* * * * The PR# and IN# commands point the input and output hooks * * at the devices plugged into a given slot. For instance, a * * "PR#1" normally causes subsequent PRINT statements to send * * data to the printer, whereas a "PR#0" directs data to the * * 40-column screen. Similarly, an "IN#0" command designates the * * keyboard as the input device. The system hangs if either * * command selects an empty slot (other than slot 0). * * Both types of commands can be used in the immediate or * * deferred modes. When used from a running program, the cmds * * should be enclosed in a PRINT statements and preceded by DOS's * * control character. For example: * * 10 D$ = CHR$ (3) + CHR$ (4); REM and ctrL-D * * 20 PRINT D$;"PR#0" * * Although a statement such as '10 PR#0' will not generate * * a syntax error message, DOS's output hook will become * * disconnected. If the input hook is still pointing at DOS, any * * subsequent INPUT or GET statements will eventually refer to * * the INITIOHK routine ($A851) which repoints both hooks at DOS. * * As a result, the computer may appear to ignore some DOS cmds * * but not others. This temporary amnesia is often contagious. * * Programmers who are not familar with the I/O hook controlling * * routines embedded in DOS, are particularly susceptible to * * irrational outbursts of anger and reoccurring bouts of low * * self-esteem. * * * ****************************************************************** ****************************************************************** * * * PR# Command Handler * * * ****************************************************************** * On entry, A5L/H contains the hex value of * the argument (slot #) that was issued with * the PR# command. The argument was previously * screened (0 to 7) via a routine (INPRMAX, * $A0AA - $A0C4) in the command parsing and * processing routines. * Select slot for peripheral device * (If slot 0 then don't actually access * slot directly.) (A229) CMDPR LDA A5L ;Get slot number. (A22B) JMP OUTPORT ;Jump into the monitor to set the output slot. ------------ (FE95) OUTPORT STA A2L ;Store slot value. OUTPRT LDX #COUT1 ;(a) = hi byte for screen output. * Set output hook for PR#. * If slot 0 then CSW points to COUT1. * Otherwise, CSW points to $Cs00 * (where s = slot number). (FEA9) IOPRT2 STY LOC0,X ;Equivalent to STY CSW. STA LOC1,X ;Equivalent to STA CSW+1. (FEAD) RTS ;Return to the caller of the command. ============ ;(Usually returns to AFTRCMD ($A17D) ;located in the command processing and ;processing routines.) ================================================================= ****************************************************************** * * * IN# Command Handler * * * ****************************************************************** * On entry, A5L/H contains the hex value of * the argument (slot #) that was issued with * the IN# command. The argument was * previously screened (0 to 7) via a * routine (INPRMAX, $A0AA - $A0C4) in * the command parsing and processing * routines. * Select slot for peripheral device * (If slot 0 then don't actually access * slot directly.) (A22E) CMDIN LDA A5L ;Get slot number. (A230) JMP INPORT ;Jumps into the monitor to set the input slot. ------------ (FE8B) INPORT STA A2L ;Store slot value. INPRT LDX #COUT1 ;(a) = #>COUT1 = #>KEYIN. ; = hi byte for scrn output. ; = hi byte for keyboard input. * Set input hook for IN#. * If slot 0 then KSW points to KEYIN. * Otherwise, KSW points to $Cs00 * (where s = slot number). (FEA9) IOPRT2 STY LOC0,X ;Equivalent to STY KSW. STA LOC1,X ;Equivalent to STA KSW+1. (FEAD) RTS ;Return to the caller of the command. ============ ;(Usually returns to AFTRCMD ($A17D) located ;in the command processing and processing ;routines.) ================================================================= ****************************************************************** * * * MON and NOMON Command Handlers * * * *----------------------------------------------------------------* * * * The MON command causes disk commands, data read from the * * disk or data sent to the disk to be selectively display on the * * screen. The NOMON command selectively cancels the display * * modes. These commands and their alphabetic arguments (C, I, O)* * are 1rst detected via the command processor. * * CIOCUMUL ($AA5E) is tested at the DSPLYCHR ($9F9F) portion * * of the output parsing routine to see if a character should be * * sent to the screen or not. It is easy to become confused over * * the distinction between CIOCUMUL ($AA5E) and MONPRSD ($AA74). * * CIOCUMUL represents the CUMMULATIVE updated record of the C,I,O* * arguments, whereas MONPRSD describes the most recent ADDITON(s)* * of the C,I,O arguments present in the table of parsed values. * * * ****************************************************************** (A233) CMDMON LDA CIOCUMUL ;Get previous cummulative record from main ORA MONPRSD ;variables table and merge it with parsed STA CIOCUMUL ;value to include the latest update. (A2C3) RTS ;(ie. C = $40 = %01000000 ============ ; I = $20 = %00100000 ; O = $10 = %00010000) ;Combinations of alphabetic arguments ;are simply described by the appropriate ;bit settings. Ex. CIO = $70 = %01110000. ;Return to the caller of the command. ;(Usually returns to AFTRCMD ($A17D) located ;in the command processing and processing ;routines.) ================================================================= (A23D) CMDNOMON BIT MONPRSD ;Test bit 6 in parsed table to see if ;"NOMON C" is selected. (A240) BVC CLRMON ;Branch if "C" not included with "NOMON". (A242) JSR CRVIADOS ;"C" was included, so prt cause command ;(but not ) was already printed. * Print a via TRUE output handler. (9FC8) CRVIADOS LDA #$8D ;. (9FCA) JMP GODSPLY ------------ (9FC5) GODSPLY JMP (CSW) ;At this stage, CSW points to . ;the true output handler (COUT1, $FDF0). . (RTS) (A245) CLRMON LDA #%0111000 ;Shut off bits in parsed table that (A247) EOR MONPRSD ;correspond to the alphabetic arguments ;that were issued with the "NOMON" cmd. (A24A) AND CIOCUMUL ;Now make sure that those bits are STA CIOCUMUL ;off in the cummulative record. (A250) RTS ;Return to the caller of the command. ============ ;(Usually returns to AFTRCMD ($A17D) located ;in the command processing and processing ;routines.)