Browse Source

added KERNAL_C64_03 and renamed the existing KERNAL_C64 to KERNAL_C64_01

master
Michael Steil 2 years ago
parent
commit
f0a30fd58e
65 changed files with 5482 additions and 1 deletions
  1. 0
    0
      KERNAL_C64_01/channelio
  2. 0
    0
      KERNAL_C64_01/clall
  3. 0
    0
      KERNAL_C64_01/close
  4. 0
    0
      KERNAL_C64_01/conkat
  5. 0
    0
      KERNAL_C64_01/declare
  6. 0
    0
      KERNAL_C64_01/disclaimer
  7. 0
    0
      KERNAL_C64_01/editor.1
  8. 0
    0
      KERNAL_C64_01/editor.2
  9. 0
    0
      KERNAL_C64_01/editor.3
  10. 0
    0
      KERNAL_C64_01/errorhandler
  11. 0
    0
      KERNAL_C64_01/init
  12. 0
    0
      KERNAL_C64_01/irqfile
  13. 0
    0
      KERNAL_C64_01/kernal
  14. 0
    0
      KERNAL_C64_01/kernal.mike
  15. 0
    0
      KERNAL_C64_01/load
  16. 0
    0
      KERNAL_C64_01/messages
  17. 0
    0
      KERNAL_C64_01/nolist
  18. 0
    0
      KERNAL_C64_01/open
  19. 0
    0
      KERNAL_C64_01/openchannel
  20. 0
    0
      KERNAL_C64_01/read
  21. 0
    0
      KERNAL_C64_01/rs232inout
  22. 0
    0
      KERNAL_C64_01/rs232nmi
  23. 0
    0
      KERNAL_C64_01/rs232rcvr
  24. 0
    0
      KERNAL_C64_01/rs232trans
  25. 0
    0
      KERNAL_C64_01/rs232trans2
  26. 0
    0
      KERNAL_C64_01/save
  27. 0
    0
      KERNAL_C64_01/serial4.0
  28. 0
    0
      KERNAL_C64_01/tapecontrol
  29. 0
    0
      KERNAL_C64_01/tapefile
  30. 0
    0
      KERNAL_C64_01/time
  31. 0
    0
      KERNAL_C64_01/vectors
  32. 0
    0
      KERNAL_C64_01/write
  33. 206
    0
      KERNAL_C64_03/channelio
  34. 37
    0
      KERNAL_C64_03/clall
  35. 135
    0
      KERNAL_C64_03/close
  36. 40
    0
      KERNAL_C64_03/conkat
  37. 292
    0
      KERNAL_C64_03/declare
  38. 41
    0
      KERNAL_C64_03/disclaimer
  39. 614
    0
      KERNAL_C64_03/editor.1
  40. 406
    0
      KERNAL_C64_03/editor.2
  41. 201
    0
      KERNAL_C64_03/editor.3
  42. 63
    0
      KERNAL_C64_03/errorhandler
  43. 244
    0
      KERNAL_C64_03/init
  44. 85
    0
      KERNAL_C64_03/irqfile
  45. 30
    0
      KERNAL_C64_03/kernal
  46. 29
    0
      KERNAL_C64_03/kernal.mike
  47. 227
    0
      KERNAL_C64_03/load
  48. 29
    0
      KERNAL_C64_03/messages
  49. 2
    0
      KERNAL_C64_03/nolist
  50. 272
    0
      KERNAL_C64_03/open
  51. 135
    0
      KERNAL_C64_03/openchannel
  52. 412
    0
      KERNAL_C64_03/read
  53. 187
    0
      KERNAL_C64_03/rs232inout
  54. 207
    0
      KERNAL_C64_03/rs232nmi
  55. 131
    0
      KERNAL_C64_03/rs232rcvr
  56. 144
    0
      KERNAL_C64_03/rs232trans
  57. 159
    0
      KERNAL_C64_03/rs232trans2
  58. 119
    0
      KERNAL_C64_03/save
  59. 310
    0
      KERNAL_C64_03/serial4.0
  60. 186
    0
      KERNAL_C64_03/tapecontrol
  61. 202
    0
      KERNAL_C64_03/tapefile
  62. 78
    0
      KERNAL_C64_03/time
  63. 50
    0
      KERNAL_C64_03/vectors
  64. 198
    0
      KERNAL_C64_03/write
  65. 11
    1
      README.md

KERNAL_C64/channelio → KERNAL_C64_01/channelio View File


KERNAL_C64/clall → KERNAL_C64_01/clall View File


KERNAL_C64/close → KERNAL_C64_01/close View File


KERNAL_C64/conkat → KERNAL_C64_01/conkat View File


KERNAL_C64/declare → KERNAL_C64_01/declare View File


KERNAL_C64/disclaimer → KERNAL_C64_01/disclaimer View File


KERNAL_C64/editor.1 → KERNAL_C64_01/editor.1 View File


KERNAL_C64/editor.2 → KERNAL_C64_01/editor.2 View File


KERNAL_C64/editor.3 → KERNAL_C64_01/editor.3 View File


KERNAL_C64/errorhandler → KERNAL_C64_01/errorhandler View File


KERNAL_C64/init → KERNAL_C64_01/init View File


KERNAL_C64/irqfile → KERNAL_C64_01/irqfile View File


KERNAL_C64/kernal → KERNAL_C64_01/kernal View File


KERNAL_C64/kernal.mike → KERNAL_C64_01/kernal.mike View File


KERNAL_C64/load → KERNAL_C64_01/load View File


KERNAL_C64/messages → KERNAL_C64_01/messages View File


KERNAL_C64/nolist → KERNAL_C64_01/nolist View File


KERNAL_C64/open → KERNAL_C64_01/open View File


KERNAL_C64/openchannel → KERNAL_C64_01/openchannel View File


KERNAL_C64/read → KERNAL_C64_01/read View File


KERNAL_C64/rs232inout → KERNAL_C64_01/rs232inout View File


KERNAL_C64/rs232nmi → KERNAL_C64_01/rs232nmi View File


KERNAL_C64/rs232rcvr → KERNAL_C64_01/rs232rcvr View File


KERNAL_C64/rs232trans → KERNAL_C64_01/rs232trans View File


KERNAL_C64/rs232trans2 → KERNAL_C64_01/rs232trans2 View File


KERNAL_C64/save → KERNAL_C64_01/save View File


KERNAL_C64/serial4.0 → KERNAL_C64_01/serial4.0 View File


KERNAL_C64/tapecontrol → KERNAL_C64_01/tapecontrol View File


KERNAL_C64/tapefile → KERNAL_C64_01/tapefile View File


KERNAL_C64/time → KERNAL_C64_01/time View File


KERNAL_C64/vectors → KERNAL_C64_01/vectors View File


KERNAL_C64/write → KERNAL_C64_01/write View File


+ 206
- 0
KERNAL_C64_03/channelio View File

