IRQ handler for UP9600

This commit is contained in:
FeralChild64 committed 2019-11-22 17:35:17 +01:00
1 parent df1285e5f3
commit 6f010b8c56
9 files changed
+138 -14

No files matched your search

+68 -1
View File
@@ -1,6 +1,6 @@
//
// Enable UP9600 interface
// Enable UP9600 interface support
//
// Based on UP9600 code by Daniel Dallman with Bo Zimmerman adaptations
@@ -11,6 +11,63 @@
up9600_enable: // XXX adapt
sei
lda IRQVECT
cmp #<ORIGIRQ
bne INSTERR; IRQ-VECTOR ALREADY CHANGED
lda IRQVECT+1
cmp #>ORIGIRQ
bne INSTERR; IRQ-VECTOR ALREADY CHANGED
lda NMIVECT
cmp #<ORIGNMI
bne INSTERR; NMI-VECTOR ALREADY CHANGED
lda NMIVECT+1
cmp #>ORIGNMI
bne INSTERR; NMI-VECTOR ALREADY CHANGED
ldy #0
sty RODBE
sty RODBS
sty RIDBE
sty RIDBS
; PROBE FOR RS232 INTERFACE
cli
lda #$7F
sta CIA2_ICR // $DD0D ; DISABLE ALL NMIS
lda #$80
sta CIA2_DDRB // $DD03 ; PB7 USED AS OUTPUT
sta $DD0E; STOP TIMERA
sta CIA2_CRB // $DD0F ; STOP TIMERB
bit CIA2_ICR // $DD0D ; CLEAR PENDING INTERRUPTS
ldx #8
INSTALL2
stx CIA2_PRB // $DD01; TOGGLE TXD
sta CIA2_PRB // $DD01; AND LOOK IF IT TRIGGERS AN
dex; SHIFT-REGISTER INTERRUPT
bne INSTALL2
lda CIA2_ICR // $DD0D ; CHECK FOR BIT3 (SDR-FLAG)
and #8
beq INSTERR; NO INTERFACE DETECTED
; GENERATE LOOKUP TABLE
ldx #0
INSTALL3
stx OUTSTAT; OUTSTAT USED AS TEMPORARY VARIABLE
ldy #8
INSTALL4
asl OUTSTAT
ror
dey
bne INSTALL4
sta REVTAB,X
inx
bpl INSTALL3
sei
// XXX set NEWIRQ as IRQ vector
// XXX set NMIDOBIT as NMI vector
@@ -63,4 +120,14 @@ ENABLE2
rts
INSTERR
cli
sec
rts
#endif // CONFIG_RS232_UP9600