Files
open-roms/c64/kernal/rs232/open_rs232.s
T
2019-11-22 17:35:17 +01:00

61 lines
895 B
ArmAsm

//
// RS-232 part of the OPEN routine
//
#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:
// First check how many RS-232 channels are currently allocated.
// If more than one, skip allocation (already allocated).
jsr rs232_count_channels
cpx #$02 // set Carry if more than one is open
bcs open_rs232_end
// Allocate buffers - first RIBUF, afterwards ROBUF
// (checked addresses on original ROMs)
lda MEMSIZK+0
sta ROBUF+0
sta RIBUF+0
dec MEMSIZK+1
lda MEMSIZK+1
sta RIBUF+1
dec MEMSIZK+1
lda MEMSIZK+1
sta ROBUF+1
// Initialize buffer indexes
lda #$00
sta RIDBE
sta RIDBS
sta RODBS
sta RODBE
#if CONFIG_RS232_UP9600
jmp up9600_enable
#endif // CONFIG_RS232_UP9600
open_rs232_end:
jmp open_done_success
#endif // HAS_RS232