@@ -0,0 +1,206 @@
.PAG 'CHANNEL I/O'
;***************************************
;* GETIN -- GET CHARACTER FROM CHANNEL *
;* CHANNEL IS DETERMINED BY DFLTN.*
;* IF DEVICE IS 0, KEYBOARD QUEUE IS *
;* EXAMINED AND A CHARACTER REMOVED IF *
;* AVAILABLE. IF QUEUE IS EMPTY, Z *
;* FLAG IS RETURNED SET. DEVICES 1-31 *
;* ADVANCE TO BASIN. *
;***************************************
;
NGETIN LDA DFLTN ;CHECK DEVICE
BNE GN10 ;NOT KEYBOARD
;
LDA NDX ;QUEUE INDEX
BEQ GN20 ;NOBODY THERE...EXIT
;
SEI
JMP LP2 ;GO REMOVE A CHARACTER
;
GN10 CMP #2 ;IS IT RS-232
BNE BN10 ;NO...USE BASIN
;
GN232 STY XSAV ;SAVE .Y, USED IN RS232
JSR BSI232
LDY XSAV ;RESTORE .Y
GN20 CLC ;GOOD RETURN
RTS
.SKI 3
;***************************************
;* BASIN-- INPUT CHARACTER FROM CHANNEL*
;* INPUT DIFFERS FROM GET ON DEVICE*
;* #0 FUNCTION WHICH IS KEYBOARD. THE *
;* SCREEN EDITOR MAKES READY AN ENTIRE *
;* LINE WHICH IS PASSED CHAR BY CHAR *
;* UP TO THE CARRIAGE RETURN. OTHER *
;* DEVICES ARE: *
;* 0 -- KEYBOARD *
;* 1 -- CASSETTE #1 *
;* 2 -- RS232 *
;* 3 -- SCREEN *
;* 4-31 -- SERIAL BUS *
;***************************************
;
NBASIN LDA DFLTN ;CHECK DEVICE
BNE BN10 ;IS NOT KEYBOARD...
;
;INPUT FROM KEYBOARD
;
LDA PNTR ;SAVE CURRENT...
STA LSTP ;... CURSOR COLUMN
LDA TBLX ;SAVE CURRENT...
STA LSXP ;... LINE NUMBER
JMP LOOP5 ;BLINK CURSOR UNTIL RETURN
;
BN10 CMP #3 ;IS INPUT FROM SCREEN?
BNE BN20 ;NO...
;
STA CRSW ;FAKE A CARRIAGE RETURN
LDA LNMX ;SAY WE ENDED...
STA INDX ;...UP ON THIS LINE
JMP LOOP5 ;PICK UP CHARACTERS
;
BN20 BCS BN30 ;DEVICES >3
CMP #2 ;RS232?
BEQ BN50
;
;INPUT FROM CASSETTE BUFFERS
;
STX XSAV
JSR JTGET
BCS JTG37 ;STOP KEY/ERROR
PHA
JSR JTGET
BCS JTG36 ;STOP KEY/ERROR
BNE JTG35 ;NOT AN END OF FILE
LDA #64 ;TELL USER EOF
JSR UDST ;IN STATUS
JTG35 DEC BUFPT
LDX XSAV ;.X PRESERVED
PLA ;CHARACTER RETURNED
;C-CLEAR FROM JTGET
RTS ;ALL DONE
;
JTG36 TAX ;SAVE ERROR INFO
PLA ;TOSS DATA
TXA ;RESTORE ERROR
JTG37 LDX XSAV ;RETURN
RTS ;ERROR RETURN C-SET FROM JTGET
.SKI 3
;GET A CHARACTER FROM APPROPRIATE
;CASSETTE BUFFER
;
JTGET JSR JTP20 ;BUFFER POINTER WRAP?
BNE JTG10 ;NO...
JSR RBLK ;YES...READ NEXT BLOCK
BCS BN33 ;STOP KEY PRESSED
LDA #0
STA BUFPT ;POINT TO BEGIN.
BEQ JTGET ;BRANCH ALWAYS
;
JTG10 LDA (TAPE1)Y ;GET CHAR FROM BUF
CLC ;GOOD RETURN
RTS
.SKI 3
;INPUT FROM SERIAL BUS
;
BN30 LDA STATUS ;STATUS FROM LAST
BEQ BN35 ;WAS GOOD
BN31 LDA #$D ;BAD...ALL DONE
BN32 CLC ;VALID DATA
BN33 RTS
;
BN35 JMP ACPTR ;GOOD...HANDSHAKE
;
;INPUT FROM RS232
;
BN50 JSR GN232 ;GET INFO
BCS BN33 ;ERROR RETURN
CMP #00
BNE BN32 ;GOOD DATA...EXIT
LDA RSSTAT ;CHECK FOR DSR OR DCD ERROR
AND #$60
BNE BN31 ;AN ERROR...EXIT WITH C/R
BEQ BN50 ;NO ERROR...STAY IN LOOP
.PAG 'CHANNEL OUTPUT'
;***************************************
;* BSOUT -- OUT CHARACTER TO CHANNEL *
;* DETERMINED BY VARIABLE DFLTO: *
;* 0 -- INVALID *
;* 1 -- CASSETTE #1 *
;* 2 -- RS232 *
;* 3 -- SCREEN *
;* 4-31 -- SERIAL BUS *
;***************************************
;
NBSOUT PHA ;PRESERVE .A
LDA DFLTO ;CHECK DEVICE
CMP #3 ;IS IT THE SCREEN?
BNE BO10 ;NO...
;
;PRINT TO CRT
;
PLA ;RESTORE DATA
JMP PRT ;PRINT ON CRT
;
BO10
BCC BO20 ;DEVICE 1 OR 2
;
;PRINT TO SERIAL BUS
;
PLA
JMP CIOUT
;
;PRINT TO CASSETTE DEVICES
;
BO20 LSR A ;RS232?
PLA ;GET DATA OFF STACK...
;
CASOUT STA T1 ;PASS DATA IN T1
; CASOUT MUST BE ENTERED WITH CARRY SET!!!
;PRESERVE REGISTERS
;
TXA
PHA
TYA
PHA
BCC BO50 ;C-CLR MEANS DFLTO=2 (RS232)
;
JSR JTP20 ;CHECK BUFFER POINTER
BNE JTP10 ;HAS NOT REACHED END
JSR WBLK ;WRITE FULL BUFFER
BCS RSTOR ;ABORT ON STOP KEY
;
;PUT BUFFER TYPE BYTE
;
LDA #BDF
LDY #0
STA (TAPE1)Y
;
;RESET BUFFER POINTER
;
INY ;MAKE .Y=1
STY BUFPT ;BUFPT=1
;
JTP10 LDA T1
STA (TAPE1)Y ;DATA TO BUFFER
;
;RESTORE .X AND .Y
;
RSTOA CLC ;GOOD RETURN
RSTOR PLA
TAY
PLA
TAX
LDA T1 ;GET .A FOR RETURN
BCC RSTOR1 ;NO ERROR
LDA #00 ;STOP ERROR IF C-SET
RSTOR1 RTS
;
;OUTPUT TO RS232
;
BO50 JSR BSO232 ;PASS DATA THROUGH VARIABLE T1
JMP RSTOA ;GO RESTORE ALL..ALWAYS GOOD
.END
; RSR 5/12/82 FIX BSOUT FOR NO REG AFFECT BUT ERRORS

+ 37
- 0
KERNAL_C64_03/clall View File

@@ -0,0 +1,37 @@
.PAG 'CLOSE ALL FILES'
;***************************************
;* CLALL -- CLOSE ALL LOGICAL FILES *
;* DELETES ALL TABLE ENTRIES AND*
;* RESTORES DEFAULT I/O CHANNELS *
;* AND CLEARS IEEE PORT DEVICES *
;*************************************
;
NCLALL LDA #0
STA LDTND ;FORGET ALL FILES
.SKI 3
;********************************************
;* CLRCH -- CLEAR CHANNELS *
;* UNLISTEN OR UNTALK IEEE DEVICES, BUT *
;* LEAVE OTHERS ALONE. DEFAULT CHANNELS *
;* ARE RESTORED. *
;********************************************
;
NCLRCH LDX #3
CPX DFLTO ;IS OUTPUT CHANNEL IEEE?
BCS JX750 ;NO...
;
JSR UNLSN ;YES...UNLISTEN IT
;
JX750 CPX DFLTN ;IS INPUT CHANNEL IEEE?
BCS CLALL2 ;NO...
;
JSR UNTLK ;YES...UNTALK IT
;
;RESTORE DEFAULT VALUES
;
;
CLALL2 STX DFLTO ;OUTPUT CHAN=3=SCREEN
LDA #0
STA DFLTN ;INPUT CHAN=0=KEYBOARD
RTS
.END

+ 135
- 0
KERNAL_C64_03/close View File

@@ -0,0 +1,135 @@
.PAG 'CLOSE'
;***************************************
;* CLOSE -- CLOSE LOGICAL FILE *
;* *
;* THE LOGICAL FILE NUMBER OF THE*
;* FILE TO BE CLOSED IS PASSED IN .A.*
;* KEYBOARD, SCREEN, AND FILES NOT *
;* OPEN PASS STRAIGHT THROUGH. TAPE *
;* FILES OPEN FOR WRITE ARE CLOSED BY*
;* DUMPING THE LAST BUFFER AND *
;* CONDITIONALLY WRITING AN END OF *
;* TAPE BLOCK.SERIAL FILES ARE CLOSED*
;* BY SENDING A CLOSE FILE COMMAND IF*
;* A SECONDARY ADDRESS WAS SPECIFIED *
;* IN ITS OPEN COMMAND. *
;***************************************
;
NCLOSE JSR JLTLK ;LOOK FILE UP
BEQ JX050 ;OPEN...
CLC ;ELSE RETURN
RTS
;
JX050 JSR JZ100 ;EXTRACT TABLE DATA
TXA ;SAVE TABLE INDEX
PHA
;
LDA FA ;CHECK DEVICE NUMBER
BEQ JX150 ;IS KEYBOARD...DONE
CMP #3
BEQ JX150 ;IS SCREEN...DONE
BCS JX120 ;IS SERIAL...PROCESS
CMP #2 ;RS232?
BNE JX115 ;NO...
;
; RS-232 CLOSE
;
; REMOVE FILE FROM TABLES
PLA
JSR JXRMV
;
JSR CLN232 ;CLEAN UP RS232 FOR CLOSE
;
; DEALLOCATE BUFFERS
;
JSR GETTOP ;GET MEMSIZ
LDA RIBUF+1 ;CHECK INPUT ALLOCATION
BEQ CLS010 ;NOT...ALLOCATED
INY
CLS010 LDA ROBUF+1 ;CHECK OUTPUT ALLOCATION
BEQ CLS020
INY
CLS020 LDA #00 ;DEALLOCATE
STA RIBUF+1
STA ROBUF+1
; FLAG TOP OF MEMORY CHANGE
JMP MEMTCF ;GO SET NEW TOP
;
;CLOSE CASSETTE FILE
;
JX115 LDA SA ;WAS IT A TAPE READ?
AND #$F
BEQ JX150 ;YES
;
JSR ZZZ ;NO. . .IT IS WRITE
LDA #0 ;END OF FILE CHARACTER
SEC ;NEED TO SET CARRY FOR CASOUT (ELSE RS232 OUTPUT!)
JSR CASOUT ;PUT IN END OF FILE
JSR WBLK
BCC JX117 ;NO ERRORS...
PLA ;CLEAN STACK FOR ERROR
LDA #0 ;BREAK KEY ERROR
RTS
;
JX117 LDA SA
CMP #$62 ;WRITE END OF TAPE BLOCK?
BNE JX150 ;NO...
;
LDA #EOT
JSR TAPEH ;WRITE END OF TAPE BLOCK
JMP JX150
;
;CLOSE AN SERIAL FILE
;
JX120 JSR CLSEI
;
;ENTRY TO REMOVE A GIVE LOGICAL FILE
;FROM TABLE OF LOGICAL, PRIMARY,
;AND SECONDARY ADDRESSES
;
JX150 PLA ;GET TABLE INDEX OFF STACK
;
; JXRMV - ENTRY TO USE AS AN RS-232 SUBROUTINE
;
JXRMV TAX
DEC LDTND
CPX LDTND ;IS DELETED FILE AT END?
BEQ JX170 ;YES...DONE
;
;DELETE ENTRY IN MIDDLE BY MOVING
;LAST ENTRY TO THAT POSITION.
;
LDY LDTND
LDA LAT,Y
STA LAT,X
LDA FAT,Y
STA FAT,X
LDA SAT,Y
STA SAT,X
;
JX170 CLC ;CLOSE EXIT
JX175 RTS
.SKI 5
;LOOKUP TABLIZED LOGICAL FILE DATA
;
LOOKUP LDA #0
STA STATUS
TXA
JLTLK LDX LDTND
JX600 DEX
BMI JZ101
CMP LAT,X
BNE JX600
RTS
.SKI 5
;ROUTINE TO FETCH TABLE ENTRIES
;
JZ100 LDA LAT,X
STA LA
LDA FAT,X
STA FA
LDA SAT,X
STA SA
JZ101 RTS
.END
; RSR 5/12/82 - MODIFY FOR CLN232

+ 40
- 0
KERNAL_C64_03/conkat View File

@@ -0,0 +1,40 @@
.BYT $EF,$A1 ;ALL OF THIS IS AVAILABLE FOR PATCH SPACE
.BYT $DF,$A6
.BYT $E1,$B1
.BYT $E2,$B2
.BYT $E3,$B3
.BYT $E4,$B4
.BYT $E5,$B5
.BYT $E6,$B6
.BYT $E7,$B7
.BYT $E8,$B8
.BYT $E9,$B9
.BYT $FA,$BA
.BYT $FB,$BB
.BYT $FC,$BC
.BYT $EC,$BD
.BYT $FE,$BE
.BYT $84,$BF
.BYT $F7,$C0
.BYT $F8,$DB
.BYT $F9,$DD
.BYT $EA,$DE
UNKAT
.BYT $5E,$E0 ;E0-E2 SPECIAL CONVERSION CODES
.BYT $5B,$E1
.BYT $5D,$E2
.BYT $40,$B0
.BYT $61,$B1 ;UNCONVERSION
.BYT $78,$DB
.BYT $79,$DD
.BYT $66,$B6
.BYT $77,$C0
.BYT $70,$F0
.BYT $71,$F1
.BYT $72,$F2
.BYT $73,$F3
.BYT $74,$F4
.BYT $75,$F5
.BYT $76,$F6
.BYT $7D,$FD
.END

