chipty5/pet.asm

195 lines
10 KiB
NASM

;
; Commodore PET specific constants and memory addresses
;
.proff
.cpu "6502"
io .namespace
.include "via.asm"
.include "crtc.asm"
.virtual $e840
via .dstruct _via
.endvirtual
.virtual $e880
crtc .dstruct _crtc
.endvirtual
.endnamespace
BASIC_START = $0401
BTOK_SYS = $9e
SCREEN_RAM = $8000
USRPOK = $0000 ; USR Function Jump Instr (4C)
USRADD = $0001 ; USR Address Low Byte / High Byte
CHARAC = $0003 ; Search Character
ENDCHR = $0004 ; Flag: Scan for Quote at End of String
COUNT = $0005 ; Input Buffer Pointer / No. of Subscripts
DIMFLG = $0006 ; Flag: Default Array DiMension / array name
VAUYP = $0007 ; Data Type: $FF = String, $00 = Numeric
INTFLG = $0008 ; Data Type: $80 = Integer, $00 = Floating
GARBFL = $0009 ; Flag: DATA scan/LlST quote/Garbage Coll
SUBFLG = $000a ; Flag: Subscript Ref / User Function Call
INPFLG = $000b ; Flag: $00 = INPUT, $40 = GET, $98 = READ
TANSGN = $000c ; Flag TAN sign / Comparison Result
LINNUM = $0011 ; Temp: Integer Value
TEMPPT = $0013 ; Pointer Temporary String
LASTPT = $0014 ; Last Temp String Address
TEMPST = $0016 ; Stack for Temporary Strings
INDEX = $001f ; Utility Pointer Area
RESHO = $0023 ; Floating-Point Product of Multiply
TXTTAB = $0028 ; Pointer: Start of BASIC Text
VARTAB = $002a ; Pointer: Start of BASIC Variables
ARYTAB = $002c ; Pointer: Start of BASIC Arrays
STREND = $002e ; Pointer End of BASIC Arrays (+1)
FRETOP = $0030 ; Pointer: Bottom of String Storage
FRESPC = $0032 ; Utility String Pointer
MEMSIZ = $0034 ; Pointer: Highest Address Used by BASIC
CURLIN = $0036 ; Current BASIC Line Number
OLDLIN = $0038 ; Previous BASIC Line Number
OLDTXT = $003a ; Pointer: BASIC Statement for CONT
DATLIN = $003c ; Current DATA Line Number
DATPTR = $003e ; Pointer: Current DATA Item Address
INPPTR = $0040 ; Vector: INPUT Routine
VARNAM = $0042 ; Current BASIC Variable Name
VARPNT = $0044 ; Pointer: Current BASIC Variable Data
FORPNT = $0046 ; Pointer: Index Variable for FOR/NEXT
TEMPF1 = $0054 ; Temporary storage for FLPT value.
TEMPF2 = $0059 ; Temporary storage for FLPT value.
FACEXP = $005e ; Floating-Point Accumulator #1: Exponent
FACHO = $005f ; Floating Accum. #1: Mantissa
FACSGN = $0063 ; Floating Accum. #1: Sign
SGNFLG = $0064 ; Pointer: Series Evaluation Constant Pointer
BITS = $0065 ; Floating -accum. #1: Overflow Digit
ARGEXP = $0066 ; Floating-Point Accumulator #2: Exponent
ARGHO = $0067 ; Floating Accum. #2: Mantissa
ARGSGN = $006b ; Floating Accum. #2: Sign
ARISGN = $006c ; Sign Comparison Result: Accum. # 1 vs #2
FACOV = $006d ; Floating Accum. #1. Low-Order (Rounding)
FBUFPT = $006e ; Pointer: Cassette Buffer
CHRGET = $0070 ; Subroutine: Get Next Byte of BASIC Text
CHRGOT = $0076 ; Entry to Get Same Byte of Text Again
TXTPTR = $0077 ; Pointer: Current Byte of BASIC Text
RNDX = $0088 ; Floating RND Function Seed Value
TIME = $008d ; Real-Time Jiffy Clock (approx) 1/60 Sec
CINV = $0090 ; Vector: Hardware Interrupt
CBINV = $0092 ; Vector: BRK Instr. Interrupt
NMINV = $0094 ; Vector: Non-Maskable Interrupt
STATUS = $0096 ; Kernal I/O Status Word: ST
LSTX = $0097 ; Current Key Pressed: 255 = No Key
SFDX = $0098 ; Flag: Print Shifted Chars.
STKEY = $009b ; Flag: STOP key / RVS key
SVXT = $009c ; Timing Constant for Tape
VERCK = $009d ; Flag: 0 = Load, 1 = Verify (Kernel)
NDX = $009e ; No. of Chars. in Keyboard Buffer (Queue)
RVS = $009f ; Flag: Print Reverse Chars. -1=Yes, 0=No Used
C3PO = $00a0 ; Flag: Serial Bus-Output Char. Buffered
INDX = $00a1 ; Pointer: End of Logical Line for INPUT
LXSP = $00a3 ; Cursor Y-X Pos. at Start of INPUT
BSOUR = $00a5 ; Buffered Character for IEEE Bus
BLNSW = $00a7 ; Cursor Blink enable: 0 = Flash Cursor
BLNCT = $00a8 ; Timer: Countdown to Toggle Cursor
GDBLN = $00a9 ; Character Under Cursor
BLNON = $00aa ; Flag: Last Cursor Blink On/Off
CRSW = $00ac ; Flag: INPUT or GET from Keyboard
LDTND = $00ae ; No. of Open Files / Index to File Table
DFLTN = $00af ; Default Input Device (0)
DFLTO = $00b0 ; Default Output (CMD) Device (3)
PRTY = $00b1 ; Tape Character Parity
DPSW = $00b2 ; Flag: Tape Byte-Received
BUFPNT = $00bb ; Pointer: Tape I/O Buffer #1
INBIT = $00bd ; Cassette Temp (64#00A7)
BITCI = $00be ; Cassette Temp (64#00A8)
RINONE = $00bf ; RS-232 Flag: Check for Start Bit (64#00A9)
FNMIDX = $00c0 ; Index to Cassette File name/Header ID for Tape write.
PTR1 = $00c0 ; Tape Pass 1 Error Log
PTR2 = $00c1 ; Tape Pass 2 Error Log
RIDATA = $00c2 ; Cassette Temp (64#00AA) read flags: 0=scan, 1-15=count, $40=load, $80=end of tape marker
RIPRTY = $00c3 ; Cassette Short Cnt (64#00AB): counter of seconds before tape write / checksum
PNT = $00c4 ; Pointer: Current Screen Line Address
PNTR = $00c6 ; Cursor Column on Current Line
SAL = $00c7 ; Pointer: Tape Buffer/ Screen Scrolling
EAL = $00c9 ; Tape End Addresses/End of Program
CMP0 = $00cb ; Tape Timing Constants
QTSW = $00cd ; Flag: Editor in Quote Mode, $00 = NO
BITTS = $00ce ; Cassette Temp (64#00B4): Tape read timer flag
FNLEN = $00d1 ; Length of Current File Name
LA = $00d2 ; Current Logical File Number
SA = $00d3 ; Current Secondary Address
FA = $00d4 ; Current Device Number
LNMX = $00d5 ; Physical Screen Line Length
TAPE1 = $00d6 ; Pointer: Start of Tape Buffer
TBLX = $00d8 ; Current Cursor Physical Line Number
DATAX = $00d9 ; Current Character to Print
FNADR = $00da ; Pointer: Current File Name
INSRT = $00dc ; Flag: Insert Mode, >0 = # INSTs
ROPRTY = $00dd ; Cassette Temp
FSBLK = $00de ; Cassette Read / Write Block Count
MYCH = $00df ; Serial Word Buffer
LDTB1 = $00e0 ; 3+4.40: Screen Line Link Table / Editor Temps
SCTOP = $00e0 ; 4.80: first line of window
SCBOT = $00e1 ; 4.80: last line of window
SCLF = $00e2 ; 4.80: first column of window
XMAX = $00e3 ; 4.80: Size of Keyboard Buffer
;XMAX = $03eb ; 4.40
RPTFLG = $00e4 ; 4.80: Flag: REPEAT Key Used, $80 = Repeat $40 = disable
;RPTFLG = $03ee ; 4.40
KOUNT = $00e5 ; 4.80: Repeat Speed Counter
;KOUNT = $03ea ; 4.40
DELAY = $00e6 ; 230 4.80: Repeat Delay Counter
;DELAY = $03e9 ; 4.40
CAS1 = $00f9 ; Tape Motor Interlock #1
CAS2 = $00fa ; Tape Motor Interlock #2
STAL = $00fb ; I/O Start Address
MEMUSS = $00fd ; Tape Load Temps
BAD = $0100 ; Tape Input Error Log
BUF = $0200 ; System INPUT Buffer
LAT = $0251 ; KERNAL Table: Active Logical File No's.
FAT = $025b ; KERNAL Table: Device No. for Each File
SAT = $0265 ; KERNAL Table: Second Address Each File
KEYD = $0270 ; Keyboard Buffer Queue (FIFO)
TBUFFR = $027a ; Tape I/O Buffer #1
;TBUFFR = $033a ; Tape I/O Buffer #2
;DELAY = $03e9 ; 4.40
;KOUNT = $03ea ; 4.40
;XMAX = $03eb ; 4.40
;RPTFLG = $03ee ; 4.40
TIMOUT = $03fc ; 4: Flag: Kernal Variable for IEEE Timeout
; Kernel
; CHKIN = $ffc6
; CHKOUT = $ffc9
; CHRIN = $ffcf
; CHROUT = $ffd2
; CLALL = $ffe7
; CLOSE = $ffc3
; CLRCHN = $ffcc
; CSYS = $ffde
; CVERF = $ffdb
; GETIN = $ffe4
; LOAD = $ffd5
; OPEN = $ffc0
; SAVE = $ffd0
; STOP = $ffe1
; UDTIM = $ffea
;CONSTANTS FROM PET BASIC 4.0
CLRCHN =$FFCC ;CLOSE I/O CHANNELS
CHKIN =$FFC6 ;OPEN INPUT CHANNEL
CHRIN =$FFCF ;INPUT SOURCE BYTE
CHROUT =$FFD2 ;OUTPUT CHARACTER TO CHAN
CLOSE =$F2E2 ;CLOSE FILE .A
OPEN =$F563 ;OPEN FILE LA,FA,SA
.pron
; vim: syntax=64tass