more UP9600 integration work
This commit is contained in:
1 parent
86e8bcbe7f
commit
fa360622bd
7 files changed
+224
-4
No files matched your search
@@ -19,7 +19,9 @@ save_iec_error:
|
|||||||
jmp lvs_device_not_found_error // XXX find a better error
|
jmp lvs_device_not_found_error // XXX find a better error
|
||||||
|
|
||||||
|
|
||||||
save_iec: // XXX finish the implementation
|
save_iec:
|
||||||
|
|
||||||
|
// XXX report error on empty file name
|
||||||
|
|
||||||
// Display SAVING
|
// Display SAVING
|
||||||
jsr lvs_display_saving
|
jsr lvs_display_saving
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#if HAS_RS232
|
#if CONFIG_RS232_UP2400
|
||||||
|
|
||||||
|
|
||||||
chkin_rs232:
|
chkin_rs232:
|
||||||
STUB_IMPLEMENTATION() // XXX provide implementation for both UP2400 and UP9600
|
STUB_IMPLEMENTATION() // XXX provide implementation for both UP2400 and UP9600
|
||||||
|
|
||||||
|
|
||||||
#endif // HAS_RS232
|
#endif // CONFIG_RS232_UP2400
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// RS-232 part of the CHKIN routine
|
||||||
|
//
|
||||||
|
|
||||||
|
// Based on UP9600 code by Daniel Dallman with Bo Zimmerman adaptations
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_RS232_UP9600
|
||||||
|
|
||||||
|
|
||||||
|
// XXX get rid of the ENABLE/DISABLE mechanism
|
||||||
|
|
||||||
|
|
||||||
|
chkin_rs232:
|
||||||
|
|
||||||
|
pha
|
||||||
|
lda XXX_UPFLAG
|
||||||
|
bne !+
|
||||||
|
pla
|
||||||
|
jmp $F20E // XXX
|
||||||
|
|
||||||
|
!:
|
||||||
|
pla
|
||||||
|
jsr $F30F // XXX
|
||||||
|
beq !+
|
||||||
|
jmp $F701 // XXX
|
||||||
|
|
||||||
|
!:
|
||||||
|
jsr $F31F // XXX
|
||||||
|
lda FA
|
||||||
|
cmp #$02
|
||||||
|
beq !+
|
||||||
|
cmp #$04
|
||||||
|
bcc chkin_rs232_nochkin
|
||||||
|
jsr XXX_DISABLE
|
||||||
|
jmp chkin_rs232_nochkin
|
||||||
|
!:
|
||||||
|
sta $99
|
||||||
|
jsr XXX_ENABLE
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
|
||||||
|
chkin_rs232_nochkin
|
||||||
|
jmp $F219 // XXX
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CONFIG_RS232_UP9600
|
||||||
@@ -17,7 +17,7 @@ chrin_rs232:
|
|||||||
lda #$00
|
lda #$00
|
||||||
sta XXX_SAVBYTE
|
sta XXX_SAVBYTE
|
||||||
sta RSSTAT
|
sta RSSTAT
|
||||||
jsr XXX_RSIN
|
jsr up9600_rsin
|
||||||
bcc !+
|
bcc !+
|
||||||
plx_trash_a
|
plx_trash_a
|
||||||
ply_trash_a
|
ply_trash_a
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// RS-232 NMI handler part
|
||||||
|
//
|
||||||
|
|
||||||
|
// Based on UP9600 code by Daniel Dallman with Bo Zimmerman adaptations
|
||||||
|
|
||||||
|
|
||||||
|
// XXX integrate with NMI handler
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_RS232_UP9600
|
||||||
|
|
||||||
|
|
||||||
|
up9600_nmi:
|
||||||
|
// XXX integrate this
|
||||||
|
|
||||||
|
|
||||||
|
NMIDOBIT
|
||||||
|
pha
|
||||||
|
bit CIA2_ICR // $DD0D; CHECK BIT 7 (STARTBIT PRINT)
|
||||||
|
bpl NMIDOBI2; NO STARTBIT RECEIVED, THEN SKIP
|
||||||
|
lda #$13
|
||||||
|
sta CIA2_CRB // $DD0F; START TIMER B (FORCED RELOAD, SIGNAL AT PB7)
|
||||||
|
sta CIA2_ICR // $DD0D; DISABLE TIMER AND FLAG INTERRUPTS
|
||||||
|
lda #<NMIBYTRY; ON NEXT NMI CALL NMIBYTRY
|
||||||
|
sta NMIVECT; (TRIGGERED BY SDR FULL)
|
||||||
|
lda #>NMIBYTRY
|
||||||
|
sta NMIVECT+1
|
||||||
|
NMIDOBI2
|
||||||
|
pla; IGNORE, IF NMI WAS TRIGGERED BY RESTORE-KEY
|
||||||
|
rti
|
||||||
|
;
|
||||||
|
NMIBYTRY
|
||||||
|
pha
|
||||||
|
bit CIA2_ICR // $DD0D; CHECK BIT 7 (SDR FULL PRINT)
|
||||||
|
bpl NMIDOBI2; SDR NOT FULL, THEN SKIP (EG. RESTORE-KEY)
|
||||||
|
lda #$92
|
||||||
|
sta CIA2_CRB // $DD0F; STOP TIMER B (KEEP SIGNALLING AT PB7!)
|
||||||
|
sta CIA2_ICR // $DD0D; ENABLE FLAG (AND TIMER) INTERRUPTS
|
||||||
|
lda #<NMIDOBIT; ON NEXT NMI CALL NMIDOBIT
|
||||||
|
sta NMIVECT; (TRIGGERED BY A STARTBIT)
|
||||||
|
lda #>NMIDOBIT
|
||||||
|
sta NMIVECT+1
|
||||||
|
phx_trash_a
|
||||||
|
phy_trash_a
|
||||||
|
lda CIA2_SDR // $DD0C; READ SDR (BIT0=DATABIT7,...,BIT7=DATABIT0)
|
||||||
|
cmp #128; MOVE BIT7 INTO CARRY-FLAG
|
||||||
|
and #127
|
||||||
|
tax
|
||||||
|
lda REVTAB,X; READ DATABITS 1-7 FROM LOOKUP TABLE
|
||||||
|
adc #0; ADD DATABIT0
|
||||||
|
ldy RIDBE; AND WRITE IT INTO THE RECEIVE BUFFER
|
||||||
|
sta (RIBUF),Y
|
||||||
|
iny
|
||||||
|
sty RIDBE
|
||||||
|
sec;;START BUFFER FULL CHK
|
||||||
|
tya
|
||||||
|
sbc RIDBS
|
||||||
|
cmp #200
|
||||||
|
bcc NMIBYTR2
|
||||||
|
lda CIA2_PRB // $DD01;; MORE THAN 200 BYTES IN THE RECEIVE BUFFER
|
||||||
|
and #$FD;; THEN DISABLE RTS
|
||||||
|
sta CIA2_PRB // $DD01
|
||||||
|
NMIBYTR2
|
||||||
|
ply_trash_a
|
||||||
|
plx_trash_a
|
||||||
|
pla
|
||||||
|
rti
|
||||||
|
|
||||||
|
#endif // CONFIG_RS232_UP9600
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Get byte from serial interface
|
||||||
|
//
|
||||||
|
|
||||||
|
// Based on UP9600 code by Daniel Dallman with Bo Zimmerman adaptations
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_RS232_UP9600
|
||||||
|
|
||||||
|
|
||||||
|
up9600_rsin:
|
||||||
|
|
||||||
|
ldy RIDBS
|
||||||
|
cpy RIDBE
|
||||||
|
beq up9600_rsin_end; // skip (empty buffer, return with carry set)
|
||||||
|
|
||||||
|
lda (RIBUF),Y
|
||||||
|
iny
|
||||||
|
sty RIDBS
|
||||||
|
pha // begin buffer emptying chk
|
||||||
|
tya
|
||||||
|
sec
|
||||||
|
sbc RIDBE
|
||||||
|
cmp #206 // 256-50
|
||||||
|
bcc !+
|
||||||
|
lda #$02
|
||||||
|
ora CIA2_PR // $DD01
|
||||||
|
sta CIA2_PR // enable RTS
|
||||||
|
clc
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
!:
|
||||||
|
pla
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
up9600_rsin_end:
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
#endif // CONFIG_RS232_UP9600
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Put byte to serial interface
|
||||||
|
//
|
||||||
|
|
||||||
|
// Based on UP9600 code by Daniel Dallman with Bo Zimmerman adaptations
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_RS232_UP9600
|
||||||
|
|
||||||
|
|
||||||
|
up9600_rsout:
|
||||||
|
|
||||||
|
pha
|
||||||
|
sta $9E // XXX synchronize with aliases
|
||||||
|
cmp #$80
|
||||||
|
and #$7F
|
||||||
|
stx $A8 // XXX synchronize with aliases
|
||||||
|
sty $A7 // XXX synchronize with aliases
|
||||||
|
tax
|
||||||
|
jsr up9600_rsout_time
|
||||||
|
|
||||||
|
lda REVTAB, x
|
||||||
|
adc #$00
|
||||||
|
lsr
|
||||||
|
sei
|
||||||
|
sta CIA1_SDR // $DC0C
|
||||||
|
lda #$02
|
||||||
|
STA XXX_OUTSTAT
|
||||||
|
ror
|
||||||
|
ora #$7F
|
||||||
|
sta CIA1_SDR // $DC0C
|
||||||
|
cli
|
||||||
|
ldx $A8 // XXX synchronize with aliases
|
||||||
|
ldy $A7 // XXX synchronize with aliases
|
||||||
|
pla
|
||||||
|
rts
|
||||||
|
|
||||||
|
up9600_rsout_time:
|
||||||
|
|
||||||
|
cli
|
||||||
|
lda #$FD
|
||||||
|
sta TIME+2 // XXX check if this is the lowest byte
|
||||||
|
|
||||||
|
rs232_rsout_wait:
|
||||||
|
|
||||||
|
lda XXX_OUTSTAT
|
||||||
|
beq !+
|
||||||
|
bit TIME+2
|
||||||
|
bmi up9600_rsout_wait
|
||||||
|
|
||||||
|
!:
|
||||||
|
jmp $F490 // XXX
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CONFIG_RS232_UP9600
|
||||||
Reference in new issue
Block a user