+ 292
- 0
KERNAL_C64_03/declare View File

@@ -0,0 +1,292 @@
.PAG 'DECLARE'
*=$0000 ;DECLARE 6510 PORTS
D6510 *=*+1 ;6510 DATA DIRECTION REGISTER
R6510 *=*+1 ;6510 DATA REGISTER
*=$0002 ;MISS 6510 REGS
;VIRTUAL REGS FOR MACHINE LANGUAGE MONITOR
PCH *=*+1
PCL *=*+1
FLGS *=*+1
ACC *=*+1
XR *=*+1
YR *=*+1
SP *=*+1
INVH *=*+1 ;USER MODIFIABLE IRQ
INVL *=*+1
.SKI 3
* =$90
STATUS *=*+1 ;I/O OPERATION STATUS BYTE
; CRFAC *=*+2 ;CORRECTION FACTOR (UNUSED)
STKEY *=*+1 ;STOP KEY FLAG
SVXT *=*+1 ;TEMPORARY
VERCK *=*+1 ;LOAD OR VERIFY FLAG
C3P0 *=*+1 ;IEEE BUFFERED CHAR FLAG
BSOUR *=*+1 ;CHAR BUFFER FOR IEEE
SYNO *=*+1 ;CASSETTE SYNC #
XSAV *=*+1 ;TEMP FOR BASIN
LDTND *=*+1 ;INDEX TO LOGICAL FILE
DFLTN *=*+1 ;DEFAULT INPUT DEVICE #
DFLTO *=*+1 ;DEFAULT OUTPUT DEVICE #
PRTY *=*+1 ;CASSETTE PARITY
DPSW *=*+1 ;CASSETTE DIPOLE SWITCH
MSGFLG *=*+1 ;OS MESSAGE FLAG
PTR1 ;CASSETTE ERROR PASS1
T1 *=*+1 ;TEMPORARY 1
TMPC
PTR2 ;CASSETTE ERROR PASS2
T2 *=*+1 ;TEMPORARY 2
TIME *=*+3 ;24 HOUR CLOCK IN 1/60TH SECONDS
R2D2 ;SERIAL BUS USAGE
PCNTR *=*+1 ;CASSETTE STUFF
; PTCH *=*+1 (UNUSED)
BSOUR1 ;TEMP USED BY SERIAL ROUTINE
FIRT *=*+1
COUNT ;TEMP USED BY SERIAL ROUTINE
CNTDN *=*+1 ;CASSETTE SYNC COUNTDOWN
BUFPT *=*+1 ;CASSETTE BUFFER POINTER
INBIT ;RS-232 RCVR INPUT BIT STORAGE
SHCNL *=*+1 ;CASSETTE SHORT COUNT
BITCI ;RS-232 RCVR BIT COUNT IN
RER *=*+1 ;CASSETTE READ ERROR
RINONE ;RS-232 RCVR FLAG FOR START BIT CHECK
REZ *=*+1 ;CASSETE READING ZEROES
RIDATA ;RS-232 RCVR BYTE BUFFER
RDFLG *=*+1 ;CASSETTE READ MODE
RIPRTY ;RS-232 RCVR PARITY STORAGE
SHCNH *=*+1 ;CASSETTE SHORT CNT
SAL *=*+1
SAH *=*+1
EAL *=*+1
EAH *=*+1
CMP0 *=*+1
TEMP *=*+1
TAPE1 *=*+2 ;ADDRESS OF TAPE BUFFER #1Y.
BITTS ;RS-232 TRNS BIT COUNT
SNSW1 *=*+1
NXTBIT ;RS-232 TRNS NEXT BIT TO BE SENT
DIFF *=*+1
RODATA ;RS-232 TRNS BYTE BUFFER
PRP *=*+1
FNLEN *=*+1 ;LENGTH CURRENT FILE N STR
LA *=*+1 ;CURRENT FILE LOGICAL ADDR
SA *=*+1 ;CURRENT FILE 2ND ADDR
FA *=*+1 ;CURRENT FILE PRIMARY ADDR
FNADR *=*+2 ;ADDR CURRENT FILE NAME STR
ROPRTY ;RS-232 TRNS PARITY BUFFER
OCHAR *=*+1
FSBLK *=*+1 ;CASSETTE READ BLOCK COUNT
MYCH *=*+1
CAS1 *=*+1 ;CASSETTE MANUAL/CONTROLLED SWITCH
TMP0
STAL *=*+1
STAH *=*+1
MEMUSS ;CASSETTE LOAD TEMPS (2 BYTES)
TMP2 *=*+2
;
;VARIABLES FOR SCREEN EDITOR
;
LSTX *=*+1 ;KEY SCAN INDEX
; SFST *=*+1 ;KEYBOARD SHIFT FLAG (UNUSED)
NDX *=*+1 ;INDEX TO KEYBOARD Q
RVS *=*+1 ;RVS FIELD ON FLAG
INDX *=*+1
LSXP *=*+1 ;X POS AT START
LSTP *=*+1
SFDX *=*+1 ;SHIFT MODE ON PRINT
BLNSW *=*+1 ;CURSOR BLINK ENAB
BLNCT *=*+1 ;COUNT TO TOGGLE CUR
GDBLN *=*+1 ;CHAR BEFORE CURSOR
BLNON *=*+1 ;ON/OFF BLINK FLAG
CRSW *=*+1 ;INPUT VS GET FLAG
PNT *=*+2 ;POINTER TO ROW
; POINT *=*+1 (UNUSED)
PNTR *=*+1 ;POINTER TO COLUMN
QTSW *=*+1 ;QUOTE SWITCH
LNMX *=*+1 ;40/80 MAX POSITON
TBLX *=*+1
DATA *=*+1
INSRT *=*+1 ;INSERT MODE FLAG
LDTB1 *=*+26 ;LINE FLAGS+ENDSPACE
USER *=*+2 ;SCREEN EDITOR COLOR IP
KEYTAB *=*+2 ;KEYSCAN TABLE INDIRECT
;RS-232 Z-PAGE
RIBUF *=*+2 ;RS-232 INPUT BUFFER POINTER
ROBUF *=*+2 ;RS-232 OUTPUT BUFFER POINTER
FREKZP *=*+4 ;FREE KERNAL ZERO PAGE 9/24/80
BASZPT *=*+1 ;LOCATION ($00FF) USED BY BASIC
.SKI 3
*=$100
BAD *=*+1
*=$200
BUF *=*+89 ;BASIC/MONITOR BUFFER
.SKI
; TABLES FOR OPEN FILES
;
LAT *=*+10 ;LOGICAL FILE NUMBERS
FAT *=*+10 ;PRIMARY DEVICE NUMBERS
SAT *=*+10 ;SECONDARY ADDRESSES
.SKI 2
; SYSTEM STORAGE
;
KEYD *=*+10 ;IRQ KEYBOARD BUFFER
MEMSTR *=*+2 ;START OF MEMORY
MEMSIZ *=*+2 ;TOP OF MEMORY
TIMOUT *=*+1 ;IEEE TIMEOUT FLAG
.SKI 2
; SCREEN EDITOR STORAGE
;
COLOR *=*+1 ;ACTIV COLOR NYBBLE
GDCOL *=*+1 ;ORIGINAL COLOR BEFORE CURSOR
HIBASE *=*+1 ;BASE LOCATION OF SCREEN (TOP)
XMAX *=*+1
RPTFLG *=*+1 ;KEY REPEAT FLAG
KOUNT *=*+1
DELAY *=*+1
SHFLAG *=*+1 ;SHIFT FLAG BYTE
LSTSHF *=*+1 ;LAST SHIFT PATTERN
KEYLOG *=*+2 ;INDIRECT FOR KEYBOARD TABLE SETUP
MODE *=*+1 ;0-PET MODE, 1-CATTACANNA
AUTODN *=*+1 ;AUTO SCROLL DOWN FLAG(=0 ON,<>0 OFF)
.SKI 3
; RS-232 STORAGE
;
M51CTR *=*+1 ;6551 CONTROL REGISTER
M51CDR *=*+1 ;6551 COMMAND REGISTER
M51AJB *=*+2 ;NON STANDARD (BITTIME/2-100)
RSSTAT *=*+1 ; RS-232 STATUS REGISTER
BITNUM *=*+1 ;NUMBER OF BITS TO SEND (FAST RESPONSE)
BAUDOF *=*+2 ;BAUD RATE FULL BIT TIME (CREATED BY OPEN)
;
; RECIEVER STORAGE
;
; INBIT *=*+1 ;INPUT BIT STORAGE
; BITCI *=*+1 ;BIT COUNT IN
; RINONE *=*+1 ;FLAG FOR START BIT CHECK
; RIDATA *=*+1 ;BYTE IN BUFFER
; RIPRTY *=*+1 ;BYTE IN PARITY STORAGE
RIDBE *=*+1 ;INPUT BUFFER INDEX TO END
RIDBS *=*+1 ;INPUT BUFFER POINTER TO START
;
; TRANSMITTER STORAGE
;
; BITTS *=*+1 ;# OF BITS TO BE SENT
; NXTBIT *=*+1 ;NEXT BIT TO BE SENT
; ROPRTY *=*+1 ;PARITY OF BYTE SENT
; RODATA *=*+1 ;BYTE BUFFER OUT
RODBS *=*+1 ;OUTPUT BUFFER INDEX TO START
RODBE *=*+1 ;OUTPUT BUFFER INDEX TO END
;
IRQTMP *=*+2 ;HOLDS IRQ DURING TAPE OPS
;
; TEMP SPACE FOR VIC-40 VARIABLES ****
;
ENABL *=*+1 ;RS-232 ENABLES (REPLACES IER)
CASTON *=*+1 ;TOD SENSE DURING CASSETTES
KIKA26 *=*+1 ;TEMP STORAGE FOR CASSETTE READ ROUTINE
STUPID *=*+1 ;TEMP D1IRQ INDICATOR FOR CASSETTE READ
LINTMP *=*+1 ;TEMPORARY FOR LINE INDEX
PALNTS *=*+1 ;PAL VS NTSC FLAG 0=NTSC 1=PAL
.SKI 3
*=$0300 ;REM PROGRAM INDIRECTS(10)
*=$0300+20 ;REM KERNAL/OS INDIRECTS(20)
CINV *=*+2 ;IRQ RAM VECTOR
CBINV *=*+2 ;BRK INSTR RAM VECTOR
NMINV *=*+2 ;NMI RAM VECTOR
IOPEN *=*+2 ;INDIRECTS FOR CODE
ICLOSE *=*+2 ; CONFORMS TO KERNAL SPEC 8/19/80
ICHKIN *=*+2
ICKOUT *=*+2
ICLRCH *=*+2
IBASIN *=*+2
IBSOUT *=*+2
ISTOP *=*+2
IGETIN *=*+2
ICLALL *=*+2
USRCMD *=*+2
ILOAD *=*+2
ISAVE *=*+2 ;SAVESP
.SKI 3
*=$0300+60
TBUFFR *=*+192 ;CASSETTE DATA BUFFER
.SKI 3
* =$400
VICSCN *=*+1024
RAMLOC
.SKI 3
.PAG 'DECLARE'
; I/O DEVICES
;
* =$D000
VICREG =* ;VIC REGISTERS
.SKI 2
* =$D400
SIDREG =* ;SID REGISTERS
.SKI 2
* =$D800
VICCOL *=*+1024 ;VIC COLOR NYBBLES
.SKI 2
* =$DC00 ;DEVICE1 6526 (PAGE1 IRQ)
COLM ;KEYBOARD MATRIX
D1PRA *=*+1
ROWS ;KEYBOARD MATRIX
D1PRB *=*+1
D1DDRA *=*+1
D1DDRB *=*+1
D1T1L *=*+1
D1T1H *=*+1
D1T2L *=*+1
D1T2H *=*+1
D1TOD1 *=*+1
D1TODS *=*+1
D1TODM *=*+1
D1TODH *=*+1
D1SDR *=*+1
D1ICR *=*+1
D1CRA *=*+1
D1CRB *=*+1
.SKI 2
* =$DD00 ;DEVICE2 6526 (PAGE2 NMI)
D2PRA *=*+1
D2PRB *=*+1
D2DDRA *=*+1
D2DDRB *=*+1
D2T1L *=*+1
D2T1H *=*+1
D2T2L *=*+1
D2T2H *=*+1
D2TOD1 *=*+1
D2TODS *=*+1
D2TODM *=*+1
D2TODH *=*+1
D2SDR *=*+1
D2ICR *=*+1
D2CRA *=*+1
D2CRB *=*+1
.SKI 2
TIMRB =$19 ;6526 CRB ENABLE ONE-SHOT TB
.PAG 'DECLARE'
;TAPE BLOCK TYPES
;
EOT =5 ;END OF TAPE
BLF =1 ;BASIC LOAD FILE
BDF =2 ;BASIC DATA FILE
PLF =3 ;FIXED PROGRAM TYPE
BDFH =4 ;BASIC DATA FILE HEADER
BUFSZ =192 ;BUFFER SIZE
;
;SCREEN EDITOR CONSTANTS
;
LLEN =40 ;SINGLE LINE 40 COLUMNS
LLEN2 =80 ;DOUBLE LINE = 80 COLUMNS
NLINES =25 ;25 ROWS ON SCREEN
WHITE =$01 ;WHITE SCREEN COLOR
BLUE =$06 ;BLUE CHAR COLOR
CR =$D ;CARRIAGE RETURN
.END
;RSR 8/3/80 ADD & CHANGE Z-PAGE
;RSR 8/11/80 ADD MEMUSS & PLF TYPE
;RSR 8/22/80 ADD RS-232 ROUTINES
;RSR 8/24/80 ADD OPEN VARIABLES
;RSR 8/29/80 ADD BAUD SPACE MOVE RS232 TO Z-PAGE
;RSR 9/2/80 ADD SCREEN EDITOR VARS&CON 
;RSR 12/7/81 MODIFY FOR VIC-40

