aboutsummaryrefslogtreecommitdiff
path: root/src/fuji_asm.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/fuji_asm.s')
-rw-r--r--src/fuji_asm.s3016
1 files changed, 3016 insertions, 0 deletions
diff --git a/src/fuji_asm.s b/src/fuji_asm.s
new file mode 100644
index 0000000..2d9f205
--- /dev/null
+++ b/src/fuji_asm.s
@@ -0,0 +1,3016 @@
+;
+; File generated by cc65 v 2.12.9
+;
+ .fopt compiler,"cc65 v 2.12.9"
+ .setcpu "6502"
+ .smart on
+ .autoimport on
+ .case on
+ .debuginfo off
+ .importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2
+ .macpack longbranch
+ .import _stdout
+ .import _fflush
+ .import _fputs
+ .import _printf
+ .import _putchar
+ .import _puts
+ .import _sprintf
+ .import _atoi
+ .import _exit
+ .import _strcmp
+ .import _strcpy
+ .import _strlen
+ .import _memcmp
+ .import _memcpy
+ .import _strcasecmp
+ .import _toupper
+ .import _get_ostype
+ .import _kbhit
+ .import _cgetc
+ .import _cursor
+ .import __clocks_per_sec
+ .import _clock
+ .import _timer_set
+ .import _timer_reset
+ .import _timer_expired
+ .export _resolv_found
+ .import _resolv_conf
+ .import _resolv_init
+ .import _resolv_query
+ .import _telnet_send
+ .export _telnet_connected
+ .export _telnet_closed
+ .export _telnet_sent
+ .export _telnet_aborted
+ .export _telnet_timedout
+ .export _telnet_newdata
+ .import _uip_init
+ .import _uip_connect
+ .import _htons
+ .import _uip_len
+ .import _uip_conn
+ .import _uip_conns
+ .import _uip_udp_conn
+ .import _uip_udp_conns
+ .import _uip_flags
+ .import _uip_process
+ .import _uip_hostaddr
+ .import _uip_netmask
+ .import _uip_draddr
+ .import _uiplib_ipaddrconv
+ .import _rs232dev_init
+ .import _rs232dev_send
+ .import _rs232dev_close
+ .import _rs232dev_poll
+ .import _atari_exec_p
+ .import _config
+ .import _format_ip
+ .import _get_config
+ .import _config_is_valid
+ .import _get_line
+ .import _set_default_config
+ .import _disable_break
+ .export _os_version
+ .export _input_buf
+ .export _chan_msg_buf
+ .export _output_buf
+ .export _channel
+ .export _last_msg_nick
+ .export _input_buf_len
+ .export _output_buf_len
+ .export _done
+ .export _connected
+ .export _joined_channel
+ .export _nick_registered
+ .export _vbell_active
+ .export _bell
+ .export _redraw_user_buffer
+ .export _nick_reg_timer
+ .export _tstate
+ .export _vbell_timer
+ .export _main
+ .export _do_pong
+ .export _do_server_msg
+ .export _do_ctcp
+ .export _do_msg
+ .export _del_user_buffer
+
+.segment "DATA"
+
+_os_version:
+ .byte $58,$4C,$5F,$58,$45,$00
+ .res 4,$00
+_input_buf:
+ .word $2900
+_chan_msg_buf:
+ .word $2A00
+_output_buf:
+ .word $2C00
+_last_msg_nick:
+ .byte $00
+ .res 20,$00
+_input_buf_len:
+ .word $0000
+_output_buf_len:
+ .word $0000
+_done:
+ .byte $00
+_connected:
+ .byte $00
+_joined_channel:
+ .byte $00
+_nick_registered:
+ .byte $00
+_vbell_active:
+ .byte $00
+
+.segment "RODATA"
+
+L0001:
+ .byte $38,$30,$30,$00,$31,$32,$30,$30,$58,$4C,$00,$C6,$F5,$EA,$E9,$C3
+ .byte $E8,$E1,$F4,$20,$76,$30,$2E,$35,$00,$53,$65,$72,$76,$65,$72,$20
+ .byte $6E,$61,$6D,$65,$2F,$49,$50,$2C,$20,$5B,$43,$5D,$6F,$6E,$66,$69
+ .byte $67,$2C,$20,$6F,$72,$20,$5B,$44,$5D,$4F,$53,$9B,$00,$5B,$25,$73
+ .byte $5D,$3A,$20,$00,$64,$00,$63,$00,$44,$3A,$46,$55,$4A,$49,$43,$4F
+ .byte $4E,$46,$2E,$43,$4F,$4D,$00,$45,$72,$72,$6F,$72,$20,$25,$64,$21
+ .byte $9B,$00,$2A,$20,$52,$65,$67,$69,$73,$74,$65,$72,$69,$6E,$67,$20
+ .byte $6E,$69,$63,$6B,$00,$4E,$49,$43,$4B,$20,$25,$73,$25,$63,$55,$53
+ .byte $45,$52,$20,$25,$73,$20,$25,$73,$20,$25,$73,$20,$3A,$25,$73,$25
+ .byte $63,$00,$46,$75,$6A,$69,$43,$68,$61,$74,$00,$43,$6F,$6D,$6D,$61
+ .byte $6E,$64,$20,$72,$65,$71,$75,$69,$72,$65,$73,$20,$61,$72,$67,$75
+ .byte $6D,$65,$6E,$74,$00,$59,$6F,$75,$20,$61,$72,$65,$20,$6E,$6F,$74
+ .byte $20,$69,$6E,$20,$61,$20,$63,$68,$61,$6E,$6E,$65,$6C,$20,$28,$75
+ .byte $73,$65,$20,$2F,$6A,$6F,$69,$6E,$20,$23,$63,$68,$61,$6E,$6E,$65
+ .byte $6C,$29,$00,$59,$6F,$75,$20,$61,$72,$65,$20,$61,$6C,$72,$65,$61
+ .byte $64,$79,$20,$69,$6E,$20,$61,$20,$63,$68,$61,$6E,$6E,$65,$6C,$20
+ .byte $28,$75,$73,$65,$20,$2F,$70,$61,$72,$74,$20,$74,$6F,$20,$6C,$65
+ .byte $61,$76,$65,$29,$00,$4E,$41,$4D,$45,$53,$00,$57,$48,$4F,$00,$2F
+ .byte $6D,$73,$67,$20,$25,$73,$20,$00,$50,$52,$49,$56,$4D,$53,$47,$20
+ .byte $25,$73,$20,$3A,$25,$73,$00,$25,$73,$20,$25,$73,$25,$63,$00,$25
+ .byte $73,$25,$63,$00,$50,$52,$49,$56,$4D,$53,$47,$20,$25,$73,$20,$25
+ .byte $63,$56,$45,$52,$53,$49,$4F,$4E,$25,$63,$25,$63,$00,$50,$52,$49
+ .byte $56,$4D,$53,$47,$20,$25,$73,$20,$25,$63,$50,$49,$4E,$47,$20,$25
+ .byte $30,$33,$64,$20,$25,$30,$33,$64,$20,$25,$30,$33,$64,$25,$63,$25
+ .byte $63,$00,$50,$52,$49,$56,$4D,$53,$47,$20,$25,$73,$20,$3A,$25,$63
+ .byte $41,$43,$54,$49,$4F,$4E,$20,$25,$73,$25,$63,$25,$63,$00,$4D,$45
+ .byte $00,$4D,$53,$47,$00,$4D,$00,$50,$52,$49,$56,$4D,$53,$47,$00,$4A
+ .byte $4F,$49,$4E,$00,$4A,$00,$4A,$4F,$49,$4E,$00,$4A,$4F,$49,$4E,$00
+ .byte $50,$41,$52,$54,$00,$50,$41,$52,$54,$00,$56,$45,$52,$53,$49,$4F
+ .byte $4E,$00,$56,$45,$52,$00,$50,$49,$4E,$47,$00,$4E,$49,$43,$4B,$00
+ .byte $2A,$20,$59,$6F,$75,$20,$61,$72,$65,$20,$6E,$6F,$77,$20,$6B,$6E
+ .byte $6F,$77,$6E,$20,$61,$73,$20,$25,$73,$9B,$00,$51,$55,$4F,$54,$45
+ .byte $00,$43,$6F,$6E,$6E,$65,$63,$74,$65,$64,$20,$74,$6F,$20,$73,$65
+ .byte $72,$76,$65,$72,$00,$43,$6F,$6E,$6E,$65,$63,$74,$69,$6F,$6E,$20
+ .byte $63,$6C,$6F,$73,$65,$64,$00,$43,$6F,$6E,$6E,$65,$63,$74,$69,$6F
+ .byte $6E,$20,$61,$62,$6F,$72,$74,$65,$64,$00,$43,$6F,$6E,$6E,$65,$63
+ .byte $74,$69,$6F,$6E,$20,$74,$69,$6D,$65,$64,$20,$6F,$75,$74,$00,$5B
+ .byte $50,$49,$4E,$47,$2C,$50,$4F,$4E,$47,$5D,$00,$2A,$20,$54,$6F,$70
+ .byte $69,$63,$3A,$20,$25,$73,$00,$2A,$20,$54,$6F,$70,$69,$63,$20,$73
+ .byte $65,$74,$20,$62,$79,$20,$25,$73,$00,$2A,$20,$48,$69,$64,$69,$6E
+ .byte $67,$20,$4D,$4F,$54,$44,$20,$28,$62,$65,$20,$70,$61,$74,$69,$65
+ .byte $6E,$74,$29,$00,$25,$64,$20,$25,$73,$00,$25,$73,$20,$25,$73,$00
+ .byte $50,$49,$4E,$47,$20,$00,$2A,$20,$25,$73,$20,$70,$69,$6E,$67,$20
+ .byte $74,$69,$6D,$65,$3A,$20,$25,$64,$2E,$25,$64,$9B,$00,$50,$52,$49
+ .byte $56,$4D,$53,$47,$00,$01,$41,$43,$54,$49,$4F,$4E,$20,$00,$2A,$20
+ .byte $25,$73,$20,$25,$73,$00,$25,$73,$20,$25,$73,$00,$01,$50,$49,$4E
+ .byte $47,$20,$00,$4E,$4F,$54,$49,$43,$45,$20,$25,$73,$20,$3A,$01,$50
+ .byte $49,$4E,$47,$20,$25,$73,$01,$25,$63,$00,$2A,$20,$43,$54,$43,$50
+ .byte $20,$50,$49,$4E,$47,$20,$66,$72,$6F,$6D,$20,$25,$73,$9B,$00,$01
+ .byte $56,$45,$52,$53,$49,$4F,$4E,$01,$00,$4E,$4F,$54,$49,$43,$45,$20
+ .byte $25,$73,$20,$3A,$01,$56,$45,$52,$53,$49,$4F,$4E,$20,$46,$75,$6A
+ .byte $69,$43,$68,$61,$74,$20,$76,$30,$2E,$35,$20,$2D,$20,$72,$75,$6E
+ .byte $6E,$69,$6E,$67,$20,$6F,$6E,$20,$61,$6E,$20,$41,$74,$61,$72,$69
+ .byte $20,$25,$73,$01,$25,$63,$00,$2A,$20,$43,$54,$43,$50,$20,$56,$45
+ .byte $52,$53,$49,$4F,$4E,$20,$66,$72,$6F,$6D,$20,$25,$73,$9B,$00,$4D
+ .byte $53,$47,$3A,$20,$25,$73,$20,$25,$73,$00,$4E,$4F,$54,$49,$43,$45
+ .byte $00,$2A,$20,$43,$54,$43,$50,$20,$72,$65,$70,$6C,$79,$20,$66,$72
+ .byte $6F,$6D,$20,$25,$73,$3A,$20,$25,$73,$00,$25,$73,$20,$25,$73,$20
+ .byte $25,$73,$20,$25,$73,$00,$25,$73,$20,$25,$73,$20,$25,$73,$00,$5B
+ .byte $62,$75,$66,$66,$65,$72,$20,$6F,$76,$65,$72,$66,$6C,$6F,$77,$5D
+ .byte $FD,$00,$50,$49,$4E,$47,$00,$48,$6F,$73,$74,$20,$27,$25,$73,$27
+ .byte $20,$6E,$6F,$74,$20,$66,$6F,$75,$6E,$64,$2E,$9B,$00,$25,$73,$20
+ .byte $69,$73,$20,$25,$73,$9B,$00
+
+.segment "BSS"
+
+_channel:
+ .res 64,$00
+_nick_reg_timer:
+ .res 4,$00
+_tstate:
+ .res 2,$00
+_vbell_timer:
+ .res 4,$00
+
+; ---------------------------------------------------------------
+; void __near__ resolv_found (__near__ unsigned char*, __near__ unsigned int*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _resolv_found: near
+
+.segment "CODE"
+
+ ldy #$00
+ lda (sp),y
+ iny
+ ora (sp),y
+ bne L0501
+ lda #<(L0001+967)
+ ldx #>(L0001+967)
+ jsr pushax
+ ldy #$07
+ jsr pushwysp
+ ldy #$04
+ jsr _printf
+ lda #$01
+ sta _done
+ jmp incsp4
+L0501: lda #<(L0001+989)
+ ldx #>(L0001+989)
+ jsr pushax
+ ldy #$07
+ jsr pushwysp
+ ldy #$07
+ jsr pushwysp
+ jsr _format_ip
+ jsr pushax
+ ldy #$06
+ jsr _printf
+ lda _connected
+ jne incsp4
+ jsr pushw0sp
+ lda _config
+ ldx _config+1
+ ldy #$53
+ jsr pushwidx
+ jsr _htons
+ jsr pushax
+ jsr _uip_connect
+ jmp incsp4
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ telnet_connected (__near__ struct telnet_state*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _telnet_connected: near
+
+.segment "CODE"
+
+ lda #<(L0001+513)
+ ldx #>(L0001+513)
+ jsr _puts
+ jsr ldax0sp
+ sta _tstate
+ stx _tstate+1
+ jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ ldy #$01
+ sta (sreg),y
+ iny
+ sta (sreg),y
+ jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ ldy #$03
+ sta (sreg),y
+ iny
+ sta (sreg),y
+ lda #<(_nick_reg_timer)
+ ldx #>(_nick_reg_timer)
+ jsr pushax
+ jsr __clocks_per_sec
+ jsr pushax
+ jsr _timer_set
+ lda #$01
+ sta _connected
+ jmp incsp2
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ telnet_closed (__near__ struct telnet_state*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _telnet_closed: near
+
+.segment "CODE"
+
+ lda #<(L0001+533)
+ ldx #>(L0001+533)
+ jsr _puts
+ lda #$10
+ sta _uip_flags
+ lda #$01
+ sta _done
+ jmp incsp2
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ telnet_sent (__near__ struct telnet_state*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _telnet_sent: near
+
+.segment "CODE"
+
+ jmp incsp2
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ telnet_aborted (__near__ struct telnet_state*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _telnet_aborted: near
+
+.segment "CODE"
+
+ lda #<(L0001+551)
+ ldx #>(L0001+551)
+ jsr _puts
+ lda #$20
+ sta _uip_flags
+ lda #$01
+ sta _done
+ jmp incsp2
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ telnet_timedout (__near__ struct telnet_state*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _telnet_timedout: near
+
+.segment "CODE"
+
+ lda #<(L0001+570)
+ ldx #>(L0001+570)
+ jsr _puts
+ lda #$20
+ sta _uip_flags
+ lda #$01
+ sta _done
+ jmp incsp2
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ telnet_newdata (__near__ struct telnet_state*, __near__ unsigned char*, unsigned int)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _telnet_newdata: near
+
+.segment "CODE"
+
+ jsr pushw0sp
+ jsr decsp1
+ ldy #$08
+ jsr pushwysp
+ jsr pushc0
+L04AF: ldy #$05
+ jsr ldaxysp
+ sta regsave
+ stx regsave+1
+ jsr decax1
+ ldy #$04
+ jsr staxysp
+ lda regsave
+ ora regsave+1
+ jeq L04B0
+ ldy #$02
+ jsr ldaxysp
+ sta regsave
+ stx regsave+1
+ jsr incax1
+ ldy #$01
+ jsr staxysp
+ ldy #$00
+ lda (regsave),y
+ ldy #$03
+ sta (sp),y
+ cmp #$0A
+ beq L04AF
+ lda (sp),y
+ cmp #$0D
+ bne L04B8
+ lda #$9B
+ sta (sp),y
+ lda #$01
+ ldy #$00
+ jmp L0515
+L04B8: lda (sp),y
+ cmp #$09
+ bne L04BF
+ lda #$7F
+ jmp L0515
+L04BF: lda (sp),y
+ cmp #$7B
+ bne L04C4
+ lda #$DB
+ jmp L0515
+L04C4: lda (sp),y
+ cmp #$7D
+ bne L04C9
+ lda #$DD
+ jmp L0515
+L04C9: lda (sp),y
+ cmp #$7E
+ bne L04CE
+ lda #$DE
+ jmp L0515
+L04CE: lda (sp),y
+ cmp #$60
+ bne L04D3
+ lda #$A7
+L0515: sta (sp),y
+L04D3: lda _output_buf
+ ldx _output_buf+1
+ jsr pushax
+ lda _output_buf_len
+ ldx _output_buf_len+1
+ sta regsave
+ stx regsave+1
+ jsr incax1
+ sta _output_buf_len
+ stx _output_buf_len+1
+ lda regsave
+ ldx regsave+1
+ jsr tosaddax
+ sta sreg
+ stx sreg+1
+ ldy #$03
+ lda (sp),y
+ ldy #$00
+ sta (sreg),y
+ lda _output_buf_len
+ ldx _output_buf_len+1
+ jsr pushax
+ ldx #$02
+ lda #$00
+ jsr tosicmp
+ bmi L04DA
+ lda #<(L0001+943)
+ ldx #>(L0001+943)
+ jsr _puts
+ lda #$01
+ ldy #$00
+ sta (sp),y
+ jmp L04B0
+L04DA: ldy #$00
+ lda (sp),y
+ jeq L04AF
+ jsr _del_user_buffer
+ lda _output_buf
+ ldx _output_buf+1
+ clc
+ adc _output_buf_len
+ pha
+ txa
+ adc _output_buf_len+1
+ tax
+ pla
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ lda _output_buf_len
+ ldx _output_buf_len+1
+ jsr pushax
+ lda #$05
+ jsr tosgea0
+ beq L04E6
+ lda _output_buf
+ ldx _output_buf+1
+ jsr pushax
+ lda #<(L0001+962)
+ ldx #>(L0001+962)
+ jsr pushax
+ ldx #$00
+ lda #$04
+ jsr _memcmp
+ cpx #$00
+ bne L04E6
+ cmp #$00
+ bne L04E6
+ jsr _do_pong
+ jmp L04F5
+L04E6: lda _output_buf
+ ldx _output_buf+1
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$3A
+ bne L04F1
+ jsr _do_msg
+ jmp L04F5
+L04F1: lda _output_buf
+ ldx _output_buf+1
+ jsr pushax
+ lda _stdout
+ ldx _stdout+1
+ jsr _fputs
+ lda _stdout
+ ldx _stdout+1
+ jsr _fflush
+L04F5: jsr _redraw_user_buffer
+ lda #$00
+ sta _output_buf_len
+ sta _output_buf_len+1
+ tay
+ sta (sp),y
+ jmp L04AF
+L04B0: ldy #$0C
+ jmp addysp
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ handle_keystroke (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _handle_keystroke: near
+
+.segment "CODE"
+
+ jsr decsp2
+ jsr pushc0
+ jsr _cgetc
+ ldy #$01
+ sta (sp),y
+ lda _input_buf_len
+ ora _input_buf_len+1
+ jne L01A9
+ lda (sp),y
+ cmp #$0E
+ beq L01AB
+ cmp #$17
+ beq L01B2
+ cmp #$7F
+ beq L01BB
+ cmp #$9B
+ jeq incsp3
+ jmp L01A9
+L01AB: lda _joined_channel
+ jeq incsp3
+ lda #<(L0001+277)
+ ldx #>(L0001+277)
+ jsr pushax
+ lda #<(_channel)
+ ldx #>(_channel)
+ jsr pushax
+ jsr _send_server_cmd
+ jmp incsp3
+L01B2: lda _joined_channel
+ jeq incsp3
+ lda #<(L0001+283)
+ ldx #>(L0001+283)
+ jsr pushax
+ lda #<(_channel)
+ ldx #>(_channel)
+ jsr pushax
+ jsr _send_server_cmd
+ jmp incsp3
+L01BB: lda _last_msg_nick
+ jeq incsp3
+ lda _input_buf
+ ldx _input_buf+1
+ jsr pushax
+ lda #<(L0001+287)
+ ldx #>(L0001+287)
+ jsr pushax
+ lda #<(_last_msg_nick)
+ ldx #>(_last_msg_nick)
+ jsr pushax
+ ldy #$06
+ jsr _sprintf
+ lda _input_buf
+ ldx _input_buf+1
+ jsr _strlen
+ sta _input_buf_len
+ stx _input_buf_len+1
+ lda #$00
+ ldy #$02
+L0519: sta (sp),y
+ lda (sp),y
+ jsr pusha0
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr tosicmp
+ jcs incsp3
+ lda _input_buf
+ sta sreg
+ lda _input_buf+1
+ sta sreg+1
+ ldy #$02
+ lda (sp),y
+ clc
+ adc sreg
+ ldx sreg+1
+ bcc L0517
+ inx
+L0517: ldy #$00
+ sta ptr1
+ stx ptr1+1
+ ldx #$00
+ lda (ptr1),y
+ ora #$80
+ jsr _putchar
+ ldy #$02
+ lda (sp),y
+ clc
+ adc #$01
+ jmp L0519
+L01A9: lda (sp),y
+ cmp #$7E
+ bne L01D2
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr pushax
+ lda #$01
+ jsr tosgea0
+ beq L01D4
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr decax1
+ sta _input_buf_len
+ stx _input_buf_len+1
+ ldy #$01
+ ldx #$00
+ lda (sp),y
+ jsr _putchar
+ jmp incsp3
+L01D4: jsr _bell
+ jmp incsp3
+L01D2: lda (sp),y
+ cmp #$9C
+ beq L01DD
+ lda (sp),y
+ cmp #$15
+ bne L01DC
+L01DD: ldx #$00
+ txa
+ sta _input_buf_len
+ sta _input_buf_len+1
+ lda #$9C
+ jsr _putchar
+ jmp incsp3
+L01DC: lda (sp),y
+ cmp #$17
+ bne L01E4
+ jsr _del_last_word
+ jmp incsp3
+L01E4: ldx #$00
+ lda (sp),y
+ ora #$80
+ jsr _putchar
+ ldy #$01
+ lda (sp),y
+ cmp #$9B
+ bne L01E9
+ lda #$0A
+ sta (sp),y
+ tya
+ dey
+ jmp L0518
+L01E9: lda (sp),y
+ cmp #$7F
+ bne L01F0
+ lda #$09
+L0518: sta (sp),y
+L01F0: lda _input_buf
+ ldx _input_buf+1
+ jsr pushax
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ sta regsave
+ stx regsave+1
+ jsr incax1
+ sta _input_buf_len
+ stx _input_buf_len+1
+ lda regsave
+ ldx regsave+1
+ jsr tosaddax
+ sta sreg
+ stx sreg+1
+ ldy #$01
+ lda (sp),y
+ dey
+ sta (sreg),y
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr pushax
+ ldx #$01
+ lda #$00
+ jsr tosicmp
+ bmi L01F9
+ ldy #$00
+ lda (sp),y
+ bne L01F9
+ jsr _bell
+ ldx #$00
+ lda #$7E
+ jsr _putchar
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr decax1
+ sta _input_buf_len
+ stx _input_buf_len+1
+L01F9: ldy #$00
+ lda (sp),y
+ jeq incsp3
+ lda _input_buf
+ ldx _input_buf+1
+ clc
+ adc _input_buf_len
+ pha
+ txa
+ adc _input_buf_len+1
+ tax
+ pla
+ sta sreg
+ stx sreg+1
+ tya
+ sta (sreg),y
+ lda _input_buf
+ sta ptr1
+ lda _input_buf+1
+ sta ptr1+1
+ lda (ptr1),y
+ cmp #$2F
+ bne L0204
+ jsr _handle_command
+ jmp L0214
+L0204: lda _joined_channel
+ beq L0208
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda #<(L0001+296)
+ ldx #>(L0001+296)
+ jsr pushax
+ lda #<(_channel)
+ ldx #>(_channel)
+ jsr pushax
+ lda _input_buf
+ ldx _input_buf+1
+ jsr pushax
+ ldy #$08
+ jsr _sprintf
+ lda _tstate
+ ldx _tstate+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr _strlen
+ jsr pushax
+ jsr _telnet_send
+ jmp L0214
+L0208: jsr _err_no_channel
+L0214: lda #$00
+ sta _input_buf_len
+ sta _input_buf_len+1
+ jmp incsp3
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ handle_command (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _handle_command: near
+
+.segment "CODE"
+
+ lda _input_buf
+ ldx _input_buf+1
+ jsr incax1
+ jsr pushax
+ jsr decsp2
+ jsr push0
+ ldy #$07
+ jsr pushwysp
+L0261: jsr ldax0sp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$0A
+ beq L0262
+ jsr ldax0sp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$20
+ beq L0262
+ jsr pushw0sp
+ ldy #$03
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ ldx #$00
+ lda (ptr1),y
+ jsr _toupper
+ ldy #$00
+ jsr staspidx
+ ldx #$00
+ lda #$01
+ jsr addeq0sp
+ jmp L0261
+L0262: jsr ldax0sp
+ ldy #$04
+ jsr staxysp
+ jsr ldax0sp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$0A
+ beq L026E
+ jsr ldax0sp
+ ldy #$02
+ jsr staxysp
+L0272: ldy #$03
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$20
+ bne L0273
+ ldy #$02
+ ldx #$00
+ lda #$01
+ jsr addeqysp
+ jmp L0272
+L0273: ldy #$03
+ jsr ldaxysp
+ jsr incax1
+ jsr stax0sp
+L0278: jsr ldax0sp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ beq L0279
+ jsr ldax0sp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$0A
+ beq L0279
+ ldx #$00
+ lda #$01
+ jsr addeq0sp
+ jmp L0278
+L0279: jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+L026E: ldy #$05
+ jsr ldaxysp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ ldy #$09
+ jsr pushwysp
+ lda #<(L0001+414)
+ ldx #>(L0001+414)
+ jsr _strcmp
+ cpx #$00
+ bne L0283
+ cmp #$00
+ bne L0283
+ lda _joined_channel
+ bne L0288
+ jsr _err_no_channel
+ jmp incsp8
+L0288: ldy #$03
+ lda (sp),y
+ dey
+ ora (sp),y
+ bne L028C
+ jsr _err_missing_arg
+ jmp incsp8
+L028C: ldy #$05
+ jsr pushwysp
+ jsr _do_me
+ jmp incsp8
+L0283: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+417)
+ ldx #>(L0001+417)
+ jsr _strcmp
+ cpx #$00
+ bne L051B
+ cmp #$00
+ beq L0294
+L051B: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+421)
+ ldx #>(L0001+421)
+ jsr _strcmp
+ cpx #$00
+ bne L0293
+ cmp #$00
+ bne L0293
+L0294: ldy #$03
+ lda (sp),y
+ dey
+ ora (sp),y
+ bne L029C
+ jsr _err_missing_arg
+ jmp incsp8
+L029C: lda #<(L0001+423)
+ ldx #>(L0001+423)
+ jmp L0524
+L0293: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+431)
+ ldx #>(L0001+431)
+ jsr _strcmp
+ cpx #$00
+ bne L051D
+ cmp #$00
+ beq L02A5
+L051D: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+436)
+ ldx #>(L0001+436)
+ jsr _strcmp
+ cpx #$00
+ bne L02A4
+ cmp #$00
+ bne L02A4
+L02A5: lda _joined_channel
+ beq L02AD
+ ldy #$03
+ lda (sp),y
+ dey
+ ora (sp),y
+ beq L02AF
+ jsr _err_already_joined
+ jmp incsp8
+L02AF: lda #<(L0001+438)
+ ldx #>(L0001+438)
+ jsr pushax
+ lda #<(_channel)
+ ldx #>(_channel)
+ jmp L0521
+L02AD: ldy #$03
+ lda (sp),y
+ dey
+ ora (sp),y
+ beq L02B7
+ lda #$01
+ sta _joined_channel
+ lda #<(_channel)
+ ldx #>(_channel)
+ jsr pushax
+ ldy #$05
+ jsr ldaxysp
+ jsr _strcpy
+ lda #<(L0001+443)
+ ldx #>(L0001+443)
+ jmp L0524
+L02B7: jsr _err_missing_arg
+ jmp incsp8
+L02A4: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+448)
+ ldx #>(L0001+448)
+ jsr _strcmp
+ cpx #$00
+ bne L02C4
+ cmp #$00
+ bne L02C4
+ lda _joined_channel
+ bne L02C9
+ jsr _err_no_channel
+ jmp incsp8
+L02C9: txa
+ sta _joined_channel
+ lda #<(L0001+453)
+ ldx #>(L0001+453)
+ jsr pushax
+ lda #<(_channel)
+ ldx #>(_channel)
+ jmp L0521
+L02C4: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+458)
+ ldx #>(L0001+458)
+ jsr _strcmp
+ cpx #$00
+ bne L051F
+ cmp #$00
+ beq L02D4
+L051F: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+466)
+ ldx #>(L0001+466)
+ jsr _strcmp
+ cpx #$00
+ bne L02D3
+ cmp #$00
+ bne L02D3
+L02D4: ldy #$03
+ lda (sp),y
+ dey
+ ora (sp),y
+ bne L02DC
+ jsr _err_missing_arg
+ jmp incsp8
+L02DC: ldy #$05
+ jsr pushwysp
+ jsr _send_ctcp_version
+ jmp incsp8
+L02D3: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+470)
+ ldx #>(L0001+470)
+ jsr _strcmp
+ cpx #$00
+ bne L02E3
+ cmp #$00
+ bne L02E3
+ ldy #$03
+ lda (sp),y
+ dey
+ ora (sp),y
+ bne L02E8
+ jsr _err_missing_arg
+ jmp incsp8
+L02E8: ldy #$05
+ jsr pushwysp
+ jsr _send_ctcp_ping
+ jmp incsp8
+L02E3: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+475)
+ ldx #>(L0001+475)
+ jsr _strcmp
+ cpx #$00
+ bne L02EF
+ cmp #$00
+ bne L02EF
+ ldy #$03
+ lda (sp),y
+ dey
+ ora (sp),y
+ bne L02F4
+ jsr _err_missing_arg
+ jmp incsp8
+L02F4: lda _config
+ ldx _config+1
+ ldy #$54
+ jsr incaxy
+ jsr pushax
+ ldy #$05
+ jsr ldaxysp
+ jsr _strcpy
+ ldy #$09
+ jsr pushwysp
+ ldy #$07
+ jsr pushwysp
+ jsr _send_server_cmd
+ lda #<(L0001+480)
+ ldx #>(L0001+480)
+ jsr pushax
+ lda _config
+ ldx _config+1
+ ldy #$54
+ jsr incaxy
+ jsr pushax
+ ldy #$04
+ jsr _printf
+ jmp incsp8
+L02EF: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+507)
+ ldx #>(L0001+507)
+ jsr _strcmp
+ cpx #$00
+ bne L0302
+ cmp #$00
+ bne L0302
+ ldy #$03
+ lda (sp),y
+ dey
+ ora (sp),y
+ bne L0307
+ jsr _err_missing_arg
+ jmp incsp8
+L0307: ldy #$05
+ jsr pushwysp
+ ldx #$00
+ txa
+ jmp L0521
+L0302: ldy #$07
+ jsr ldaxysp
+L0524: jsr pushax
+ ldy #$05
+ jsr ldaxysp
+L0521: jsr pushax
+ jsr _send_server_cmd
+ jmp incsp8
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ send_server_cmd (__near__ unsigned char*, __near__ unsigned char*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _send_server_cmd: near
+
+.segment "CODE"
+
+ ldy #$01
+ lda (sp),y
+ dey
+ ora (sp),y
+ beq L0219
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda #<(L0001+311)
+ ldx #>(L0001+311)
+ jsr pushax
+ ldy #$09
+ jsr pushwysp
+ ldy #$09
+ jsr pushwysp
+ lda #$0A
+ jsr pusha0
+ tay
+ jmp L0525
+L0219: lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda #<(L0001+319)
+ ldx #>(L0001+319)
+ jsr pushax
+ ldy #$09
+ jsr pushwysp
+ lda #$0A
+ jsr pusha0
+ ldy #$08
+L0525: jsr _sprintf
+ lda _tstate
+ ldx _tstate+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr _strlen
+ jsr pushax
+ jsr _telnet_send
+ jmp incsp4
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ bell (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _bell: near
+
+.segment "CODE"
+
+ lda _config
+ ldx _config+1
+ ldy #$96
+ jsr ldaxidx
+ txa
+ and #$08
+ bne L015D
+ lda _config
+ ldx _config+1
+ ldy #$96
+ jsr ldaxidx
+ txa
+ and #$20
+ beq L0160
+ lda #$01
+ sta _vbell_active
+ lda #<(_vbell_timer)
+ ldx #>(_vbell_timer)
+ jsr pushax
+ jsr __clocks_per_sec
+ jsr pushax
+ lda #$0A
+ jsr tosudiva0
+ jsr pushax
+ jsr _timer_set
+ lda _config
+ ldx _config+1
+ ldy #$93
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ clc
+ adc #$08
+ sta $02C6
+ rts
+L0160: ldx #$00
+ lda #$FD
+ jmp _putchar
+L015D: rts
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ redraw_user_buffer (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _redraw_user_buffer: near
+
+.segment "CODE"
+
+ jsr decsp2
+ ldx #$28
+ lda #$00
+ jsr pushax
+ lda _input_buf_len
+ ora _input_buf_len+1
+ jeq incsp4
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr decax1
+ ldy #$02
+ jsr staxysp
+L049B: jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ ldy #$03
+ jsr ldaxysp
+ clc
+ adc sreg
+ sta sreg
+ txa
+ adc sreg+1
+ tax
+ lda sreg
+ sta ptr2
+ stx ptr2+1
+ lda _input_buf
+ sta sreg
+ lda _input_buf+1
+ sta sreg+1
+ ldy #$03
+ jsr ldaxysp
+ clc
+ adc sreg
+ sta sreg
+ txa
+ adc sreg+1
+ tax
+ lda sreg
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ ora #$80
+ sta (ptr2),y
+ ldy #$03
+ jsr ldaxysp
+ sta regsave
+ stx regsave+1
+ jsr decax1
+ ldy #$02
+ jsr staxysp
+ lda regsave
+ ora regsave+1
+ bne L049B
+ jsr ldax0sp
+ clc
+ adc _input_buf_len
+ pha
+ txa
+ adc _input_buf_len+1
+ tax
+ pla
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ jsr pushw0sp
+ lda _stdout
+ ldx _stdout+1
+ jsr _fputs
+ lda _stdout
+ ldx _stdout+1
+ jsr _fflush
+ jmp incsp4
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ main (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _main: near
+
+.segment "CODE"
+
+ ldy #$4C
+ jsr subysp
+ jsr _disable_break
+ jsr _get_ostype
+ and #$07
+ ldy #$4B
+ sta (sp),y
+ cmp #$01
+ bne L003B
+ ldy #$FF
+L0040: iny
+ lda L0001,y
+ sta _os_version,y
+ bne L0040
+ jmp L0042
+L003B: lda (sp),y
+ cmp #$02
+ bne L0042
+ ldy #$FF
+L0047: iny
+ lda L0001+4,y
+ sta _os_version,y
+ bne L0047
+L0042: lda #$01
+ jsr _cursor
+ lda #$00
+ sta $02C6
+ lda #$0C
+ sta $02C5
+ ldx #$00
+ lda #$7D
+ jsr _putchar
+ lda #<(L0001+11)
+ ldx #>(L0001+11)
+ jsr _puts
+ ldx #$00
+ lda #$9B
+ jsr _putchar
+ jsr _config_is_valid
+ tax
+ bne L005C
+ jsr _get_config
+ tax
+ bne L005C
+ jsr _set_default_config
+L005C: lda _config
+ ldx _config+1
+ sta sreg
+ stx sreg+1
+ ldy #$96
+ jsr ldaxidx
+ pha
+ txa
+ ora #$10
+ tax
+ pla
+ ldy #$95
+ sta (sreg),y
+ iny
+ txa
+ sta (sreg),y
+L0061: lda #$00
+ sta _done
+ jsr _rs232dev_close
+ lda _config
+ ldx _config+1
+ ldy #$93
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ sta $02C6
+ lda _config
+ ldx _config+1
+ iny
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ sta $02C5
+ lda #<(L0001+25)
+ ldx #>(L0001+25)
+ jsr pushax
+ ldy #$02
+ jsr _printf
+ lda #<(L0001+61)
+ ldx #>(L0001+61)
+ jsr pushax
+ lda _config
+ ldx _config+1
+ ldy #$11
+ jsr incaxy
+ jsr pushax
+ ldy #$04
+ jsr _printf
+ lda _stdout
+ ldx _stdout+1
+ jsr _fflush
+ lda sp
+ ldx sp+1
+ jsr pushax
+ lda #$40
+ jsr pusha
+ jsr _get_line
+ lda sp
+ ldx sp+1
+ jsr pushax
+ lda #<(L0001+68)
+ ldx #>(L0001+68)
+ jsr _strcasecmp
+ cpx #$00
+ bne L007B
+ cmp #$00
+ bne L007B
+ jsr _exit
+ jmp L0092
+L007B: lda sp
+ ldx sp+1
+ jsr pushax
+ lda #<(L0001+70)
+ ldx #>(L0001+70)
+ jsr _strcasecmp
+ cpx #$00
+ bne L0083
+ cmp #$00
+ bne L0083
+ lda _atari_exec_p
+ ldx _atari_exec_p+1
+ jsr pushax
+ lda #<(L0001+72)
+ ldx #>(L0001+72)
+ pha
+ ldy #$00
+ lda (sp),y
+ sta jmpvec+1
+ iny
+ lda (sp),y
+ sta jmpvec+2
+ pla
+ jsr jmpvec
+ jsr incsp2
+ ldy #$49
+ jsr staxysp
+ lda #<(L0001+87)
+ ldx #>(L0001+87)
+ jsr pushax
+ ldy #$4E
+ jsr pushwysp
+ ldy #$04
+ jsr _printf
+ ldy #$00
+ jsr _bell
+ jmp L0061
+L0083: ldy #$00
+ lda (sp),y
+ beq L0092
+ lda _config
+ ldx _config+1
+ ldy #$11
+ jsr incaxy
+ jsr pushax
+ lda #$02
+ jsr leaasp
+ jsr _strcpy
+L0092: lda _config
+ ldx _config+1
+ ldy #$10
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ jsr pusha
+ jsr _rs232dev_init
+ cmp #$00
+ jne L0061
+ lda #$41
+ jsr leaasp
+ jsr pushax
+ jsr __clocks_per_sec
+ jsr shrax1
+ jsr pushax
+ jsr _timer_set
+ jsr _uip_init
+ lda #<(_uip_hostaddr)
+ ldx #>(_uip_hostaddr)
+ jsr pushax
+ lda _config
+ ldx _config+1
+ jsr incax4
+ jsr pushax
+ ldx #$00
+ lda #$04
+ jsr _memcpy
+ lda #<(_uip_draddr)
+ ldx #>(_uip_draddr)
+ jsr pushax
+ lda _config
+ ldx _config+1
+ jsr incax8
+ jsr pushax
+ ldx #$00
+ lda #$04
+ jsr _memcpy
+ lda #$45
+ jsr leaasp
+ sta sreg
+ stx sreg+1
+ lda #$FF
+ ldy #$00
+ sta (sreg),y
+ iny
+ sta (sreg),y
+ lda #$45
+ jsr leaasp
+ sta sreg
+ stx sreg+1
+ lda #$FF
+ iny
+ sta (sreg),y
+ iny
+ lda #$00
+ sta (sreg),y
+ lda #<(_uip_netmask)
+ ldx #>(_uip_netmask)
+ jsr pushax
+ lda #$47
+ jsr leaasp
+ jsr ldaxi
+ ldy #$00
+ jsr staxspidx
+ lda #<(_uip_netmask)
+ ldx #>(_uip_netmask)
+ jsr pushax
+ lda #$47
+ jsr leaasp
+ ldy #$03
+ jsr ldaxidx
+ ldy #$02
+ jsr staxspidx
+ lda _config
+ ldx _config+1
+ ldy #$11
+ jsr incaxy
+ jsr pushax
+ lda #$47
+ jsr leaasp
+ jsr pushax
+ jsr _uiplib_ipaddrconv
+ tax
+ beq L00E3
+ lda #$45
+ jsr leaasp
+ jsr pushax
+ lda _config
+ ldx _config+1
+ ldy #$53
+ jsr pushwidx
+ jsr _htons
+ jsr pushax
+ jsr _uip_connect
+ jmp L00EB
+L00E3: jsr _resolv_init
+ lda _config
+ ldx _config+1
+ ldy #$0C
+ jsr incaxy
+ jsr pushax
+ jsr _resolv_conf
+ lda _config
+ ldx _config+1
+ ldy #$11
+ jsr incaxy
+ jsr pushax
+ jsr _resolv_query
+L00EB: lda _done
+ jne L00F3
+ jsr _rs232dev_poll
+ sta _uip_len
+ stx _uip_len+1
+ cpx #$00
+ bne L0526
+ cmp #$00
+ beq L00F7
+L0526: jsr pushc1
+ jsr _uip_process
+ lda _uip_len
+ ora _uip_len+1
+ jeq L011C
+ jsr _rs232dev_send
+ jmp L011C
+L00F7: lda #$41
+ jsr leaasp
+ jsr pushax
+ jsr _timer_expired
+ stx tmp1
+ ora tmp1
+ jeq L011C
+ lda #$41
+ jsr leaasp
+ jsr pushax
+ jsr _timer_reset
+ ldx #$00
+ txa
+L0529: ldy #$49
+ jsr staxysp
+ jsr pushax
+ lda #$01
+ jsr toslta0
+ beq L0107
+ ldy #$4A
+ jsr ldaxysp
+ jsr pushax
+ lda #$23
+ jsr tosmula0
+ clc
+ adc #<(_uip_conns)
+ tay
+ txa
+ adc #>(_uip_conns)
+ tax
+ tya
+ sta _uip_conn
+ stx _uip_conn+1
+ jsr pushc2
+ jsr _uip_process
+ lda _uip_len
+ ora _uip_len+1
+ beq L0108
+ jsr _rs232dev_send
+L0108: ldy #$4A
+ jsr ldaxysp
+ jsr incax1
+ jmp L0529
+L0107: ldx #$00
+ txa
+L052A: ldy #$49
+ jsr staxysp
+ jsr pushax
+ lda #$01
+ jsr toslta0
+ beq L011C
+ ldy #$4A
+ jsr ldaxysp
+ jsr pushax
+ lda #$0B
+ jsr tosmula0
+ clc
+ adc #<(_uip_udp_conns)
+ tay
+ txa
+ adc #>(_uip_udp_conns)
+ tax
+ tya
+ sta _uip_udp_conn
+ stx _uip_udp_conn+1
+ lda #$05
+ jsr pusha
+ jsr _uip_process
+ lda _uip_len
+ ora _uip_len+1
+ beq L011D
+ jsr _rs232dev_send
+L011D: ldy #$4A
+ jsr ldaxysp
+ jsr incax1
+ jmp L052A
+L011C: lda _vbell_active
+ beq L0130
+ lda #<(_vbell_timer)
+ ldx #>(_vbell_timer)
+ jsr pushax
+ jsr _timer_expired
+ stx tmp1
+ ora tmp1
+ beq L0130
+ lda _config
+ ldx _config+1
+ ldy #$93
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ sta $02C6
+ lda #$00
+ sta _vbell_active
+L0130: jsr _kbhit
+ tax
+ beq L013C
+ jsr _handle_keystroke
+L013C: lda _connected
+ jeq L00EB
+ lda _nick_registered
+ jne L00EB
+ lda #<(_nick_reg_timer)
+ ldx #>(_nick_reg_timer)
+ jsr pushax
+ jsr _timer_expired
+ stx tmp1
+ ora tmp1
+ jeq L00EB
+ lda #<(L0001+98)
+ ldx #>(L0001+98)
+ jsr _puts
+ lda _input_buf
+ ldx _input_buf+1
+ jsr pushax
+ lda #<(L0001+117)
+ ldx #>(L0001+117)
+ jsr pushax
+ lda _config
+ ldx _config+1
+ ldy #$54
+ jsr incaxy
+ jsr pushax
+ lda #$0A
+ jsr pusha0
+ lda _config
+ ldx _config+1
+ ldy #$54
+ jsr incaxy
+ jsr pushax
+ lda #<(L0001+146)
+ ldx #>(L0001+146)
+ jsr pushax
+ lda _config
+ ldx _config+1
+ ldy #$11
+ jsr incaxy
+ jsr pushax
+ lda _config
+ ldx _config+1
+ ldy #$69
+ jsr incaxy
+ jsr pushax
+ lda #$0A
+ jsr pusha0
+ ldy #$12
+ jsr _sprintf
+ lda _tstate
+ ldx _tstate+1
+ jsr pushax
+ lda _input_buf
+ ldx _input_buf+1
+ jsr pushax
+ lda _input_buf
+ ldx _input_buf+1
+ jsr _strlen
+ jsr pushax
+ jsr _telnet_send
+ lda #$00
+ sta _input_buf_len
+ sta _input_buf_len+1
+ lda #$01
+ sta _nick_registered
+ jmp L00EB
+L00F3: lda #$00
+ sta _joined_channel
+ sta _nick_registered
+ sta _connected
+ jmp L0061
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ err_missing_arg (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _err_missing_arg: near
+
+.segment "CODE"
+
+ lda #<(L0001+155)
+ ldx #>(L0001+155)
+ jsr _puts
+ jmp _bell
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ err_no_channel (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _err_no_channel: near
+
+.segment "CODE"
+
+ lda #<(L0001+181)
+ ldx #>(L0001+181)
+ jsr _puts
+ jmp _bell
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ err_already_joined (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _err_already_joined: near
+
+.segment "CODE"
+
+ lda #<(L0001+227)
+ ldx #>(L0001+227)
+ jsr _puts
+ jmp _bell
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ del_last_word (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _del_last_word: near
+
+.segment "CODE"
+
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr pushax
+ jsr push0
+L017E: lda _input_buf_len
+ ora _input_buf_len+1
+ beq L017F
+ lda _input_buf
+ ldx _input_buf+1
+ clc
+ adc _input_buf_len
+ pha
+ txa
+ adc _input_buf_len+1
+ tax
+ pla
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$20
+ bne L017F
+ ldx #$00
+ lda #$01
+ jsr addeq0sp
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr decax1
+ sta _input_buf_len
+ stx _input_buf_len+1
+ jmp L017E
+L017F: lda _input_buf_len
+ ora _input_buf_len+1
+ beq L0187
+ lda _input_buf
+ ldx _input_buf+1
+ clc
+ adc _input_buf_len
+ pha
+ txa
+ adc _input_buf_len+1
+ tax
+ pla
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$20
+ beq L0187
+ ldx #$00
+ lda #$01
+ jsr addeq0sp
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr decax1
+ sta _input_buf_len
+ stx _input_buf_len+1
+ jmp L017F
+L0187: ldy #$05
+ jsr pushwysp
+ lda #$79
+ jsr tosgea0
+ beq L018E
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr pushax
+ lda #$79
+ jsr toslta0
+ beq L018E
+ ldx #$00
+ lda #$1C
+ jsr _putchar
+ ldx #$00
+ lda #$9C
+ jsr _putchar
+ ldx #$00
+ lda #$9C
+ jsr _putchar
+ ldy #$00
+ jsr _redraw_user_buffer
+ jmp incsp4
+L018E: ldx #$00
+ lda #$7E
+ jsr _putchar
+ ldx #$00
+ lda #$01
+ ldy #$00
+ jsr subeqysp
+ stx tmp1
+ ora tmp1
+ bne L018E
+ jmp incsp4
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ send_ctcp_version (__near__ unsigned char*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _send_ctcp_version: near
+
+.segment "CODE"
+
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda #<(L0001+324)
+ ldx #>(L0001+324)
+ jsr pushax
+ ldy #$07
+ jsr pushwysp
+ jsr push1
+ jsr push1
+ lda #$0A
+ jsr pusha0
+ ldy #$0C
+ jsr _sprintf
+ lda _tstate
+ ldx _tstate+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr _strlen
+ jsr pushax
+ jsr _telnet_send
+ jmp incsp2
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ send_ctcp_ping (__near__ unsigned char*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _send_ctcp_ping: near
+
+.segment "CODE"
+
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda #<(L0001+349)
+ ldx #>(L0001+349)
+ jsr pushax
+ ldy #$07
+ jsr pushwysp
+ jsr push1
+ lda $0014
+ jsr pusha0
+ lda $0013
+ jsr pusha0
+ lda $0012
+ jsr pusha0
+ jsr push1
+ lda #$0A
+ jsr pusha0
+ ldy #$12
+ jsr _sprintf
+ lda _tstate
+ ldx _tstate+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr _strlen
+ jsr pushax
+ jsr _telnet_send
+ jmp incsp2
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ do_me (__near__ unsigned char*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _do_me: near
+
+.segment "CODE"
+
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda #<(L0001+386)
+ ldx #>(L0001+386)
+ jsr pushax
+ lda #<(_channel)
+ ldx #>(_channel)
+ jsr pushax
+ jsr push1
+ ldy #$0B
+ jsr pushwysp
+ jsr push1
+ lda #$0A
+ jsr pusha0
+ ldy #$0E
+ jsr _sprintf
+ lda _tstate
+ ldx _tstate+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr _strlen
+ jsr pushax
+ jsr _telnet_send
+ jmp incsp2
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ do_pong (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _do_pong: near
+
+.segment "CODE"
+
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda _output_buf
+ ldx _output_buf+1
+ jsr pushax
+ lda _output_buf_len
+ ldx _output_buf_len+1
+ jsr _memcpy
+ lda _chan_msg_buf
+ sta sreg
+ lda _chan_msg_buf+1
+ sta sreg+1
+ lda #$4F
+ ldy #$01
+ sta (sreg),y
+L0343: jsr ldax0sp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ beq L0344
+ jsr ldax0sp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$9B
+ bne L0346
+ jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$0A
+ ldy #$00
+ sta (sreg),y
+L0346: jsr ldax0sp
+ jsr incax1
+ jsr stax0sp
+ jmp L0343
+L0344: lda _tstate
+ ldx _tstate+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda _output_buf_len
+ ldx _output_buf_len+1
+ jsr pushax
+ jsr _telnet_send
+ lda _config
+ ldx _config+1
+ ldy #$96
+ jsr ldaxidx
+ txa
+ and #$40
+ jeq incsp2
+ lda #<(L0001+591)
+ ldx #>(L0001+591)
+ jsr _puts
+ jmp incsp2
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ do_server_msg (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _do_server_msg: near
+
+.segment "CODE"
+
+ lda _output_buf
+ ldx _output_buf+1
+ jsr pushax
+ jsr decsp6
+ jsr push0
+ jsr decsp2
+L0356: ldy #$0B
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$20
+ beq L0357
+ ldy #$0A
+ ldx #$00
+ lda #$01
+ jsr addeqysp
+ jmp L0356
+L0357: ldy #$0A
+ ldx #$00
+ lda #$01
+ jsr addeqysp
+ ldy #$0B
+ jsr ldaxysp
+ ldy #$08
+ jsr staxysp
+L035D: ldy #$09
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$20
+ beq L035E
+ ldy #$08
+ ldx #$00
+ lda #$01
+ jsr addeqysp
+ jmp L035D
+L035E: ldy #$09
+ jsr ldaxysp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ ldy #$08
+ tax
+ lda #$01
+ jsr addeqysp
+ lda _config
+ ldx _config+1
+ ldy #$54
+ jsr incaxy
+ jsr _strlen
+ jsr stax0sp
+ ldy #$0B
+ jsr pushwysp
+ lda _config
+ ldx _config+1
+ ldy #$54
+ jsr incaxy
+ jsr pushax
+ ldy #$05
+ jsr ldaxysp
+ jsr _memcmp
+ cpx #$00
+ bne L0367
+ cmp #$00
+ bne L0367
+ jsr ldax0sp
+ jsr incax1
+ ldy #$08
+ jsr addeqysp
+L0367: ldy #$0B
+ jsr ldaxysp
+ jsr _atoi
+ ldy #$02
+ jsr staxysp
+ stx tmp1
+ ora tmp1
+ jeq L0370
+ ldy #$03
+ jsr ldaxysp
+ cpx #$01
+ jne L039D
+ cmp #$3B
+ jeq L038C
+ cmp #$4C
+ beq L0379
+ cmp #$4D
+ beq L037E
+ cmp #$60
+ beq L038C
+ cmp #$61
+ beq L038C
+ cmp #$6E
+ beq L038C
+ cmp #$74
+ beq L0383
+ cmp #$76
+ beq L038C
+ cmp #$77
+ beq L038B
+ jmp L039D
+L0379: lda #<(L0001+603)
+ ldx #>(L0001+603)
+ jsr pushax
+ ldy #$0D
+ jsr pushwysp
+ ldy #$04
+ jmp L052B
+L037E: lda #<(L0001+615)
+ ldx #>(L0001+615)
+ jsr pushax
+ ldy #$0D
+ jsr pushwysp
+ ldy #$04
+ jmp L052B
+L0383: lda _config
+ ldx _config+1
+ ldy #$96
+ jsr ldaxidx
+ txa
+ and #$10
+ tax
+ lda #$00
+ jsr bnegax
+ beq L03A2
+ ldy #$0B
+ jsr pushwysp
+ lda _stdout
+ ldx _stdout+1
+ jsr _fputs
+ jmp L03A2
+L038B: lda _config
+ ldx _config+1
+ ldy #$96
+ jsr ldaxidx
+ txa
+ and #$10
+ beq L038C
+ lda #<(L0001+633)
+ ldx #>(L0001+633)
+ jsr _puts
+ jmp L03A2
+L038C: ldy #$0B
+ jsr pushwysp
+ lda _stdout
+ ldx _stdout+1
+ jsr _fputs
+ jmp L03A2
+L039D: lda #<(L0001+660)
+ ldx #>(L0001+660)
+ jsr pushax
+ ldy #$05
+ jmp L0531
+L0370: lda #<(L0001+666)
+ ldx #>(L0001+666)
+ jsr pushax
+ ldy #$0D
+L0531: jsr ldaxysp
+ jsr pushax
+ ldy #$0F
+ jsr pushwysp
+ ldy #$06
+L052B: jsr _printf
+L03A2: ldy #$0C
+ jmp addysp
+
+.endproc
+
+; ---------------------------------------------------------------
+; unsigned char __near__ do_ctcp (__near__ unsigned char*, __near__ unsigned char*)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _do_ctcp: near
+
+.segment "CODE"
+
+ ldy #$0C
+ jsr subysp
+ ldy #$0F
+ jsr pushwysp
+ lda #<(L0001+672)
+ ldx #>(L0001+672)
+ jsr pushax
+ ldx #$00
+ lda #$05
+ jsr _memcmp
+ cpx #$00
+ jne L03A8
+ cmp #$00
+ jne L03A8
+ jsr _clock
+ jsr pusheax
+ ldx #$00
+ stx sreg
+ stx sreg+1
+ lda #$0A
+ jsr tosumuleax
+ ldy #$08
+ jsr steaxysp
+ ldy #$0D
+ jsr ldaxysp
+ jsr incax5
+ jsr _atoi
+ jsr axlong
+ jsr pusheax
+ ldy #$11
+ jsr ldaxysp
+ ldy #$09
+ jsr incaxy
+ jsr _atoi
+ jsr axlong
+ ldy sreg
+ sty sreg+1
+ stx sreg
+ tax
+ lda #$00
+ jsr tosaddeax
+ jsr pusheax
+ ldy #$11
+ jsr ldaxysp
+ ldy #$0D
+ jsr incaxy
+ jsr _atoi
+ jsr axlong
+ stx sreg+1
+ sta sreg
+ lda #$00
+ tax
+ jsr tosaddeax
+ jsr pusheax
+ ldx #$00
+ stx sreg
+ stx sreg+1
+ lda #$0A
+ jsr tosmuleax
+ ldy #$04
+ jsr steaxysp
+ ldy #$07
+ jsr ldeaxysp
+ ldy #$08
+ jsr lsubeqysp
+ ldy #$0B
+ jsr ldeaxysp
+ jsr pusheax
+ jsr __clocks_per_sec
+ jsr axulong
+ jsr tosudiveax
+ ldy #$08
+ jsr steaxysp
+ ldy #$0B
+ jsr ldeaxysp
+ jsr pusheax
+ ldx #$00
+ stx sreg
+ stx sreg+1
+ lda #$0A
+ jsr tosdiveax
+ ldy #$02
+ jsr staxysp
+ ldy #$0B
+ jsr ldeaxysp
+ jsr pusheax
+ ldx #$00
+ stx sreg
+ stx sreg+1
+ lda #$0A
+ jsr tosmodeax
+ jsr stax0sp
+ lda #<(L0001+678)
+ ldx #>(L0001+678)
+ jsr pushax
+ ldy #$13
+ jsr pushwysp
+ ldy #$09
+ jsr pushwysp
+ ldy #$09
+ jsr pushwysp
+ ldy #$08
+ jsr _printf
+ ldx #$00
+ lda #$01
+ jmp L03A7
+L03A8: ldx #$00
+ txa
+L03A7: ldy #$10
+ jmp addysp
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ do_msg (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _do_msg: near
+
+.segment "CODE"
+
+ lda _output_buf
+ ldx _output_buf+1
+ jsr pushax
+ lda _output_buf
+ ldx _output_buf+1
+ jsr pushax
+ jsr push0
+ jsr push0
+ jsr push0
+L03D0: ldy #$07
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$20
+ beq L03D1
+ ldy #$07
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$21
+ bne L03D3
+ ldy #$07
+ jsr ldaxysp
+ jsr stax0sp
+L03D3: ldy #$06
+ ldx #$00
+ lda #$01
+ jsr addeqysp
+ jmp L03D0
+L03D1: iny
+ lda (sp),y
+ dey
+ ora (sp),y
+ bne L03D8
+ jsr _do_server_msg
+ jmp L03CA
+L03D8: ldy #$07
+ jsr ldaxysp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ ldy #$06
+ tax
+ lda #$01
+ jsr addeqysp
+ ldy #$07
+ jsr ldaxysp
+ ldy #$04
+ jsr staxysp
+L03E0: ldy #$05
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$20
+ beq L03E1
+ ldy #$04
+ ldx #$00
+ lda #$01
+ jsr addeqysp
+ jmp L03E0
+L03E1: ldy #$05
+ jsr ldaxysp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ ldy #$04
+ tax
+ lda #$01
+ jsr addeqysp
+ ldy #$05
+ jsr ldaxysp
+ ldy #$02
+ jsr staxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$9B
+ beq L03F6
+L03EB: ldy #$03
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ beq L03EC
+ ldy #$03
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$20
+ beq L03EC
+ ldy #$02
+ ldx #$00
+ lda #$01
+ jsr addeqysp
+ jmp L03EB
+L03EC: ldy #$03
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ beq L03F6
+ ldy #$03
+ jsr ldaxysp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ ldy #$02
+ tax
+ lda #$01
+ jsr addeqysp
+ ldy #$03
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$3A
+ bne L03F6
+ ldy #$02
+ ldx #$00
+ lda #$01
+ jsr addeqysp
+L03F6: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+701)
+ ldx #>(L0001+701)
+ jsr _strcmp
+ cpx #$00
+ jne L03F9
+ cmp #$00
+ jne L03F9
+ ldy #$09
+ jsr ldaxysp
+ sta sreg
+ stx sreg+1
+ lda #$3C
+ ldy #$00
+ sta (sreg),y
+ jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$3E
+ ldy #$00
+ sta (sreg),y
+ jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ ldy #$01
+ sta (sreg),y
+ ldy #$07
+ jsr pushwysp
+ lda _config
+ ldx _config+1
+ ldy #$54
+ jsr incaxy
+ jsr _strcasecmp
+ cpx #$00
+ bne L0533
+ cmp #$00
+ jeq L0407
+L0533: ldy #$05
+ jsr pushwysp
+ lda #<(L0001+709)
+ ldx #>(L0001+709)
+ jsr pushax
+ ldx #$00
+ lda #$08
+ jsr _memcmp
+ cpx #$00
+ bne L040C
+ cmp #$00
+ bne L040C
+ ldy #$09
+ jsr ldaxysp
+ jsr incax1
+ ldy #$08
+ jsr staxysp
+ jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ lda _output_buf
+ ldx _output_buf+1
+ jsr pushax
+ lda _output_buf_len
+ ldx _output_buf_len+1
+ jsr decax2
+ jsr tosaddax
+ sta sreg
+ stx sreg+1
+ lda #$9B
+ ldy #$00
+ sta (sreg),y
+ lda _output_buf
+ ldx _output_buf+1
+ jsr pushax
+ lda _output_buf_len
+ ldx _output_buf_len+1
+ jsr decax1
+ jsr tosaddax
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ lda #<(L0001+718)
+ ldx #>(L0001+718)
+ jsr pushax
+ ldy #$0D
+ jsr pushwysp
+ ldy #$07
+ jsr ldaxysp
+ jsr incax8
+ jsr pushax
+ ldy #$06
+ jmp L0532
+L040C: lda #<(L0001+726)
+ ldx #>(L0001+726)
+ jsr pushax
+ ldy #$0D
+ jsr pushwysp
+ ldy #$09
+ jsr pushwysp
+ ldy #$06
+ jmp L0532
+L0407: ldy #$05
+ jsr pushwysp
+ lda #<(L0001+732)
+ ldx #>(L0001+732)
+ jsr pushax
+ ldx #$00
+ lda #$06
+ jsr _memcmp
+ cpx #$00
+ jne L0425
+ cmp #$00
+ jne L0425
+ ldy #$09
+ jsr ldaxysp
+ jsr incax1
+ ldy #$08
+ jsr staxysp
+ jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ lda _output_buf
+ ldx _output_buf+1
+ jsr pushax
+ lda _output_buf_len
+ ldx _output_buf_len+1
+ jsr decax2
+ jsr tosaddax
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda #<(L0001+739)
+ ldx #>(L0001+739)
+ jsr pushax
+ ldy #$0F
+ jsr pushwysp
+ ldy #$09
+ jsr ldaxysp
+ jsr incax6
+ jsr pushax
+ lda #$0A
+ jsr pusha0
+ tay
+ jsr _sprintf
+ lda _tstate
+ ldx _tstate+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr _strlen
+ jsr pushax
+ jsr _telnet_send
+ lda #<(L0001+762)
+ ldx #>(L0001+762)
+ jsr pushax
+ ldy #$0D
+ jsr pushwysp
+ ldy #$04
+ jmp L0532
+L0425: ldy #$05
+ jsr pushwysp
+ lda #<(L0001+783)
+ ldx #>(L0001+783)
+ jsr pushax
+ ldx #$00
+ lda #$09
+ jsr _memcmp
+ cpx #$00
+ bne L0440
+ cmp #$00
+ bne L0440
+ ldy #$09
+ jsr ldaxysp
+ jsr incax1
+ ldy #$08
+ jsr staxysp
+ jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda #<(L0001+793)
+ ldx #>(L0001+793)
+ jsr pushax
+ ldy #$0F
+ jsr pushwysp
+ lda #<(_os_version)
+ ldx #>(_os_version)
+ jsr pushax
+ lda #$0A
+ jsr pusha0
+ tay
+ jsr _sprintf
+ lda _tstate
+ ldx _tstate+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr pushax
+ lda _chan_msg_buf
+ ldx _chan_msg_buf+1
+ jsr _strlen
+ jsr pushax
+ jsr _telnet_send
+ lda #<(L0001+855)
+ ldx #>(L0001+855)
+ jsr pushax
+ ldy #$0D
+ jsr pushwysp
+ ldy #$04
+ jmp L0532
+L0440: lda #<(L0001+879)
+ ldx #>(L0001+879)
+ jsr pushax
+ ldy #$0D
+ jsr pushwysp
+ ldy #$09
+ jsr pushwysp
+ ldy #$06
+ jsr _printf
+ lda _config
+ ldx _config+1
+ ldy #$96
+ jsr ldaxidx
+ txa
+ and #$80
+ beq L045C
+ jsr _bell
+L045C: jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ lda #<(_last_msg_nick)
+ ldx #>(_last_msg_nick)
+ jsr pushax
+ ldy #$0B
+ jsr ldaxysp
+ jsr incax1
+ jsr _strcpy
+ jmp L0482
+L03F9: ldy #$09
+ jsr pushwysp
+ lda #<(L0001+890)
+ ldx #>(L0001+890)
+ jsr _strcmp
+ cpx #$00
+ bne L0465
+ cmp #$00
+ bne L0465
+ ldy #$03
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ cmp #$01
+ bne L0465
+ ldy #$09
+ jsr ldaxysp
+ jsr incax1
+ ldy #$08
+ jsr staxysp
+ jsr ldax0sp
+ sta sreg
+ stx sreg+1
+ lda #$00
+ tay
+ sta (sreg),y
+ ldy #$0B
+ jsr pushwysp
+ ldy #$05
+ jsr ldaxysp
+ jsr incax1
+ jsr pushax
+ jsr _do_ctcp
+ tax
+ bne L0482
+ lda #<(L0001+897)
+ ldx #>(L0001+897)
+ jsr pushax
+ ldy #$0D
+ jsr pushwysp
+ ldy #$07
+ jsr ldaxysp
+ jsr incax1
+ jsr pushax
+ ldy #$06
+ jmp L0532
+L0465: ldy #$03
+ jsr ldaxysp
+ ldy #$00
+ sta ptr1
+ stx ptr1+1
+ lda (ptr1),y
+ beq L047A
+ lda #<(L0001+922)
+ ldx #>(L0001+922)
+ jsr pushax
+ ldy #$0D
+ jsr pushwysp
+ ldy #$0D
+ jsr pushwysp
+ ldy #$0D
+ jsr pushwysp
+ ldy #$0D
+ jsr pushwysp
+ ldy #$0A
+ jmp L0532
+L047A: lda #<(L0001+934)
+ ldx #>(L0001+934)
+ jsr pushax
+ ldy #$0D
+ jsr pushwysp
+ ldy #$0D
+ jsr pushwysp
+ ldy #$0D
+ jsr pushwysp
+ ldy #$08
+L0532: jsr _printf
+L0482: lda _stdout
+ ldx _stdout+1
+ jsr _fflush
+L03CA: ldy #$0A
+ jmp addysp
+
+.endproc
+
+; ---------------------------------------------------------------
+; void __near__ del_user_buffer (void)
+; ---------------------------------------------------------------
+
+.segment "CODE"
+
+.proc _del_user_buffer: near
+
+.segment "CODE"
+
+ lda _input_buf_len
+ ora _input_buf_len+1
+ beq L048F
+ ldx #$00
+ lda #$9C
+ jsr _putchar
+ lda _input_buf_len
+ ldx _input_buf_len+1
+ jsr pushax
+ lda #$78
+ jsr tosgea0
+ beq L048F
+ ldx #$00
+ lda #$1C
+ jsr _putchar
+ ldx #$00
+ lda #$9C
+ jmp _putchar
+L048F: rts
+
+.endproc
+