various I/O updates

This commit is contained in:
FeralChild64 committed 2019-10-31 17:16:32 +01:00
1 parent bdcebb554f
commit c03c7abf45
11 files changed
+263 -15

No files matched your search

+25 -1
View File
@@ -7,9 +7,33 @@
#if HAS_RS232
#if CONFIG_MEMORY_MODEL_60K
.error "CONFIG_MEMORY_MODEL_60K is not compatible with RS-232 memory allocation code"
#endif
close_rs232:
// XXX provide implementation for both UP2400 and UP960
// First check how many RS-232 channels are currently allocated.
// If more than one, skip deallocation (other channels still uses the buffer).
jsr rs232_count_channels
bcs close_rs232_end
// Deallocate buffer
inc MEMSIZK+1
inc MEMSIZK+1
// XXX is this needed? check with original ROM what it actually does
lda #$00
sta ROBUF+0
sta ROBUF+1
sta RIBUF+0
sta RIBUF+1
close_rs232_end:
jmp close_remove_from_table
+33 -2
View File
@@ -7,9 +7,40 @@
#if HAS_RS232
#if CONFIG_MEMORY_MODEL_60K
.error "CONFIG_MEMORY_MODEL_60K is not compatible with RS-232 memory allocation code"
#endif
open_rs232:
// XXX provide implementation for both UP2400 and UP9600
// First check how many RS-232 channels are currently allocated.
// If more than one, skip allocation (already allocated).
jsr rs232_count_channels
bcs open_rs232_end
// Allocate buffer
lda MEMSIZK+0
sta ROBUF+0
sta RIBUF+0
dec MEMSIZK+1
lda MEMSIZK+1
sta ROBUF+1 // XXX RIBUF or ROBUF?
dec MEMSIZK+1
lda MEMSIZK+1
sta RIBUF+1 // XXX RIBUF or ROBUF?
lda #$00
sta RIDBE
sta RIDBS
sta RODBS
sta RODBE
open_rs232_end:
jmp open_done_success
+28
View File
@@ -0,0 +1,28 @@
//
// Sets .X to number of open RS-232 channels
// Sets Carry if more than one is open
#if HAS_RS232
rs232_count_channels:
ldx #$00
ldy LDTND
!:
dey
bmi close_rs232_search_done
lda FAT, y
cmp #$02
bne !-
inx
bpl !- // branch always
cpx #$02
rts
#endif