+ 41
- 0
KERNAL_C64_03/disclaimer View File

@@ -0,0 +1,41 @@
;****************************************
;* *
;* KK K EEEEE RRRR NN N AAA LL *
;* KK KK EE RR R NNN N AA A LL *
;* KKK EE RR R NNN N AA A LL *
;* KKK EEEE RRRR NNNNN AAAAA LL *
;* KK K EE RR R NN NN AA A LL *
;* KK KK EE RR R NN NN AA A LL *
;* KK KK EEEEE RR R NN NN AA A LLLLL *
;* *
;***************************************
;
;***************************************
;* PET KERNAL *
;* MEMORY AND I/O DEPENDENT ROUTINES *
;* DRIVING THE HARDWARE OF THE *
;* FOLLOWING CBM MODELS: *
;* COMMODORE 64 OR MODIFED VIC-40 *
;* COPYRIGHT (C) 1982 BY *
;* COMMODORE BUSINESS MACHINES (CBM) *
;***************************************
.SKI 3
;****LISTING DATE --1200 14 MAY 1982****
.SKI 3
;***************************************
;* THIS SOFTWARE IS FURNISHED FOR USE *
;* USE IN THE VIC OR COMMODORE COMPUTER*
;* SERIES ONLY. *
;* *
;* COPIES THEREOF MAY NOT BE PROVIDED *
;* OR MADE AVAILABLE FOR USE ON ANY *
;* OTHER SYSTEM. *
;* *
;* THE INFORMATION IN THIS DOCUMENT IS *
;* SUBJECT TO CHANGE WITHOUT NOTICE. *
;* *
;* NO RESPONSIBILITY IS ASSUMED FOR *
;* RELIABILITY OF THIS SOFTWARE. RSR *
;* *
;***************************************
.END

+ 614
- 0
KERNAL_C64_03/editor.1 View File

