1: .segment "MEM_KERNAL_ZP": zeropage 2: 3: zSTATUS: .res 1 ; $0090 ; status of TAPE/IEC routines 4: 5: zSTKEY: .res 1 ; $0091 6: zSVXT: .res 1 ; $0092 7: zVERCKK: .res 1 ; $0093 ; verify flag: Remember in KLOAD if LOAD (=0) or VERIFY (=1) is requested. 8: zC3PO: .res 1 ; $0094 ; delayed byte for IEC output 9: ; As an EOI must be signaled BEFORE the last byte is transferred, 10: ; the KERNAL routines use a delayed write approach: 11: ; 12: ; It starts with zC3PO = 0. 13: ; When the first byte to be output is given to the IEC routines, 14: ; it is written to zBSOUR, and zC3PO.7 is set. 15: ; When the next byte is written, zC3PO is tested. As it is negative, 16: ; the byte in zBSOUR is being output to the IEC bus. Afterwards, 17: ; the new byte is written into zBSOUR. 18: ; When the last byte is transferred, the next command transmitted 19: ; (i.e. LISTEN, TALK, UNLISTEN, UNTALK) tests for zC3PO. As it is 20: ; negative, the last byte (in zBSOUR) is output to the IEC bus, and 21: ; an EOI is signalled. 22: ; 23: zBSOUR: .res 1 ; $0095 ; The byte to write on the IEC bus. (see also zC3PO) 24: zSYNO: .res 1 ; $0096 25: zTEMPX: .res 1 ; $0097 26: zLDTND: .res 1 ; $0098 ; number of active entries in the lLAT, lFAT and lSAT table 27: zDFLTN: .res 1 ; $0099 28: zDFLTO: .res 1 ; $009A 29: zPRTY: .res 1 ; $009B 30: zDPSW: .res 1 ; $009C 31: zNSGFLG: .res 1 ; $009D ; message output policy: 32: ; bit 7: Output "Loading", "Saving", "Verifying", "Found", ... messages 33: ; bit 6: Output "I/O ERROR #n" if KERNAL routines encounter an error 34: ; This value is only set by kSETMSG. 35: 36: zPTR1: .res 1 ; $009E 37: zPTR2: .res 1 ; $009F 38: zTIME: .res 3 ; $00A0 39: zTSFCNT: .res 1 ; $00A3 ; mark: signal EOI (== $80) or not (== $00) on IEC bus. 40: zTBTCNT: .res 1 ; $00A4 41: zCNTDN: .res 1 ; $00A5 42: zBUFPNT: .res 1 ; $00A6 ; pointer into tape buffer (lTBUFFR), stored as an index 0..(TBUFFR_SIZE - 1): Contains the last value that was written or read. 43: zINBIT: .res 1 ; $00A7 44: zBITC1: .res 1 ; $00A8 45: zRINONE: .res 1 ; $00A9 46: zRIDATA: .res 1 ; $00AA 47: zRIPRTY: .res 1 ; $00AB 48: zSAL: .res 2 ; $00AC 49: zEAL: .res 2 ; $00AE 50: zCMPO: .res 2 ; $00B0 51: zTAPE1: .res 2 ; $00B2 52: zBITTS: .res 1 ; $00B4 53: zNXTBIT: .res 1 ; $00B5 54: zRODATA: .res 1 ; $00B6 55: zFNLEN: .res 1 ; $00B7 ; length of the name of the file to be opened. Address at zFNADR. Only used on OPEN and LOAD. 56: zLA: .res 1 ; $00B8 ; logical device number of current open file (or in preparation to a call to OPEN) 57: zSA: .res 1 ; $00B9 ; device (primary) address of current open file (or in preparation to a call to OPEN) 58: zFA: .res 1 ; $00BA ; secondary address of current open file (or in preparation to a call to OPEN) 59: zFNADR: .res 2 ; $00BB ; address of the name of the file to be opened. Length at zFNLEN. Only used on OPEN and LOAD. 60: zROPRTY: .res 1 ; $00BD 61: zFSBLK: .res 1 ; $00BE 62: zMYCH: .res 1 ; $00BF 63: zCAS1: .res 1 ; $00C0 ; 0 if no tape operation in progress, != 0 otherwise. Use in the IRQ routine to switch off tape motor, if needed. 64: zSTAL: .res 2 ; $00C1 65: zMEMUSS: .res 2 ; $00C3 66: zLSTX: .res 1 ; $00C5 ; last pressed key. That is, after keyboard scanning completes, this becomes a copy of zSFDX. This is used for determining if key repetition is to be performed. 67: zNDX: .res 1 ; $00C6 ; current numbers of characters in the keyboard buffer (lKEYD). The maximum is stored in lXMAX. 68: zRVS: .res 1 ; $00C7 69: zINDX: .res 1 ; $00C8 70: zLXSP: .res 1 ; $00C9 71: zTEMP_zPNTR: .res 1 ; $00CA ; temporary buffer for cursorpos (zPNTR) inside of BASIN 72: zSFDX: .res 1 ; $00CB ; key code if the code that is currently found pressed 73: zBLNSW: .res 1 ; $00CC ; blink switch: <> 0 -> disable cursor, == 0 -> enable cursor 74: zBLNCT: .res 1 ; $00CD 75: zGDBLN: .res 1 ; $00CE 76: zBLNON: .res 1 ; $00CF ; current blink state: 0 = cursor currently invisible, 1 = cursor is just now visible on the screen 77: zCRSW: .res 1 ; $00D0 ; used in editor routines for sreen input: > 0 if CR has been pressed, 0 if there has not been any input yet (or no CR has been pressed yet) 78: zPNT: .res 2 ; $00D1 ; pointer to start of current cursor row in video RAM (cf. zUSER) 79: zPNTR: .res 1 ; $00D3 ; column of current cursor position (0 ... X-1) 80: zQTSW: .res 1 ; $00D4 ; quotation mark switch: 1 = we are in quotation mode, 0 = we are not. 81: zLNMX: .res 1 ; $00D5 ; maximum column number in the current (logical) line 82: zTBLX: .res 1 ; $00D6 ; row of current cursor positon (0 ... Y-1) 83: zSCHAR: .res 1 ; $00D7 ; temporary storage for a character in editor routines for input and output, and temporary storage in tape routines 84: zINSRT: .res 1 ; $00D8 ; number of characters to output in INSERT mode. 0 = we are not in insert mode 85: zLDTB1: .res 26 ; $00D9 ; high byte of start address of (logical) screen rows 86: ; Bit 7 ($80) is 1 if this line is "stand-alone"; 87: ; it is 0 if this line is combined with the previous one 88: ; the lower bits (and #>lVIDEORAM_SIZE) define the high byte bits of the start address of this row. 89: ; 90: ; For the last row, this table entry contains $FF as an end marker. 91: 92: zUSER: .res 2 ; $00F3 ; pointer to start of current cursor row in color RAM (cf. zPNT) 93: zKEYTAB: .res 2 ; $00F5 94: zRIBUF: .res 2 ; $00F7 ; pointer to the RS232 input buffer (ring buffer) (see also lRIDBE, lRIDBS) 95: zROBUF: .res 2 ; $00F9 ; pointer to the RS232 output buffer (ring buffer) (see also lRODBE, lRODBS) 96: zFREKXP: .res 4 ; $00FB 97: 98: .segment "MEM_KERNAL_DATA_0200" 99: 100: ; the following table contains the data (logical file number, primary address, secondary address) for open files. 101: ; The entries correspond to each other: That is, lLAT + x, lFAT + x and lSAT + x contain the data for the file 102: ; with the index (*not* logical file number!) x. 103: 104: lLAT_Size := 10 105: lLAT: .res lLAT_Size ; $0259 ; table of logical file numbers for open files. Number of active entries in zLDTND. Cannot be 0 for active files. 106: lFAT: .res lLAT_Size ; $0263 ; table of device (primary) addresses for open files. Number of active entries in zLDTND. 107: lSAT: .res lLAT_Size ; $026D ; table of secondary addresses for open files. Number of active entries in zLDTND. 108: 109: lKEYD: .res 10 ; $0277 110: lMEMSTR: .res 2 ; $0281 111: lMEMSIZ: .res 2 ; $0283 112: lTIMOUT: .res 1 ; $0285 113: lCOLOR: .res 1 ; $0286 ; default color (bit 7 must be 0, or CHROUT_SCREEN will behave erroneouskly!) 114: lGDCOL: .res 1 ; $0287 115: lHIBASE: .res 1 ; $0288 ; high byte of video RAM address 116: lXMAX: .res 1 ; $0289 ; maximum number of characters in the keyboard buffer (lKEYD). zNDX is checked against this value 117: lRPTFLG: .res 1 ; $028A ; repeat flag for keys 118: ; bit 7 ($80) == 1 -> repeat all keys 119: ; bit 6 ($40) == 1 -> do not repeat any key 120: ; else: Repeat special keys (space, CRSRS, INS/DEL), but not the others 121: 122: ; the test is done starting with bit 7, then bit 6. 123: ; thus, if both are set, all keys are repeated 124: 125: lKOUNT: .res 1 ; $028B ; delay counter for key repetitions. This is decremented on every IRQ, starting from 4. 126: 127: lDELAY: .res 1 ; $028C ; delay counter for key repetitions. It is used for the initial delay before the key repetition starts. 128: 129: lSHFLAG: .res 1 ; $028D ; contains the state of the shift keys while scanning the keyboard. 130: ; The state is an OR between the following values, if the correspondig key is pressed: 131: ; bit 0 ($01) = shift 132: ; bit 1 ($02) = C= 133: ; bit 2 ($04) = CTRL 134: lSHFLAG_SHIFT := $01 135: lSHFLAG_CBM := $02 136: lSHFLAG_CTRL := $04 137: 138: lLSTSHF: .res 1 ; $028E ; contains the *last* shift state. That is, after the keyboard is scanned, this becomes a copy of lSHFLAG. This way, the KERNAL prevents a repeated toggling when pressend SHIFT + C= 139: lKEYLOG: .res 2 ; $028F 140: lMODE: .res 1 ; $0291 ; determines editor mode. 141: ; bit 7 ($80) == 1 -> Switching between uppercase-mode and lowercase-mode via SHIFT + C= is not allowed 142: ; bit 4 ($10) == 1 -> TODO ??? (used in VIC20-02) 143: ; bit 3 ($08) == 1 -> we are in lowercase mode, == 0 -> we are in uppercase mode (only VIC20-02) 144: ; on VIC20-02, lMODE also contains the offset into the @KEYTABS_VEC table ($00-$16) 145: 146: ; on the VIC20-02, lMODE is used in CHROUT_SCREEN to determine if some chars are to 147: ; be translated (according to CHROUT_REPLACEMENT_TABLE). If lMODE is not 0, the 148: ; translation is done. If it is 0, the translation is skipped. 149: 150: lAUTODN: .res 1 ; $0292 ; TODO "Auto down" flag: (Flag: "combine line with next line, if needed") 151: 152: ; If the output is done because of some key press, lAUTODN is not 0. In this case, 153: ; when the output reaches the end of a row, this row is combined with the next 154: ; row. Furthermore, the screen contents below the current line are scrolled down. 155: 156: ; If the output is done without some key press, lAUTODN is 0. In this case, 157: ; when the output reaches the end of a row, this row is combined with the next 158: ; one, but the screen contents are NOT scrolled down. 159: 160: lM51CTR: .res 1 ; $0293 161: lM51CDR: .res 1 ; $0294 162: lM51AJB: .res 2 ; $0295 163: lRSSTAT: .res 1 ; $0297 164: lBITNUM: .res 1 ; $0298 165: lBAUDOF: .res 2 ; $0299 166: lRIDBE: .res 1 ; $029B ; RS232 input buffer at zRIBUF: read pointer 167: lRIDBS: .res 1 ; $029C ; RS232 input buffer at zRIBUF: write pointer 168: lRODBS: .res 1 ; $029D ; RS232 output buffer at zROBUF: read pointer 169: lRODBE: .res 1 ; $029E ; RS232 output buffer at zROBUF: write pointer 170: lIRQTMP: .res 2 ; $029F 171: 172: .if CompileComputer >= C64_GENERAL 173: 174: lENABL: .res 1 ; $02A1 ; CIA2 ICR temporary register 175: lTODSNS: .res 1 ; $02A2 176: lTRDTMP: .res 1 ; $02A3 177: lTD1IRQ: .res 1 ; $02A4 178: lTLNIDX: .res 1 ; $02A5 179: lTVSFLG: .res 1 ; $02A6 180: 181: .else 182: 183: lTLNIDX := $00F2 184: 185: .endif 186: 187: .segment "MEM_KERNAL_DATA_0300" 188: 189: lCINV: .res 2 ; $0314 190: lCNBINV: .res 2 ; $0316 191: lNMINV: .res 2 ; $0318 192: lIOPEN: .res 2 ; $031A 193: lICLOSE: .res 2 ; $031C 194: lICHKIN: .res 2 ; $031E 195: lICKOUT: .res 2 ; $0320 196: lICLRCH: .res 2 ; $0322 197: lIBASIN: .res 2 ; $0324 198: lIBSOUT: .res 2 ; $0326 199: lISTOP: .res 2 ; $0328 200: lIGETIN: .res 2 ; $032A 201: lICLALL: .res 2 ; $032C 202: lUSRCMD: .res 2 ; $032E 203: lILOAD: .res 2 ; $0330 204: lISAVE: .res 2 ; $0332 205: 206: .res 8 ; $0334 - $033B, unused 207: 208: lTBUFFR_SIZE := $00C0 209: lTBUFFR: .res lTBUFFR_SIZE ; $033C ; tape buffer. The pointer into this buffer can be found at zBUFPNT. 210: 211: .if CompileComputer >= C64_GENERAL 212: lVIDEORAM := $0400 213: .if .defined(C64JAPAN) 214: lBASICRAM := $1000 215: .else 216: lBASICRAM := $0800 217: .endif 218: .endif 219: 220: lVIDEORAM_SIZE := $03FF 221: 222: .if CompileComputer = VIC20_02 223: zMEMUSS_2 := zC3PO 224: .else 225: zMEMUSS_2 := zMEMUSS 226: .endif