mirror of https://github.com/mist64/cbmsrc.git
Michael Steil
4 years ago
36 changed files with 5486 additions and 15 deletions
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 (NTSC OR PAL VIDEO) * |
||||
;* COPYRIGHT (C) 1982 BY * |
||||
;* COMMODORE BUSINESS MACHINES (CBM) * |
||||
;*************************************** |
||||
.SKI 3 |
||||
;****LISTING DATE --1200 06 JULY 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 |
@ -0,0 +1,611 @@
|
||||
.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 |
||||
LDA LDTB1,X |
||||
AND #$03 ;GET RID OF GARBAGE |
||||
ORA HIBASE ;OR IN HIGH ORDER BITS |
||||
STA PNT+1 |
||||
LDA LDTB2,X |
||||
STA PNT |
||||
; |
||||
LDA #LLEN-1 |
||||
INX |
||||
FNDEND LDY LDTB1,X |
||||
BMI STDONE |
||||
CLC |
||||
ADC #LLEN |
||||
INX |
||||
BPL FNDEND |
||||
STDONE |
||||
STA LNMX |
||||
RTS |
||||
.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 FINDST ;FIND 1ST PHYSICAL LINE |
||||
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 |
@ -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 LDA #$20 |
||||
STA (PNT)Y |
||||
JSR CPATCH ;DO THE COLOR (IN BACKGROUND) |
||||
NOP ;FILL |
||||
DEY |
||||
BPL CLR10 |
||||
RTS |
||||
.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 |
@ -0,0 +1,202 @@
|
||||
.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) RC=311 |
||||
.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 |
||||
; RSR 6/22/82 ADD 311 PLA RASTER COMPARE |
@ -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 |
@ -0,0 +1,245 @@
|
||||
.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 |
||||
; |
||||
; SET TOP OF MEMORY |
||||
; |
||||
RAMTBT |
||||
TAY ;MOVE $00 TO .Y |
||||
LDA #3 ;SET HIGH INITAL INDEX |
||||
STA TMP0+1 |
||||
; |
||||
RAMTZ1 INC TMP0+1 ;MOVE INDEX THRU MEMORY |
||||
RAMTZ2 LDA (TMP0)Y ;GET PRESENT DATA |
||||
TAX ;SAVE IN .X |
||||
LDA #$55 ;DO A $55,$AA TEST |
||||
STA (TMP0)Y |
||||
CMP (TMP0)Y |
||||
BNE SIZE |
||||
ROL A |
||||
STA (TMP0)Y |
||||
CMP (TMP0)Y |
||||
BNE SIZE |
||||
TXA ;RESTORE OLD DATA |
||||
STA (TMP0)Y |
||||
INY |
||||
BNE RAMTZ2 |
||||
BEQ RAMTZ1 |
||||
; |
||||
SIZE TYA ;SET TOP OF MEMORY |
||||
TAX |
||||
LDY TMP0+1 |
||||
CLC |
||||
JSR SETTOP |
||||
LDA #$08 ;SET BOTTOM OF MEMORY |
||||
STA MEMSTR+1 ;ALWAYS AT $0800 |
||||
LDA #$04 ;SCREEN ALWAYS AT $400 |
||||
STA HIBASE ;SET BASE OF SCREEN |
||||
RTS |
||||
.SKI 3 |
||||
BSIT .WOR WRTZ,WRTN,KEY,READ ;TABLE OF INDIRECTS FOR CASSETTE IRQ'S |
||||
.PAG 'INITILIZE CODE' |
||||
; IOINIT - INITILIZE IO DEVICES |
||||
; |
||||
IOINIT LDA #$7F ;KILL INTERRUPTS |
||||
STA D1ICR |
||||
STA D2ICR |
||||
STA D1PRA ;TURN ON STOP KEY |
||||
LDA #%00001000 ;SHUT OFF TIMERS |
||||
STA D1CRA |
||||
STA D2CRA |
||||
STA D1CRB |
||||
STA D2CRB |
||||
; CONFIGURE PORTS |
||||
LDX #$00 ;SET UP KEYBOARD INPUTS |
||||
STX D1DDRB ;KEYBOARD INPUTS |
||||
STX D2DDRB ;USER PORT (NO RS-232) |
||||
STX SIDREG+24 ;TURN OFF SID |
||||
DEX |
||||
STX D1DDRA ;KEYBOARD OUTPUTS |
||||
LDA #%00000111 ;SET SERIAL/VA14/15 (CLKHI) |
||||
STA D2PRA |
||||
LDA #%00111111 ;SET SERIAL IN/OUT, VA14/15OUT |
||||
STA D2DDRA |
||||
; |
||||
; SET UP THE 6510 LINES |
||||
; |
||||
LDA #%11100111 ;MOTOR ON, HIRAM LOWRAM CHAREN HIGH |
||||
STA R6510 |
||||
LDA #%00101111 ;MTR OUT,SW IN,WR OUT,CONTROL OUT |
||||
STA D6510 |
||||
; |
||||
;JSR CLKHI ;CLKHI TO RELEASE SERIAL DEVICES ^ |
||||
; |
||||
IOKEYS LDA PALNTS ;PAL OR NTSC |
||||
BEQ IO010 ;NTSC |
||||
LDA #<SIXTYP |
||||
STA D1T1L |
||||
LDA #>SIXTYP |
||||
JMP IO020 |
||||
IO010 LDA #<SIXTY ;KEYBOARD SCAN IRQ'S |
||||
STA D1T1L |
||||
LDA #>SIXTY |
||||
IO020 STA D1T1H |
||||
JMP PIOKEY ;PATCH IOKEYS |
||||
; LDA #$81 ;ENABLE T1 IRQ'S |
||||
; STA D1ICR |
||||
; LDA D1CRA |
||||
; AND #$80 ;SAVE ONLY TOD BIT |
||||
; ORA #%00010001 ;ENABLE TIMER1 |
||||
; STA D1CRA |
||||
; JMP CLKLO ;RELEASE THE CLOCK LINE |
||||
; |
||||
; SIXTY HERTZ VALUES |
||||
; |
||||
SIXTY = 17045 ;NTSC |
||||
SIXTYP = 16421 ;PAL |
||||
.PAGE 'INIT - SYS SUBS' |
||||
SETNAM STA FNLEN |
||||
STX FNADR |
||||
STY FNADR+1 |
||||
RTS |
||||
.SKI 5 |
||||
SETLFS STA LA |
||||
STX FA |
||||
STY SA |
||||
RTS |
||||
.SKI 5 |
||||
READSS LDA FA ;SEE WHICH DEVICES' TO READ |
||||
CMP #2 ;IS IT RS-232? |
||||
BNE READST ;NO...READ SERIAL/CASS |
||||
LDA RSSTAT ;YES...GET RS-232 UP |
||||
PHA |
||||
LDA #00 ;CLEAR RS232 STATUS WHEN READ |
||||
STA RSSTAT |
||||
PLA |
||||
RTS |
||||
SETMSG STA MSGFLG |
||||
READST LDA STATUS |
||||
UDST ORA STATUS |
||||
STA STATUS |
||||
RTS |
||||
.SKI 5 |
||||
SETTMO STA TIMOUT |
||||
RTS |
||||
.SKI 5 |
||||
MEMTOP BCC SETTOP |
||||
; |
||||
;CARRY SET--READ TOP OF MEMORY |
||||
; |
||||
GETTOP LDX MEMSIZ |
||||
LDY MEMSIZ+1 |
||||
; |
||||
;CARRY CLEAR--SET TOP OF MEMORY |
||||
; |
||||
SETTOP STX MEMSIZ |
||||
STY MEMSIZ+1 |
||||
RTS |
||||
.SKI 5 |
||||
;MANAGE BOTTOM OF MEMORY |
||||
; |
||||
MEMBOT BCC SETBOT |
||||
; |
||||
;CARRY SET--READ BOTTOM OF MEMORY |
||||
; |
||||
LDX MEMSTR |
||||
LDY MEMSTR+1 |
||||
; |
||||
;CARRY CLEAR--SET BOTTOM OF MEMORY |
||||
; |
||||
SETBOT STX MEMSTR |
||||
STY MEMSTR+1 |
||||
RTS |
||||
.END |
||||
; RSR 8/5/80 CHANGE IO STRUCTURE |
||||
; RSR 8/15/80 ADD MEMORY TEST |
||||
; RSR 8/21/80 CHANGE I/O FOR MOD |
||||
; RSR 8/25/80 CHANGE I/O FOR MOD2 |
||||
; RSR 8/29/80 CHANGE RAMTEST FOR HARDWARE MISTAKE |
||||
; RSR 9/22/80 CHANGE SO RAM HANG RS232 STATUS READ |
||||
; RSR 5/12/82 CHANGE START1 ORDER TO REMOVE DISK PROBLEM |
||||
; RSR 6/21/82 MODIFY FOR UNIVERSAL |
@ -0,0 +1,76 @@
|
||||
.PAGE 'IRQFILE - DISPATCHER' |
||||
; SIMIRQ - SIMULATE AN IRQ (FOR CASSETTE READ) |
||||
; ENTER BY A JSR SIMIRQ |
||||
; |
||||
SIMIRQ PHP |
||||
PLA ;FIX THE BREAK FLAG |
||||
AND #$EF |
||||
PHA |
||||
; PULS - CHECKS FOR REAL IRQ'S OR BREAKS |
||||
; |
||||
PULS PHA |
||||
TXA |
||||
PHA |
||||
TYA |
||||
PHA |
||||
TSX |
||||
LDA $104,X ;GET OLD P STATUS |
||||
AND #$10 ;BREAK FLAG? |
||||
BEQ PULS1 ;...NO |
||||
JMP (CBINV) ;...YES...BREAK INSTR |
||||
PULS1 JMP (CINV) ;...IRQ |
||||
.PAGE 'PATCHES 6/82' |
||||
; PCINT - ADD UNIVERSAL TO CINIT |
||||
; |
||||
PCINT JSR CINT |
||||
P0010 LDA VICREG+18 ;CHECK RASTER COMPARE FOR ZERO |
||||
BNE P0010 ;IF IT'S ZERO THEN CHECK VALUE... |
||||
LDA VICREG+25 ;GET RASTER IRQ VALUE |
||||
AND #$01 |
||||
STA PALNTS ;PLACE IN PAL/NTSC INDICATOR |
||||
JMP IOKEYS |
||||
; |
||||
; PIOKEY - ADD UNIVERSAL TO IOKEYS |
||||
; |
||||
PIOKEY LDA #$81 ;ENABLE T1 IRQ'S |
||||
STA D1ICR |
||||
LDA D1CRA |
||||
AND #$80 ;SAVE ONLY TOD BIT |
||||
ORA #%00010001 ;ENABLE TIMER1 |
||||
STA D1CRA |
||||
JMP CLKLO ;RELEASE THE CLOCK LINE |
||||
*=$E500-20 |
||||
; |
||||
; BAUDOP - BAUD RATE TABLE FOR PAL |
||||
; .985248E6/BAUD-RATE/2-100 |
||||
; |
||||
BAUDOP .WOR 9853-CBIT ;50 BAUD |
||||
.WOR 6568-CBIT ;75 BAUD |
||||
.WOR 4478-CBIT ;110 BAUD |
||||
.WOR 3660-CBIT ;134.6 BAUD |
||||
.WOR 3284-CBIT ;150 BAUD |
||||
.WOR 1642-CBIT ;300 BAUD |
||||
.WOR 821-CBIT ;600 BAUD |
||||
.WOR 411-CBIT ;1200 BAUD |
||||
.WOR 274-CBIT ;1800 BAUD |
||||
.WOR 205-CBIT ;2400 BAUD |
||||
.SKI2 |
||||
*=$E500-32 ;(20-12) |
||||
; FPATCH - TAPE FILENAME TIMEOUT |
||||
; |
||||
FPATCH ADC #2 ;TIME IS (8 TO 13 SEC OF DISPLAY) |
||||
FPAT00 LDY STKEY ;CHECK FOR KEY DOWN ON LAST ROW... |
||||
INY |
||||
BNE FPAT01 ;KEY...EXIT LOOP |
||||
CMP TIME+1 ;WATCH TIMER |
||||
BNE FPAT00 |
||||
FPAT01 RTS |
||||
.SKI 2 |
||||
*=$E500-38 ;(32-6) |
||||
; CPATCH - FIX TO CLEAR LINE |
||||
; PREVENTS WHITE CHARACTER FLASH... |
||||
; |
||||
CPATCH LDA VICREG+33 ;ALWAYS CLEAR TO CURRENT BACKGND COLOR |
||||
STA (USER)Y ;PLACE IN COLOR POINTER |
||||
RTS |
||||
.END |
@ -0,0 +1,30 @@
|
||||
.LIB DISCLAIMER |
||||
.LIB DECLARE |
||||
*=$E500 ;START OF VIC-40 KERNAL |
||||
.LIB EDITOR.1 |
||||
;.LIB CONKAT (JAPAN CONVERSION TABLES) |
||||
.LIB EDITOR.2 |
||||
.LIB EDITOR.3 |
||||
.LIB SERIAL4.0 |
||||
.LIB RS232TRANS |
||||
.LIB RS232RCVR |
||||
.LIB RS232INOUT |
||||
.LIB MESSAGES |
||||
.LIB CHANNELIO |
||||
.LIB OPENCHANNEL |
||||
.LIB CLOSE |
||||
.LIB CLALL |
||||
.LIB OPEN |
||||
.LIB LOAD |
||||
.LIB SAVE |
||||
.LIB TIME |
||||
.LIB ERRORHANDLER |
||||
.LIB TAPEFILE |
||||
.LIB TAPECONTROL |
||||
.LIB READ |
||||
.LIB WRITE |
||||
.LIB INIT |
||||
.LIB RS232NMI |
||||
.LIB IRQFILE |
||||
.LIB VECTORS |
||||
.END |
@ -0,0 +1,29 @@
|
||||
.LIB DISCLAIMER |
||||
.LIB DECLARE |
||||
*=$E500 ;START OF VIC-40 KERNAL |
||||
.LIB EDITOR.1 |
||||
.LIB EDITOR.2 |
||||
.LIB EDITOR.3 |
||||
.LIB SERIAL4.0 |
||||
.LIB RS232TRANS |
||||
.LIB RS232RCVR |
||||
.LIB RS232INOUT |
||||
.LIB MESSAGES |
||||
.LIB CHANNELIO |
||||
.LIB OPENCHANNEL |
||||
.LIB CLOSE |
||||
.LIB CLALL |
||||
.LIB OPEN |
||||
.LIB LOAD |
||||
.LIB SAVE |
||||
.LIB TIME |
||||
.LIB ERRORHANDLER |
||||
.LIB TAPEFILE |
||||
.LIB TAPECONTROL |
||||
.LIB READ |
||||
.LIB WRITE |
||||
.LIB INIT |
||||
.LIB RS232NMI |
||||
.LIB IRQFILE |
||||
.LIB VECTORS |
||||
.END |
@ -0,0 +1,227 @@
|
||||
.PAG 'LOAD FUNCTION' |
||||
;********************************** |
||||
;* LOAD RAM FUNCTION * |
||||
;* * |
||||
;* LOADS FROM CASSETTE 1 OR 2, OR * |
||||
;* SERIAL BUS DEVICES >=4 TO 31 * |
||||
;* AS DETERMINED BY CONTENTS OF * |
||||
;* VARIABLE FA. VERIFY FLAG IN .A * |
||||
;* * |
||||
;* ALT LOAD IF SA=0, NORMAL SA=1 * |
||||
;* .X , .Y LOAD ADDRESS IF SA=0 * |
||||
;* .A=0 PERFORMS LOAD,<> IS VERIFY* |
||||
;* * |
||||
;* HIGH LOAD RETURN IN X,Y. * |
||||
;* * |
||||
;********************************** |
||||
.SKI 3 |
||||
LOADSP STX MEMUSS ;.X HAS LOW ALT START |
||||
STY MEMUSS+1 |
||||
LOAD JMP (ILOAD) ;MONITOR LOAD ENTRY |
||||
; |
||||
NLOAD STA VERCK ;STORE VERIFY FLAG |
||||
LDA #0 |
||||
STA STATUS |
||||
; |
||||
LDA FA ;CHECK DEVICE NUMBER |
||||
BNE LD20 |
||||
; |
||||
LD10 JMP ERROR9 ;BAD DEVICE #-KEYBOARD |
||||
; |
||||
LD20 CMP #3 |
||||
BEQ LD10 ;DISALLOW SCREEN LOAD |
||||
BCC LD100 ;HANDLE TAPES DIFFERENT |
||||
; |
||||
;LOAD FROM CBM IEEE DEVICE |
||||
; |
||||
LDY FNLEN ;MUST HAVE FILE NAME |
||||
BNE LD25 ;YES...OK |
||||
; |
||||
JMP ERROR8 ;MISSING FILE NAME |
||||
; |
||||
LD25 LDX SA ;SAVE SA IN .X |
||||
JSR LUKING ;TELL USER LOOKING |
||||
LDA #$60 ;SPECIAL LOAD COMMAND |
||||
STA SA |
||||
JSR OPENI ;OPEN THE FILE |
||||
; |
||||
LDA FA |
||||
JSR TALK ;ESTABLISH THE CHANNEL |
||||
LDA SA |
||||
JSR TKSA ;TELL IT TO LOAD |
||||
; |
||||
JSR ACPTR ;GET FIRST BYTE |
||||
STA EAL |
||||
; |
||||
LDA STATUS ;TEST STATUS FOR ERROR |
||||
LSR A |
||||
LSR A |
||||
BCS LD90 ;FILE NOT FOUND... |
||||
JSR ACPTR |
||||
STA EAH |
||||
; |
||||
TXA ;FIND OUT OLD SA |
||||
BNE LD30 ;SA<>0 USE DISK ADDRESS |
||||
LDA MEMUSS ;ELSE LOAD WHERE USER WANTS |
||||
STA EAL |
||||
LDA MEMUSS+1 |
||||
STA EAH |
||||
LD30 JSR LODING ;TELL USER LOADING |
||||
; |
||||
LD40 LDA #$FD ;MASK OFF TIMEOUT |
||||
AND STATUS |
||||
STA STATUS |
||||
; |
||||
JSR STOP ;STOP KEY? |
||||
BNE LD45 ;NO... |
||||
; |
||||
JMP BREAK ;STOP KEY PRESSED |
||||
; |
||||
LD45 JSR ACPTR ;GET BYTE OFF IEEE |
||||
TAX |
||||
LDA STATUS ;WAS THERE A TIMEOUT? |
||||
LSR A |
||||
LSR A |
||||
BCS LD40 ;YES...TRY AGAIN |
||||
TXA |
||||
LDY VERCK ;PERFORMING VERIFY? |
||||
BEQ LD50 ;NO...LOAD |
||||
LDY #0 |
||||
CMP (EAL)Y ;VERIFY IT |
||||
BEQ LD60 ;O.K.... |
||||
LDA #SPERR ;NO GOOD...VERIFY ERROR |
||||
JSR UDST ;UPDATE STATUS |
||||
.BYT $2C ;SKIP NEXT STORE |
||||
; |
||||
LD50 STA (EAL)Y |
||||
LD60 INC EAL ;INCREMENT STORE ADDR |
||||
BNE LD64 |
||||
INC EAH |
||||
LD64 BIT STATUS ;EOI? |
||||
BVC LD40 ;NO...CONTINUE LOAD |
||||
; |
||||
JSR UNTLK ;CLOSE CHANNEL |
||||
JSR CLSEI ;CLOSE THE FILE |
||||
BCC LD180 ;BRANCH ALWAYS |
||||
; |
||||
LD90 JMP ERROR4 ;FILE NOT FOUND |
||||
; |
||||
;LOAD FROM TAPE |
||||
; |
||||
LD100 LSR A |
||||
BCS LD102 ;IF C-SET THEN IT'S CASSETTE |
||||
; |
||||
JMP ERROR9 ;BAD DEVICE # |
||||
; |
||||
LD102 JSR ZZZ ;SET POINTERS AT TAPE |
||||
BCS LD104 |
||||
JMP ERROR9 ;DEALLOCATED... |
||||
LD104 JSR CSTE1 ;TELL USER ABOUT BUTTONS |
||||
BCS LD190 ;STOP KEY PRESSED? |
||||
JSR LUKING ;TELL USER SEARCHING |
||||
; |
||||
LD112 LDA FNLEN ;IS THERE A NAME? |
||||
BEQ LD150 ;NONE...LOAD ANYTHING |
||||
JSR FAF ;FIND A FILE ON TAPE |
||||
BCC LD170 ;GOT IT! |
||||
BEQ LD190 ;STOP KEY PRESSED |
||||
BCS LD90 ;NOPE...END OF TAPE |
||||
; |
||||
LD150 JSR FAH ;FIND ANY HEADER |
||||
BEQ LD190 ;STOP KEY PRESSED |
||||
BCS LD90 ;NO HEADER |
||||
; |
||||
LD170 LDA STATUS |
||||
AND #SPERR ;MUST GOT HEADER RIGHT |
||||
SEC |
||||
BNE LD190 ;IS BAD |
||||
; |
||||
CPX #BLF ;IS IT A MOVABLE PROGRAM... |
||||
BEQ LD178 ;YES |
||||
; |
||||
CPX #PLF ;IS IT A PROGRAM |
||||
BNE LD112 ;NO...ITS SOMETHING ELSE |
||||
; |
||||
LD177 LDY #1 ;FIXED LOAD... |
||||
LDA (TAPE1)Y ;...THE ADDRESS IN THE... |
||||
STA MEMUSS ;...BUFFER IS THE START ADDRESS |
||||
INY |
||||
LDA (TAPE1)Y |
||||
STA MEMUSS+1 |
||||
BCS LD179 ;JMP ..CARRY SET BY CPX'S |
||||
; |
||||
LD178 LDA SA ;CHECK FOR MONITOR LOAD... |
||||
BNE LD177 ;...YES WE WANT FIXED TYPE |
||||
; |
||||
LD179 LDY #3 ;TAPEA - TAPESTA |
||||
;CARRY SET BY CPX'S |
||||
LDA (TAPE1)Y |
||||
LDY #1 |
||||
SBC (TAPE1)Y |
||||
TAX ;LOW TO .X |
||||
LDY #4 |
||||
LDA (TAPE1)Y |
||||
LDY #2 |
||||
SBC (TAPE1)Y |
||||
TAY ;HIGH TO .Y |
||||
; |
||||
CLC ;EA = STA+(TAPEA-TAPESTA) |
||||
TXA |
||||
ADC MEMUSS ; |
||||
STA EAL |
||||
TYA |
||||
ADC MEMUSS+1 |
||||
STA EAH |
||||
LDA MEMUSS ;SET UP STARTING ADDRESS |
||||
STA STAL |
||||
LDA MEMUSS+1 |
||||
STA STAH |
||||
JSR LODING ;TELL USER LOADING |
||||
JSR TRD ;DO TAPE BLOCK LOAD |
||||
.BYT $24 ;CARRY FROM TRD |
||||
; |
||||
LD180 CLC ;GOOD EXIT |
||||
; |
||||
; SET UP END LOAD ADDRESS |
||||
; |
||||
LDX EAL |
||||
LDY EAH |
||||
; |
||||
LD190 RTS |
||||
.SKI 5 |
||||
;SUBROUTINE TO PRINT TO CONSOLE: |
||||
; |
||||
;SEARCHING [FOR NAME] |
||||
; |
||||
LUKING LDA MSGFLG ;SUPPOSED TO PRINT? |
||||
BPL LD115 ;...NO |
||||
LDY #MS5-MS1 ;"SEARCHING" |
||||
JSR MSG |
||||
LDA FNLEN |
||||
BEQ LD115 |
||||
LDY #MS6-MS1 ;"FOR" |
||||
JSR MSG |
||||
.SKI 3 |
||||
;SUBROUTINE TO OUTPUT FILE NAME |
||||
; |
||||
OUTFN LDY FNLEN ;IS THERE A NAME? |
||||
BEQ LD115 ;NO...DONE |
||||
LDY #0 |
||||
LD110 LDA (FNADR)Y |
||||
JSR BSOUT |
||||
INY |
||||
CPY FNLEN |
||||
BNE LD110 |
||||
; |
||||
LD115 RTS |
||||
.SKI 3 |
||||
;SUBROUTINE TO PRINT: |
||||
; |
||||
;LOADING/VERIFING |
||||
; |
||||
LODING LDY #MS10-MS1 ;ASSUME 'LOADING' |
||||
LDA VERCK ;CHECK FLAG |
||||
BEQ LD410 ;ARE DOING LOAD |
||||
LDY #MS21-MS1 ;ARE 'VERIFYING' |
||||
LD410 JMP SPMSG |
||||
.END |
@ -0,0 +1,29 @@
|
||||
.PAG 'MESSAGES' |
||||
MS1 .BYT $D,'I/O ERROR ',$A3 |
||||
MS5 .BYT $D,'SEARCHING',$A0 |
||||
MS6 .BYT 'FOR',$A0 |
||||
MS7 .BYT $D,'PRESS PLAY ON TAP',$C5 |
||||
MS8 .BYT 'PRESS RECORD & PLAY ON TAP',$C5 |
||||
MS10 .BYT $D,'LOADIN',$C7 |
||||
MS11 .BYT $D,'SAVING',$A0 |
||||
MS21 .BYT $D,'VERIFYIN',$C7 |
||||
MS17 .BYT $D,'FOUND',$A0 |
||||
MS18 .BYT $D,'OK',$8D |
||||
; MS34 .BYT $D,'MONITOR',$8D |
||||
; MS36 .BYT $D,'BREA',$CB |
||||
.SKI 5 |
||||
;PRINT MESSAGE TO SCREEN ONLY IF |
||||
;OUTPUT ENABLED |
||||
; |
||||
SPMSG BIT MSGFLG ;PRINTING MESSAGES? |
||||
BPL MSG10 ;NO... |
||||
MSG LDA MS1,Y |
||||
PHP |
||||
AND #$7F |
||||
JSR BSOUT |
||||
INY |
||||
PLP |
||||
BPL MSG |
||||
MSG10 CLC |
||||
RTS |
||||
.END |
@ -0,0 +1,274 @@
|
||||
.PAG 'OPEN FILE' |
||||
;*********************************** |
||||
;* * |
||||
;* OPEN FUNCTION * |
||||
;* * |
||||
;* CREATES AN ENTRY IN THE LOGICAL * |
||||
;* FILES TABLES CONSISTING OF * |
||||
;* LOGICAL FILE NUMBER--LA, DEVICE * |
||||
;* NUMBER--FA, AND SECONDARY CMD-- * |
||||
;* SA. * |
||||
;* * |
||||
;* A FILE NAME DESCRIPTOR, FNADR & * |
||||
;* FNLEN ARE PASSED TO THIS ROUTINE* |
||||
;* * |
||||
;*********************************** |
||||
; |
||||
NOPEN LDX LA ;CHECK FILE # |
||||
BNE OP98 ;IS NOT THE KEYBOARD |
||||
; |
||||
JMP ERROR6 ;NOT INPUT FILE... |
||||
; |
||||
OP98 JSR LOOKUP ;SEE IF IN TABLE |
||||
BNE OP100 ;NOT FOUND...O.K. |
||||
; |
||||
JMP ERROR2 ;FILE OPEN |
||||
; |
||||
OP100 LDX LDTND ;LOGICAL DEVICE TABLE END |
||||
CPX #10 ;MAXIMUM # OF OPEN FILES |
||||
BCC OP110 ;LESS THAN 10...O.K. |
||||
; |
||||
JMP ERROR1 ;TOO MANY FILES |
||||
; |
||||
OP110 INC LDTND ;NEW FILE |
||||
LDA LA |
||||
STA LAT,X ;STORE LOGICAL FILE # |
||||
LDA SA |
||||
ORA #$60 ;MAKE SA AN SERIAL COMMAND |
||||
STA SA |
||||
STA SAT,X ;STORE COMMAND # |
||||
LDA FA |
||||
STA FAT,X ;STORE DEVICE # |
||||
; |
||||
;PERFORM DEVICE SPECIFIC OPEN TASKS |
||||
; |
||||
BEQ OP175 ;IS KEYBOARD...DONE. |
||||
CMP #3 |
||||
BEQ OP175 ;IS SCREEN...DONE. |
||||
BCC OP150 ;ARE CASSETTES 1 & 2 |
||||
; |
||||
JSR OPENI ;IS ON SERIAL...OPEN IT |
||||
BCC OP175 ;BRANCH ALWAYS...DONE |
||||
; |
||||
;PERFORM TAPE OPEN STUFF |
||||
; |
||||
OP150 CMP #2 |
||||
BNE OP152 |
||||
; |
||||
JMP OPN232 |
||||
; |
||||
OP152 JSR ZZZ ;SEE IF TAPE BUFFER |
||||
BCS OP155 ;YES |
||||
; |
||||
JMP ERROR9 ;NO...DEALLOCATED |
||||
; |
||||
OP155 LDA SA |
||||
AND #$F ;MASK OFF COMMAND |
||||
BNE OP200 ;NON ZERO IS TAPE WRITE |
||||
; |
||||
;OPEN CASSETE TAPE FILE TO READ |
||||
; |
||||
JSR CSTE1 ;TELL "PRESS PLAY" |
||||
BCS OP180 ;STOP KEY PRESSED |
||||
; |
||||
JSR LUKING ;TELL USER "SEARCHING" |
||||
; |
||||
LDA FNLEN |
||||
BEQ OP170 ;LOOKING FOR ANY FILE |
||||
; |
||||
JSR FAF ;LOOKING FOR NAMED FILE |
||||
BCC OP171 ;FOUND IT!!! |
||||
BEQ OP180 ;STOP KEY PRESSED |
||||
; |
||||
OP160 JMP ERROR4 ;FILE NOT FOUND |
||||
; |
||||
OP170 JSR FAH ;GET ANY OLD HEADER |
||||
BEQ OP180 ;STOP KEY PRESSED |
||||
BCC OP171 ;ALL O.K. |
||||
BCS OP160 ;FILE NOT FOUND... |
||||
; |
||||
;OPEN CASSETTE TAPE FOR WRITE |
||||
; |
||||
OP200 JSR CSTE2 ;TELL "PRESS PLAY AND RECORD" |
||||
BCS OP180 ;STOP KEY PRESSED |
||||
LDA #BDFH ;DATA FILE HEADER TYPE |
||||
JSR TAPEH ;WRITE IT |
||||
; |
||||
;FINISH OPEN FOR TAPE READ/WRITE |
||||
; |
||||
OP171 LDA #BUFSZ-1 ;ASSUME FORCE READ |
||||
; |
||||
LDY SA |
||||
CPY #$60 ;OPEN FOR READ? |
||||
BEQ OP172 |
||||
; |
||||
;SET POINTERS FOR BUFFERING DATA |
||||
; |
||||
LDY #0 |
||||
LDA #BDF ;TYPE FLAG FOR BLOCK |
||||
STA (TAPE1)Y ;TO BEGIN OF BUFFER |
||||
TYA |
||||
; |
||||
OP172 STA BUFPT ;POINT TO DATA |
||||
OP175 CLC ;FLAG GOOD OPEN |
||||
OP180 RTS ;EXIT IN PEACE |
||||
.SKI 5 |
||||
OPENI LDA SA |
||||
BMI OP175 ;NO SA...DONE |
||||
; |
||||
LDY FNLEN |
||||
BEQ OP175 ;NO FILE NAME...DONE |
||||
; |
||||
LDA #0 ;CLEAR THE SERIAL STATUS |
||||
STA STATUS |
||||
; |
||||
LDA FA |
||||
JSR LISTN ;DEVICE LA TO LISTEN |
||||
; |
||||
LDA SA |
||||
ORA #$F0 |
||||
JSR SECND |
||||
; |
||||
LDA STATUS ;ANYBODY HOME? |
||||
BPL OP35 ;YES...CONTINUE |
||||
; |
||||
;THIS ROUTINE IS CALLED BY OTHER |
||||
;KERNAL ROUTINES WHICH ARE CALLED |
||||
;DIRECTLY BY OS. KILL RETURN |
||||
;ADDRESS TO RETURN TO OS. |
||||
; |
||||
PLA |
||||
PLA |
||||
JMP ERROR5 ;DEVICE NOT PRESENT |
||||
; |
||||
OP35 LDA FNLEN |
||||
BEQ OP45 ;NO NAME...DONE SEQUENCE |
||||
; |
||||
;SEND FILE NAME OVER SERIAL |
||||
; |
||||
LDY #0 |
||||
OP40 LDA (FNADR)Y |
||||
JSR CIOUT |
||||
INY |
||||
CPY FNLEN |
||||
BNE OP40 |
||||
; |
||||
OP45 JMP CUNLSN ;JSR UNLSN: CLC: RTS |
||||
.PAGE 'OPEN RS232 FILE' |
||||
; OPN232 - OPEN AN RS-232 OR PARALLEL PORT FILE |
||||
; |
||||
; VARIABLES INITILIZED |
||||
; BITNUM - # OF BITS TO BE SENT CALC FROM M51CTR |
||||
; BAUDOF - BAUD RATE FULL |
||||
; RSSTAT - RS-232 STATUS REG |
||||
; M51CTR - 6551 CONTROL REG |
||||
; M51CDR - 6551 COMMAND REG |
||||
; M51AJB - USER BAUD RATE (CLOCK/BAUD/2-100) |
||||
; ENABL - 6526 NMI ENABLES (1-NMI BIT ON) |
||||
; |
||||
OPN232 JSR CLN232 ;SET UP RS232, .Y=0 ON RETURN |
||||
; |
||||
; PASS PRAMS TO M51REGS |
||||
; |
||||
STY RSSTAT ;CLEAR STATUS |
||||
; |
||||
OPN020 CPY FNLEN ;CHECK IF AT END OF FILENAME |
||||
BEQ OPN025 ;YES... |
||||
; |
||||
LDA (FNADR)Y ;MOVE DATA |
||||
STA M51CTR,Y ;TO M51REGS |
||||
INY |
||||
CPY #4 ;ONLY 4 POSSIBLE PRAMS |
||||
BNE OPN020 |
||||
; |
||||
; CALC # OF BITS |
||||
; |
||||
OPN025 JSR BITCNT |
||||
STX BITNUM |
||||
; |
||||
; CALC BAUD RATE |
||||
; |
||||
LDA M51CTR |
||||
AND #$0F |
||||
BEQ OPN028 |
||||
; |
||||
; CALCULATE START-TEST RATE... |
||||
; DIFFERENT THAN ORIGINAL RELEASE 901227-01 |
||||
; |
||||
ASL A ;GET OFFSET INTO TABLES |
||||
TAX |
||||
LDA PALNTS ;GET TV STANDARD |
||||
BNE OPN026 |
||||
LDY BAUDO-1,X ;NTSC STANDARD |
||||
LDA BAUDO-2,X |
||||
JMP OPN027 |
||||
; |
||||
OPN026 LDY BAUDOP-1,X ;PAL STANDARD |
||||
LDA BAUDOP-2,X |
||||
OPN027 STY M51AJB+1 ;HOLD START RATE IN M51AJB |
||||
STA M51AJB |
||||
OPN028 LDA M51AJB ;CALCULATE BAUD RATE |
||||
ASL A |
||||
JSR POPEN ;GOTO PATCH AREA |
||||
; |
||||
; CHECK FOR 3/X LINE RESPONSE |
||||
; |
||||
OPN030 LDA M51CDR ;BIT 0 OF M51CDR |
||||
LSR A |
||||
BCC OPN050 ;...3 LINE |
||||
; |
||||
; CHECK FOR X LINE PROPER STATES |
||||
; |
||||
LDA D2PRB |
||||
ASL A |
||||
BCS OPN050 |
||||
JSR CKDSRX ;CHANGE FROM JMP TO PREVENT SYSTEM DAMAGE (901227-02) |
||||
; |
||||
; SET UP BUFFER POINTERS (DBE=DBS) |
||||
; |
||||
OPN050 LDA RIDBE |
||||
STA RIDBS |
||||
LDA RODBE |
||||
STA RODBS |
||||
; |
||||
; ALLOCATE BUFFERS |
||||
; |
||||
OPN055 JSR GETTOP ;GET MEMSIZ |
||||
LDA RIBUF+1 ;IN ALLOCATION... |
||||
BNE OPN060 ;ALREADY |
||||
DEY ;THERE GOES 256 BYTES |
||||
STY RIBUF+1 |
||||
STX RIBUF |
||||
OPN060 LDA ROBUF+1 ;OUT ALLOCATION... |
||||
BNE MEMTCF ;ALREAY |
||||
DEY ;THERE GOES 256 BYTES |
||||
STY ROBUF+1 |
||||
STX ROBUF |
||||
MEMTCF SEC ;SIGNAL TOP OF MEMORY CHANGE |
||||
LDA #$F0 |
||||
JMP SETTOP ;TOP CHANGED |
||||
; |
||||
; CLN232 - CLEAN UP 232 SYSTEM FOR OPEN/CLOSE |
||||
; SET UP DDRB AND CB2 FOR RS-232 |
||||
; |
||||
CLN232 LDA #$7F ;CLEAR NMI'S |
||||
STA D2ICR |
||||
LDA #%00000110 ;DDRB |
||||
STA D2DDRB |
||||
STA D2PRB ;DTR,RTS HIGH |
||||
LDA #$04 ;OUTPUT HIGH PA2 |
||||
ORA D2PRA |
||||
STA D2PRA |
||||
LDY #00 |
||||
STY ENABL ;CLEAR ENABLS |
||||
RTS |
||||
.END |
||||
; RSR 8/25/80 - ADD RS-232 CODE |
||||
; RSR 8/26/80 - TOP OF MEMORY HANDLER |
||||
; RSR 8/29/80 - ADD FILENAME TO M51REGS |
||||
; RSR 9/02/80 - FIX ORDERING OF RS-232 ROUTINES |
||||
; RSR 12/11/81 - MODIFY FOR VIC-40 I/O |
||||
; RSR 2/08/82 - CLEAR STATUS IN OPENI |
||||
; RSR 5/12/82 - COMPACT RS232 OPEN/CLOSE CODE |
||||
; RSR 6/22/82 - CHANGE RS232 OPEN FOR UNIVERAL |
||||
; RSR 7/06/82 - CHANGE JMP CKDSRX TO PREVENT BAD BUFFERING |
@ -0,0 +1,135 @@
|
||||
.PAG 'OPEN CHANNEL' |
||||
;*************************************** |
||||
;* CHKIN -- OPEN CHANNEL FOR INPUT * |
||||
;* * |
||||
;* THE NUMBER OF THE LOGICAL FILE TO BE* |
||||
;* OPENED FOR INPUT IS PASSED IN .X. * |
||||
;* CHKIN SEARCHES THE LOGICAL FILE * |
||||
;* TO LOOK UP DEVICE AND COMMAND INFO. * |
||||
;* ERRORS ARE REPORTED IF THE DEVICE * |
||||
;* WAS NOT OPENED FOR INPUT ,(E.G. * |
||||
;* CASSETTE WRITE FILE), OR THE LOGICAL* |
||||
;* FILE HAS NO REFERENCE IN THE TABLES.* |
||||
;* DEVICE 0, (KEYBOARD), AND DEVICE 3 * |
||||
;* (SCREEN), REQUIRE NO TABLE ENTRIES * |
||||
;* AND ARE HANDLED SEPARATE. * |
||||
;*************************************** |
||||
; |
||||
NCHKIN JSR LOOKUP ;SEE IF FILE KNOWN |
||||
BEQ JX310 ;YUP... |
||||
; |
||||
JMP ERROR3 ;NO...FILE NOT OPEN |
||||
; |
||||
JX310 JSR JZ100 ;EXTRACT FILE INFO |
||||
; |
||||
LDA FA |
||||
BEQ JX320 ;IS KEYBOARD...DONE. |
||||
; |
||||
;COULD BE SCREEN, KEYBOARD, OR SERIAL |
||||
; |
||||
CMP #3 |
||||
BEQ JX320 ;IS SCREEN...DONE. |
||||
BCS JX330 ;IS SERIAL...ADDRESS IT |
||||
CMP #2 ;RS232? |
||||
BNE JX315 ;NO... |
||||
; |
||||
JMP CKI232 |
||||
; |
||||
;SOME EXTRA CHECKS FOR TAPE |
||||
; |
||||
JX315 LDX SA |
||||
CPX #$60 ;IS COMMAND A READ? |
||||
BEQ JX320 ;YES...O.K....DONE |
||||
; |
||||
JMP ERROR6 ;NOT INPUT FILE |
||||
; |
||||
JX320 STA DFLTN ;ALL INPUT COME FROM HERE |
||||
; |
||||
CLC ;GOOD EXIT |
||||
RTS |
||||
; |
||||
;AN SERIAL DEVICE HAS TO BE A TALKER |
||||
; |
||||
JX330 TAX ;DEVICE # FOR DFLTO |
||||
JSR TALK ;TELL HIM TO TALK |
||||
; |
||||
LDA SA ;A SECOND? |
||||
BPL JX340 ;YES...SEND IT |
||||
JSR TKATN ;NO...LET GO |
||||
JMP JX350 |
||||
; |
||||
JX340 JSR TKSA ;SEND SECOND |
||||
; |
||||
JX350 TXA |
||||
BIT STATUS ;DID HE LISTEN? |
||||
BPL JX320 ;YES |
||||
; |
||||
JMP ERROR5 ;DEVICE NOT PRESENT |
||||
.PAG 'OPEN CHANNEL OUT' |
||||
;*************************************** |
||||
;* CHKOUT -- OPEN CHANNEL FOR OUTPUT * |
||||
;* * |
||||
;* THE NUMBER OF THE LOGICAL FILE TO BE* |
||||
;* OPENED FOR OUTPUT IS PASSED IN .X. * |
||||
;* CHKOUT SEARCHES THE LOGICAL FILE * |
||||
;* TO LOOK UP DEVICE AND COMMAND INFO. * |
||||
;* ERRORS ARE REPORTED IF THE DEVICE * |
||||
;* WAS NOT OPENED FOR INPUT ,(E.G. * |
||||
;* KEYBOARD), OR THE LOGICAL FILE HAS * |
||||
;* REFERENCE IN THE TABLES. * |
||||
;* DEVICE 0, (KEYBOARD), AND DEVICE 3 * |
||||
;* (SCREEN), REQUIRE NO TABLE ENTRIES * |
||||
;* AND ARE HANDLED SEPARATE. * |
||||
;*************************************** |
||||
; |
||||
NCKOUT JSR LOOKUP ;IS FILE IN TABLE? |
||||
BEQ CK5 ;YES... |
||||
; |
||||
JMP ERROR3 ;NO...FILE NOT OPEN |
||||
; |
||||
CK5 JSR JZ100 ;EXTRACT TABLE INFO |
||||
; |
||||
LDA FA ;IS IT KEYBOARD? |
||||
BNE CK10 ;NO...SOMETHING ELSE. |
||||
; |
||||
CK20 JMP ERROR7 ;YES...NOT OUTPUT FILE |
||||
; |
||||
;COULD BE SCREEN,SERIAL,OR TAPES |
||||
; |
||||
CK10 CMP #3 |
||||
BEQ CK30 ;IS SCREEN...DONE |
||||
BCS CK40 ;IS SERIAL...ADDRESS IT |
||||
CMP #2 ;RS232? |
||||
BNE CK15 |
||||
; |
||||
JMP CKO232 |
||||
; |
||||
; |
||||
;SPECIAL TAPE CHANNEL HANDLING |
||||
; |
||||
CK15 LDX SA |
||||
CPX #$60 ;IS COMMAND READ? |
||||
BEQ CK20 ;YES...ERROR |
||||
; |
||||
CK30 STA DFLTO ;ALL OUTPUT GOES HERE |
||||
; |
||||
CLC ;GOOD EXIT |
||||
RTS |
||||
; |
||||
CK40 TAX ;SAVE DEVICE FOR DFLTO |
||||
JSR LISTN ;TELL HIM TO LISTEN |
||||
; |
||||
LDA SA ;IS THERE A SECOND? |
||||
BPL CK50 ;YES... |
||||
; |
||||
JSR SCATN ;NO...RELEASE LINES |
||||
BNE CK60 ;BRANCH ALWAYS |
||||
; |
||||
CK50 JSR SECND ;SEND SECOND... |
||||
; |
||||
CK60 TXA |
||||
BIT STATUS ;DID HE LISTEN? |
||||
BPL CK30 ;YES...FINISH UP |
||||
; |
||||
JMP ERROR5 ;NO...DEVICE NOT PRESENT |
||||
.END |
@ -0,0 +1,412 @@
|
||||
.PAGE 'CASSETTE READ' |
||||
; VARIABLES USED IN CASSETTE READ ROUTINES |
||||
; |
||||
; REZ - COUNTS ZEROS (IF Z THEN CORRECT # OF DIPOLES) |
||||
; RER - FLAGS ERRORS (IF Z THEN NO ERROR) |
||||
; DIFF - USED TO PRESERVE SYNO (OUTSIDE OF BIT ROUTINES) |
||||
; SYNO - FLAGS IF WE HAVE BLOCK SYNC (16 ZERO DIPOLES) |
||||
; SNSW1 - FLAGS IF WE HAVE BYTE SYNC (A LONGLONG) |
||||
; DATA - HOLDS MOST RECENT DIPOLE BIT VALUE |
||||
; MYCH - HOLDS INPUT BYTE BEING BUILT |
||||
; FIRT - USED TO INDICATE WHICH HALF OF DIPOLE WE'RE IN |
||||
; SVXT - TEMP USED TO ADJUST SOFTWARE SERVO |
||||
; TEMP - USED TO HOLD DIPOLE TIME DURING TYPE CALCULATIONS |
||||
; PRTY - HOLDS CURRENT CALCULATED PARITY BIT |
||||
; PRP - HAS COMBINED ERROR VALUES FROM BIT ROUTINES |
||||
; FSBLK - INDICATE WHICH BLOCK WE'RE LOOKING AT (0 TO EXIT) |
||||
; SHCNL - HOLDS FSBLK, USED TO DIRECT ROUTINES, BECAUSE OF EXIT CASE |
||||
; RDFLG - HOLDS FUNCTION MODE |
||||
; MI - WAITING FOR BLOCK SYNC |
||||
; VS - IN DATA BLOCK READING DATA |
||||
; NE - WAITING FOR BYTE SYNC |
||||
; SAL - INDIRECT TO DATA STORAGE AREA |
||||
; SHCNH - LEFT OVER FROM DEBUGGING |
||||
; BAD - STORAGE SPACE FOR BAD READ LOCATIONS (BOTTOM OF STACK) |
||||
; PTR1 - COUNT OF READ LOCATIONS IN ERROR (POINTER INTO BAD, MAX 61) |
||||
; PTR2 - COUNT OF RE-READ LOCATIONS (POINTER INTO BAD, DURING RE-READ) |
||||
; VERCHK - VERIFY OR LOAD FLAG (Z - LOADING) |
||||
; CMP0 - SOFTWARE SERVO (+/- ADJUST TO TIME CALCS) |
||||
; DPSW - IF NZ THEN EXPECTING LL/L COMBINATION THAT ENDS A BYTE |
||||
; PCNTR - COUNTS DOWN FROM 8-0 FOR DATA THEN TO FF FOR PARITY |
||||
; STUPID - HOLD INDICATOR (NZ - NO T1IRQ YET) FOR T1IRQ |
||||
; KIKA26 - HOLDS OLD D1ICR AFTER CLEAR ON READ |
||||
; |
||||
.PAG 'CASSETTE READ' |
||||
READ LDX D1T2H ;GET TIME SINCE LAST INTERRUPT |
||||
LDY #$FF ;COMPUTE COUNTER DIFFERENCE |
||||
TYA |
||||
SBC D1T2L |
||||
CPX D1T2H ;CHECK FOR TIMER HIGH ROLLOVER... |
||||
BNE READ ;...YES THEN RECOMPUTE |
||||
STX TEMP |
||||
TAX |
||||
STY D1T2L ;RELOAD TIMER2 (COUNT DOWN FROM $FFFF) |
||||
STY D1T2H |
||||
LDA #$19 ;ENABLE TIMER |
||||
STA D1CRB |
||||
LDA D1ICR ;CLEAR READ INTERRUPT |
||||
STA KIKA26 ;SAVE FOR LATTER |
||||
TYA |
||||
SBC TEMP ;CALCULATE HIGH |
||||
STX TEMP |
||||
LSR A ;MOVE TWO BITS FROM HIGH TO TEMP |
||||
ROR TEMP |
||||
LSR A |
||||
ROR TEMP |
||||
LDA CMP0 ;CALC MIN PULSE VALUE |
||||
CLC |
||||
ADC #60 |
||||
CMP TEMP ;IF PULSE LESS THAN MIN... |
||||
BCS RDBK ;...THEN IGNORE AS NOISE |
||||
LDX DPSW ;CHECK IF LAST BIT... |
||||
BEQ RJDJ ;...NO THEN CONTINUE |
||||
JMP RADJ ;...YES THEN GO FINISH BYTE |
||||
.SKI 2 |
||||
RJDJ LDX PCNTR ;IF 9 BITS READ... |
||||
BMI JRAD2 ;... THEN GOTO ENDING |
||||
LDX #0 ;SET BIT VALUE TO ZERO |
||||
ADC #48 ;ADD UP TO HALF WAY BETWEEN... |
||||
ADC CMP0 ;...SHORT PULSE AND SYNC PULSE |
||||
CMP TEMP ;CHECK FOR SHORT... |
||||
BCS RADX2 ;...YES IT'S A SHORT |
||||
INX ;SET BIT VALUE TO ONE |
||||
ADC #38 ;MOVE TO MIDDLE OF HIGH |
||||
ADC CMP0 |
||||
CMP TEMP ;CHECK FOR ONE... |
||||
BCS RADL ;...YES IT'S A ONE |
||||
ADC #44 ;MOVE TO LONGLONG |
||||
ADC CMP0 |
||||
CMP TEMP ;CHECK FOR LONGLONG... |
||||
BCC SRER ;...GREATER THAN IS ERROR |
||||
JRAD2 JMP RAD2 ;...IT'S A LONGLONG |
||||
.SKI 2 |
||||
SRER LDA SNSW1 ;IF NOT SYNCRONIZED... |
||||
BEQ RDBK ;...THEN NO ERROR |
||||
STA RER ;...ELSE FLAG RER |
||||
BNE RDBK ;JMP |
||||
.SKI 2 |
||||
RADX2 INC REZ ;COUNT REZ UP ON ZEROS |
||||
BCS RAD5 ;JMP |
||||
RADL DEC REZ ;COUNT REZ DOWN ON ONES |
||||
RAD5 SEC ;CALC ACTUAL VALUE FOR COMPARE STORE |
||||
SBC #19 |
||||
SBC TEMP ;SUBTRACT INPUT VALUE FROM CONSTANT... |
||||
ADC SVXT ;...ADD DIFFERENCE TO TEMP STORAGE... |
||||
STA SVXT ;...USED LATER TO ADJUST SOFT SERVO |
||||
LDA FIRT ;FLIP DIPOLE FLAG |
||||
EOR #1 |
||||
STA FIRT |
||||
BEQ RAD3 ;SECOND HALF OF DIPOLE |
||||
STX DATA ;FIRST HALF SO STORE ITS VALUE |
||||
.SKI 3 |
||||
RDBK LDA SNSW1 ;IF NO BYTE START... |
||||
BEQ RADBK ;...THEN RETURN |
||||
LDA KIKA26 ;CHECK TO SEE IF TIMER1 IRQD US... |
||||
AND #$01 |
||||
BNE RADKX ;...YES |
||||
LDA STUPID ;CHECK FOR OLD T1IRQ |
||||
BNE RADBK ;NO...SO EXIT |
||||
; |
||||
RADKX LDA #0 ;...YES, SET DIPOLE FLAG FOR FIRST HALF |
||||
STA FIRT |
||||
STA STUPID ;SET T1IRQ FLAG |
||||
LDA PCNTR ;CHECK WHERE WE ARE IN BYTE... |
||||
BPL RAD4 ;...DOING DATA |
||||
BMI JRAD2 ;...PROCESS PARITY |
||||
.SKI 2 |
||||
RADP LDX #166 ;SET UP FOR LONGLONG TIMEOUT |
||||
JSR STT1 |
||||
LDA PRTY ;IF PARITY NOT EVEN... |
||||
BNE SRER ;...THEN GO SET ERROR |
||||
RADBK JMP PREND ;GO RESTORE REGS AND RTI |
||||
.SKI 3 |
||||
RAD3 LDA SVXT ;ADJUST THE SOFTWARE SERVO (CMP0) |
||||
BEQ ROUT1 ;NO ADJUST |
||||
BMI ROUT2 ;ADJUST FOR MORE BASE TIME |
||||
DEC CMP0 ;ADJUST FOR LESS BASE TIME |
||||
.BYT $2C ;SKIP TWO BYTES |
||||
ROUT2 INC CMP0 |
||||
ROUT1 LDA #0 ;CLEAR DIFFERENCE VALUE |
||||
STA SVXT |
||||
;CHECK FOR CONSECUTIVE LIKE VALUES IN DIPOLE... |
||||
CPX DATA |
||||
BNE RAD4 ;...NO, GO PROCESS INFO |
||||
TXA ;...YES SO CHECK THE VALUES... |
||||
BNE SRER ;IF THEY WERE ONES THEN ERROR |
||||
; CONSECUTIVE ZEROS |
||||
LDA REZ ;...CHECK HOW MANY ZEROS HAVE HAPPENED |
||||
BMI RDBK ;...IF MANY DON'T CHECK |
||||
CMP #16 ;... DO WE HAVE 16 YET?... |
||||
BCC RDBK ;....NO SO CONTINUE |
||||
STA SYNO ;....YES SO FLAG SYNO (BETWEEN BLOCKS) |
||||
BCS RDBK ;JMP |
||||
.SKI 3 |
||||
RAD4 TXA ;MOVE READ DATA TO .A |
||||
EOR PRTY ;CALCULATE PARITY |
||||
STA PRTY |
||||
LDA SNSW1 ;REAL DATA?... |
||||
BEQ RADBK ;...NO SO FORGET BY EXITING |
||||
DEC PCNTR ;DEC BIT COUNT |
||||
BMI RADP ;IF MINUS THEN TIME FOR PARITY |
||||
LSR DATA ;SHIFT BIT FROM DATA... |
||||
ROR MYCH ;...INTO BYTE STORAGE (MYCH) BUFFER |
||||
LDX #218 ;SET UP FOR NEXT DIPOLE |
||||
JSR STT1 |
||||
JMP PREND ;RESTORE REGS AND RTI |
||||
.SKI 3 |
||||
; RAD2 - LONGLONG HANDLER (COULD BE A LONG ONE) |
||||
RAD2 LDA SYNO ;HAVE WE GOTTEN BLOCK SYNC... |
||||
BEQ RAD2Y ;...NO |
||||
LDA SNSW1 ;CHECK IF WE'VE HAD A REAL BYTE START... |
||||
BEQ RAD2X ;...NO |
||||
RAD2Y LDA PCNTR ;ARE WE AT END OF BYTE... |
||||
BMI RAD2X ;YES...GO ADJUST FOR LONGLONG |
||||
JMP RADL ;...NO SO TREAT IT AS A LONG ONE READ |
||||
.SKI 2 |
||||
RAD2X LSR TEMP ;ADJUST TIMEOUT FOR... |
||||
LDA #147 ;...LONGLONG PULSE VALUE |
||||
SEC |
||||
SBC TEMP |
||||
ADC CMP0 |
||||
ASL A |
||||
TAX ;AND SET TIMEOUT FOR LAST BIT |
||||
JSR STT1 |
||||
INC DPSW ;SET BIT THROW AWAY FLAG |
||||
LDA SNSW1 ;IF BYTE SYNCRONIZED.... |
||||
BNE RADQ2 ;...THEN SKIP TO PASS CHAR |
||||
LDA SYNO ;THROWS OUT DATA UNTILL BLOCK SYNC... |
||||
BEQ RDBK2 ;...NO BLOCK SYNC |
||||
STA RER ;FLAG DATA AS ERROR |
||||
LDA #0 ;KILL 16 SYNC FLAG |
||||
STA SYNO |
||||
LDA #$81 ;SET UP FOR TIMER1 INTERRUPTS |
||||
STA D1ICR |
||||
STA SNSW1 ;FLAG THAT WE HAVE BYTE SYNCRONIZED |
||||
; |
||||
RADQ2 LDA SYNO ;SAVE SYNO STATUS |
||||
STA DIFF |
||||
BEQ RADK ;NO BLOCK SYNC, NO BYTE LOOKING |
||||
LDA #0 ;TURN OFF BYTE SYNC SWITCH |
||||
STA SNSW1 |
||||
LDA #$01 ;DISABLE TIMER1 INTERRUPTS |
||||
STA D1ICR |
||||
RADK LDA MYCH ;PASS CHARACTER TO BYTE ROUTINE |
||||
STA OCHAR |
||||
LDA RER ;COMBINE ERROR VALUES WITH ZERO COUNT... |
||||
ORA REZ |
||||
STA PRP ;...AND SAVE IN PRP |
||||
RDBK2 JMP PREND ;GO BACK AND GET LAST BYTE |
||||
.SKI 2 |
||||
RADJ JSR NEWCH ;FINISH BYTE, CLR FLAGS |
||||
STA DPSW ;CLEAR BIT THROW AWAY FLAG |
||||
LDX #218 ;INITILIZE FOR NEXT DIPOLE |
||||
JSR STT1 |
||||
LDA FSBLK ;CHECK FOR LAST VALUE |
||||
BEQ RD15 |
||||
STA SHCNL |
||||
.PAG 'BYTE HANDLER' |
||||
;************************************************* |
||||
;* BYTE HANDLER OF CASSETTE READ * |
||||
;* * |
||||
;* THIS PORTION OF IN LINE CODE IS PASSED THE * |
||||
;* BYTE ASSEMBLED FROM READING TAPE IN OCHAR. * |
||||
;* RER IS SET IF THE BYTE READ IS IN ERROR. * |
||||
;* REZ IS SET IF THE INTERRUPT PROGRAM IS READING* |
||||
;* ZEROS. RDFLG TELLS US WHAT WE ARE DOING. * |
||||
;* BIT 7 SAYS TO IGNORE BYTES UNTIL REZ IS SET * |
||||
;* BIT 6 SAYS TO LOAD THE BYTE. OTHERWISE RDFLG * |
||||
;* IS A COUNTDOWN AFTER SYNC. IF VERCK IS SET * |
||||
;* WE DO A COMPARE INSTEAD OF A STORE AND SET * |
||||
;* STATUS. FSBLK COUNTS THE TWO BLOCKS. PTR1 IS * |
||||
;* INDEX TO ERROR TABLE FOR PASS1. PTR2 IS INDEX* |
||||
;* TO CORRECTION TABLE FOR PASS2. * |
||||
;************************************************* |
||||
; |
||||
SPERR=16 |
||||
CKERR=32 |
||||
SBERR=4 |
||||
LBERR=8 |
||||
; |
||||
RD15 LDA #$F |
||||
; |
||||
BIT RDFLG ;TEST FUNCTION MODE |
||||
BPL RD20 ;NOT WAITING FOR ZEROS |
||||
; |
||||
LDA DIFF ;ZEROS YET? |
||||
BNE RD12 ;YES...WAIT FOR SYNC |
||||
LDX FSBLK ;IS PASS OVER? |
||||
DEX ;...IF FSBLK ZERO THEN NO ERROR (FIRST GOOD) |
||||
BNE RD10 ;NO... |
||||
; |
||||
LDA #LBERR |
||||
JSR UDST ;YES...LONG BLOCK ERROR |
||||
BNE RD10 ;BRANCH ALWAYS |
||||
; |
||||
RD12 LDA #0 |
||||
STA RDFLG ;NEW MODE IS WAIT FOR SYNC |
||||
RD10 JMP PREND ;EXIT...DONE |
||||
; |
||||
RD20 BVS RD60 ;WE ARE LOADING |
||||
BNE RD200 ;WE ARE SYNCING |
||||
; |
||||
LDA DIFF ;DO WE HAVE BLOCK SYNC... |
||||
BNE RD10 ;...YES, EXIT |
||||
LDA PRP ;IF FIRST BYTE HAS ERROR... |
||||
BNE RD10 ;...THEN SKIP (EXIT) |
||||
LDA SHCNL ;MOVE FSBLK TO CARRY... |
||||
LSR A |
||||
LDA OCHAR ; SHOULD BE A HEADER COUNT CHAR |
||||
BMI RD22 ;IF NEG THEN FIRSTBLOCK DATA |
||||
BCC RD40 ;...EXPECTING FIRSTBLOCK DATA...YES |
||||
CLC |
||||
RD22 BCS RD40 ;EXPECTING SECOND BLOCK?...YES |
||||
AND #$F ;MASK OFF HIGH STORE HEADER COUNT... |
||||
STA RDFLG ;...IN MODE FLAG (HAVE CORRECT BLOCK) |
||||
RD200 DEC RDFLG ;WAIT UNTILL WE GET REAL DATA... |
||||
BNE RD10 ;...9876543210 REAL |
||||
LDA #$40 ;NEXT UP IS REAL DATA... |
||||
STA RDFLG ;...SET DATA MODE |
||||
JSR RD300 ;GO SETUP ADDRESS POINTERS |
||||
LDA #0 ;DEBUG CODE################################################## |
||||
STA SHCNH |
||||
BEQ RD10 ;JMP TO CONTINUE |
||||
.SKI 2 |
||||
RD40 LDA #$80 ;WE WANT TO... |
||||
STA RDFLG ;IGNORE BYTES MODE |
||||
BNE RD10 ;JMP |
||||
.SKI 2 |
||||
RD60 LDA DIFF ;CHECK FOR END OF BLOCK... |
||||
BEQ RD70 ;...OKAY |
||||
; |
||||
LDA #SBERR ;SHORT BLOCK ERROR |
||||
JSR UDST |
||||
LDA #0 ;FORCE RDFLG FOR AN END |
||||
JMP RD161 |
||||
.SKI 2 |
||||
RD70 JSR CMPSTE ;CHECK FOR END OF STORAGE AREA |
||||
BCC *+5 ;NOT DONE YET |
||||
JMP RD160 |
||||
LDX SHCNL ;CHECK WHICH PASS... |
||||
DEX |
||||
BEQ RD58 ;...SECOND PASS |
||||
LDA VERCK ;CHECK IF LOAD OR VERIFY... |
||||
BEQ RD80 ;...LOADING |
||||
LDY #0 ;...JUST VERIFYING |
||||
LDA OCHAR |
||||
CMP (SAL)Y ;COMPARE WITH DATA IN PET |
||||
BEQ RD80 ;...GOOD SO CONTINUE |
||||
LDA #1 ;...BAD SO FLAG... |
||||
STA PRP ;...AS AN ERROR |
||||
.SKI 1 |
||||
; STORE BAD LOCATIONS FOR SECOND PASS RE-TRY |
||||
RD80 LDA PRP ;CHK FOR ERRORS... |
||||
BEQ RD59 ;...NO ERRORS |
||||
LDX #61 ;MAX ALLOWED IS 30 |
||||
CPX PTR1 ;ARE WE AT MAX?... |
||||
BCC RD55 ;...YES, FLAG AS SECOND PASS ERROR |
||||
LDX PTR1 ;GET INDEX INTO BAD... |
||||
LDA SAH ;...AND STORE THE BAD LOCATION |
||||
STA BAD+1,X ;...IN BAD TABLE |
||||
LDA SAL |
||||
STA BAD,X |
||||
INX ;ADVANCE POINTER TO NEXT |
||||
INX |
||||
STX PTR1 |
||||
JMP RD59 ;GO STORE CHARACTER |
||||
.SKI 2 |
||||
; CHECK BAD TABLE FOR RE-TRY (SECOND PASS) |
||||
RD58 LDX PTR2 ;HAVE WE DONE ALL IN THE TABLE?... |
||||
CPX PTR1 |
||||
BEQ RD90 ;...YES |
||||
LDA SAL ;SEE IF THIS IS NEXT IN THE TABLE... |
||||
CMP BAD,X |
||||
BNE RD90 ;...NO |
||||
LDA SAH |
||||
CMP BAD+1,X |
||||
BNE RD90 ;...NO |
||||
INC PTR2 ;WE FOUND NEXT ONE, SO ADVANCE POINTER |
||||
INC PTR2 |
||||
LDA VERCK ;DOING A LOAD OR VERIFY?... |
||||
BEQ RD52 ;...LOADING |
||||
LDA OCHAR ;...VERIFYING, SO CHECK |
||||
LDY #0 |
||||
CMP (SAL)Y |
||||
BEQ RD90 ;...OKAY |
||||
INY ;MAKE .Y= 1 |
||||
STY PRP ;FLAG IT AS AN ERROR |
||||
.SKI 2 |
||||
RD52 LDA PRP ;A SECOND PASS ERROR?... |
||||
BEQ RD59 ;...NO |
||||
;SECOND PASS ERR |
||||
RD55 LDA #SPERR |
||||
JSR UDST |
||||
BNE RD90 ;JMP |
||||
.SKI 2 |
||||
RD59 LDA VERCK ;LOAD OR VERIFY?... |
||||
BNE RD90 ;...VERIFY, DON'T STORE |
||||
TAY ;MAKE Y ZERO |
||||
LDA OCHAR |
||||
STA (SAL)Y ;STORE CHARACTER |
||||
RD90 JSR INCSAL ;INCREMENT ADDR. |
||||
BNE RD180 ;BRANCH ALWAYS |
||||
.SKI 3 |
||||
RD160 LDA #$80 ;SET MODE SKIP NEXT DATA |
||||
RD161 STA RDFLG |
||||
; |
||||
; MODIFY FOR C64 6526'S |
||||
; |
||||
SEI ;PROTECT CLEARING OF T1 INFORMATION |
||||
LDX #$01 |
||||
STX D1ICR ;CLEAR T1 ENABLE... |
||||
LDX D1ICR ;CLEAR THE INTERRUPT |
||||
LDX FSBLK ;DEC FSBLK FOR NEXT PASS... |
||||
DEX |
||||
BMI RD167 ;WE ARE DONE...FSBLK=0 |
||||
STX FSBLK ;...ELSE FSBLK=NEXT |
||||
RD167 DEC SHCNL ;DEC PASS CALC... |
||||
BEQ RD175 ;...ALL DONE |
||||
LDA PTR1 ;CHECK FOR FIRST PASS ERRORS... |
||||
BNE RD180 ;...YES SO CONTINUE |
||||
STA FSBLK ;CLEAR FSBLK IF NO ERRORS... |
||||
BEQ RD180 ;JMP TO EXIT |
||||
.SKI 2 |
||||
RD175 JSR TNIF ;READ IT ALL...EXIT |
||||
JSR RD300 ;RESTORE SAL & SAH |
||||
LDY #0 ;SET SHCNH TO ZERO... |
||||
STY SHCNH ;...USED TO CALC PARITY BYTE |
||||
; |
||||
;COMPUTE PARITY OVER LOAD |
||||
; |
||||
VPRTY LDA (SAL)Y ;CALC BLOCK BCC |
||||
EOR SHCNH |
||||
STA SHCNH |
||||
JSR INCSAL ;INCREMENT ADDRESS |
||||
JSR CMPSTE ;TEST AGAINST END |
||||
BCC VPRTY ;NOT DONE YET... |
||||
LDA SHCNH ;CHECK FOR BCC CHAR MATCH... |
||||
EOR OCHAR |
||||
BEQ RD180 ;...YES, EXIT |
||||
;CHKSUM ERROR |
||||
LDA #CKERR |
||||
JSR UDST |
||||
RD180 JMP PREND |
||||
.SKI 4 |
||||
RD300 LDA STAH ; RESTORE STARTING ADDRESS... |
||||
STA SAH ;...POINTERS (SAH & SAL) |
||||
LDA STAL |
||||
STA SAL |
||||
RTS |
||||
.SKI 4 |
||||
NEWCH LDA #8 ;SET UP FOR 8 BITS+PARITY |
||||
STA PCNTR |
||||
LDA #0 ;INITILIZE... |
||||
STA FIRT ;..DIPOLE COUNTER |
||||
STA RER ;..ERROR FLAG |
||||
STA PRTY ;..PARITY BIT |
||||
STA REZ ;..ZERO COUNT |
||||
RTS ;.A=0 ON RETURN |
||||
.END |
||||
; RSR 7/31/80 ADD COMMENTS |
||||
; RSR 3/28/82 MODIFY FOR C64 (ADD STUPID/COMMENTS) |
||||
; RSR 3/29/82 PUT BLOCK T1IRQ CONTROL |
||||
; RSR 5/11/82 MODIFY C64 STUPID CODE |
@ -0,0 +1,187 @@
|
||||
.PAG 'RS232 INOUT' |
||||
; OUTPUT A FILE OVER USR PORT |
||||
; USING RS232 |
||||
; |
||||
CKO232 STA DFLTO ;SET DEFAULT OUT |
||||
LDA M51CDR ;CHECK FOR 3/X LINE |
||||
LSR A |
||||
BCC CKO100 ;3LINE...NO TURN AROUND |
||||
; |
||||
;*TURN AROUND LOGIC |
||||
; |
||||
; CHECK FOR DSR AND RTS |
||||
; |
||||
LDA #$02 ;BIT RTS IS ON |
||||
BIT D2PRB |
||||
BPL CKDSRX ;NO DSR...ERROR |
||||
BNE CKO100 ;RTS...OUTPUTING OR FULL DUPLEX |
||||
; |
||||
; CHECK FOR ACTIVE INPUT |
||||
; RTS WILL BE LOW IF CURRENTLY INPUTING |
||||
; |
||||
CKO020 LDA ENABL |
||||
AND #$02 ;LOOK AT IER FOR T2 |
||||
BNE CKO020 ;HANG UNTILL INPUT DONE |
||||
; |
||||
; WAIT FOR CTS TO BE OFF AS SPEC REQS |
||||
; |
||||
CKO030 BIT D2PRB |
||||
BVS CKO030 |
||||
; |
||||
; TURN ON RTS |
||||
; |
||||
LDA D2PRB |
||||
ORA #$02 |
||||
STA D2PRB |
||||
; |
||||
; WAIT FOR CTS TO GO ON |
||||
; |
||||
CKO040 BIT D2PRB |
||||
BVS CKO100 ;DONE... |
||||
BMI CKO040 ;WE STILL HAVE DSR |
||||
; |
||||
CKDSRX LDA #$40 ;A DATA SET READY ERROR |
||||
STA RSSTAT ;MAJOR ERROR....WILL REQUIRE REOPEN |
||||
; |
||||
CKO100 CLC ;NO ERROR |
||||
RTS |
||||
; |
||||
.PAGE 'RS232 INOUT' |
||||
; BSO232 - OUTPUT A CHAR RS232 |
||||
; DATA PASSED IN T1 FROM BSOUT |
||||
; |
||||
; HANG LOOP FOR BUFFER FULL |
||||
; |
||||
BSOBAD JSR BSO100 ;KEEP TRYING TO START SYSTEM... |
||||
; |
||||
; BUFFER HANDLER |
||||
; |
||||
BSO232 LDY RODBE |
||||
INY |
||||
CPY RODBS ;CHECK FOR BUFFER FULL |
||||
BEQ BSOBAD ;HANG IF SO...TRYING TO RESTART |
||||
STY RODBE ;INDICATE NEW START |
||||
DEY |
||||
LDA T1 ;GET DATA... |
||||
STA (ROBUF)Y ;STORE DATA |
||||
; |
||||
; SET UP IF NECESSARY TO OUTPUT |
||||
; |
||||
BSO100 LDA ENABL ;CHECK FOR A T1 NMI ENABLE |
||||
LSR A ;BIT 0 |
||||
BCS BSO120 ;RUNNING....SO EXIT |
||||
; |
||||
; SET UP T1 NMI'S |
||||
; |
||||
BSO110 LDA #$10 ;TURN OFF TIMER TO PREVENT FALSE START... |
||||
STA D2CRA |
||||
LDA BAUDOF ;SET UP TIMER1 |
||||
STA D2T1L |
||||
LDA BAUDOF+1 |
||||
STA D2T1H |
||||
LDA #$81 |
||||
JSR OENABL |
||||
JSR RSTBGN ;SET UP TO SEND (WILL STOP ON CTS OR DSR ERROR) |
||||
LDA #$11 ;TURN ON TIMER |
||||
STA D2CRA |
||||
BSO120 RTS |
||||
.PAGE 'RS232 INOUT' |
||||
; INPUT A FILE OVER USER PORT |
||||
; USING RS232 |
||||
; |
||||
CKI232 STA DFLTN ;SET DEFAULT INPUT |
||||
; |
||||
LDA M51CDR ;CHECK FOR 3/X LINE |
||||
LSR A |
||||
BCC CKI100 ;3 LINE...NO HANDSHAKE |
||||
; |
||||
AND #$08 ;FULL/HALF CHECK (BYTE SHIFTED ABOVE) |
||||
BEQ CKI100 ;FULL...NO HANDSHAKE |
||||
; |
||||
;*TURN AROUND LOGIC |
||||
; |
||||
; CHECK IF DSR AND NOT RTS |
||||
; |
||||
LDA #$02 ;BIT RTS IS ON |
||||
BIT D2PRB |
||||
BPL CKDSRX ;NO DSR...ERROR |
||||
BEQ CKI110 ;RTS LOW...IN CORRECT MODE |
||||
; |
||||
; WAIT FOR ACTIVE OUTPUT TO BE DONE |
||||
; |
||||
CKI010 LDA ENABL |
||||
LSR A ;CHECK T1 (BIT 0) |
||||
BCS CKI010 |
||||
; |
||||
; TURN OFF RTS |
||||
; |
||||
LDA D2PRB |
||||
AND #$FF-02 |
||||
STA D2PRB |
||||
; |
||||
; WAIT FOR DCD TO GO HIGH (IN SPEC) |
||||
; |
||||
CKI020 LDA D2PRB |
||||
AND #$04 |
||||
BEQ CKI020 |
||||
; |
||||
; ENABLE FLAG FOR RS232 INPUT |
||||
; |
||||
CKI080 LDA #$90 |
||||
CLC ;NO ERROR |
||||
JMP OENABL ;FLAG IN ENABL********** |
||||
; |
||||
; IF NOT 3 LINE HALF THEN... |
||||
; SEE IF WE NEED TO TURN ON FLAG |
||||
; |
||||
CKI100 LDA ENABL ;CHECK FOR FLAG OR T2 ACTIVE |
||||
AND #$12 |
||||
BEQ CKI080 ;NO NEED TO TURN ON |
||||
CKI110 CLC ;NO ERROR |
||||
RTS |
||||
.PAGE 'RS232 INOUT' |
||||
; BSI232 - INPUT A CHAR RS232 |
||||
; |
||||
; BUFFER HANDLER |
||||
; |
||||
BSI232 LDA RSSTAT ;GET STATUS UP TO CHANGE... |
||||
LDY RIDBS ;GET LAST BYTE ADDRESS |
||||
CPY RIDBE ;SEE IF BUFFER EMPTY |
||||
BEQ BSI010 ;RETURN A NULL IF NO CHAR |
||||
; |
||||
AND #$FF-$08 ;CLEAR BUFFER EMPTY STATUS |
||||
STA RSSTAT |
||||
LDA (RIBUF)Y ;GET LAST CHAR |
||||
INC RIDBS ;INC TO NEXT POS |
||||
; |
||||
; RECEIVER ALWAYS RUNS |
||||
; |
||||
RTS |
||||
; |
||||
BSI010 ORA #$08 ;SET BUFFER EMPTY STATUS |
||||
STA RSSTAT |
||||
LDA #$0 ;RETURN A NULL |
||||
RTS |
||||
.SKI 4 |
||||
; RSP232 - PROTECT SERIAL/CASS FROM RS232 NMI'S |
||||
; |
||||
RSP232 PHA ;SAVE .A |
||||
LDA ENABL ;DOES RS232 HAVE ANY ENABLES? |
||||
BEQ RSPOK ;NO... |
||||
RSPOFF LDA ENABL ;WAIT UNTILL DONE |
||||
AND #%00000011 ; WITH T1 & T2 |
||||
BNE RSPOFF |
||||
LDA #%00010000 ; DISABLE FLAG (NEED TO RENABLE IN USER CODE) |
||||
STA D2ICR ;TURN OF ENABL************ |
||||
LDA #0 |
||||
STA ENABL ;CLEAR ALL ENABLS |
||||
RSPOK PLA ;ALL DONE |
||||
RTS |
||||
.END |
||||
; RSR 8/24/80 ORIGINAL CODE OUT |
||||
; RSR 8/25/80 ORIGINAL CODE IN |
||||
; RSR 9/22/80 REMOVE PARALLEL REFS & FIX XLINE LOGIC |
||||
; RSR 12/11/81 MODIFY FOR VIC-40 I/O |
||||
; RSR 2/15/82 FIX SOME ENABL PROBLEMS |
||||
; RSR 3/31/82 FIX FLASE STARTS ON TRANSMITT |
||||
; RSR 5/12/82 REDUCE CODE AND FIX X-LINE CTS HOLD-OFF |
@ -0,0 +1,208 @@
|
||||
.PAGE 'NMI HANDLER' |
||||
NMI SEI ;NO IRQ'S ALLOWED... |
||||
JMP (NMINV) ;...COULD MESS UP CASSETTES |
||||
NNMI PHA |
||||
TXA |
||||
PHA |
||||
TYA |
||||
PHA |
||||
NNMI10 LDA #$7F ;DISABLE ALL NMI'S |
||||
STA D2ICR |
||||
LDY D2ICR ;CHECK IF REAL NMI... |
||||
BMI NNMI20 ;NO...RS232/OTHER |
||||
; |
||||
NNMI18 JSR A0INT ;CHECK IF $A0 IN...NO .Y |
||||
BNE NNMI19 ;...NO |
||||
JMP ($8002) ;...YES |
||||
; |
||||
; CHECK FOR STOP KEY DOWN |
||||
; |
||||
NNMI19 |
||||
JSR UD60 ;NO .Y |
||||
JSR STOP ;NO .Y |
||||
BNE NNMI20 ;NO STOP KEY...TEST FOR RS232 |
||||
; |
||||
; TIMB - WHERE SYSTEM GOES ON A BRK INSTRUCTION |
||||
; |
||||
TIMB JSR RESTOR ;RESTORE SYSTEM INDIRECTS |
||||
JSR IOINIT ;RESTORE I/O FOR BASIC |
||||
JSR CINT ;RESTORE SCREEN FOR BASIC |
||||
JMP ($A002) ;...NO, SO BASIC WARM START |
||||
.SKI 2 |
||||
; DISABLE NMI'S UNTILL READY |
||||
; SAVE ON STACK |
||||
; |
||||
NNMI20 TYA ;.Y SAVED THROUGH RESTORE |
||||
AND ENABL ;SHOW ONLY ENABLES |
||||
TAX ;SAVE IN .X FOR LATTER |
||||
; |
||||
; T1 NMI CHECK - TRANSMITT A BIT |
||||
; |
||||
AND #$01 ;CHECK FOR T1 |
||||
BEQ NNMI30 ;NO... |
||||
; |
||||
LDA D2PRA |
||||
AND #$FF-$04 ;FIX FOR CURRENT I/O |
||||
ORA NXTBIT ;LOAD DATA AND... |
||||
STA D2PRA ;...SEND IT |
||||
; |
||||
LDA ENABL ;RESTORE NMI'S |
||||
STA D2ICR ;READY FOR NEXT... |
||||
; |
||||
; BECAUSE OF 6526 ICR STRUCTURE... |
||||
; HANDLE ANOTHER NMI AS A SUBROUTINE |
||||
; |
||||
TXA ;TEST FOR ANOTHER NMI |
||||
AND #$12 ;TEST FOR T2 OR FLAG |
||||
BEQ NNMI25 |
||||
AND #$02 ;CHECK FOR T2 |
||||
BEQ NNMI22 ;MUST BE A FLAG |
||||
; |
||||
JSR T2NMI ;HANDLE A NORMAL BIT IN... |
||||
JMP NNMI25 ;...THEN CONTINUE OUTPUT |
||||
; |
||||
NNMI22 JSR FLNMI ;HANDLE A START BIT... |
||||
; |
||||
NNMI25 JSR RSTRAB ;GO CALC INFO (CODE COULD BE IN LINE) |
||||
JMP NMIRTI |
||||
; |
||||
.SKI 2 |
||||
; T2 NMI CHECK - RECIEVE A BIT |
||||
; |
||||
NNMI30 TXA |
||||
AND #$02 ;MASK TO T2 |
||||
BEQ NNMI40 ;NO... |
||||
; |
||||
JSR T2NMI ;HANDLE INTERRUPT |
||||
JMP NMIRTI |
||||
.SKI 2 |
||||
; FLAG NMI HANDLER - RECIEVE A START BIT |
||||
; |
||||
NNMI40 TXA ;CHECK FOR EDGE |
||||
AND #$10 ;ON FLAG... |
||||
BEQ NMIRTI ;NO... |
||||
; |
||||
JSR FLNMI ;START BIT ROUTINE |
||||
.SKI 2 |
||||
NMIRTI LDA ENABL ;RESTORE NMI'S |
||||
STA D2ICR |
||||
PREND PLA ;BECAUSE OF MISSING SCREEN EDITOR |
||||
TAY |
||||
PLA |
||||
TAX |
||||
PLA |
||||
RTI |
||||
.SKI 4 |
||||
; BAUDO TABLE CONTAINS VALUES |
||||
; FOR 14.31818E6/14/BAUD RATE/2 (NTSC) |
||||
; |
||||
BAUDO .WOR 10277-CBIT ; 50 BAUD |
||||
.WOR 6818-CBIT ; 75 BAUD |
||||
.WOR 4649-CBIT ; 110 BAUD |
||||
.WOR 3800-CBIT ; 134.6 BAUD |
||||
.WOR 3409-CBIT ; 150 BAUD |
||||
.WOR 1705-CBIT ; 300 BAUD |
||||
.WOR 852-CBIT ; 600 BAUD |
||||
.WOR 426-CBIT ; 1200 BAUD |
||||
.WOR 284-CBIT ; 1800 BAUD |
||||
.WOR 213-CBIT ; 2400 BAUD |
||||
; |
||||
; CBIT - AN ADJUSTMENT TO MAKE NEXT T2 HIT NEAR CENTER |
||||
; OF THE NEXT BIT. |
||||
; APROX THE TIME TO SERVICE A CB1 NMI |
||||
CBIT =100 ;CYCLES |
||||
.PAG 'NMI - SUBROUTINES' |
||||
; T2NMI - SUBROUTINE TO HANDLE AN RS232 |
||||
; BIT INPUT. |
||||
; |
||||
T2NMI LDA D2PRB ;GET DATA IN |
||||
AND #01 ;MASK OFF... |
||||
STA INBIT ;...SAVE FOR LATTER |
||||
; |
||||
; UPDATE T2 FOR MID BIT CHECK |
||||
; (WORST CASE <213 CYCLES TO HERE) |
||||
; (CALC 125 CYCLES+43-66 DEAD) |
||||
; |
||||
LDA D2T2L ;CALC NEW TIME & CLR NMI |
||||
SBC #22+6 |
||||
ADC BAUDOF |
||||
STA D2T2L |
||||
LDA D2T2H |
||||
ADC BAUDOF+1 |
||||
STA D2T2H |
||||
; |
||||
LDA #$11 ;ENABLE TIMER |
||||
STA D2CRB |
||||
; |
||||
LDA ENABL ;RESTORE NMI'S EARLY... |
||||
STA D2ICR |
||||
; |
||||
LDA #$FF ;ENABLE COUNT FROM $FFFF |
||||
STA D2T2L |
||||
STA D2T2H |
||||
; |
||||
JMP RSRCVR ;GO SHIFT IN... |
||||
.SKI 3 |
||||
; FLNMI - SUBROUTINE TO HANDLE THE |
||||
; START BIT TIMING.. |
||||
; |
||||
; CHECK FOR NOISE ? |
||||
; |
||||
FLNMI |
||||
; |
||||
; GET HALF BIT RATE VALUE |
||||
; |
||||
LDA M51AJB |
||||
STA D2T2L |
||||
LDA M51AJB+1 |
||||
STA D2T2H |
||||
; |
||||
LDA #$11 ;ENABLE TIMER |
||||
STA D2CRB |
||||
; |
||||
LDA #$12 ;DISABLE FLAG, ENABLE T2 |
||||
EOR ENABL |
||||
STA ENABL |
||||
;ORA #$82 |
||||
;STA D2ICR |
||||
; |
||||
LDA #$FF ;PRESET FOR COUNT DOWN |
||||
STA D2T2L |
||||
STA D2T2H |
||||
; |
||||
LDX BITNUM ;GET #OF BITS IN |
||||
STX BITCI ;PUT IN RCVRCNT |
||||
RTS |
||||
; |
||||
; POPEN - PATCHES OPEN RS232 FOR UNIVERSAL KERNAL |
||||
; |
||||
POPEN TAX ;WE'RE CALCULATING BAUD RATE |
||||
LDA M51AJB+1 ; M51AJB=FREQ/BAUD/2-100 |
||||
ROL A |
||||
TAY |
||||
TXA |
||||
ADC #CBIT+CBIT |
||||
STA BAUDOF |
||||
TYA |
||||
ADC #0 |
||||
STA BAUDOF+1 |
||||
RTS |
||||
NOP |
||||
NOP |
||||
.END |
||||
; RSR 8/02/80 - ROUTINE FOR PANIC |
||||
; RSR 8/08/80 - PANIC & STOP KEY |
||||
; RSR 8/12/80 - CHANGE FOR A0INT A SUBROUTINE |
||||
; RSR 8/19/80 - ADD RS-232 CHECKS |
||||
; RSR 8/21/80 - MODIFY RS-232 |
||||
; RSR 8/29/80 - CHANGE PANIC ORDER FOR JACK |
||||
; RSR 8/30/80 - ADD T2 |
||||
; RSR 9/22/80 - ADD 1800 BAUD OPPS! |
||||
; RSR 12/08/81 - MODIFY FOR VIC-40 SYSTEM |
||||
; RSR 12/11/81 - CONTINUE MODIFICATIONS (VIC-40) |
||||
; RSR 12/14/81 - MODIFY FOR 6526 TIMER ADJUST |
||||
; RSR 2/09/82 - FIX ENABLE FOR FLAG NMI |
||||
; RSR 2/16/82 - REWRITE FOR 6526 PROBLEMS |
||||
; RSR 3/11/82 - CHANGE NMI RENABLE, FIX RESTORE |
||||
; RSR 3/29/82 - ENABLES ARE ALWAYS OR'ED WITH $80 |
||||
; RSR 6/21/82 - ADD OPEN PATCH |
@ -0,0 +1,130 @@
|
||||
.PAG 'RS-232 RECEIVER' |
||||
; RSRCVR - NMI ROUTINE TO COLLECT |
||||
; DATA INTO BYTES |
||||
; |
||||
; RSR 8/18/80 |
||||
; |
||||
; VARIABLES USED |
||||
; INBIT - INPUT BIT VALUE |
||||
; BITCI - BIT COUNT IN |
||||
; RINONE - FLAG FOR START BIT CHECK <>0 START BIT |
||||
; RIDATA - BYTE INPUT BUFFER |
||||
; RIPRTY - HOLDS BYTE INPUT PARITY |
||||
; RIBUF - INDIRECT POINTER TO DATA BUFFER |
||||
; RIDBE - INPUT BUFFER INDEX TO END |
||||
; RIDBS - INPUT BUFFER POINTER TO START |
||||
; IF RIDBE=RIDBS THEN INPUT BUFFER EMPTY |
||||
; |
||||
RSRCVR LDX RINONE ;CHECK FOR START BIT |
||||
BNE RSRTRT ;WAS START BIT |
||||
; |
||||
DEC BITCI ;CHECK WHERE WE ARE IN INPUT... |
||||
BEQ RSR030 ;HAVE A FULL BYTE |
||||
BMI RSR020 ;GETTING STOP BITS |
||||
; |
||||
; CALC PARITY |
||||
; |
||||
LDA INBIT ;GET DATA UP |
||||
EOR RIPRTY ;CALC NEW PARITY |
||||
STA RIPRTY |
||||
; |
||||
; SHIFT DATA BIT IN |
||||
; |
||||
LSR INBIT ;IN BIT POS 0 |
||||
ROR RIDATA ;C INTO DATA |
||||
; |
||||
; EXIT |
||||
; |
||||
RSREXT RTS |
||||
.PAG 'RS-232 RECEIVER' |
||||
; HAVE STOP BIT, SO STORE IN BUFFER |
||||
; |
||||
RSR018 DEC BITCI ;NO PARITY, DEC SO CHECK WORKS |
||||
RSR020 LDA INBIT ;GET DATA... |
||||
BEQ RSR060 ;...ZERO, AN ERROR? |
||||
; |
||||
LDA M51CTR ;CHECK FOR CORRECT # OF STOP BITS |
||||
ASL A ;CARRY TELL HOW MAY STOP BITS |
||||
LDA #01 |
||||
ADC BITCI |
||||
BNE RSREXT ;NO..EXIT |
||||
; |
||||
; RSRABL - ENABLE TO RECIEVE A BYTE |
||||
; |
||||
RSRABL LDA #$90 ;ENABLE FLAG FOR NEXT BYTE |
||||
STA D2ICR ;TOSS BAD/OLD NMI |
||||
ORA ENABL ;MARK IN ENABLE REGISTER*********** |
||||
STA ENABL ;RE-ENABLED BY JMP OENABL |
||||
STA RINONE ;FLAG FOR START BIT |
||||
; |
||||
RSRSXT LDA #$02 ;DISABLE T2 |
||||
JMP OENABL ;FLIP-OFF ENABL*************** |
||||
.SKI 2 |
||||
; RECIEVER START BIT CHECK |
||||
; |
||||
RSRTRT LDA INBIT ;CHECK IF SPACE |
||||
BNE RSRABL ;BAD...TRY AGAIN |
||||
STA RINONE ;GOOD...DISABLE FLAG |
||||
RTS ;AND EXIT |
||||
.SKI 4 |
||||
; |
||||
; PUT DATA IN BUFFER (AT PARITY TIME) |
||||
; |
||||
RSR030 LDY RIDBE ;GET END |
||||
INY |
||||
CPY RIDBS ;HAVE WE PASSED START? |
||||
BEQ RECERR ;YES...ERROR |
||||
; |
||||
STY RIDBE ;MOVE RIDBE FOWARD |
||||
DEY |
||||
; |
||||
LDA RIDATA ;GET BYTE BUFFER UP |
||||
LDX BITNUM ;SHIFT UNTILL FULL BYTE |
||||
RSR031 CPX #9 ;ALWAYS 8 BITS |
||||
BEQ RSR032 |
||||
LSR A ;FILL WITH ZEROS |
||||
INX |
||||
BNE RSR031 |
||||
; |
||||
RSR032 STA (RIBUF)Y ;DATA TO PAGE BUFFER |
||||
; |
||||
; PARITY CHECKING |
||||
; |
||||
LDA #$20 ;CHECK 6551 COMMAND REGISTER |
||||
BIT M51CDR |
||||
BEQ RSR018 ;NO PARITY BIT SO STOP BIT |
||||
BMI RSREXT ;NO PARITY CHECK |
||||
; |
||||
; CHECK CALC PARITY |
||||
; |
||||
LDA INBIT |
||||
EOR RIPRTY ;PUT IN WITH PARITY |
||||
BEQ RSR050 ;EVEN PARITY |
||||
BVS RSREXT ;ODD...OKAY SO EXIT |
||||
.BYT $2C ;SKIP TWO |
||||
RSR050 BVC RSREXT ;EVEN...OKAY SO EXIT |
||||
; |
||||
; ERRORS REPORTED |
||||
LDA #1 ;PARITY ERROR |
||||
.BYT $2C |
||||
RECERR LDA #$4 ;RECIEVER OVERRUN |
||||
.BYT $2C |
||||
BREAKE LDA #$80 ;BREAK DETECTED |
||||
.BYT $2C |
||||
FRAMEE LDA #$02 ;FRAME ERROR |
||||
ERR232 ORA RSSTAT |
||||
STA RSSTAT |
||||
JMP RSRABL ;BAD EXIT SO HANG ##????????## |
||||
; |
||||
; CHECK FOR ERRORS |
||||
; |
||||
RSR060 LDA RIDATA ;EXPECTING STOP... |
||||
BNE FRAMEE ;FRAME ERROR |
||||
BEQ BREAKE ;COULD BE A BREAK |
||||
.END |
||||
; RSR - 8/21/80 ADD MODS |
||||
; RSR - 8/24/80 FIX ERRORS |
||||
; RSR - 8/27/80 FIX MAJOR ERRORS |
||||
; RSR - 8/30/80 FIX T2 ADJUST |
||||
; RSR - 12/11/81 MODIFY FOR VIC-40 I/O |
||||
; RSR - 3/11/82 FIX FOR BAD/OLD NMI'S |
@ -0,0 +1,144 @@
|
||||
.PAGE 'RS-232 TRANSMITT' |
||||
; RSTRAB - ENTRY FOR NMI CONTINUE ROUTINE |
||||
; RSTBGN - ENTRY FOR START TRANSMITTER |
||||
; |
||||
; RSR - 8/18/80 |
||||
; |
||||
; VARIABLES USED |
||||
; BITTS - # OF BITS TO BE SENT (<>0 NOT DONE) |
||||
; NXTBIT - BYTE CONTAINS NEXT BIT TO BE SENT |
||||
; ROPRTY - BYTE CONTAINS PARITY BIT CALCULATED |
||||
; RODATA - STORES DATA BYTE CURRENTLY BEING TRANSMITTED |
||||
; RODBS - OUTPUT BUFFER INDEX START |
||||
; RODBE - OUTPUT BUFFER INDEX END |
||||
; IF RODBS=RODBE THEN BUFFER EMPTY |
||||
; ROBUF - INDIRECT POINTER TO DATA BUFFER |
||||
; RSSTAT - RS-232 STATUS BYTE |
||||
; |
||||
; XXX US - NORMAL BIT PATH |
||||
; XXX US - WORST CASE PARITY BIT PATH |
||||
; XXX US - STOP BIT PATH |
||||
; XXX US - START BIT PATH |
||||
; |
||||
RSTRAB LDA BITTS ;CHECK FOR PLACE IN BYTE... |
||||
BEQ RSTBGN ;...DONE, =0 START NEXT |
||||
; |
||||
BMI RST050 ;...DOING STOP BITS |
||||
; |
||||
LSR RODATA ;SHIFT DATA INTO CARRY |
||||
LDX #00 ;PREPARE FOR A ZERO |
||||
BCC RST005 ;YES...A ZERO |
||||
DEX ;NO...MAKE AN $FF |
||||
RST005 TXA ;READY TO SEND |
||||
; |
||||
EOR ROPRTY ;CALC INTO PARITY |
||||
STA ROPRTY |
||||
; |
||||
DEC BITTS ;BIT COUNT DOWN |
||||
BEQ RST010 ;WANT A PARITY INSTEAD |
||||
; |
||||
RSTEXT TXA ;CALC BIT WHOLE TO SEND |
||||
AND #$04 ;GOES OUT D2PA2 |
||||
STA NXTBIT |
||||
RTS |
||||
.PAGE 'RS-232 TRANSMITT' |
||||
; CALCULATE PARITY |
||||
; NXTBIT =0 UPON ENTRY |
||||
; |
||||
RST010 LDA #$20 ;CHECK 6551 REG BITS |
||||
BIT M51CDR |
||||
BEQ RSPNO ;...NO PARITY, SEND A STOP |
||||
BMI RST040 ;...NOT REAL PARITY |
||||
BVS RST030 ;...EVEN PARITY |
||||
; |
||||
LDA ROPRTY ;CALC ODD PARITY |
||||
BNE RSPEXT ;CORRECT GUESS |
||||
; |
||||
RSWEXT DEX ;WRONG GUESS...ITS A ONE |
||||
; |
||||
RSPEXT DEC BITTS ;ONE STOP BIT ALWAYS |
||||
LDA M51CTR ;CHECK # OF STOP BITS |
||||
BPL RSTEXT ;...ONE |
||||
DEC BITTS ;...TWO |
||||
BNE RSTEXT ;JUMP |
||||
; |
||||
RSPNO ;LINE TO SEND CANNOT BE PB0 |
||||
INC BITTS ;COUNTS AS ONE STOP BIT |
||||
BNE RSWEXT ;JUMP TO FLIP TO ONE |
||||
; |
||||
RST030 LDA ROPRTY ;EVEN PARITY |
||||
BEQ RSPEXT ;CORRECT GUESS...EXIT |
||||
BNE RSWEXT ;WRONG...FLIP AND EXIT |
||||
; |
||||
RST040 BVS RSPEXT ;WANTED SPACE |
||||
BVC RSWEXT ; WANTED MARK |
||||
.SKI 3 |
||||
; STOP BITS |
||||
; |
||||
RST050 INC BITTS ;STOP BIT COUNT TOWARDS ZERO |
||||
LDX #$FF ;SEND STOP BIT |
||||
BNE RSTEXT ;JUMP TO EXIT |
||||
; |
||||
.PAG 'RS-232 TRANSMITT' |
||||
; RSTBGN - ENTRY TO START BYTE TRANS |
||||
; |
||||
RSTBGN LDA M51CDR ;CHECK FOR 3/X LINE |
||||
LSR A |
||||
BCC RST060 ;3 LINE...NO CHECK |
||||
BIT D2PRB ;CHECK FOR... |
||||
BPL DSRERR ;...DSR ERROR |
||||
BVC CTSERR ;...CTS ERROR |
||||
; |
||||
; SET UP TO SEND NEXT BYTE |
||||
; |
||||
RST060 LDA #0 |
||||
STA ROPRTY ;ZERO PARITY |
||||
STA NXTBIT ;SEND START BIT |
||||
LDX BITNUM ;GET # OF BITS |
||||
RST070 STX BITTS ;BITTS=#OF BITTS+1 |
||||
; |
||||
RST080 LDY RODBS ;CHECK BUFFER POINTERS |
||||
CPY RODBE |
||||
BEQ RSODNE ;ALL DONE... |
||||
; |
||||
LDA (ROBUF)Y ;GET DATA... |
||||
STA RODATA ;...INTO BYTE BUFFER |
||||
INC RODBS ;MOVE POINTER TO NEXT |
||||
RTS |
||||
.SKI 3 |
||||
; SET ERRORS |
||||
; |
||||
DSRERR LDA #$40 ;DSR GONE ERROR |
||||
.BYT $2C |
||||
CTSERR LDA #$10 ;CTS GONE ERROR |
||||
ORA RSSTAT |
||||
STA RSSTAT |
||||
; |
||||
; ERRORS TURN OFF T1 |
||||
; |
||||
RSODNE LDA #$01 ;KILL T1 NMI |
||||
;ENTRY TO TURN OFF AN ENABLED NMI... |
||||
OENABL STA D2ICR ;TOSS BAD/OLD NMI |
||||
EOR ENABL ;FLIP ENABLE |
||||
ORA #$80 ;ENABLE GOOD NMI'S |
||||
STA ENABL |
||||
STA D2ICR |
||||
RTS |
||||
.SKI 3 |
||||
; BITCNT - CAL # OF BITS TO BE SENT |
||||
; RETURNS #OF BITS+1 |
||||
; |
||||
BITCNT LDX #9 ;CALC WORD LENGTH |
||||
LDA #$20 |
||||
BIT M51CTR |
||||
BEQ BIT010 |
||||
DEX ;BIT 5 HIGH IS A 7 OR 5 |
||||
BIT010 BVC BIT020 |
||||
DEX ;BIT 6 HIGH IS A 6 OR 5 |
||||
DEX |
||||
BIT020 RTS |
||||
.END |
||||
; RSR 8/24/80 CORRECT SOME MISTAKES |
||||
; RSR 8/27/80 CHANGE BITNUM BASE TO #BITS+1 |
||||
; RSR 12/11/81 MODIFY FOR VIC-40 |
||||
; RSR 3/11/82 FIX ENABLES FOR BAD/OLD NMI'S |
@ -0,0 +1,159 @@
|
||||
.PAGE 'RS-232 TRANSMITT' |
||||
; RSTRAB - ENTRY FOR NMI CONTINUE ROUTINE |
||||
; RSTBGN - ENTRY FOR START TRANSMITTER |
||||
; |
||||
; RSR - 8/18/80 |
||||
; |
||||
; VARIABLES USED |
||||
; BITTS - # OF BITS TO BE SENT (<>0 NOT DONE) |
||||
; NXTBIT - BYTE CONTAINS NEXT BIT TO BE SENT |
||||
; ROPRTY - BYTE CONTAINS PARITY BIT CALCULATED |
||||
; RODATA - STORES DATA BYTE CURRENTLY BEING TRANSMITTED |
||||
; RODBS - OUTPUT BUFFER INDEX START |
||||
; RODBE - OUTPUT BUFFER INDEX END |
||||
; IF RODBS=RODBE THEN BUFFER EMPTY |
||||
; ROBUF - INDIRECT POINTER TO DATA BUFFER |
||||
; RSSTAT - RS-232 STATUS BYTE |
||||
; |
||||
; XXX US - NORMAL BIT PATH |
||||
; XXX US - WORST CASE PARITY BIT PATH |
||||
; XXX US - STOP BIT PATH |
||||
; XXX US - START BIT PATH |
||||
; |
||||
RSTRAB LDA BITTS ;CHECK FOR PLACE IN BYTE... |
||||
BEQ RSTBGN ;...DONE, =0 START NEXT |
||||
; |
||||
BMI RST050 ;...DOING STOP BITS |
||||
; |
||||
LSR RODATA ;SHIFT DATA INTO CARRY |
||||
LDX #00 ;PREPARE FOR A ZERO |
||||
BCC RST005 ;YES...A ZERO |
||||
DEX ;NO...MAKE AN $FF |
||||
RST005 TXA ;READY TO SEND |
||||
; |
||||
EOR ROPRTY ;CALC INTO PARITY |
||||
STA ROPRTY |
||||
; |
||||
DEC BITTS ;BIT COUNT DOWN |
||||
BEQ RST010 ;WANT A PARITY INSTEAD |
||||
; |
||||
RSTEXT TXA ;CALC BIT WHOLE TO SEND |
||||
AND #$20 ;GOES OUT CB2 |
||||
STA NXTBIT |
||||
RTS |
||||
.PAGE 'RS-232 TRANSMITT' |
||||
; CALCULATE PARITY |
||||
; NXTBIT =0 UPON ENTRY |
||||
; |
||||
RST010 LDA #$20 ;CHECK 6551 REG BITS |
||||
BIT M51CDR |
||||
BEQ RSPNO ;...NO PARITY, SEND A STOP |
||||
BMI RST040 ;...NOT REAL PARITY |
||||
BVS RST030 ;...EVEN PARITY |
||||
; |
||||
LDA ROPRTY ;CALC ODD PARITY |
||||
BNE RSPEXT ;CORRECT GUESS |
||||
; |
||||
RSWEXT DEX ;WRONG GUESS...ITS A ONE |
||||
; |
||||
RSPEXT DEC BITTS ;ONE STOP BIT ALWAYS |
||||
LDA M51CTR ;CHECK # OF STOP BITS |
||||
BPL RSTEXT ;...ONE |
||||
DEC BITTS ;...TWO |
||||
BNE RSTEXT ;JUMP |
||||
; |
||||
RSPNO ;LINE TO SEND CANNOT BE PB0 |
||||
INC BITTS ;COUNTS AS ONE STOP BIT |
||||
BNE RSWEXT ;JUMP TO FLIP TO ONE |
||||
; |
||||
RST030 LDA ROPRTY ;EVEN PARITY |
||||
BEQ RSPEXT ;CORRECT GUESS...EXIT |
||||
BNE RSWEXT ;WRONG...FLIP AND EXIT |
||||
; |
||||
RST040 BVS RSPEXT ;WANTED SPACE |
||||
BVC RSWEXT ; WANTED MARK |
||||
.SKI 3 |
||||
; STOP BITS |
||||
; |
||||
RST050 INC BITTS ;STOP BIT COUNT TOWARDS ZERO |
||||
LDX #$FF ;SEND STOP BIT |
||||
BNE RSTEXT ;JUMP TO EXIT |
||||
; |
||||
.PAG 'RS-232 TRANSMITT' |
||||
; RSTBGN - ENTRY TO START BYTE TRANS |
||||
; |
||||
RSTBGN LDA M51CDR ;CHECK FOR 3/X LINE |
||||
LSR A |
||||
BCC RST060 ;3 LINE...NO CHECK |
||||
BIT D2ORB ;CHECK FOR... |
||||
BPL DSRERR ;...DSR ERROR |
||||
BVC CTSERR ;...CTS ERROR |
||||
; |
||||
; SET UP TO SEND NEXT BYTE |
||||
; |
||||
RST060 LDA #0 |
||||
STA ROPRTY ;ZERO PARITY |
||||
STA NXTBIT ;SEND START BIT |
||||
LDX BITNUM ;GET # OF BITS |
||||
RST070 STX BITTS ;BITTS=#OF BITTS+1 |
||||
; |
||||
RST080 LDY RODBS ;CHECK BUFFER POINTERS |
||||
CPY RODBE |
||||
BEQ RSODNE ;ALL DONE... |
||||
; |
||||
LDA (ROBUF)Y ;GET DATA... |
||||
STA RODATA ;...INTO BYTE BUFFER |
||||
INC RODBS |
||||
; |
||||
; CARRIAGE RETURN DELAY |
||||
; |
||||
CMP #$13 ;DELAY ON C/R |
||||
BNE RST090 ;NONE |
||||
LDX M51ADJ ;M51CRD |
||||
BEQ RST090 |
||||
LDY #$40 ;TURN OF T1 |
||||
STY D1IER |
||||
; |
||||
RST085 LDY #0 ;DELAY LOOP |
||||
JSR TOARTS |
||||
JSR TOARTS |
||||
DEY |
||||
BNE RST085 |
||||
DEX |
||||
BNE RST085 |
||||
LDX #$C0 ;TURN T1 BACK ON |
||||
STX D1IER |
||||
; |
||||
RST090 |
||||
TOARTS RTS |
||||
.SKI 3 |
||||
; SET ERRORS |
||||
; |
||||
DSRERR LDA #$40 ;DSR GONE ERROR |
||||
.BYT $2C |
||||
CTSERR LDA #$10 ;CTS GONE ERROR |
||||
ORA RSSTAT |
||||
STA RSSTAT |
||||
; |
||||
; ERRORS TURN OFF T1 |
||||
; |
||||
RSODNE LDA #$40 ;KILL T1 NMI |
||||
STA D1IER |
||||
RTS |
||||
.SKI 3 |
||||
; BITCNT - CAL # OF BITS TO BE SENT |
||||
; RETURNS #OF BITS+1 |
||||
; |
||||
BITCNT LDX #9 ;CALC WORD LENGTH |
||||
LDA #$20 |
||||
BIT M51CTR |
||||
BEQ BIT010 |
||||
DEX ;BIT 5 HIGH IS A 7 OR 5 |
||||
BIT010 BVC BIT020 |
||||
DEX ;BIT 6 HIGH IS A 6 OR 5 |
||||
DEX |
||||
BIT020 RTS |
||||
.END |
||||
; RSR 8/24/80 CORRECT SOME MISTAKES |
||||
; RSR 8/27/80 CHANGE BITNUM BASE TO #BITS+1 |
||||
; RSR 9/23/80 ADD C/R DELAY |
@ -0,0 +1,119 @@
|
||||
.PAG 'SAVE FUNCTION' |
||||
;*********************************** |
||||
;* SAVE * |
||||
;* * |
||||
;* SAVES TO CASSETTE 1 OR 2, OR * |
||||
;* IEEE DEVICES 4>=N>=31 AS SELECT-* |
||||
;* ED BY VARIABLE FA. * |
||||
;* * |
||||
;*START OF SAVE IS INDIRECT AT .A * |
||||
;*END OF SAVE IS .X,.Y * |
||||
;*********************************** |
||||
.SKI 3 |
||||
SAVESP STX EAL |
||||
STY EAH |
||||
TAX ;SET UP START |
||||
LDA $00,X |
||||
STA STAL |
||||
LDA $01,X |
||||
STA STAH |
||||
; |
||||
SAVE JMP (ISAVE) |
||||
NSAVE LDA FA ***MONITOR ENTRY |
||||
BNE SV20 |
||||
; |
||||
SV10 JMP ERROR9 ;BAD DEVICE # |
||||
; |
||||
SV20 CMP #3 |
||||
BEQ SV10 |
||||
BCC SV100 |
||||
LDA #$61 |
||||
STA SA |
||||
LDY FNLEN |
||||
BNE SV25 |
||||
; |
||||
JMP ERROR8 ;MISSING FILE NAME |
||||
; |
||||
SV25 JSR OPENI |
||||
JSR SAVING |
||||
LDA FA |
||||
JSR LISTN |
||||
LDA SA |
||||
JSR SECND |
||||
LDY #0 |
||||
JSR RD300 |
||||
LDA SAL |
||||
JSR CIOUT |
||||
LDA SAH |
||||
JSR CIOUT |
||||
SV30 JSR CMPSTE ;COMPARE START TO END |
||||
BCS SV50 ;HAVE REACHED END |
||||
LDA (SAL)Y |
||||
JSR CIOUT |
||||
JSR STOP |
||||
BNE SV40 |
||||
; |
||||
BREAK JSR CLSEI |
||||
LDA #0 |
||||
SEC |
||||
RTS |
||||
; |
||||
SV40 JSR INCSAL ;INCREMENT CURRENT ADDR. |
||||
BNE SV30 |
||||
SV50 JSR UNLSN |
||||
.SKI 5 |
||||
CLSEI BIT SA |
||||
BMI CLSEI2 |
||||
LDA FA |
||||
JSR LISTN |
||||
LDA SA |
||||
AND #$EF |
||||
ORA #$E0 |
||||
JSR SECND |
||||
; |
||||
CUNLSN JSR UNLSN ;ENTRY FOR OPENI |
||||
; |
||||
CLSEI2 CLC |
||||
RTS |
||||
.SKI 5 |
||||
SV100 LSR A |
||||
BCS SV102 ;IF C-SET THEN IT'S CASSETTE |
||||
; |
||||
JMP ERROR9 ;BAD DEVICE # |
||||
; |
||||
SV102 JSR ZZZ ;GET ADDR OF TAPE |
||||
BCC SV10 ;BUFFER IS DEALLOCATED |
||||
JSR CSTE2 |
||||
BCS SV115 ;STOP KEY PRESSED |
||||
JSR SAVING ;TELL USER 'SAVING' |
||||
SV105 LDX #PLF ;DECIDE TYPE TO SAVE |
||||
LDA SA ;1-PLF 0-BLF |
||||
AND #01 |
||||
BNE SV106 |
||||
LDX #BLF |
||||
SV106 TXA |
||||
JSR TAPEH |
||||
BCS SV115 ;STOP KEY PRESSED |
||||
JSR TWRT |
||||
BCS SV115 ;STOP KEY PRESSED |
||||
LDA SA |
||||
AND #2 ;WRITE END OF TAPE? |
||||
BEQ SV110 ;NO... |
||||
; |
||||
LDA #EOT |
||||
JSR TAPEH |
||||
.BYT $24 ;SKIP 1 BYTE |
||||
; |
||||
SV110 CLC |
||||
SV115 RTS |
||||
.SKI 3 |
||||
;SUBROUTINE TO OUTPUT: |
||||
;'SAVING <FILE NAME>' |
||||
; |
||||
SAVING LDA MSGFLG |
||||
BPL SV115 ;NO PRINT |
||||
; |
||||
LDY #MS11-MS1 ;'SAVING' |
||||
JSR MSG |
||||
JMP OUTFN ;<FILE NAME> |
||||
.END |
@ -0,0 +1,310 @@
|
||||
.PAG 'SERIAL ROUTINES' |
||||
;COMMAND SERIAL BUS DEVICE TO TALK |
||||
; |
||||
TALK ORA #$40 ;MAKE A TALK ADR |
||||
.BYT $2C ;SKIP TWO BYTES |
||||
.SKI 3 |
||||
;COMMAND SERIAL BUS DEVICE TO LISTEN |
||||
; |
||||
LISTN ORA #$20 ;MAKE A LISTEN ADR |
||||
JSR RSP232 ;PROTECT SELF FROM RS232 NMI'S |
||||
LIST1 PHA |
||||
; |
||||
; |
||||
BIT C3P0 ;CHARACTER LEFT IN BUF? |
||||
BPL LIST2 ;NO... |
||||
; |
||||
;SEND BUFFERED CHARACTER |
||||
; |
||||
SEC ;SET EOI FLAG |
||||
ROR R2D2 |
||||
; |
||||
JSR ISOUR ;SEND LAST CHARACTER |
||||
; |
||||
LSR C3P0 ;BUFFER CLEAR FLAG |
||||
LSR R2D2 ;CLEAR EOI FLAG |
||||
; |
||||
; |
||||
LIST2 PLA ;TALK/LISTEN ADDRESS |
||||
STA BSOUR |
||||
SEI |
||||
JSR DATAHI |
||||
CMP #$3F ;CLKHI ONLY ON UNLISTEN |
||||
BNE LIST5 |
||||
JSR CLKHI |
||||
; |
||||
LIST5 LDA D2PRA ;ASSERT ATTENTION |
||||
ORA #$08 |
||||
STA D2PRA |
||||
; |
||||
.SKI 3 |
||||
ISOURA SEI |
||||
JSR CLKLO ;SET CLOCK LINE LOW |
||||
JSR DATAHI |
||||
JSR W1MS ;DELAY 1 MS |
||||
.SKI 3 |
||||
ISOUR SEI ;NO IRQ'S ALLOWED |
||||
JSR DATAHI ;MAKE SURE DATA IS RELEASED |
||||
JSR DEBPIA ;DATA SHOULD BE LOW |
||||
BCS NODEV |
||||
JSR CLKHI ;CLOCK LINE HIGH |
||||
BIT R2D2 ;EOI FLAG TEST |
||||
BPL NOEOI |
||||
; DO THE EOI |
||||
ISR02 JSR DEBPIA ;WAIT FOR DATA TO GO HIGH |
||||
BCC ISR02 |
||||
; |
||||
ISR03 JSR DEBPIA ;WAIT FOR DATA TO GO LOW |
||||
BCS ISR03 |
||||
; |
||||
NOEOI JSR DEBPIA ;WAIT FOR DATA HIGH |
||||
BCC NOEOI |
||||
JSR CLKLO ;SET CLOCK LOW |
||||
; |
||||
; SET TO SEND DATA |
||||
; |
||||
LDA #$08 ;COUNT 8 BITS |
||||
STA COUNT |
||||
; |
||||
ISR01 |
||||
LDA D2PRA ;DEBOUNCE THE BUS |
||||
CMP D2PRA |
||||
BNE ISR01 |
||||
ASL A ;SET THE FLAGS |
||||
BCC FRMERR ;DATA MUST BE HI |
||||
; |
||||
ROR BSOUR ;NEXT BIT INTO CARRY |
||||
BCS ISRHI |
||||
JSR DATALO |
||||
BNE ISRCLK |
||||
ISRHI JSR DATAHI |
||||
ISRCLK JSR CLKHI ;CLOCK HI |
||||
NOP |
||||
NOP |
||||
NOP |
||||
NOP |
||||
LDA D2PRA |
||||
AND #$FF-$20 ;DATA HIGH |
||||
ORA #$10 ;CLOCK LOW |
||||
STA D2PRA |
||||
DEC COUNT |
||||
BNE ISR01 |
||||
LDA #$04 ;SET TIMER FOR 1MS |
||||
STA D1T2H |
||||
LDA #TIMRB ;TRIGGER TIMER |
||||
STA D1CRB |
||||
LDA D1ICR ;CLEAR THE TIMER FLAGS<<<<<<<<<<<<< |
||||
ISR04 LDA D1ICR |
||||
AND #$02 |
||||
BNE FRMERR |
||||
JSR DEBPIA |
||||
BCS ISR04 |
||||
CLI ;LET IRQ'S CONTINUE |
||||
RTS |
||||
; |
||||
NODEV ;DEVICE NOT PRESENT ERROR |
||||
LDA #$80 |
||||
.BYT $2C |
||||
FRMERR ;FRAMING ERROR |
||||
LDA #$03 |
||||
CSBERR JSR UDST ;COMMODORE SERIAL BUSS ERROR ENTRY |
||||
CLI ;IRQ'S WERE OFF...TURN ON |
||||
CLC ;MAKE SURE NO KERNAL ERROR RETURNED |
||||
BCC DLABYE ;TURN ATN OFF ,RELEASE ALL LINES |
||||
; |
||||
.SKI 3 |
||||
;SEND SECONDARY ADDRESS AFTER LISTEN |
||||
; |
||||
SECND STA BSOUR ;BUFFER CHARACTER |
||||
JSR ISOURA ;SEND IT |
||||
.SKI 3 |
||||
;RELEASE ATTENTION AFTER LISTEN |
||||
; |
||||
SCATN LDA D2PRA |
||||
AND #$FF-$08 |
||||
STA D2PRA ;RELEASE ATTENTION |
||||
RTS |
||||
.SKI 3 |
||||
;TALK SECOND ADDRESS |
||||
; |
||||
TKSA STA BSOUR ;BUFFER CHARACTER |
||||
JSR ISOURA ;SEND SECOND ADDR |
||||
.SKI 3 |
||||
TKATN ;SHIFT OVER TO LISTENER |
||||
SEI ;NO IRQ'S HERE |
||||
JSR DATALO ;DATA LINE LOW |
||||
JSR SCATN |
||||
JSR CLKHI ;CLOCK LINE HIGH JSR/RTS |
||||
TKATN1 JSR DEBPIA ;WAIT FOR CLOCK TO GO LOW |
||||
BMI TKATN1 |
||||
CLI ;IRQ'S OKAY NOW |
||||
RTS |
||||
.SKI 3 |
||||
;BUFFERED OUTPUT TO SERIAL BUS |
||||
; |
||||
CIOUT BIT C3P0 ;BUFFERED CHAR? |
||||
BMI CI2 ;YES...SEND LAST |
||||
; |
||||
SEC ;NO... |
||||
ROR C3P0 ;SET BUFFERED CHAR FLAG |
||||
BNE CI4 ;BRANCH ALWAYS |
||||
; |
||||
CI2 PHA ;SAVE CURRENT CHAR |
||||
JSR ISOUR ;SEND LAST CHAR |
||||
PLA ;RESTORE CURRENT CHAR |
||||
CI4 STA BSOUR ;BUFFER CURRENT CHAR |
||||
CLC ;CARRY-GOOD EXIT |
||||
RTS |
||||
.SKI 3 |
||||
;SEND UNTALK COMMAND ON SERIAL BUS |
||||
; |
||||
UNTLK SEI |
||||
JSR CLKLO |
||||
LDA D2PRA ;PULL ATN |
||||
ORA #$08 |
||||
STA D2PRA |
||||
LDA #$5F ;UNTALK COMMAND |
||||
.BYT $2C ;SKIP TWO BYTES |
||||
.SKI 3 |
||||
;SEND UNLISTEN COMMAND ON SERIAL BUS |
||||
; |
||||
UNLSN LDA #$3F ;UNLISTEN COMMAND |
||||
JSR LIST1 ;SEND IT |
||||
; |
||||
; RELEASE ALL LINES |
||||
DLABYE JSR SCATN ;ALWAYS RELEASE ATN |
||||
; DELAY THEN RELEASE CLOCK AND DATA |
||||
; |
||||
DLADLH TXA ;DELAY APPROX 60 US |
||||
LDX #10 |
||||
DLAD00 DEX |
||||
BNE DLAD00 |
||||
TAX |
||||
JSR CLKHI |
||||
JMP DATAHI |
||||
.SKI 3 |
||||
;INPUT A BYTE FROM SERIAL BUS |
||||
; |
||||
ACPTR |
||||
SEI ;NO IRQ ALLOWED |
||||
LDA #$00 ;SET EOI/ERROR FLAG |
||||
STA COUNT |
||||
JSR CLKHI ;MAKE SURE CLOCK LINE IS RELEASED |
||||
ACP00A JSR DEBPIA ;WAIT FOR CLOCK HIGH |
||||
BPL ACP00A |
||||
; |
||||
EOIACP |
||||
LDA #$01 ;SET TIMER 2 FOR 256US |
||||
STA D1T2H |
||||
LDA #TIMRB |
||||
STA D1CRB |
||||
JSR DATAHI ;DATA LINE HIGH (MAKES TIMMING MORE LIKE VIC-20 |
||||
LDA D1ICR ;CLEAR THE TIMER FLAGS<<<<<<<<<<<< |
||||
ACP00 LDA D1ICR |
||||
AND #$02 ;CHECK THE TIMER |
||||
BNE ACP00B ;RAN OUT..... |
||||
JSR DEBPIA ;CHECK THE CLOCK LINE |
||||
BMI ACP00 ;NO NOT YET |
||||
BPL ACP01 ;YES..... |
||||
; |
||||
ACP00B LDA COUNT ;CHECK FOR ERROR (TWICE THRU TIMEOUTS) |
||||
BEQ ACP00C |
||||
LDA #2 |
||||
JMP CSBERR ; ST = 2 READ TIMEOUT |
||||
; |
||||
; TIMER RAN OUT DO AN EOI THING |
||||
; |
||||
ACP00C JSR DATALO ;DATA LINE LOW |
||||
JSR CLKHI ; DELAY AND THEN SET DATAHI (FIX FOR 40US C64) |
||||
LDA #$40 |
||||
JSR UDST ;OR AN EOI BIT INTO STATUS |
||||
INC COUNT ;GO AROUND AGAIN FOR ERROR CHECK ON EOI |
||||
BNE EOIACP |
||||
; |
||||
; DO THE BYTE TRANSFER |
||||
; |
||||
ACP01 LDA #08 ;SET UP COUNTER |
||||
STA COUNT |
||||
; |
||||
ACP03 LDA D2PRA ;WAIT FOR CLOCK HIGH |
||||
CMP D2PRA ;DEBOUNCE |
||||
BNE ACP03 |
||||
ASL A ;SHIFT DATA INTO CARRY |
||||
BPL ACP03 ;CLOCK STILL LOW... |
||||
ROR BSOUR1 ;ROTATE DATA IN |
||||
; |
||||
ACP03A LDA D2PRA ;WAIT FOR CLOCK LOW |
||||
CMP D2PRA ;DEBOUNCE |
||||
BNE ACP03A |
||||
ASL A |
||||
BMI ACP03A |
||||
DEC COUNT |
||||
BNE ACP03 ;MORE BITS..... |
||||
;...EXIT... |
||||
JSR DATALO ;DATA LOW |
||||
BIT STATUS ;CHECK FOR EOI |
||||
BVC ACP04 ;NONE... |
||||
; |
||||
JSR DLADLH ;DELAY THEN SET DATA HIGH |
||||
; |
||||
ACP04 LDA BSOUR1 |
||||
CLI ;IRQ IS OK |
||||
CLC ;GOOD EXIT |
||||
RTS |
||||
; |
||||
CLKHI ;SET CLOCK LINE HIGH (INVERTED) |
||||
LDA D2PRA |
||||
AND #$FF-$10 |
||||
STA D2PRA |
||||
RTS |
||||
; |
||||
CLKLO ;SET CLOCK LINE LOW (INVERTED) |
||||
LDA D2PRA |
||||
ORA #$10 |
||||
STA D2PRA |
||||
RTS |
||||
; |
||||
; |
||||
DATAHI ;SET DATA LINE HIGH (INVERTED) |
||||
LDA D2PRA |
||||
AND #$FF-$20 |
||||
STA D2PRA |
||||
RTS |
||||
; |
||||
DATALO ;SET DATA LINE LOW (INVERTED) |
||||
LDA D2PRA |
||||
ORA #$20 |
||||
STA D2PRA |
||||
RTS |
||||
; |
||||
DEBPIA LDA D2PRA ;DEBOUNCE THE PIA |
||||
CMP D2PRA |
||||
BNE DEBPIA |
||||
ASL A ;SHIFT THE DATA BIT INTO THE CARRY... |
||||
RTS ;...AND THE CLOCK INTO NEG FLAG |
||||
; |
||||
W1MS ;DELAY 1MS USING LOOP |
||||
TXA ;SAVE .X |
||||
LDX #200-16 ;1000US-(1000/500*8=#40US HOLDS) |
||||
W1MS1 DEX ;5US LOOP |
||||
BNE W1MS1 |
||||
TAX ;RESTORE .X |
||||
RTS |
||||
.END |
||||
;******************************* |
||||
;WRITTEN 8/11/80 BOB FAIRBAIRN |
||||
;TEST SERIAL0.6 8/12/80 RJF |
||||
;CHANGE I/O STRUCTURE 8/21/80 RJF |
||||
;MORE I/O CHANGES 8/24/80 RJF |
||||
;FINAL RELEASE INTO KERNAL 8/26/80 RJF |
||||
;SOME CLEAN UP 9/8/80 RSR |
||||
;ADD IRQ PROTECT ON ISOUR AND TKATN 9/22/80 RSR |
||||
;FIX UNTALK 10/7/80 RSR |
||||
;MODIFY FOR VIC-40 I/O SYSTEM 12/08/81 RSR |
||||
;ADD SEI TO (UNTLK,ISOURA,LIST2) 12/14/81 RSR |
||||
;MODIFY FOR 6526 FLAGS FIX ERRS 12/31/81 RSR |
||||
;MODIFY FOR COMMODORE 64 I/O 3/11/82 RSR |
||||
;CHANGE ACPTR EOI FOR BETTER RESPONSE 3/28/82 RSR |
||||
;CHANGE WAIT 1 MS ROUTINE FOR LESS CODE 4/8/82 RSR |
||||
;****************************** |
||||
.END |
@ -0,0 +1,186 @@
|
||||
.PAG 'TAPE CONTROL' |
||||
JTP20 JSR ZZZ |
||||
INC BUFPT |
||||
LDY BUFPT |
||||
CPY #BUFSZ |
||||
RTS |
||||
.SKI 5 |
||||
;STAYS IN ROUTINE D2T1LL PLAY SWITCH |
||||
; |
||||
CSTE1 JSR CS10 |
||||
BEQ CS25 |
||||
LDY #MS7-MS1 ;"PRESS PLAY..." |
||||
CS30 JSR MSG |
||||
CS40 JSR TSTOP ;WATCH FOR STOP KEY |
||||
JSR CS10 ;WATCH CASSETTE SWITCHES |
||||
BNE CS40 |
||||
LDY #MS18-MS1 ;"OK" |
||||
JMP MSG |
||||
.SKI 5 |
||||
;SUBR RETURNS <> FOR CASSETTE SWITCH |
||||
; |
||||
CS10 LDA #$10 ;CHECK PORT |
||||
BIT R6510 ;CLOSED?... |
||||
BNE CS25 ;NO. . . |
||||
BIT R6510 ;CHECK AGAIN TO DEBOUNCE |
||||
CS25 CLC ;GOOD RETURN |
||||
RTS |
||||
.SKI 5 |
||||
;CHECKS FOR PLAY & RECORD |
||||
; |
||||
CSTE2 JSR CS10 |
||||
BEQ CS25 |
||||
LDY #MS8-MS1 ;"RECORD" |
||||
BNE CS30 |
||||
.SKI 5 |
||||
;READ HEADER BLOCK ENTRY |
||||
; |
||||
RBLK LDA #0 |
||||
STA STATUS |
||||
STA VERCK |
||||
JSR LDAD1 |
||||
.SKI 3 |
||||
;READ LOAD BLOCK ENTRY |
||||
; |
||||
TRD JSR CSTE1 ;SAY 'PRESS PLAY' |
||||
BCS TWRT3 ;STOP KEY PRESSED |
||||
SEI |
||||
LDA #0 ;CLEAR FLAGS... |
||||
STA RDFLG |
||||
STA SNSW1 |
||||
STA CMP0 |
||||
STA PTR1 |
||||
STA PTR2 |
||||
STA DPSW |
||||
LDA #$90 ;ENABLE FOR CA1 IRQ...READ LINE |
||||
LDX #14 ;POINT IRQ VECTOR TO READ |
||||
BNE TAPE ;JMP |
||||
.SKI 5 |
||||
;WRITE HEADER BLOCK ENTRY |
||||
; |
||||
WBLK JSR LDAD1 |
||||
; |
||||
;WRITE LOAD BLOCK ENTRY |
||||
; |
||||
TWRT LDA #20 ;BETWEEN BLOCK SHORTS |
||||
STA SHCNH |
||||
TWRT2 JSR CSTE2 ;SAY 'PRESS PLAY & RECORD' |
||||
TWRT3 BCS STOP3 ;STOP KEY PRESSED |
||||
SEI |
||||
LDA #$82 ;ENABLE T2 IRQS...WRITE TIME |
||||
LDX #8 ;VECTOR IRQ TO WRTZ |
||||
.SKI 5 |
||||
;START TAPE OPERATION ENTRY POINT |
||||
; |
||||
TAPE LDY #$7F ;KILL UNWANTED IRQ'S |
||||
STY D1ICR |
||||
STA D1ICR ;TURN ON WANTED |
||||
LDA D1CRA ;CALC TIMER ENABLES |
||||
ORA #$19 |
||||
STA D1CRB ;TURN ON T2 IRQ'S FOR CASS WRITE(ONE SHOT) |
||||
AND #$91 ;SAVE TOD 50/60 INDICATION |
||||
STA CASTON ;PLACE IN AUTO MODE FOR T1 |
||||
; WAIT FOR RS-232 TO FINISH |
||||
JSR RSP232 |
||||
; DISABLE SCREEN DISPLAY |
||||
LDA VICREG+17 |
||||
AND #$FF-$10 ;DISABLE SCREEN |
||||
STA VICREG+17 |
||||
; MOVE IRQ TO IRQTEMP FOR CASS OPS |
||||
LDA CINV |
||||
STA IRQTMP |
||||
LDA CINV+1 |
||||
STA IRQTMP+1 |
||||
JSR BSIV ;GO CHANGE IRQ VECTOR |
||||
LDA #2 ;FSBLK STARTS AT 2 |
||||
STA FSBLK |
||||
JSR NEWCH ;PREP LOCAL COUNTERS AND FLAGS |
||||
LDA R6510 ;TURN MOTOR ON |
||||
AND #%011111 ;LOW TURNS ON |
||||
STA R6510 |
||||
STA CAS1 ;FLAG INTERNAL CONTROL OF CASS MOTOR |
||||
LDX #$FF ;DELAY BETWEEN BLOCKS |
||||
TP32 LDY #$FF |
||||
TP35 DEY |
||||
BNE TP35 |
||||
DEX |
||||
BNE TP32 |
||||
CLI |
||||
TP40 LDA IRQTMP+1 ;CHECK FOR INTERRUPT VECTOR... |
||||
CMP CINV+1 ;...POINTING AT KEY ROUTINE |
||||
CLC |
||||
BEQ STOP3 ;...YES RETURN |
||||
JSR TSTOP ;...NO CHECK FOR STOP KEY |
||||
; |
||||
; 60 HZ KEYSCAN IGNORED |
||||
; |
||||
JSR UD60 ; STOP KEY CHECK |
||||
JMP TP40 ;STAY IN LOOP UNTILL TAPES ARE DONE |
||||
.SKI 5 |
||||
TSTOP JSR STOP ;STOP KEY DOWN? |
||||
CLC ;ASSUME NO STOP |
||||
BNE STOP4 ;WE WERE RIGHT |
||||
; |
||||
;STOP KEY DOWN... |
||||
; |
||||
JSR TNIF ;TURN OFF CASSETTES |
||||
SEC ;FAILURE FLAG |
||||
PLA ;BACK ONE SQUARE... |
||||
PLA |
||||
; |
||||
; LDA #0 ;STOP KEY FLAG |
||||
; |
||||
STOP3 LDA #0 ;DEALLOCATE IRQTMP |
||||
STA IRQTMP+1 ;IF C-SET THEN STOP KEY |
||||
STOP4 RTS |
||||
.SKI 5 |
||||
; |
||||
; STT1 - SET UP TIMEOUT WATCH FOR NEXT DIPOLE |
||||
; |
||||
STT1 STX TEMP ;.X HAS CONSTANT FOR TIMEOUT |
||||
LDA CMP0 ;CMP0*5 |
||||
ASL A |
||||
ASL A |
||||
CLC |
||||
ADC CMP0 |
||||
CLC |
||||
ADC TEMP ;ADJUST LONG BYTE COUNT |
||||
STA TEMP |
||||
LDA #0 |
||||
BIT CMP0 ;CHECK CMP0 ... |
||||
BMI STT2 ;...MINUS, NO ADJUST |
||||
ROL A ;...PLUS SO ADJUST POS |
||||
STT2 ASL TEMP ;MULTIPLY CORRECTED VALUE BY 4 |
||||
ROL A |
||||
ASL TEMP |
||||
ROL A |
||||
TAX |
||||
STT3 LDA D1T2L ;WATCH OUT FOR D1T2H ROLLOVER... |
||||
CMP #22 ;...TIME FOR ROUTINE...!!!... |
||||
BCC STT3 ;...TOO CLOSE SO WAIT UNTILL PAST |
||||
ADC TEMP ;CALCULATE AND... |
||||
STA D1T1L ;...STORE ADUSTED TIME COUNT |
||||
TXA |
||||
ADC D1T2H ;ADJUST FOR HIGH TIME COUNT |
||||
STA D1T1H |
||||
LDA CASTON ;ENABLE TIMERS |
||||
STA D1CRA |
||||
STA STUPID ;NON-ZERO MEANS AN T1 IRQ HAS NOT OCCURED YET |
||||
LDA D1ICR ;CLEAR OLD T1 INTERRUPT |
||||
AND #$10 ;CHECK FOR OLD-FLAG IRQ |
||||
BEQ STT4 ;NO...NORMAL EXIT |
||||
LDA #>STT4 ;PUSH SIMULATED RETURN ADDRESS ON STACK |
||||
PHA |
||||
LDA #<STT4 |
||||
PHA |
||||
JMP SIMIRQ |
||||
STT4 CLI ;ALLOW FOR RE-ENTRY CODE |
||||
RTS |
||||
.END |
||||
; RSR 8/25/80 MODIFY I/O FOR MOD2 HARDWARE |
||||
; RSR 12/11/81 MODIFY I/O FOR VIC-40 |
||||
; RSR 2/9/82 ADD SCREEN DISABLE FOR TAPE |
||||
; RSR 3/28/82 ADD T2IRQ TO START CASSETTE WRITE |
||||
; RSR 3/28/82 ADD CASSETTE READ TIMER1 FLAG |
||||
; RSR 5/11/82 CHANGE SO WE DON'T MISS ANY IRQ'S |
||||
; RSR 5/14/82 SIMULATE AN IRQ |
@ -0,0 +1,202 @@
|
||||
.PAG 'TAPE FILES' |
||||
;FAH -- FIND ANY HEADER |
||||
; |
||||
;READS TAPE DEVICE UNTIL ONE OF FOLLOWING |
||||
;BLOCK TYPES FOUND: BDFH--BASIC DATA |
||||
;FILE HEADER, BLF--BASIC LOAD FILE |
||||
;FOR SUCCESS CARRY IS CLEAR ON RETURN. |
||||
;FOR FAILURE CARRY IS SET ON RETURN. |
||||
;IN ADDITION ACCUMULATOR IS 0 IF STOP |
||||
;KEY WAS PRESSED. |
||||
; |
||||
FAH LDA VERCK ;SAVE OLD VERIFY |
||||
PHA |
||||
JSR RBLK ;READ TAPE BLOCK |
||||
PLA |
||||
STA VERCK ;RESTORE VERIFY FLAG |
||||
BCS FAH40 ;READ TERMINATED |
||||
; |
||||
LDY #0 |
||||
LDA (TAPE1)Y ;GET HEADER TYPE |
||||
; |
||||
CMP #EOT ;CHECK END OF TAPE? |
||||
BEQ FAH40 ;YES...FAILURE |
||||
; |
||||
CMP #BLF ;BASIC LOAD FILE? |
||||
BEQ FAH50 ;YES...SUCCESS |
||||
; |
||||
CMP #PLF ;FIXED LOAD FILE? |
||||
BEQ FAH50 ;YES...SUCCESS |
||||
; |
||||
CMP #BDFH ;BASIC DATA FILE? |
||||
BNE FAH ;NO...KEEP TRYING |
||||
; |
||||
FAH50 TAX ;RETURN FILE TYPE IN .X |
||||
BIT MSGFLG ;PRINTING MESSAGES? |
||||
BPL FAH45 ;NO... |
||||
; |
||||
LDY #MS17-MS1 ;PRINT "FOUND" |
||||
JSR MSG |
||||
; |
||||
;OUTPUT COMPLETE FILE NAME |
||||
; |
||||
LDY #5 |
||||
FAH55 LDA (TAPE1)Y |
||||
JSR BSOUT |
||||
INY |
||||
CPY #21 |
||||
BNE FAH55 |
||||
; |
||||
FAH56 LDA TIME+1 ;SET UP FOR TIME OUT... |
||||
JSR FPATCH ;GOTO PATCH... |
||||
NOP |
||||
; |
||||
FAH45 CLC ;SUCCESS FLAG |
||||
DEY ;MAKE NONZERO FOR OKAY RETURN |
||||
; |
||||
FAH40 RTS |
||||
.SKI 5 |
||||
;TAPEH--WRITE TAPE HEADER |
||||
;ERROR IF TAPE BUFFER DE-ALLOCATED |
||||
;CARRY CLEAR IF O.K. |
||||
; |
||||
TAPEH STA T1 |
||||
; |
||||
;DETERMINE ADDRESS OF BUFFER |
||||
; |
||||
JSR ZZZ |
||||
BCC TH40 ;BUFFER WAS DE-ALLOCATED |
||||
; |
||||
;PRESERVE START AND END ADDRESSES |
||||
;FOR CASE OF HEADER FOR LOAD FILE |
||||
; |
||||
LDA STAH |
||||
PHA |
||||
LDA STAL |
||||
PHA |
||||
LDA EAH |
||||
PHA |
||||
LDA EAL |
||||
PHA |
||||
; |
||||
;PUT BLANKS IN TAPE BUFFER |
||||
; |
||||
LDY #BUFSZ-1 |
||||
LDA #' |
||||
BLNK2 STA (TAPE1)Y |
||||
DEY |
||||
BNE BLNK2 |
||||
; |
||||
;PUT BLOCK TYPE IN HEADER |
||||
; |
||||
LDA T1 |
||||
STA (TAPE1)Y |
||||
; |
||||
;PUT START LOAD ADDRESS IN HEADER |
||||
; |
||||
INY |
||||
LDA STAL |
||||
STA (TAPE1)Y |
||||
INY |
||||
LDA STAH |
||||
STA (TAPE1)Y |
||||
; |
||||
;PUT END LOAD ADDRESS IN HEADER |
||||
; |
||||
INY |
||||
LDA EAL |
||||
STA (TAPE1)Y |
||||
INY |
||||
LDA EAH |
||||
STA (TAPE1)Y |
||||
; |
||||
;PUT FILE NAME IN HEADER |
||||
; |
||||
INY |
||||
STY T2 |
||||
LDY #0 |
||||
STY T1 |
||||
TH20 LDY T1 |
||||
CPY FNLEN |
||||
BEQ TH30 |
||||
LDA (FNADR)Y |
||||
LDY T2 |
||||
STA (TAPE1)Y |
||||
INC T1 |
||||
INC T2 |
||||
BNE TH20 |
||||
; |
||||
;SET UP START AND END ADDRESS OF HEADER |
||||
; |
||||
TH30 JSR LDAD1 |
||||
; |
||||
;SET UP TIME FOR LEADER |
||||
; |
||||
LDA #$69 |
||||
STA SHCNH |
||||
; |
||||
JSR TWRT2 ;WRITE HEADER ON TAPE |
||||
; |
||||
;RESTORE START AND END ADDRESS OF |
||||
;LOAD FILE. |
||||
; |
||||
TAY ;SAVE ERROR CODE IN .Y |
||||
PLA |
||||
STA EAL |
||||
PLA |
||||
STA EAH |
||||
PLA |
||||
STA STAL |
||||
PLA |
||||
STA STAH |
||||
TYA ;RESTORE ERROR CODE FOR RETURN |
||||
; |
||||
TH40 RTS |
||||
.SKI 5 |
||||
;FUNCTION TO RETURN TAPE BUFFER |
||||
;ADDRESS IN TAPE1 |
||||
; |
||||
ZZZ LDX TAPE1 ;ASSUME TAPE1 |
||||
LDY TAPE1+1 |
||||
CPY #>BUF ;CHECK FOR ALLOCATION... |
||||
;...[TAPE1+1]=0 OR 1 MEANS DEALLOCATED |
||||
;...C CLR => DEALLOCATED |
||||
RTS |
||||
.SKI 5 |
||||
LDAD1 JSR ZZZ ;GET PTR TO CASSETTE |
||||
TXA |
||||
STA STAL ;SAVE START LOW |
||||
CLC |
||||
ADC #BUFSZ ;COMPUTE POINTER TO END |
||||
STA EAL ;SAVE END LOW |
||||
TYA |
||||
STA STAH ;SAVE START HIGH |
||||
ADC #0 ;COMPUTE POINTER TO END |
||||
STA EAH ;SAVE END HIGH |
||||
RTS |
||||
.SKI 5 |
||||
FAF JSR FAH ;FIND ANY HEADER |
||||
BCS FAF40 ;FAILED |
||||
; |
||||
;SUCCESS...SEE IF RIGHT NAME |
||||
; |
||||
LDY #5 ;OFFSET INTO TAPE HEADER |
||||
STY T2 |
||||
LDY #0 ;OFFSET INTO FILE NAME |
||||
STY T1 |
||||
FAF20 CPY FNLEN ;COMPARE THIS MANY |
||||
BEQ FAF30 ;DONE |
||||
; |
||||
LDA (FNADR)Y |
||||
LDY T2 |
||||
CMP (TAPE1)Y |
||||
BNE FAF ;MISMATCH--TRY NEXT HEADER |
||||
INC T1 |
||||
INC T2 |
||||
LDY T1 |
||||
BNE FAF20 ;BRANCH ALWAYS |
||||
; |
||||
FAF30 CLC ;SUCCESS FLAG |
||||
FAF40 RTS |
||||
.END |
||||
; RSR 4/10/82 ADD KEY DOWN TEST IN FAH... |
@ -0,0 +1,78 @@
|
||||
.PAG 'TIME FUNCTION' |
||||
;*********************************** |
||||
;* * |
||||
;* TIME * |
||||
;* * |
||||
;*CONSISTS OF THREE FUNCTIONS: * |
||||
;* (1) UDTIM-- UPDATE TIME. USUALLY* |
||||
;* CALLED EVERY 60TH SECOND. * |
||||
;* (2) SETTIM-- SET TIME. .Y=MSD, * |
||||
;* .X=NEXT SIGNIFICANT,.A=LSD * |
||||
;* (3) RDTIM-- READ TIME. .Y=MSD, * |
||||
;* .X=NEXT SIGNIFICANT,.A=LSD * |
||||
;* * |
||||
;*********************************** |
||||
.SKI |
||||
;INTERRUPTS ARE COMING FROM THE 6526 TIMERS |
||||
; |
||||
UDTIM LDX #0 ;PRE-LOAD FOR LATER |
||||
; |
||||
;HERE WE PROCEED WITH AN INCREMENT |
||||
;OF THE TIME REGISTER. |
||||
; |
||||
UD20 INC TIME+2 |
||||
BNE UD30 |
||||
INC TIME+1 |
||||
BNE UD30 |
||||
INC TIME |
||||
; |
||||
;HERE WE CHECK FOR ROLL-OVER 23:59:59 |
||||
;AND RESET THE CLOCK TO ZERO IF TRUE |
||||
; |
||||
UD30 SEC |
||||
LDA TIME+2 |
||||
SBC #$01 |
||||
LDA TIME+1 |
||||
SBC #$1A |
||||
LDA TIME |
||||
SBC #$4F |
||||
BCC UD60 |
||||
; |
||||
;TIME HAS ROLLED--ZERO REGISTER |
||||
; |
||||
STX TIME |
||||
STX TIME+1 |
||||
STX TIME+2 |
||||
; |
||||
;SET STOP KEY FLAG HERE |
||||
; |
||||
UD60 LDA ROWS ;WAIT FOR IT TO SETTLE |
||||
CMP ROWS |
||||
BNE UD60 ;STILL BOUNCING |
||||
TAX ;SET FLAGS... |
||||
BMI UD80 ;NO STOP KEY...EXIT STOP KEY=$7F |
||||
LDX #$FF-$42 ;CHECK FOR A SHIFT KEY (C64 KEYBOARD) |
||||
STX COLM |
||||
UD70 LDX ROWS ;WAIT TO SETTLE... |
||||
CPX ROWS |
||||
BNE UD70 |
||||
STA COLM ;!!!!!WATCH OUT...STOP KEY .A=$7F...SAME AS COLMS WAS... |
||||
INX ;ANY KEY DOWN ABORTS |
||||
BNE UD90 ;LEAVE SAME AS BEFORE... |
||||
UD80 STA STKEY ;SAVE FOR OTHER ROUTINES |
||||
UD90 RTS |
||||
.SKI 5 |
||||
RDTIM SEI ;KEEP TIME FROM ROLLING |
||||
LDA TIME+2 ;GET LSD |
||||
LDX TIME+1 ;GET NEXT MOST SIG. |
||||
LDY TIME ;GET MSD |
||||
.SKI 5 |
||||
SETTIM SEI ;KEEP TIME FROM CHANGING |
||||
STA TIME+2 ;STORE LSD |
||||
STX TIME+1 ;NEXT MOST SIGNIFICANT |
||||
STY TIME ;STORE MSD |
||||
CLI |
||||
RTS |
||||
.END |
||||
; RSR 8/21/80 REMOVE CRFAC CHANGE STOP |
||||
; RSR 3/29/82 ADD SHIT KEY CHECK FOR COMMODORE 64 |
@ -0,0 +1,51 @@
|
||||
.PAG 'JUMP TABLE/VECTORS' |
||||
*=$FF80 |
||||
.BYT 0 ;RELEASE NUMBER OF C64 KERNAL |
||||
JMP PCINT |
||||
JMP IOINIT |
||||
JMP RAMTAS |
||||
*=$FF8A ;NEW VECTORS FOR BASIC |
||||
JMP RESTOR ;RESTORE VECTORS TO INITIAL SYSTEM |
||||
JMP VECTOR ;CHANGE VECTORS FOR USER |
||||
* =$FF90 |
||||
JMP SETMSG ;CONTROL O.S. MESSAGES |
||||
JMP SECND ;SEND SA AFTER LISTEN |
||||
JMP TKSA ;SEND SA AFTER TALK |
||||
JMP MEMTOP ;SET/READ TOP OF MEMORY |
||||
JMP MEMBOT ;SET/READ BOTTOM OF MEMORY |
||||
JMP SCNKEY ;SCAN KEYBOARD |
||||
JMP SETTMO ;SET TIMEOUT IN IEEE |
||||
JMP ACPTR ;HANDSHAKE IEEE BYTE IN |
||||
JMP CIOUT ;HANDSHAKE IEEE BYTE OUT |
||||
JMP UNTLK ;SEND UNTALK OUT IEEE |
||||
JMP UNLSN ;SEND UNLISTEN OUT IEEE |
||||
JMP LISTN ;SEND LISTEN OUT IEEE |
||||
JMP TALK ;SEND TALK OUT IEEE |
||||
JMP READSS ;RETURN I/O STATUS BYTE |
||||
JMP SETLFS ;SET LA, FA, SA |
||||
JMP SETNAM ;SET LENGTH AND FN ADR |
||||
OPEN JMP (IOPEN) ;OPEN LOGICAL FILE |
||||
CLOSE JMP (ICLOSE) ;CLOSE LOGICAL FILE |
||||
CHKIN JMP (ICHKIN) ;OPEN CHANNEL IN |
||||
CKOUT JMP (ICKOUT) ;OPEN CHANNEL OUT |
||||
CLRCH JMP (ICLRCH) ;CLOSE I/O CHANNEL |
||||
BASIN JMP (IBASIN) ;INPUT FROM CHANNEL |
||||
BSOUT JMP (IBSOUT) ;OUTPUT TO CHANNEL |
||||
JMP LOADSP ;LOAD FROM FILE |
||||
JMP SAVESP ;SAVE TO FILE |
||||
JMP SETTIM ;SET INTERNAL CLOCK |
||||
JMP RDTIM ;READ INTERNAL CLOCK |
||||
STOP JMP (ISTOP) ;SCAN STOP KEY |
||||
GETIN JMP (IGETIN) ;GET CHAR FROM Q |
||||
CLALL JMP (ICLALL) ;CLOSE ALL FILES |
||||
JMP UDTIM ;INCREMENT CLOCK |
||||
JSCROG JMP SCRORG ;SCREEN ORG |
||||
JPLOT JMP PLOT ;READ/SET X,Y COORD |
||||
JIOBAS JMP IOBASE ;RETURN I/O BASE |
||||
.SKI 5 |
||||
.PAG 'JUMP TABLE/VECTORS' |
||||
*=$FFFA |
||||
.WOR NMI ;PROGRAM DEFINEABLE |
||||
.WOR START ;INITIALIZATION CODE |
||||
.WOR PULS ;INTERRUPT HANDLER |
||||
.END |
@ -0,0 +1,198 @@
|
||||
.PAG 'TAPE WRITE' |
||||
; CASSETTE INFO - FSBLK IS BLOCK COUNTER FOR RECORD |
||||
; FSBLK = 2 -FIRST HEADER |
||||
; = 1 -FIRST DATA |
||||
; = 0 -SECOND DATA |
||||
; |
||||
; WRITE - TOGGLE WRITE BIT ACCORDING TO LSB IN OCHAR |
||||
; |
||||
WRITE LDA OCHAR ;SHIFT BIT TO WRITE INTO CARRY |
||||
LSR A |
||||
LDA #96 ;...C CLR WRITE SHORT |
||||
BCC WRT1 |
||||
WRTW LDA #176 ;...C SET WRITE LONG |
||||
WRT1 LDX #0 ;SET AND STORE TIME |
||||
WRTX STA D1T2L |
||||
STX D1T2H |
||||
LDA D1ICR ;CLEAR IRQ |
||||
LDA #$19 ;ENABLE TIMER (ONE-SHOT) |
||||
STA D1CRB |
||||
LDA R6510 ;TOGGLE WRITE BIT |
||||
EOR #$08 |
||||
STA R6510 |
||||
AND #$08 ;LEAVE ONLY WRITE BIT |
||||
RTS |
||||
; |
||||
WRTL3 SEC ;FLAG PRP FOR END OF BLOCK |
||||
ROR PRP |
||||
BMI WRT3 ; JMP |
||||
; |
||||
; WRTN - CALLED AT THE END OF EACH BYTE |
||||
; TO WRITE A LONG RER REZ |
||||
; HHHHHHLLLLLLHHHLLL... |
||||
; |
||||
WRTN LDA RER ;CHECK FOR ONE LONG |
||||
BNE WRTN1 |
||||
LDA #16 ;WRITE A LONG BIT |
||||
LDX #1 |
||||
JSR WRTX |
||||
BNE WRT3 |
||||
INC RER |
||||
LDA PRP ;IF END OF BLOCK(BIT SET BY WRTL3)... |
||||
BPL WRT3 ;...NO END CONTINUE |
||||
JMP WRNC ;...END ...FINISH OFF |
||||
; |
||||
WRTN1 LDA REZ ;CHECK FOR A ONE BIT |
||||
BNE WRTN2 |
||||
JSR WRTW |
||||
BNE WRT3 |
||||
INC REZ |
||||
BNE WRT3 |
||||
; |
||||
WRTN2 JSR WRITE |
||||
BNE WRT3 ;ON BIT LOW EXIT |
||||
LDA FIRT ;CHECK FOR FIRST OF DIPOLE |
||||
EOR #1 |
||||
STA FIRT |
||||
BEQ WRT2 ;DIPOLE DONE |
||||
LDA OCHAR ;FLIPS BIT FOR COMPLEMENTARY RIGHT |
||||
EOR #1 |
||||
STA OCHAR |
||||
AND #1 ;TOGGLE PARITY |
||||
EOR PRTY |
||||
STA PRTY |
||||
WRT3 JMP PREND ;RESTORE REGS AND RTI EXIT |
||||
; |
||||
WRT2 LSR OCHAR ;MOVE TO NEXT BIT |
||||
DEC PCNTR ;DEC COUNTER FOR # OF BITS |
||||
LDA PCNTR ;CHECK FOR 8 BITS SENT... |
||||
BEQ WRT4 ;...IF YES MOVE IN PARITY |
||||
BPL WRT3 ;...ELSE SEND REST |
||||
; |
||||
WRTS JSR NEWCH ;CLEAN UP COUNTERS |
||||
CLI ;ALLOW FOR INTERRUPTS TO NEST |
||||
LDA CNTDN ;ARE WE WRITING HEADER COUNTERS?... |
||||
BEQ WRT6 ;...NO |
||||
; WRITE HEADER COUNTERS (9876543210 TO HELP WITH READ) |
||||
LDX #0 ;CLEAR BCC |
||||
STX DATA |
||||
WRTS1 DEC CNTDN |
||||
LDX FSBLK ;CHECK FOR FIRST BLOCK HEADER |
||||
CPX #2 |
||||
BNE WRT61 ;...NO |
||||
ORA #$80 ;...YES MARK FIRST BLOCK HEADER |
||||
WRT61 STA OCHAR ;WRITE CHARACTERS IN HEADER |
||||
BNE WRT3 |
||||
; |
||||
WRT6 JSR CMPSTE ;COMPARE START:END |
||||
BCC WRT7 ;NOT DONE |
||||
BNE WRTL3 ;GO MARK END |
||||
INC SAH |
||||
LDA DATA ;WRITE OUT BCC |
||||
STA OCHAR |
||||
BCS WRT3 ;JMP |
||||
; |
||||
WRT7 LDY #0 ;GET NEXT CHARACTER |
||||
LDA (SAL)Y |
||||
STA OCHAR ;STORE IN OUTPUT CHARACTER |
||||
EOR DATA ;UPDATE BCC |
||||
STA DATA |
||||
JSR INCSAL ;INCREMENT FETCH ADDRESS |
||||
BNE WRT3 ;BRANCH ALWAYS |
||||
; |
||||
WRT4 LDA PRTY ;MOVE PARITY INTO OCHAR... |
||||
EOR #1 |
||||
STA OCHAR ;...TO BE WRITTEN AS NEXT BIT |
||||
WRTBK JMP PREND ;RESTORE REGS AND RTI EXIT |
||||
; |
||||
WRNC DEC FSBLK ;CHECK FOR END |
||||
BNE WREND ;...BLOCK ONLY |
||||
JSR TNOF ;...WRITE, SO TURN OFF MOTOR |
||||
WREND LDA #80 ;PUT 80 CASSETTE SYNCS AT END |
||||
STA SHCNL |
||||
LDX #8 |
||||
SEI |
||||
JSR BSIV ;SET VECTOR TO WRITE ZEROS |
||||
BNE WRTBK ;JMP |
||||
; |
||||
WRTZ LDA #120 ;WRITE LEADING ZEROS FOR SYNC |
||||
JSR WRT1 |
||||
BNE WRTBK |
||||
DEC SHCNL ;CHECK IF DONE WITH LOW SYNC... |
||||
BNE WRTBK ;...NO |
||||
JSR NEWCH ;...YES CLEAR UP COUNTERS |
||||
DEC SHCNH ;CHECK IF DONE WITH SYNC... |
||||
BPL WRTBK ;...NO |
||||
LDX #10 ;...YES SO SET VECTOR FOR DATA |
||||
JSR BSIV |
||||
CLI |
||||
INC SHCNH ;ZERO SHCNH |
||||
LDA FSBLK ;IF DONE THEN... |
||||
BEQ STKY ;...GOTO SYSTEM RESTORE |
||||
JSR RD300 |
||||
LDX #9 ;SET UP FOR HEADER COUNT |
||||
STX CNTDN |
||||
STX PRP ;CLEAR ENDOF BLOCK FLAG |
||||
BNE WRTS ;JMP |
||||
; |
||||
TNIF PHP ;CLEAN UP INTERRUPTS AND RESTORE PIA'S |
||||
SEI |
||||
LDA VICREG+17 ;UNLOCK VIC |
||||
ORA #$10 ;ENABLE DISPLAY |
||||
STA VICREG+17 |
||||
JSR TNOF ;TURN OFF MOTOR |
||||
LDA #$7F ;CLEAR INTERRUPTS |
||||
STA D1ICR |
||||
JSR IOKEYS ;RESTORE KEYBOARD IRQ FROM TIMMER1 |
||||
LDA IRQTMP+1 ;RESTORE KEYBOARD INTERRUPT VECTOR |
||||
BEQ TNIQ ;NO IRQ (IRQ VECTOR CANNOT BE Z-PAGE) |
||||
STA CINV+1 |
||||
LDA IRQTMP |
||||
STA CINV |
||||
TNIQ PLP |
||||
RTS |
||||
; |
||||
STKY JSR TNIF ;GO RESTORE SYSTEM INTERRUPTS |
||||
BEQ WRTBK ;CAME FOR CASSETTE IRQ SO RTI |
||||
; |
||||
; BSIV - SUBROUTINE TO CHANGE IRQ VECTORS |
||||
; ENTRYS - .X = 8 WRITE ZEROS TO TAPE |
||||
; .X = 10 WRITE DATA TO TAPE |
||||
; .X = 12 RESTORE TO KEYSCAN |
||||
; .X = 14 READ DATA FROM TAPE |
||||
; |
||||
BSIV LDA BSIT-8,X ;MOVE IRQ VECTORS, TABLE TO INDIRECT |
||||
STA CINV |
||||
LDA BSIT+1-8,X |
||||
STA CINV+1 |
||||
RTS |
||||
; |
||||
TNOF LDA R6510 ;TURN OFF CASSETTE MOTOR |
||||
ORA #$20 ; |
||||
STA R6510 |
||||
RTS |
||||
.SKI 3 |
||||
;COMPARE START AND END LOAD/SAVE |
||||
;ADDRESSES. SUBROUTINE CALLED BY |
||||
;TAPE READ, SAVE, TAPE WRITE |
||||
; |
||||
CMPSTE SEC |
||||
LDA SAL |
||||
SBC EAL |
||||
LDA SAH |
||||
SBC EAH |
||||
RTS |
||||
.SKI 3 |
||||
;INCREMENT ADDRESS POINTER SAL |
||||
; |
||||
INCSAL INC SAL |
||||
BNE INCR |
||||
INC SAH |
||||
INCR RTS |
||||
.END |
||||
; RSR 7/28/80 ADD COMMENTS |
||||
; RSR 8/4/80 CHANGED I/O FOR VIXEN |
||||
; RSR 8/21/80 CHANGED I/O FOR VIXEN MOD |
||||
; RSR 8/25/80 CHANGED I/O FOR VIXEN MOD2 |
||||
; RSR 12/11/81 MODIFY I/O FOR VIC-40 |
||||
; RSR 2/9/82 ADD VIC TURN ON, REPLACE SAH WITH PRP |
Loading…
Reference in new issue