@@ -0,0 +1,614 @@
.PAG 'SCREEN EDITOR'
MAXCHR=80
NWRAP=2 ;MAX NUMBER OF PHYSICAL LINES PER LOGICAL LINE
;
;UNDEFINED FUNCTION ENTRY
;
; UNDEFD LDX #0
; UNDEF2 LDA UNMSG,X
; JSR PRT
; INX
; CPX #UNMSG2-UNMSG
; BNE UNDEF2
; SEC
; RTS
;
; UNMSG .BYT $D,'?ADVANCED FUNCTION NOT AVAILABLE',$D
; UNMSG2
;
;RETURN ADDRESS OF 6526
;
IOBASE LDX #<D1PRA
LDY #>D1PRA
RTS
;
;RETURN MAX ROWS,COLS OF SCREEN
;
SCRORG LDX #LLEN
LDY #NLINES
RTS
;
;READ/PLOT CURSOR POSITION
;
PLOT BCS PLOT10
STX TBLX
STY PNTR
JSR STUPT
PLOT10 LDX TBLX
LDY PNTR
RTS
.SKI 5
;INITIALIZE I/O
;
CINT
;
; ESTABLISH SCREEN MEMORY
;
JSR PANIC ;SET UP VIC
;
LDA #0 ;MAKE SURE WE'RE IN PET MODE
STA MODE
STA BLNON ;WE DONT HAVE A GOOD CHAR FROM THE SCREEN YET
.SKI
LDA #<SHFLOG ;SET SHIFT LOGIC INDIRECTS
STA KEYLOG
LDA #>SHFLOG
STA KEYLOG+1
LDA #10
STA XMAX ;MAXIMUM TYPE AHEAD BUFFER SIZE
STA DELAY
LDA #$E ;INIT COLOR TO LIGHT BLUE<<<<<<<<<<
STA COLOR
LDA #4
STA KOUNT ;DELAY BETWEEN KEY REPEATS
LDA #$C
STA BLNCT
STA BLNSW
CLSR LDA HIBASE ;FILL HI BYTE PTR TABLE
ORA #$80
TAY
LDA #0
TAX
LPS1 STY LDTB1,X
CLC
ADC #LLEN
BCC LPS2
INY ;CARRY BUMP HI BYTE
LPS2 INX
CPX #NLINES+1 ;DONE # OF LINES?
BNE LPS1 ;NO...
LDA #$FF ;TAG END OF LINE TABLE
STA LDTB1,X
LDX #NLINES-1 ;CLEAR FROM THE BOTTOM LINE UP
CLEAR1 JSR CLRLN ;SEE SCROLL ROUTINES
DEX
BPL CLEAR1
.SKI 5
;HOME FUNCTION
;
NXTD LDY #0
STY PNTR ;LEFT COLUMN
STY TBLX ;TOP LINE
;
;MOVE CURSOR TO TBLX,PNTR
;
STUPT
LDX TBLX ;GET CURENT LINE INDEX
LDA PNTR ;GET CHARACTER POINTER
FNDSTR LDY LDTB1,X ;FIND BEGINING OF LINE
BMI STOK ;BRANCH IF START FOUND
CLC
ADC #LLEN ;ADJUST POINTER
STA PNTR
DEX
BPL FNDSTR
;
STOK JSR SETPNT ;SET UP PNT INDIRECT 901227-03**********
;
LDA #LLEN-1
INX
FNDEND LDY LDTB1,X
BMI STDONE
CLC
ADC #LLEN
INX
BPL FNDEND
STDONE
STA LNMX
JMP SCOLOR ;MAKE COLOR POINTER FOLLOW 901227-03**********
.SKI 5
; THIS IS A PATCH FOR INPUT LOGIC 901227-03**********
; FIXES INPUT"XXXXXXX-40-XXXXX";A$ PROBLEM
;
FINPUT CPX LSXP ;CHECK IF ON SAME LINE
BEQ FINPUX ;YES..RETURN TO SEND
JMP FINDST ;CHECK IF WE WRAPPED DOWN...
FINPUX RTS
NOP ;KEEP THE SPACE THE SAME...
.SKI 5
;PANIC NMI ENTRY
;
VPAN JSR PANIC ;FIX VIC SCREEN
JMP NXTD ;HOME CURSOR
.SKI 5
PANIC LDA #3 ;RESET DEFAULT I/O
STA DFLTO
LDA #0
STA DFLTN
.SKI 5
;INIT VIC
;
INITV LDX #47 ;LOAD ALL VIC REGS ***
PX4 LDA TVIC-1,X
STA VICREG-1,X
DEX
BNE PX4
RTS
.SKI 5
;
;REMOVE CHARACTER FROM QUEUE
;
LP2 LDY KEYD
LDX #0
LP1 LDA KEYD+1,X
STA KEYD,X
INX
CPX NDX
BNE LP1
DEC NDX
TYA
CLI
CLC ;GOOD RETURN
RTS
;
LOOP4 JSR PRT
LOOP3
LDA NDX
STA BLNSW
STA AUTODN ;TURN ON AUTO SCROLL DOWN
BEQ LOOP3
SEI
LDA BLNON
BEQ LP21
LDA GDBLN
LDX GDCOL ;RESTORE ORIGINAL COLOR
LDY #0
STY BLNON
JSR DSPP
LP21 JSR LP2
CMP #$83 ;RUN KEY?
BNE LP22
LDX #9
SEI
STX NDX
LP23 LDA RUNTB-1,X
STA KEYD-1,X
DEX
BNE LP23
BEQ LOOP3
LP22 CMP #$D
BNE LOOP4
LDY LNMX
STY CRSW
CLP5 LDA (PNT)Y
CMP #'
BNE CLP6
DEY
BNE CLP5
CLP6 INY
STY INDX
LDY #0
STY AUTODN ;TURN OFF AUTO SCROLL DOWN
STY PNTR
STY QTSW
LDA LSXP
BMI LOP5
LDX TBLX
JSR FINPUT ;CHECK FOR SAME LINE AS START 901227-03**********
CPX LSXP
BNE LOP5
LDA LSTP
STA PNTR
CMP INDX
BCC LOP5
BCS CLP2
.SKI 5
;INPUT A LINE UNTIL CARRIAGE RETURN
;
LOOP5 TYA
PHA
TXA
PHA
LDA CRSW
BEQ LOOP3
LOP5 LDY PNTR
LDA (PNT)Y
NOTONE
STA DATA
LOP51 AND #$3F
ASL DATA
BIT DATA
BPL LOP54
ORA #$80
LOP54 BCC LOP52
LDX QTSW
BNE LOP53
LOP52 BVS LOP53
ORA #$40
LOP53 INC PNTR
JSR QTSWC
CPY INDX
BNE CLP1
CLP2 LDA #0
STA CRSW
LDA #$D
LDX DFLTN ;FIX GETS FROM SCREEN
CPX #3 ;IS IT THE SCREEN?
BEQ CLP2A
LDX DFLTO
CPX #3
BEQ CLP21
CLP2A JSR PRT
CLP21 LDA #$D
CLP1 STA DATA
PLA
TAX
PLA
TAY
LDA DATA
CMP #$DE ;IS IT <PI> ?
BNE CLP7
LDA #$FF
CLP7 CLC
RTS
.SKI 5
QTSWC CMP #$22
BNE QTSWL
LDA QTSW
EOR #$1
STA QTSW
LDA #$22
QTSWL RTS
.SKI 5
NXT33 ORA #$40
NXT3 LDX RVS
BEQ NVS
NC3 ORA #$80
NVS LDX INSRT
BEQ NVS1
DEC INSRT
NVS1 LDX COLOR PUT COLOR ON SCREEN
JSR DSPP
JSR WLOGIC ;CHECK FOR WRAPAROUND
LOOP2 PLA
TAY
LDA INSRT
BEQ LOP2
LSR QTSW
LOP2 PLA
TAX
PLA
CLC ;GOOD RETURN
CLI
RTS
.PAG
WLOGIC
JSR CHKDWN ;MAYBE WE SHOULD WE INCREMENT TBLX
INC PNTR ;BUMP CHARCTER POINTER
LDA LNMX ;
CMP PNTR ;IF LNMX IS LESS THAN PNTR
BCS WLGRTS ;BRANCH IF LNMX>=PNTR
CMP #MAXCHR-1 ;PAST MAX CHARACTERS
BEQ WLOG10 ;BRANCH IF SO
LDA AUTODN ;SHOULD WE AUTO SCROLL DOWN?
BEQ WLOG20 ;BRANCH IF NOT
JMP BMT1 ;ELSE DECIDE WHICH WAY TO SCROLL
.SKIP 3
WLOG20
LDX TBLX ;SEE IF WE SHOULD SCROLL DOWN
CPX #NLINES
BCC WLOG30 ;BRANCH IF NOT
JSR SCROL ;ELSE DO THE SCROL UP
DEC TBLX ;AND ADJUST CURENT LINE#
LDX TBLX
WLOG30 ASL LDTB1,X ;WRAP THE LINE
LSR LDTB1,X
INX ;INDEX TO NEXT LLINE
LDA LDTB1,X ;GET HIGH ORDER BYTE OF ADDRESS
ORA #$80 ;MAKE IT A NON-CONTINUATION LINE
STA LDTB1,X ;AND PUT IT BACK
DEX ;GET BACK TO CURRENT LINE
LDA LNMX ;CONTINUE THE BYTES TAKEN OUT
CLC
ADC #LLEN
STA LNMX
FINDST
LDA LDTB1,X ;IS THIS THE FIRST LINE?
BMI FINX ;BRANCH IF SO
DEX ;ELSE BACKUP 1
BNE FINDST
FINX
JMP SETPNT ;MAKE SURE PNT IS RIGHT
.SKI
WLOG10 DEC TBLX
JSR NXLN
LDA #0
STA PNTR ;POINT TO FIRST BYTE
WLGRTS RTS
.PAG
BKLN LDX TBLX
BNE BKLN1
STX PNTR
PLA
PLA
BNE LOOP2
;
BKLN1 DEX
STX TBLX
JSR STUPT
LDY LNMX
STY PNTR
RTS
.SKI 5
;PRINT ROUTINE
;
PRT PHA
STA DATA
TXA
PHA
TYA
PHA
LDA #0
STA CRSW
LDY PNTR
LDA DATA
BPL *+5
JMP NXTX
CMP #$D
BNE NJT1
JMP NXT1
NJT1 CMP #'
BCC NTCN
CMP #$60 ;LOWER CASE?
BCC NJT8 ;NO...
AND #$DF ;YES...MAKE SCREEN LOWER
BNE NJT9 ;ALWAYS
NJT8 AND #$3F
NJT9 JSR QTSWC
JMP NXT3
NTCN LDX INSRT
BEQ CNC3X
JMP NC3
CNC3X CMP #$14
BNE NTCN1
TYA
BNE BAK1UP
JSR BKLN
JMP BK2
BAK1UP JSR CHKBAK ;SHOULD WE DEC TBLX
DEY
STY PNTR
BK1 JSR SCOLOR ;FIX COLOR PTRS
BK15 INY
LDA (PNT)Y
DEY
STA (PNT)Y
INY
LDA (USER)Y
DEY
STA (USER)Y
INY
CPY LNMX
BNE BK15
BK2 LDA #'
STA (PNT)Y
LDA COLOR
STA (USER)Y
BPL JPL3
NTCN1 LDX QTSW
BEQ NC3W
CNC3 JMP NC3
NC3W CMP #$12
BNE NC1
STA RVS
NC1 CMP #$13
BNE NC2
JSR NXTD
NC2 CMP #$1D
BNE NCX2
INY
JSR CHKDWN
STY PNTR
DEY
CPY LNMX
BCC NCZ2
DEC TBLX
JSR NXLN
LDY #0
JPL4 STY PNTR
NCZ2 JMP LOOP2
NCX2 CMP #$11
BNE COLR1
CLC
TYA
ADC #LLEN
TAY
INC TBLX
CMP LNMX
BCC JPL4
BEQ JPL4
DEC TBLX
CURS10 SBC #LLEN
BCC GOTDWN
STA PNTR
BNE CURS10
GOTDWN JSR NXLN
JPL3 JMP LOOP2
COLR1 JSR CHKCOL ;CHECK FOR A COLOR
JMP LOWER ;WAS JMP LOOP2
.SKI 3
;CHECK COLOR
;
.SKI 5
;SHIFTED KEYS
;
NXTX
KEEPIT
AND #$7F
CMP #$7F
BNE NXTX1
LDA #$5E
NXTX1
NXTXA
CMP #$20 ;IS IT A FUNCTION KEY
BCC UHUH
JMP NXT33
UHUH
CMP #$D
BNE UP5
JMP NXT1
UP5 LDX QTSW
BNE UP6
CMP #$14
BNE UP9
LDY LNMX
LDA (PNT)Y
CMP #'
BNE INS3
CPY PNTR
BNE INS1
INS3 CPY #MAXCHR-1
BEQ INSEXT ;EXIT IF LINE TOO LONG
JSR NEWLIN ;SCROLL DOWN 1
INS1 LDY LNMX
JSR SCOLOR
INS2 DEY
LDA (PNT)Y
INY
STA (PNT)Y
DEY
LDA (USER)Y
INY
STA (USER)Y
DEY
CPY PNTR
BNE INS2
LDA #$20
STA (PNT)Y
LDA COLOR
STA (USER)Y
INC INSRT
INSEXT JMP LOOP2
UP9 LDX INSRT
BEQ UP2
UP6 ORA #$40
JMP NC3
UP2 CMP #$11
BNE NXT2
LDX TBLX
BEQ JPL2
DEC TBLX
LDA PNTR
SEC
SBC #LLEN
BCC UPALIN
STA PNTR
BPL JPL2
UPALIN JSR STUPT
BNE JPL2
NXT2 CMP #$12
BNE NXT6
LDA #0
STA RVS
NXT6 CMP #$1D
BNE NXT61
TYA
BEQ BAKBAK
JSR CHKBAK
DEY
STY PNTR
JMP LOOP2
BAKBAK JSR BKLN
JMP LOOP2
NXT61 CMP #$13
BNE SCCL
JSR CLSR
JPL2 JMP LOOP2
SCCL
ORA #$80 ;MAKE IT UPPER CASE
JSR CHKCOL ;TRY FOR COLOR
JMP UPPER ;WAS JMP LOOP2
;
NXLN LSR LSXP
LDX TBLX
NXLN2 INX
CPX #NLINES ;OFF BOTTOM?
BNE NXLN1 ;NO...
JSR SCROL ;YES...SCROLL
NXLN1 LDA LDTB1,X ;DOUBLE LINE?
BPL NXLN2 ;YES...SCROLL AGAIN
STX TBLX
JMP STUPT
NXT1
LDX #0
STX INSRT
STX RVS
STX QTSW
STX PNTR
JSR NXLN
JPL5 JMP LOOP2
;
;
; CHECK FOR A DECREMENT TBLX
;
CHKBAK LDX #NWRAP
LDA #0
CHKLUP CMP PNTR
BEQ BACK
CLC
ADC #LLEN
DEX
BNE CHKLUP
RTS
;
BACK DEC TBLX
RTS
;
; CHECK FOR INCREMENT TBLX
;
CHKDWN LDX #NWRAP
LDA #LLEN-1
DWNCHK CMP PNTR
BEQ DNLINE
CLC
ADC #LLEN
DEX
BNE DWNCHK
RTS
;
DNLINE LDX TBLX
CPX #NLINES
BEQ DWNBYE
INC TBLX
;
DWNBYE RTS
.SKI2
CHKCOL
LDX #15 ;THERE'S 15 COLORS
CHK1A CMP COLTAB,X
BEQ CHK1B
DEX
BPL CHK1A
RTS
;
CHK1B
STX COLOR ;CHANGE THE COLOR
RTS
.SKI1
COLTAB
;BLK,WHT,RED,CYAN,MAGENTA,GRN,BLUE,YELLOW
.BYT $90,$05,$1C,$9F,$9C,$1E,$1F,$9E
.BYT $81,$95,$96,$97,$98,$99,$9A,$9B
.END
; RSR MODIFY FOR VIC-40 SYSTEM
; RSR 12/31/81 ADD 8 MORE COLORS

