-;----------------------------------------------------------------------------
-; SER_UNINSTALL routine. Is called before the driver is removed from memory.
-; Must return an SER_ERR_xx code in a/x.
-
-SER_UNINSTALL:
- pushall
- print_string "SER_UNINSTALL called"
- pullall
- jmp SER_CLOSE
-
-
-.macro print_string2 addr, len
- ldx #0 ; channel 0
- lda #<addr
- sta ICBAL,x ; address
- lda #>addr
- sta ICBAH,x
- lda #<len
- sta ICBLL,x ; length
- lda #>len
- sta ICBLH,x
- lda #PUTCHR
- sta ICCOM,x
- jsr CIOV
-.endmacro
-
-.macro push_ptr1
- lda ptr1+1
- pha
- lda ptr1
- pha
-.endmacro
-
-.macro pull_ptr1
- pla
- sta ptr1
- pla
- sta ptr1+1
-.endmacro
-
-.macro push_ptr2und1
- lda ptr2+1
- pha
- lda ptr2
- pha
- lda ptr1+1
- pha
- sta ptr2+1
- tax
- lda ptr1
- pha
- sta ptr2
-.endmacro
-
-.macro pull_ptr2und1
- pla
- sta ptr1
- pla
- sta ptr1+1
- pla
- sta ptr2
- pla
- sta ptr2+1
-.endmacro
-
-
-nl_txt: .byte ATEOL
-nl_txt_len = * - nl_txt
-
-nl: pushall
- print_string2 nl_txt, nl_txt_len
- pullall
- rts
-
-iocb_txt: .byte " IOCB number: "
-iocb_txt_len = * - iocb_txt
-
-print_iocb_txt:
- pushall
- print_string2 iocb_txt, iocb_txt_len
- pullall
- rts
-
-open_txt: .byte "OPEN"
-open_txt_len = * - open_txt
-
-print_open_txt:
- pushall
- print_string2 open_txt, open_txt_len
- pullall
- rts
-
-
-put_txt: .byte "PUT "
-put_txt_len = * - put_txt
-
-print_put_txt:
- pushall
- print_string2 put_txt, put_txt_len
- pullall
- rts
-
-aux1_txt: .byte "AUX1: "
-aux1_txt_len = * - aux1_txt
-
-dump_aux1:
- pushall
- print_string2 aux1_txt,aux1_txt_len
- tsx
- lda $103,x
- jsr dump_hex_low
- jsr nl
- pullall
- rts
-
-dump_iocb_num:
- pushall
- txa
- jsr dump_hex_low
- pullall
- rts
-
-dump_hex:
- pushall
- tsx
- lda $103,x
- jsr dump_hex_low
- pullall
- rts
-
-
-; no need to preserve regs
-dump_hex_low:
- tax
- push_ptr1
-
- lda #<outbuf
- sta ptr1
- lda #>outbuf
- sta ptr1+1
-
- txa
- jsr hex8
-
- ldx #0 ; channel 0
-
- lda #2
- sta ICBLL,x ; length
- lda #0
- sta ICBLH,x
-
- lda #<outbuf
- sta ICBAL,x ; address
- lda #>outbuf
- sta ICBAH,x
- lda #PUTCHR
- sta ICCOM,x
- jsr CIOV
-
-
- pull_ptr1
- rts
-
-
-; ldy #SER_PARAMS::BAUDRATE
-; lda (ptr1),y
-
-dump:
- pushall
- push_ptr2und1
-
-.ifndef __ATARIXL__
- tay
- lda #<outbuf
- sta ptr1
- lda #>outbuf
- sta ptr1+1
-
- ; ptr1 - pointer to string buffer
- ; ptr2 - pointer to rs232 params
- tya
- jsr hex16
- lda #':'
- sta (ptr1),y
- iny
- lda #' '
- sta (ptr1),y
- iny
- lda #' '
- sta (ptr1),y
- lda ptr1
- clc
- adc #3
- sta ptr1
- bcc @f
- inc ptr1+1
-@f:
-
-.repeat 5
-
- ldy #0
- lda (ptr2),y
- jsr hex8
- lda #' '
- sta (ptr1),y
- inc ptr1
- bne *+4
- inc ptr1+1
- inc ptr2
- bne *+4
- inc ptr2+1
-
-.endrepeat
-
- lda #ATEOL
- sta (ptr1),y
- inc ptr1
- bne *+4
- inc ptr1+1
-
- ldx #0 ; channel 0
-
- lda ptr1
- sec
- sbc #<outbuf
- sta ICBLL,x ; length
- lda ptr1+1
- sbc #>outbuf
- sta ICBLH,x
-
- lda #<outbuf
- sta ICBAL,x ; address
- lda #>outbuf
- sta ICBAH,x
- lda #PUTCHR
- sta ICCOM,x
- jsr CIOV
-.endif
-
- pull_ptr2und1
- pullall
- rts
-