+ 406
- 0
KERNAL_C64_03/editor.2 View File

@@ -0,0 +1,406 @@
.PAG 'EDITOR.2'
;SCREEN SCROLL ROUTINE
;
SCROL LDA SAL
PHA
LDA SAH
PHA
LDA EAL
PHA
LDA EAH
PHA
;
; S C R O L L U P
;
SCRO0 LDX #$FF
DEC TBLX
DEC LSXP
DEC LINTMP
SCR10 INX ;GOTO NEXT LINE
JSR SETPNT ;POINT TO 'TO' LINE
CPX #NLINES-1 ;DONE?
BCS SCR41 ;BRANCH IF SO
;
LDA LDTB2+1,X ;SETUP FROM PNTR
STA SAL
LDA LDTB1+1,X
JSR SCRLIN ;SCROLL THIS LINE UP1
BMI SCR10
;
SCR41
JSR CLRLN
;
LDX #0 ;SCROLL HI BYTE POINTERS
SCRL5 LDA LDTB1,X
AND #$7F
LDY LDTB1+1,X
BPL SCRL3
ORA #$80
SCRL3 STA LDTB1,X
INX
CPX #NLINES-1
BNE SCRL5
;
LDA LDTB1+NLINES-1
ORA #$80
STA LDTB1+NLINES-1
LDA LDTB1 ;DOUBLE LINE?
BPL SCRO0 ;YES...SCROLL AGAIN
;
INC TBLX
INC LINTMP
LDA #$7F ;CHECK FOR CONTROL KEY
STA COLM ;DROP LINE 2 ON PORT B
LDA ROWS
CMP #$FB ;SLOW SCROLL KEY?(CONTROL)
PHP ;SAVE STATUS. RESTORE PORT B
LDA #$7F ;FOR STOP KEY CHECK
STA COLM
PLP
BNE MLP42
;
LDY #0
MLP4 NOP ;DELAY
DEX
BNE MLP4
DEY
BNE MLP4
STY NDX ;CLEAR KEY QUEUE BUFFER
;
MLP42 LDX TBLX
;
PULIND PLA ;RESTORE OLD INDIRECTS
STA EAH
PLA
STA EAL
PLA
STA SAH
PLA
STA SAL
RTS
.PAGE
NEWLIN
LDX TBLX
BMT1 INX
; CPX #NLINES ;EXCEDED THE NUMBER OF LINES ???
; BEQ BMT2 ;VIC-40 CODE
LDA LDTB1,X ;FIND LAST DISPLAY LINE OF THIS LINE
BPL BMT1 ;TABLE END MARK=>$FF WILL ABORT...ALSO
BMT2 STX LINTMP ;FOUND IT
;GENERATE A NEW LINE
CPX #NLINES-1 ;IS ONE LINE FROM BOTTOM?
BEQ NEWLX ;YES...JUST CLEAR LAST
BCC NEWLX ;<NLINES...INSERT LINE
JSR SCROL ;SCROLL EVERYTHING
LDX LINTMP
DEX
DEC TBLX
JMP WLOG30
NEWLX LDA SAL
PHA
LDA SAH
PHA
LDA EAL
PHA
LDA EAH
PHA
LDX #NLINES
SCD10 DEX
JSR SETPNT ;SET UP TO ADDR
CPX LINTMP
BCC SCR40
BEQ SCR40 ;BRANCH IF FINISHED
LDA LDTB2-1,X ;SET FROM ADDR
STA SAL
LDA LDTB1-1,X
JSR SCRLIN ;SCROLL THIS LINE DOWN
BMI SCD10
SCR40
JSR CLRLN
LDX #NLINES-2
SCRD21
CPX LINTMP ;DONE?
BCC SCRD22 ;BRANCH IF SO
LDA LDTB1+1,X
AND #$7F
LDY LDTB1,X ;WAS IT CONTINUED
BPL SCRD19 ;BRANCH IF SO
ORA #$80
SCRD19 STA LDTB1+1,X
DEX
BNE SCRD21
SCRD22
LDX LINTMP
JSR WLOG30
;
JMP PULIND ;GO PUL OLD INDIRECTS AND RETURN
;
; SCROLL LINE FROM SAL TO PNT
; AND COLORS FROM EAL TO USER
;
SCRLIN
AND #$03 ;CLEAR ANY GARBAGE STUFF
ORA HIBASE ;PUT IN HIORDER BITS
STA SAL+1
JSR TOFROM ;COLOR TO & FROM ADDRS
LDY #LLEN-1
SCD20
LDA (SAL)Y
STA (PNT)Y
LDA (EAL)Y
STA (USER)Y
DEY
BPL SCD20
RTS
;
; DO COLOR TO AND FROM ADDRESSES
; FROM CHARACTER TO AND FROM ADRS
;
TOFROM
JSR SCOLOR
LDA SAL ;CHARACTER FROM
STA EAL ;MAKE COLOR FROM
LDA SAL+1
AND #$03
ORA #>VICCOL
STA EAL+1
RTS
;
; SET UP PNT AND Y
; FROM .X
;
SETPNT LDA LDTB2,X
STA PNT
LDA LDTB1,X
AND #$03
ORA HIBASE
STA PNT+1
RTS
;
; CLEAR THE LINE POINTED TO BY .X
;
CLRLN LDY #LLEN-1
JSR SETPNT
JSR SCOLOR
CLR10 JSR CPATCH ;REVERSED ORDER FROM 901227-02
LDA #$20 ;STORE A SPACE
STA (PNT)Y ;TO DISPLAY
DEY
BPL CLR10
RTS
NOP
.SKI 5
;
;PUT A CHAR ON THE SCREEN
;
DSPP TAY ;SAVE CHAR
LDA #2
STA BLNCT ;BLINK CURSOR
JSR SCOLOR ;SET COLOR PTR
TYA ;RESTORE COLOR
DSPP2 LDY PNTR ;GET COLUMN
STA (PNT)Y ;CHAR TO SCREEN
TXA
STA (USER)Y ;COLOR TO SCREEN
RTS
.SKI 5
SCOLOR LDA PNT ;GENERATE COLOR PTR
STA USER
LDA PNT+1
AND #$03
ORA #>VICCOL ;VIC COLOR RAM
STA USER+1
RTS
.PAG
KEY JSR $FFEA ;UPDATE JIFFY CLOCK
LDA BLNSW ;BLINKING CRSR ?
BNE KEY4 ;NO
DEC BLNCT ;TIME TO BLINK ?
BNE KEY4 ;NO
LDA #20 ;RESET BLINK COUNTER
REPDO STA BLNCT
LDY PNTR ;CURSOR POSITION
LSR BLNON ;CARRY SET IF ORIGINAL CHAR
LDX GDCOL ;GET CHAR ORIGINAL COLOR
LDA (PNT)Y ;GET CHARACTER
BCS KEY5 ;BRANCH IF NOT NEEDED
;
INC BLNON ;SET TO 1
STA GDBLN ;SAVE ORIGINAL CHAR
JSR SCOLOR
LDA (USER)Y ;GET ORIGINAL COLOR
STA GDCOL ;SAVE IT
LDX COLOR ;BLINK IN THIS COLOR
LDA GDBLN ;WITH ORIGINAL CHARACTER
;
KEY5 EOR #$80 ;BLINK IT
JSR DSPP2 ;DISPLAY IT
;
KEY4 LDA R6510 ;GET CASSETTE SWITCHES
AND #$10 ;IS SWITCH DOWN ?
BEQ KEY3 ;BRANCH IF SO
;
LDY #0
STY CAS1 ;CASSETTE OFF SWITCH
;
LDA R6510
ORA #$20
BNE KL24 ;BRANCH IF MOTOR IS OFF
;
KEY3 LDA CAS1
BNE KL2
;
LDA R6510
AND #%011111 ;TURN MOTOR ON
;
KL24
STA R6510
;
KL2 JSR SCNKEY ;SCAN KEYBOARD
;
KPREND LDA D1ICR ;CLEAR INTERUPT FLAGS
PLA ;RESTORE REGISTERS
TAY
PLA
TAX
PLA
RTI ;EXIT FROM IRQ ROUTINES
.SKI 3
; ****** GENERAL KEYBOARD SCAN ******
;
SCNKEY LDA #$00
STA SHFLAG
LDY #64 ;LAST KEY INDEX
STY SFDX ;NULL KEY FOUND
STA COLM ;RAISE ALL LINES
LDX ROWS ;CHECK FOR A KEY DOWN
CPX #$FF ;NO KEYS DOWN?
BEQ SCNOUT ;BRANCH IF NONE
TAY ;.A=0 LDY #0
LDA #<MODE1
STA KEYTAB
LDA #>MODE1
STA KEYTAB+1
LDA #$FE ;START WITH 1ST COLUMN
STA COLM
SCN20 LDX #8 ;8 ROW KEYBOARD
PHA ;SAVE COLUMN OUTPUT INFO
SCN22 LDA ROWS
CMP ROWS ;DEBOUNCE KEYBOARD
BNE SCN22
SCN30 LSR A ;LOOK FOR KEY DOWN
BCS CKIT ;NONE
PHA
LDA (KEYTAB),Y ;GET CHAR CODE
CMP #$05
BCS SPCK2 ;IF NOT SPECIAL KEY GO ON
CMP #$03 ;COULD IT BE A STOP KEY?
BEQ SPCK2 ;BRANCH IF SO
ORA SHFLAG
STA SHFLAG ;PUT SHIFT BIT IN FLAG BYTE
BPL CKUT
SPCK2
STY SFDX ;SAVE KEY NUMBER
CKUT PLA
CKIT INY
CPY #65
BCS CKIT1 ;BRANCH IF FINISHED
DEX
BNE SCN30
SEC
PLA ;RELOAD COLUMN INFO
ROL A
STA COLM ;NEXT COLUMN ON KEYBOARD
BNE SCN20 ;ALWAYS BRANCH
CKIT1 PLA ;DUMP COLUMN OUTPUT...ALL DONE
JMP (KEYLOG) ;EVALUATE SHIFT FUNCTIONS
REKEY LDY SFDX ;GET KEY INDEX
LDA (KEYTAB)Y ;GET CHAR CODE
TAX ;SAVE THE CHAR
CPY LSTX ;SAME AS PREV CHAR INDEX?
BEQ RPT10 ;YES
LDY #$10 ;NO - RESET DELAY BEFORE REPEAT
STY DELAY
BNE CKIT2 ;ALWAYS
RPT10 AND #$7F ;UNSHIFT IT
BIT RPTFLG ;CHECK FOR REPEAT DISABLE
BMI RPT20 ;YES
BVS SCNRTS
CMP #$7F ;NO KEYS ?
SCNOUT BEQ CKIT2 ;YES - GET OUT
CMP #$14 ;AN INST/DEL KEY ?
BEQ RPT20 ;YES - REPEAT IT
CMP #$20 ;A SPACE KEY ?
BEQ RPT20 ;YES
CMP #$1D ;A CRSR LEFT/RIGHT ?
BEQ RPT20 ;YES
CMP #$11 ;A CRSR UP/DWN ?
BNE SCNRTS ;NO - EXIT
RPT20 LDY DELAY ;TIME TO REPEAT ?
BEQ RPT40 ;YES
DEC DELAY
BNE SCNRTS
RPT40 DEC KOUNT ;TIME FOR NEXT REPEAT ?
BNE SCNRTS ;NO
LDY #4 ;YES - RESET CTR
STY KOUNT
LDY NDX ;NO REPEAT IF QUEUE FULL
DEY
BPL SCNRTS
CKIT2
LDY SFDX ;GET INDEX OF KEY
STY LSTX ;SAVE THIS INDEX TO KEY FOUND
LDY SHFLAG ;UPDATE SHIFT STATUS
STY LSTSHF
CKIT3 CPX #$FF ;A NULL KEY OR NO KEY ?
BEQ SCNRTS ;BRANCH IF SO
TXA ;NEED X AS INDEX SO...
LDX NDX ;GET # OF CHARS IN KEY QUEUE
CPX XMAX ;IRQ BUFFER FULL ?
BCS SCNRTS ;YES - NO MORE INSERT
PUTQUE
STA KEYD,X ;PUT RAW DATA HERE
INX
STX NDX ;UPDATE KEY QUEUE COUNT
SCNRTS LDA #$7F ;SETUP PB7 FOR STOP KEY SENSE
STA COLM
RTS
.PAG
;
; SHIFT LOGIC
;
SHFLOG
LDA SHFLAG
CMP #$03 ;COMMODORE SHIFT COMBINATION?
BNE KEYLG2 ;BRANCH IF NOT
CMP LSTSHF ;DID I DO THIS ALREADY
BEQ SCNRTS ;BRANCH IF SO
LDA MODE
BMI SHFOUT ;DONT SHIFT IF ITS MINUS
.SKI
SWITCH LDA VICREG+24 ;**********************************:
EOR #$02 ;TURN ON OTHER CASE
STA VICREG+24 ;POINT THE VIC THERE
JMP SHFOUT
.SKI
;
KEYLG2
ASL A
CMP #$08 ;WAS IT A CONTROL KEY
BCC NCTRL ;BRANCH IF NOT
LDA #6 ;ELSE USE TABLE #4
;
NCTRL
NOTKAT
TAX
LDA KEYCOD,X
STA KEYTAB
LDA KEYCOD+1,X
STA KEYTAB+1
SHFOUT
JMP REKEY
.END
; RSR 12/08/81 MODIFY FOR VIC-40
; RSR 2/18/82 MODIFY FOR 6526 INPUT PAD SENSE
; RSR 3/11/82 FIX KEYBOARD DEBOUNCE, REPAIR FILE
; RSR 3/11/82 MODIFY FOR COMMODORE 64

+ 201
- 0
KERNAL_C64_03/editor.3 View File

@@ -0,0 +1,201 @@
.PAG 'KEYBOARD TABLES'
KEYCOD ;KEYBOARD MODE 'DISPATCH'
.WORD MODE1
.WORD MODE2
.WORD MODE3
.WORD CONTRL ;CONTROL KEYS
;
; COTTACONNA MODE
;
;.WORD MODE1 ;PET MODE1
;.WORD MODE2 ;PET MODE2
;.WORD CCTTA3 ;DUMMY WORD
;.WORD CONTRL
;
; EXTENDED KATAKANA MODE
;
;.WORD CCTTA2 ;KATAKANA CHARACTERS
;.WORD CCTTA3 ;LIMITED GRAPHICS
;.WORD CCTTA3 ;DUMMY
;.WORD CONTRL
.SKI 5
.PAG 'EDITOR.3'
MODE1
;DEL,3,5,7,9,+,YEN SIGN,1
.BYT $14,$0D,$1D,$88,$85,$86,$87,$11
;RETURN,W,R,Y,I,P,*,LEFT ARROW
.BYT $33,$57,$41,$34,$5A,$53,$45,$01
;RT CRSR,A,D,G,J,L,;,CTRL
.BYT $35,$52,$44,$36,$43,$46,$54,$58
;F4,4,6,8,0,-,HOME,2
.BYT $37,$59,$47,$38,$42,$48,$55,$56
;F1,Z,C,B,M,.,R.SHIFTT,SPACE
.BYT $39,$49,$4A,$30,$4D,$4B,$4F,$4E
;F2,S,F,H,K,:,=,COM.KEY
.BYT $2B,$50,$4C,$2D,$2E,$3A,$40,$2C
;F3,E,T,U,O,@,EXP,Q
.BYT $5C,$2A,$3B,$13,$01,$3D,$5E,$2F
;CRSR DWN,L.SHIFT,X,V,N,,,/,STOP
.BYT $31,$5F,$04,$32,$20,$02,$51,$03
.BYT $FF ;END OF TABLE NULL
.SKI3
MODE2 ;SHIFT
;INS,%,',),+,YEN,!
.BYT $94,$8D,$9D,$8C,$89,$8A,$8B,$91
;SRETURN,W,R,Y,I,P,*,SLEFT ARROW
.BYT $23,$D7,$C1,$24,$DA,$D3,$C5,$01
;LF.CRSR,A,D,G,J,L,;,CTRL
.BYT $25,$D2,$C4,$26,$C3,$C6,$D4,$D8
;,$,&,(, ,"
.BYT $27,$D9,$C7,$28,$C2,$C8,$D5,$D6
;F5,Z,C,B,M,.,R.SHIFT,SSPACE
.BYT $29,$C9,$CA,$30,$CD,$CB,$CF,$CE
;F6,S,F,H,K,:,=,SCOM.KEY
.BYT $DB,$D0,$CC,$DD,$3E,$5B,$BA,$3C
;F7,E,T,U,O,@,PI,G
.BYT $A9,$C0,$5D,$93,$01,$3D,$DE,$3F
;CRSR DWN,L.SHIFT,X,V,N,,,/,RUN
.BYT $21,$5F,$04,$22,$A0,$02,$D1,$83
.BYT $FF ;END OF TABLE NULL
;
MODE3 ;LEFT WINDOW GRAHPICS
;INS,C10,C12,C14,9,+,POUND SIGN,C8
.BYT $94,$8D,$9D,$8C,$89,$8A,$8B,$91
;RETURN,W,R,Y,I,P,*,LFT.ARROW
.BYT $96,$B3,$B0,$97,$AD,$AE,$B1,$01
;LF.CRSR,A,D,G,J,L,;,CTRL
.BYT $98,$B2,$AC,$99,$BC,$BB,$A3,$BD
;F8,C11,C13,C15,0,-,HOME,C9
.BYT $9A,$B7,$A5,$9B,$BF,$B4,$B8,$BE
;F2,Z,C,B,M,.,R.SHIFT,SPACE
.BYT $29,$A2,$B5,$30,$A7,$A1,$B9,$AA
;F4,S,F,H,K,:,=,COM.KEY
.BYT $A6,$AF,$B6,$DC,$3E,$5B,$A4,$3C
;F6,E,T,U,O,@,PI,Q
.BYT $A8,$DF,$5D,$93,$01,$3D,$DE,$3F
;CRSR.UP,L.SHIFT,X,V,N,,,/,STOP
.BYT $81,$5F,$04,$95,$A0,$02,$AB,$83
.BYT $FF ;END OF TABLE NULL
;CCTTA2 ;WAS CCTTA2 IN JAPANESE VERSION
LOWER
CMP #$0E ;DOES HE WANT LOWER CASE?
BNE UPPER ;BRANCH IF NOT
LDA VICREG+24 ;ELSE SET VIC TO POINT TO LOWER CASE
ORA #$02
BNE ULSET ;JMP
.SKI
UPPER
CMP #$8E ;DOES HE WANT UPPER CASE
BNE LOCK ;BRANCH IF NOT
LDA VICREG+24 ;MAKE SURE VIC POINT TO UPPER/PET SET
AND #$FF-$02
ULSET STA VICREG+24
OUTHRE JMP LOOP2
.SKI
LOCK
CMP #8 ;DOES HE WANT TO LOCK IN THIS MODE?
BNE UNLOCK ;BRANCH IF NOT
LDA #$80 ;ELSE SET LOCK SWITCH ON
ORA MODE ;DON'T HURT ANYTHING - JUST IN CASE
BMI LEXIT
.SKI
UNLOCK
CMP #9 ;DOES HE WANT TO UNLOCK THE KEYBOARD?
BNE OUTHRE ;BRANCH IF NOT
LDA #$7F ;CLEAR THE LOCK SWITCH
AND MODE ;DONT HURT ANYTHING
LEXIT STA MODE
JMP LOOP2 ;GET OUT
;CCTTA3
;.BYT $04,$FF,$FF,$FF,$FF,$FF,$E2,$9D
;RUN-K24-K31
;.BYT $83,$01,$FF,$FF,$FF,$FF,$FF,$91
;K32-K39.F5
;.BYT $A0,$FF,$FF,$FF,$FF,$EE,$01,$89
;CO.KEY,K40-K47.F6
;.BYT $02,$FF,$FF,$FF,$FF,$E1,$FD,$8A
;K48-K55
;.BYT $FF,$FF,$FF,$FF,$FF,$B0,$E0,$8B
;K56-K63
;.BYT $F2,$F4,$F6,$FF,$F0,$ED,$93,$8C
;.BYT $FF ;END OF TABLE NULL
.SKI3
CONTRL
;NULL,RED,PURPLE,BLUE,RVS ,NULL,NULL,BLACK
.BYT $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
;NULL, W ,REVERSE, Y , I , P ,NULL,MUSIC
.BYT $1C,$17,$01,$9F,$1A,$13,$05,$FF
.BYT $9C,$12,$04,$1E,$03,$06,$14,$18
;NULL,CYAN,GREEN,YELLOW,RVS OFF,NULL,NULL,WHITE
.BYT $1F,$19,$07,$9E,$02,$08,$15,$16
.BYT $12,$09,$0A,$92,$0D,$0B,$0F,$0E
.BYT $FF,$10,$0C,$FF,$FF,$1B,$00,$FF
.BYT $1C,$FF,$1D,$FF,$FF,$1F,$1E,$FF
.BYT $90,$06,$FF,$05,$FF,$FF,$11,$FF
.BYT $FF ;END OF TABLE NULL
TVIC
.BYT 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;SPRITES (0-16)
.BYT $9B,55,0,0,0,$08,0,$14,$0f,0,0,0,0,0,0 ;DATA (17-31)
.BYT 14,6,1,2,3,4,0,1,2,3,4,5,6,7 ;32-46
;
RUNTB .BYT 'LOAD',$D,'RUN',$D
;
LINZ0 = VICSCN
LINZ1 = LINZ0+LLEN
LINZ2 = LINZ1+LLEN
LINZ3 = LINZ2+LLEN
LINZ4 = LINZ3+LLEN
LINZ5 = LINZ4+LLEN
LINZ6 = LINZ5+LLEN
LINZ7 = LINZ6+LLEN
LINZ8 = LINZ7+LLEN
LINZ9 = LINZ8+LLEN
LINZ10 = LINZ9+LLEN
LINZ11 = LINZ10+LLEN
LINZ12 = LINZ11+LLEN
LINZ13 = LINZ12+LLEN
LINZ14 = LINZ13+LLEN
LINZ15 = LINZ14+LLEN
LINZ16 = LINZ15+LLEN
LINZ17 = LINZ16+LLEN
LINZ18 = LINZ17+LLEN
LINZ19 = LINZ18+LLEN
LINZ20 = LINZ19+LLEN
LINZ21 = LINZ20+LLEN
LINZ22 = LINZ21+LLEN
LINZ23 = LINZ22+LLEN
LINZ24 = LINZ23+LLEN
.SKIP 3
;****** SCREEN LINES LO BYTE TABLE ******
;
LDTB2
.BYTE <LINZ0
.BYTE <LINZ1
.BYTE <LINZ2
.BYTE <LINZ3
.BYTE <LINZ4
.BYTE <LINZ5
.BYTE <LINZ6
.BYTE <LINZ7
.BYTE <LINZ8
.BYTE <LINZ9
.BYTE <LINZ10
.BYTE <LINZ11
.BYTE <LINZ12
.BYTE <LINZ13
.BYTE <LINZ14
.BYTE <LINZ15
.BYTE <LINZ16
.BYTE <LINZ17
.BYTE <LINZ18
.BYTE <LINZ19
.BYTE <LINZ20
.BYTE <LINZ21
.BYTE <LINZ22
.BYTE <LINZ23
.BYTE <LINZ24
.END
; RSR 12/08/81 MODIFY FOR VIC-40 KEYSCAN
; RSR 2/17/81 MODIFY FOR THE STINKING 6526R2 CHIP
; RSR 3/11/82 MODIFY FOR COMMODORE 64
; RSR 3/28/82 MODIFY FOR NEW PLA

+ 63
- 0
KERNAL_C64_03/errorhandler View File

@@ -0,0 +1,63 @@
.PAG 'ERROR HANDLER'
;***************************************
;* STOP -- CHECK STOP KEY FLAG AND *
;* RETURN Z FLAG SET IF FLAG TRUE. *
;* ALSO CLOSES ACTIVE CHANNELS AND *
;* FLUSHES KEYBOARD QUEUE. *
;* ALSO RETURNS KEY DOWNS FROM LAST *
;* KEYBOARD ROW IN .A. *
;***************************************
NSTOP LDA STKEY ;VALUE OF LAST ROW
CMP #$7F ;CHECK STOP KEY POSITION
BNE STOP2 ;NOT DOWN
PHP
JSR CLRCH ;CLEAR CHANNELS
STA NDX ;FLUSH QUEUE
PLP
STOP2 RTS
.SKI 5
;************************************
;* *
;* ERROR HANDLER *
;* *
;* PRINTS KERNAL ERROR MESSAGE IF *
;* BIT 6 OF MSGFLG SET. RETURNS *
;* WITH ERROR # IN .A AND CARRY. *
;* *
;************************************
;
ERROR1 LDA #1 ;TOO MANY FILES
.BYT $2C
ERROR2 LDA #2 ;FILE OPEN
.BYT $2C
ERROR3 LDA #3 ;FILE NOT OPEN
.BYT $2C
ERROR4 LDA #4 ;FILE NOT FOUND
.BYT $2C
ERROR5 LDA #5 ;DEVICE NOT PRESENT
.BYT $2C
ERROR6 LDA #6 ;NOT INPUT FILE
.BYT $2C
ERROR7 LDA #7 ;NOT OUTPUT FILE
.BYT $2C
ERROR8 LDA #8 ;MISSING FILE NAME
.BYT $2C
ERROR9 LDA #9 ;BAD DEVICE #
;
PHA ;ERROR NUMBER ON STACK
JSR CLRCH ;RESTORE I/O CHANNELS
;
LDY #MS1-MS1
BIT MSGFLG ;ARE WE PRINTING ERROR?
BVC EREXIT ;NO...
;
JSR MSG ;PRINT "CBM I/O ERROR #"
PLA
PHA
ORA #$30 ;MAKE ERROR # ASCII
JSR BSOUT ;PRINT IT
;
EREXIT PLA
SEC
RTS
.END

+ 244
- 0
KERNAL_C64_03/init View File

@@ -0,0 +1,244 @@
.PAGE 'INITIALIZATION'
; START - SYSTEM RESET
; WILL GOTO ROM AT $8000...
; IF LOCS $8004-$8008
; = 'CBM80'
; ^^^ > THESE HAVE MSB SET
; KERNAL EXPECTS...
; $8000- .WORD INITILIZE (HARD START)
; $8002- .WORD PANIC (WARM START)
; ... ELSE BASIC SYSTEM USED
; ******************TESTING ONLY***************
; USE AUTO DISK/CASSETTE LOAD WHEN DEVELOPED...
;
START LDX #$FF
SEI
TXS
CLD
JSR A0INT ;TEST FOR $A0 ROM IN
BNE START1
JMP ($8000) ; GO INIT AS $A000 ROM WANTS
START1 STX VICREG+22 ;SET UP REFRESH (.X=<5)
JSR IOINIT ;GO INITILIZE I/O DEVICES
JSR RAMTAS ;GO RAM TEST AND SET
JSR RESTOR ;GO SET UP OS VECTORS
;
JSR PCINT ;GO INITILIZE SCREEN NEWXXX
CLI ;INTERRUPTS OKAY NOW
JMP ($A000) ;GO TO BASIC SYSTEM
.SKI 4
; A0INT - TEST FOR AN $8000 ROM
; RETURNS Z - $8000 IN
;
A0INT LDX #TBLA0E-TBLA0R ;CHECK FOR $8000
A0IN1 LDA TBLA0R-1,X
CMP $8004-1,X
BNE A0IN2
DEX
BNE A0IN1
A0IN2 RTS
;
TBLA0R .BYT $C3,$C2,$CD,'80' ;..CBM80..
TBLA0E
.SKI 4
; RESTOR - SET KERNAL INDIRECTS AND VECTORS (SYSTEM)
;
RESTOR LDX #<VECTSS
LDY #>VECTSS
CLC
;
; VECTOR - SET KERNAL INDIRECT AND VECTORS (USER)
;
VECTOR STX TMP2
STY TMP2+1
LDY #VECTSE-VECTSS-1
MOVOS1 LDA CINV,Y ;GET FROM STORAGE
BCS MOVOS2 ;C...WANT STORAGE TO USER
LDA (TMP2)Y ;...WANT USER TO STORAGE
MOVOS2 STA (TMP2)Y ;PUT IN USER
STA CINV,Y ;PUT IN STORAGE
DEY
BPL MOVOS1
RTS
;
VECTSS .WOR KEY,TIMB,NNMI
.WOR NOPEN,NCLOSE,NCHKIN
.WOR NCKOUT,NCLRCH,NBASIN
.WOR NBSOUT,NSTOP,NGETIN
.WOR NCLALL,TIMB ;GOTO BREAK ON A USRCMD JMP
.WOR NLOAD,NSAVE
VECTSE
.PAGE 'INITILIZE CODE'
; RAMTAS - MEMORY SIZE CHECK AND SET
;
RAMTAS LDA #0 ;ZERO LOW MEMORY
TAY ;START AT 0002
RAMTZ0 STA $0002,Y ;ZERO PAGE
STA $0200,Y ;USER BUFFERS AND VARS
STA $0300,Y ;SYSTEM SPACE AND USER SPACE
INY
BNE RAMTZ0
;
;ALLOCATE TAPE BUFFERS
;
LDX #<TBUFFR
LDY #>TBUFFR
STX TAPE1
STY TAPE1+1