mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-08-20 17:29:45 +00:00
git-svn-id: http://svn.code.sf.net/p/netboot65/code@164 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
4027ab28ef
commit
cf4a3824be
@ -6,8 +6,11 @@
|
|||||||
.export filter_number
|
.export filter_number
|
||||||
.export check_for_abort_key
|
.export check_for_abort_key
|
||||||
.export get_key_if_available
|
.export get_key_if_available
|
||||||
|
.export get_key_ip65
|
||||||
.importzp copy_src
|
.importzp copy_src
|
||||||
|
|
||||||
|
.import ip65_process
|
||||||
|
|
||||||
.include "../inc/common.i"
|
.include "../inc/common.i"
|
||||||
.code
|
.code
|
||||||
|
|
||||||
@ -27,6 +30,16 @@ get_key:
|
|||||||
get_key_if_available=$ffe4
|
get_key_if_available=$ffe4
|
||||||
|
|
||||||
|
|
||||||
|
;process inbound ip packets while waiting for a keypress
|
||||||
|
get_key_ip65:
|
||||||
|
jsr ip65_process
|
||||||
|
jsr $ffe4
|
||||||
|
beq get_key_ip65
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;check whether the RUN/STOP key is being pressed
|
;check whether the RUN/STOP key is being pressed
|
||||||
;inputs: none
|
;inputs: none
|
||||||
;outputs: sec if RUN/STOP pressed, clear otherwise
|
;outputs: sec if RUN/STOP pressed, clear otherwise
|
||||||
@ -49,7 +62,8 @@ check_for_abort_key:
|
|||||||
;cribbed from http://codebase64.org/doku.php?id=base:robust_string_input
|
;cribbed from http://codebase64.org/doku.php?id=base:robust_string_input
|
||||||
;======================================================================
|
;======================================================================
|
||||||
;Input a string and store it in GOTINPUT, terminated with a null byte.
|
;Input a string and store it in GOTINPUT, terminated with a null byte.
|
||||||
;x:a is a pointer to the allowed list of characters, null-terminated.
|
;AX is a pointer to the allowed list of characters, null-terminated.
|
||||||
|
;set AX to $0000 for no filter on input
|
||||||
;max # of chars in y returns num of chars entered in y.
|
;max # of chars in y returns num of chars entered in y.
|
||||||
;======================================================================
|
;======================================================================
|
||||||
|
|
||||||
@ -64,35 +78,37 @@ get_filtered_input:
|
|||||||
sta INPUT_Y
|
sta INPUT_Y
|
||||||
|
|
||||||
;Wait for a character.
|
;Wait for a character.
|
||||||
INPUT_GET:
|
@input_get:
|
||||||
jsr get_key
|
jsr get_key_ip65
|
||||||
sta LASTCHAR
|
sta LASTCHAR
|
||||||
|
|
||||||
cmp #$14 ;Delete
|
cmp #$14 ;Delete
|
||||||
beq DELETE
|
beq @delete
|
||||||
|
|
||||||
cmp #$0d ;Return
|
cmp #$0d ;Return
|
||||||
beq INPUT_DONE
|
beq @input_done
|
||||||
|
|
||||||
;End reached?
|
;End reached?
|
||||||
lda INPUT_Y
|
lda INPUT_Y
|
||||||
cmp MAXCHARS
|
cmp MAXCHARS
|
||||||
beq INPUT_GET
|
beq @input_get
|
||||||
|
|
||||||
;Check the allowed list of characters.
|
;Check the allowed list of characters.
|
||||||
ldy #$00
|
ldy #$00
|
||||||
CHECKALLOWED:
|
lda allowed_ptr+1 ;was the input filter point nul?
|
||||||
|
beq @input_ok
|
||||||
|
@check_allowed:
|
||||||
lda (allowed_ptr),y ;Overwritten
|
lda (allowed_ptr),y ;Overwritten
|
||||||
beq INPUT_GET ;Reached end of list (0)
|
beq @input_get ;Reached end of list (0)
|
||||||
|
|
||||||
cmp LASTCHAR
|
cmp LASTCHAR
|
||||||
beq INPUTOK ;Match found
|
beq @input_ok ;Match found
|
||||||
|
|
||||||
;Not end or match, keep checking
|
;Not end or match, keep checking
|
||||||
iny
|
iny
|
||||||
jmp CHECKALLOWED
|
jmp @check_allowed
|
||||||
|
|
||||||
INPUTOK:
|
@input_ok:
|
||||||
lda LASTCHAR ;Get the char back
|
lda LASTCHAR ;Get the char back
|
||||||
ldy INPUT_Y
|
ldy INPUT_Y
|
||||||
sta GOTINPUT,y ;Add it to string
|
sta GOTINPUT,y ;Add it to string
|
||||||
@ -100,30 +116,29 @@ INPUTOK:
|
|||||||
|
|
||||||
inc INPUT_Y ;Next character
|
inc INPUT_Y ;Next character
|
||||||
|
|
||||||
|
|
||||||
;Not yet.
|
;Not yet.
|
||||||
jmp INPUT_GET
|
jmp @input_get
|
||||||
|
|
||||||
INPUT_DONE:
|
@input_done:
|
||||||
ldy INPUT_Y
|
ldy INPUT_Y
|
||||||
beq no_input
|
beq @no_input
|
||||||
lda #$00
|
lda #$00
|
||||||
sta GOTINPUT,y ;Zero-terminate
|
sta GOTINPUT,y ;Zero-terminate
|
||||||
clc
|
clc
|
||||||
ldax #GOTINPUT
|
ldax #GOTINPUT
|
||||||
rts
|
rts
|
||||||
no_input:
|
@no_input:
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
; Delete last character.
|
; Delete last character.
|
||||||
DELETE:
|
@delete:
|
||||||
;First, check if we're at the beginning. If so, just exit.
|
;First, check if we're at the beginning. If so, just exit.
|
||||||
lda INPUT_Y
|
lda INPUT_Y
|
||||||
bne DELETE_OK
|
bne @delete_ok
|
||||||
jmp INPUT_GET
|
jmp @input_get
|
||||||
|
|
||||||
;At least one character entered.
|
;At least one character entered.
|
||||||
DELETE_OK:
|
@delete_ok:
|
||||||
;Move pointer back.
|
;Move pointer back.
|
||||||
dec INPUT_Y
|
dec INPUT_Y
|
||||||
|
|
||||||
@ -137,7 +152,7 @@ DELETE_OK:
|
|||||||
jsr $ffd2
|
jsr $ffd2
|
||||||
|
|
||||||
;Wait for next char
|
;Wait for next char
|
||||||
jmp INPUT_GET
|
jmp @input_get
|
||||||
|
|
||||||
|
|
||||||
;=================================================
|
;=================================================
|
||||||
@ -159,4 +174,3 @@ MAXCHARS: .res 1
|
|||||||
LASTCHAR: .res 1
|
LASTCHAR: .res 1
|
||||||
INPUT_Y: .res 1
|
INPUT_Y: .res 1
|
||||||
GOTINPUT: .res 40
|
GOTINPUT: .res 40
|
||||||
|
|
||||||
|
@ -121,16 +121,9 @@ listen_on_port_80
|
|||||||
nb65call #NB65_PRINT_HEX
|
nb65call #NB65_PRINT_HEX
|
||||||
lda #"!"
|
lda #"!"
|
||||||
jsr print_a
|
jsr print_a
|
||||||
ldaxi #4
|
ldaxi #html_length
|
||||||
stax nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH
|
stax nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH
|
||||||
ldaxi #press_a_key_to_continue
|
ldaxi #html
|
||||||
stax nb65_param_buffer+NB65_TCP_PAYLOAD_POINTER
|
|
||||||
ldaxi #nb65_param_buffer
|
|
||||||
nb65call #NB65_SEND_TCP_PACKET
|
|
||||||
|
|
||||||
ldaxi #4
|
|
||||||
stax nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH
|
|
||||||
ldaxi #nb65_signature
|
|
||||||
stax nb65_param_buffer+NB65_TCP_PAYLOAD_POINTER
|
stax nb65_param_buffer+NB65_TCP_PAYLOAD_POINTER
|
||||||
ldaxi #nb65_param_buffer
|
ldaxi #nb65_param_buffer
|
||||||
nb65call #NB65_SEND_TCP_PACKET
|
nb65call #NB65_SEND_TCP_PACKET
|
||||||
@ -276,6 +269,10 @@ failed dc.b "FAILED ", 0
|
|||||||
ok dc.b "OK ", 0
|
ok dc.b "OK ", 0
|
||||||
transmission_error dc.b "ERROR WHILE SENDING ",0
|
transmission_error dc.b "ERROR WHILE SENDING ",0
|
||||||
|
|
||||||
|
html dc.b "<H1>c64 test page</h1><form method=post>foo:<input type=text name=foo><br>bar:<textarea name=bar></textarea><br><INPUT type=submit value=send>"
|
||||||
|
html_end
|
||||||
|
html_length equ html_end-html
|
||||||
|
|
||||||
;self modifying code
|
;self modifying code
|
||||||
get_next_byte
|
get_next_byte
|
||||||
lda $ffff
|
lda $ffff
|
||||||
|
@ -53,8 +53,9 @@ NB65_PRINT_DOTTED_QUAD EQU $82 ;inputs: AX=pointer to 4 bytes that will
|
|||||||
NB65_PRINT_IP_CONFIG EQU $83 ;no inputs, no outputs, prints to screen current IP configuration
|
NB65_PRINT_IP_CONFIG EQU $83 ;no inputs, no outputs, prints to screen current IP configuration
|
||||||
|
|
||||||
|
|
||||||
NB65_INPUT_HOSTNAME EQU $90 ;no inputs, outputs: AX = pointer to hostname (which may be IP address).
|
NB65_INPUT_STRING EQU $90 ;no inputs, outputs: AX = pointer to null terminated string
|
||||||
NB65_INPUT_PORT_NUMBER EQU $91 ;no inputs, outputs: AX = port number entered ($0000..$FFFF)
|
NB65_INPUT_HOSTNAME EQU $91 ;no inputs, outputs: AX = pointer to hostname (which may be IP address).
|
||||||
|
NB65_INPUT_PORT_NUMBER EQU $92 ;no inputs, outputs: AX = port number entered ($0000..$FFFF)
|
||||||
|
|
||||||
NB65_BLOCK_COPY EQU $A0 ;inputs: AX points to a block copy structure, outputs: none
|
NB65_BLOCK_COPY EQU $A0 ;inputs: AX points to a block copy structure, outputs: none
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
; .include "../inc/c64keycodes.i"
|
; .include "../inc/c64keycodes.i"
|
||||||
; 3) define a routine called 'exit_telnet'
|
; 3) define a routine called 'exit_telnet'
|
||||||
; 4) define a buffer called 'scratch_buffer'
|
; 4) define a buffer called 'scratch_buffer'
|
||||||
; 5) define a zero page var called temp_ptr
|
; 5) define a zero page var called buffer_ptr
|
||||||
.code
|
.code
|
||||||
telnet_main_entry:
|
telnet_main_entry:
|
||||||
;prompt for a hostname, then resolve to an IP address
|
;prompt for a hostname, then resolve to an IP address
|
||||||
@ -68,22 +68,30 @@ telnet_main_entry:
|
|||||||
beq @petscii_mode
|
beq @petscii_mode
|
||||||
jmp @char_mode_input
|
jmp @char_mode_input
|
||||||
@ascii_mode:
|
@ascii_mode:
|
||||||
; lda #14
|
|
||||||
; jsr print_a ;switch to lower case
|
|
||||||
lda #0
|
lda #0
|
||||||
jmp @character_mode_set
|
sta character_set
|
||||||
@petscii_mode:
|
sta line_mode
|
||||||
; lda #142
|
|
||||||
; jsr print_a ;switch to upper case
|
|
||||||
lda #1
|
lda #1
|
||||||
@character_mode_set:
|
sta local_echo
|
||||||
sta character_mode
|
lda #telnet_state_normal
|
||||||
|
sta telnet_state
|
||||||
|
jmp @after_mode_set
|
||||||
|
@petscii_mode:
|
||||||
|
lda #1
|
||||||
|
sta character_set
|
||||||
|
lda #0
|
||||||
|
sta local_echo
|
||||||
|
sta line_mode
|
||||||
|
|
||||||
|
|
||||||
|
@after_mode_set:
|
||||||
|
|
||||||
lda #147 ; 'CLR/HOME'
|
lda #147 ; 'CLR/HOME'
|
||||||
jsr print_a
|
jsr print_a
|
||||||
|
|
||||||
ldax #connecting_in
|
ldax #connecting_in
|
||||||
jsr print
|
jsr print
|
||||||
lda character_mode
|
lda character_set
|
||||||
beq @a_mode
|
beq @a_mode
|
||||||
ldax #petscii
|
ldax #petscii
|
||||||
jsr print
|
jsr print
|
||||||
@ -127,6 +135,35 @@ telnet_connect:
|
|||||||
jsr print
|
jsr print
|
||||||
jmp telnet_main_entry
|
jmp telnet_main_entry
|
||||||
@not_disconnected:
|
@not_disconnected:
|
||||||
|
lda line_mode
|
||||||
|
beq @not_line_mode
|
||||||
|
|
||||||
|
nb65call #NB65_INPUT_STRING
|
||||||
|
stax buffer_ptr
|
||||||
|
ldy #0
|
||||||
|
@copy_one_char:
|
||||||
|
lda (buffer_ptr),y
|
||||||
|
tax
|
||||||
|
lda petscii_to_ascii_table,x
|
||||||
|
beq @end_of_input_string
|
||||||
|
sta scratch_buffer,y
|
||||||
|
iny
|
||||||
|
bne @copy_one_char
|
||||||
|
@end_of_input_string:
|
||||||
|
lda #$0d
|
||||||
|
sta scratch_buffer,y
|
||||||
|
iny
|
||||||
|
lda #$0a
|
||||||
|
sta scratch_buffer,y
|
||||||
|
iny
|
||||||
|
sty nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH
|
||||||
|
lda #0
|
||||||
|
sta nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH+1
|
||||||
|
|
||||||
|
jmp @no_more_input
|
||||||
|
|
||||||
|
@not_line_mode:
|
||||||
|
|
||||||
;is there anything in the input buffer?
|
;is there anything in the input buffer?
|
||||||
lda $c6 ;NDX - chars in keyboard buffer
|
lda $c6 ;NDX - chars in keyboard buffer
|
||||||
beq @main_polling_loop
|
beq @main_polling_loop
|
||||||
@ -135,6 +172,9 @@ telnet_connect:
|
|||||||
sta nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH+1
|
sta nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH+1
|
||||||
@get_next_char:
|
@get_next_char:
|
||||||
jsr $ffe4 ;getkey - 0 means no input
|
jsr $ffe4 ;getkey - 0 means no input
|
||||||
|
; pha
|
||||||
|
; jsr print_hex
|
||||||
|
; pla
|
||||||
tax
|
tax
|
||||||
beq @no_more_input
|
beq @no_more_input
|
||||||
cmp #$03 ;RUN/STOP
|
cmp #$03 ;RUN/STOP
|
||||||
@ -154,8 +194,19 @@ telnet_connect:
|
|||||||
jsr print_cr
|
jsr print_cr
|
||||||
jmp telnet_main_entry
|
jmp telnet_main_entry
|
||||||
@not_runstop:
|
@not_runstop:
|
||||||
lda character_mode
|
lda character_set
|
||||||
bne @no_conversion_required
|
bne @no_conversion_required
|
||||||
|
txa
|
||||||
|
cmp #$0d
|
||||||
|
bne @not_cr
|
||||||
|
|
||||||
|
;if we get a CR in ascii mode, send CR/LF
|
||||||
|
ldy nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH
|
||||||
|
sta scratch_buffer,y
|
||||||
|
inc nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH
|
||||||
|
ldx #$0a
|
||||||
|
jmp @no_conversion_required
|
||||||
|
@not_cr:
|
||||||
lda petscii_to_ascii_table,x
|
lda petscii_to_ascii_table,x
|
||||||
tax
|
tax
|
||||||
@no_conversion_required:
|
@no_conversion_required:
|
||||||
@ -202,11 +253,104 @@ telnet_callback:
|
|||||||
dec buffer_length+1
|
dec buffer_length+1
|
||||||
:
|
:
|
||||||
ldy #0
|
ldy #0
|
||||||
|
sty iac_response_buffer_length
|
||||||
@next_byte:
|
@next_byte:
|
||||||
lda (buffer_ptr),y
|
lda (buffer_ptr),y
|
||||||
tax
|
tax
|
||||||
lda character_mode
|
lda character_set
|
||||||
bne @no_conversion_req
|
beq :+
|
||||||
|
jmp @no_conversion_req
|
||||||
|
:
|
||||||
|
|
||||||
|
lda telnet_state
|
||||||
|
cmp #telnet_state_got_command
|
||||||
|
beq @waiting_for_option
|
||||||
|
cmp #telnet_state_got_iac
|
||||||
|
beq @waiting_for_command
|
||||||
|
; we must be in 'normal' mode
|
||||||
|
txa
|
||||||
|
cmp #255
|
||||||
|
beq :+
|
||||||
|
jmp @not_iac
|
||||||
|
:
|
||||||
|
lda #telnet_state_got_iac
|
||||||
|
sta telnet_state
|
||||||
|
jmp @byte_processed
|
||||||
|
@waiting_for_command:
|
||||||
|
txa
|
||||||
|
sta telnet_command
|
||||||
|
cmp #$fb ;WILL
|
||||||
|
beq @option
|
||||||
|
cmp #$fc ;WONT
|
||||||
|
beq @option
|
||||||
|
cmp #$fd ; DO
|
||||||
|
beq @option
|
||||||
|
cmp #$fe ;DONT
|
||||||
|
beq @option
|
||||||
|
;we got a command we don't understand - just ignore it
|
||||||
|
lda #telnet_state_normal
|
||||||
|
sta telnet_state
|
||||||
|
jmp @byte_processed
|
||||||
|
@option:
|
||||||
|
lda #telnet_state_got_command
|
||||||
|
sta telnet_state
|
||||||
|
jmp @byte_processed
|
||||||
|
|
||||||
|
@waiting_for_option:
|
||||||
|
;we have now got IAC, <command>, <option>
|
||||||
|
txa
|
||||||
|
sta telnet_option
|
||||||
|
lda telnet_command
|
||||||
|
|
||||||
|
cmp #$fb
|
||||||
|
beq @iac_will
|
||||||
|
|
||||||
|
cmp #$fc
|
||||||
|
beq @iac_wont
|
||||||
|
|
||||||
|
;if we get here, then it's a "do" or "don't", both of which we should send a "wont" back for
|
||||||
|
;(since there are no "do" options we actually honour)
|
||||||
|
lda #$fc ;wont
|
||||||
|
@add_iac_response:
|
||||||
|
ldx iac_response_buffer_length
|
||||||
|
sta iac_response_buffer+1,x
|
||||||
|
lda #255
|
||||||
|
sta iac_response_buffer,x
|
||||||
|
lda telnet_option
|
||||||
|
sta iac_response_buffer+2,x
|
||||||
|
|
||||||
|
inc iac_response_buffer_length
|
||||||
|
inc iac_response_buffer_length
|
||||||
|
inc iac_response_buffer_length
|
||||||
|
|
||||||
|
lda #telnet_state_normal
|
||||||
|
sta telnet_state
|
||||||
|
jmp @byte_processed
|
||||||
|
@iac_will:
|
||||||
|
lda telnet_option
|
||||||
|
cmp #$01 ;ECHO
|
||||||
|
beq @will_echo
|
||||||
|
cmp #$03 ;DO SUPPRESS GA
|
||||||
|
beq @will_suppress_ga
|
||||||
|
|
||||||
|
@iac_wont:
|
||||||
|
lda #$fe ;dont
|
||||||
|
jmp @add_iac_response
|
||||||
|
|
||||||
|
@will_echo:
|
||||||
|
lda #0
|
||||||
|
sta local_echo
|
||||||
|
lda #$fd ;DO
|
||||||
|
jmp @add_iac_response
|
||||||
|
|
||||||
|
@will_suppress_ga:
|
||||||
|
lda #0
|
||||||
|
sta line_mode
|
||||||
|
lda #$fd ;DO
|
||||||
|
jmp @add_iac_response
|
||||||
|
|
||||||
|
@not_iac:
|
||||||
|
|
||||||
lda ascii_to_petscii_table,x
|
lda ascii_to_petscii_table,x
|
||||||
tax
|
tax
|
||||||
@no_conversion_req:
|
@no_conversion_req:
|
||||||
@ -216,17 +360,30 @@ telnet_callback:
|
|||||||
jsr print_a
|
jsr print_a
|
||||||
pla
|
pla
|
||||||
tay
|
tay
|
||||||
|
@byte_processed:
|
||||||
iny
|
iny
|
||||||
dec buffer_length
|
dec buffer_length
|
||||||
lda #$ff
|
lda #$ff
|
||||||
cmp buffer_length
|
cmp buffer_length
|
||||||
bne @next_byte
|
beq :+
|
||||||
|
jmp @next_byte
|
||||||
|
:
|
||||||
inc buffer_ptr+1
|
inc buffer_ptr+1
|
||||||
dec buffer_length+1
|
dec buffer_length+1
|
||||||
bmi @finished
|
bmi @finished
|
||||||
ldy #0
|
ldy #0
|
||||||
jmp @next_byte
|
jmp @next_byte
|
||||||
@finished:
|
@finished:
|
||||||
|
|
||||||
|
lda iac_response_buffer_length
|
||||||
|
beq @no_iac_response
|
||||||
|
ldx #0
|
||||||
|
stax nb65_param_buffer+NB65_TCP_PAYLOAD_LENGTH
|
||||||
|
ldax #iac_response_buffer
|
||||||
|
stax nb65_param_buffer+NB65_TCP_PAYLOAD_POINTER
|
||||||
|
ldax #nb65_param_buffer
|
||||||
|
nb65call #NB65_SEND_TCP_PACKET
|
||||||
|
@no_iac_response:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;constants
|
;constants
|
||||||
@ -248,8 +405,20 @@ telnet_ip: .res 4
|
|||||||
telnet_port: .res 2
|
telnet_port: .res 2
|
||||||
|
|
||||||
connection_closed: .res 1
|
connection_closed: .res 1
|
||||||
character_mode: .res 1
|
character_set: .res 1
|
||||||
buffer_offset: .res 1
|
buffer_offset: .res 1
|
||||||
|
local_echo: .res 1
|
||||||
|
line_mode: .res 1
|
||||||
|
telnet_state: .res 1
|
||||||
|
telnet_command: .res 1
|
||||||
|
telnet_option: .res 1
|
||||||
|
|
||||||
|
telnet_state_normal = 0
|
||||||
|
telnet_state_got_iac = 1
|
||||||
|
telnet_state_got_command = 2
|
||||||
|
|
||||||
;nb65_param_buffer DS.B $20
|
;nb65_param_buffer DS.B $20
|
||||||
buffer_length: .res 2
|
buffer_length: .res 2
|
||||||
|
|
||||||
|
iac_response_buffer: .res 256
|
||||||
|
iac_response_buffer_length: .res 1
|
@ -506,6 +506,14 @@ ip_configured:
|
|||||||
.import filter_dns
|
.import filter_dns
|
||||||
.import get_filtered_input
|
.import get_filtered_input
|
||||||
.import filter_number
|
.import filter_number
|
||||||
|
|
||||||
|
cpy #NB65_INPUT_STRING
|
||||||
|
bne :+
|
||||||
|
ldy #40 ;max chars
|
||||||
|
ldax #$0000
|
||||||
|
jmp get_filtered_input
|
||||||
|
:
|
||||||
|
|
||||||
cpy #NB65_INPUT_HOSTNAME
|
cpy #NB65_INPUT_HOSTNAME
|
||||||
bne :+
|
bne :+
|
||||||
ldy #40 ;max chars
|
ldy #40 ;max chars
|
||||||
|
@ -65,6 +65,7 @@
|
|||||||
.import parse_dotted_quad
|
.import parse_dotted_quad
|
||||||
.import dotted_quad_value
|
.import dotted_quad_value
|
||||||
|
|
||||||
|
.import get_key_ip65
|
||||||
.import cfg_ip
|
.import cfg_ip
|
||||||
.import cfg_netmask
|
.import cfg_netmask
|
||||||
.import cfg_gateway
|
.import cfg_gateway
|
||||||
@ -163,7 +164,7 @@ init:
|
|||||||
.else
|
.else
|
||||||
lda #$1E ;petscii for green text
|
lda #$1E ;petscii for green text
|
||||||
.endif
|
.endif
|
||||||
|
lda #$05 ;petscii for white text
|
||||||
jsr print_a
|
jsr print_a
|
||||||
|
|
||||||
;relocate our r/w data
|
;relocate our r/w data
|
||||||
@ -216,8 +217,7 @@ main_menu:
|
|||||||
jsr print_cr
|
jsr print_cr
|
||||||
|
|
||||||
@get_key:
|
@get_key:
|
||||||
jsr ip65_process
|
jsr get_key_ip65
|
||||||
jsr get_key
|
|
||||||
cmp #KEYCODE_F1
|
cmp #KEYCODE_F1
|
||||||
bne @not_tftp
|
bne @not_tftp
|
||||||
jmp @tftp_boot
|
jmp @tftp_boot
|
||||||
@ -256,8 +256,7 @@ main_menu:
|
|||||||
jsr print_ip_config
|
jsr print_ip_config
|
||||||
jsr print_cr
|
jsr print_cr
|
||||||
@get_key_config_menu:
|
@get_key_config_menu:
|
||||||
jsr ip65_process
|
jsr get_key_ip65
|
||||||
jsr get_key
|
|
||||||
cmp #KEYCODE_ABORT
|
cmp #KEYCODE_ABORT
|
||||||
bne @not_abort
|
bne @not_abort
|
||||||
jmp main_menu
|
jmp main_menu
|
||||||
@ -549,9 +548,8 @@ net_apps_menu:
|
|||||||
ldax #net_apps_menu_msg
|
ldax #net_apps_menu_msg
|
||||||
jsr print
|
jsr print
|
||||||
@get_key:
|
@get_key:
|
||||||
jsr ip65_process
|
jsr get_key_ip65
|
||||||
jsr get_key
|
cmp #KEYCODE_ABORT
|
||||||
cmp #KEYCODE_ABORT
|
|
||||||
bne @not_abort
|
bne @not_abort
|
||||||
jmp main_menu
|
jmp main_menu
|
||||||
@not_abort:
|
@not_abort:
|
||||||
|
@ -45,6 +45,10 @@ basicstub:
|
|||||||
|
|
||||||
init:
|
init:
|
||||||
|
|
||||||
|
; jsr dump_dir
|
||||||
|
jsr dump_file
|
||||||
|
rts
|
||||||
|
|
||||||
lda #01
|
lda #01
|
||||||
sta io_track_no
|
sta io_track_no
|
||||||
lda #01
|
lda #01
|
||||||
@ -69,6 +73,9 @@ init:
|
|||||||
bcs @error
|
bcs @error
|
||||||
jsr dump_sector ;DEBUG
|
jsr dump_sector ;DEBUG
|
||||||
|
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
@error:
|
@error:
|
||||||
jsr print_cr
|
jsr print_cr
|
||||||
lda ip65_error
|
lda ip65_error
|
||||||
@ -90,6 +97,154 @@ dump_sector:
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
dump_dir:
|
||||||
|
LDA #dirname_end-dirname
|
||||||
|
LDX #<dirname
|
||||||
|
LDY #>dirname
|
||||||
|
JSR $FFBD ; call SETNAM
|
||||||
|
LDA #$02 ; filenumber 2
|
||||||
|
LDX $BA
|
||||||
|
BNE @skip
|
||||||
|
LDX #$08 ; default to device number 8
|
||||||
|
@skip:
|
||||||
|
LDY #$00 ; secondary address 0 (required for dir reading!)
|
||||||
|
JSR $FFBA ; call SETLFS
|
||||||
|
|
||||||
|
JSR $FFC0 ; call OPEN (open the directory)
|
||||||
|
BCS @error ; quit if OPEN failed
|
||||||
|
|
||||||
|
LDX #$02 ; filenumber 2
|
||||||
|
JSR $FFC6 ; call CHKIN
|
||||||
|
|
||||||
|
LDY #$04 ; skip 4 bytes on the first dir line
|
||||||
|
BNE @skip2
|
||||||
|
@next:
|
||||||
|
LDY #$02 ; skip 2 bytes on all other lines
|
||||||
|
@skip2:
|
||||||
|
JSR getbyte ; get a byte from dir and ignore it
|
||||||
|
DEY
|
||||||
|
BNE @skip2
|
||||||
|
|
||||||
|
JSR getbyte ; get low byte of basic line number
|
||||||
|
TAY
|
||||||
|
JSR getbyte ; get high byte of basic line number
|
||||||
|
PHA
|
||||||
|
TYA ; transfer Y to X without changing Akku
|
||||||
|
TAX
|
||||||
|
PLA
|
||||||
|
JSR $BDCD ; print basic line number
|
||||||
|
|
||||||
|
JSR getbyte
|
||||||
|
JSR getbyte
|
||||||
|
LDA #'#' ; print a space first
|
||||||
|
@char:
|
||||||
|
JSR $FFD2 ; call CHROUT (print character)
|
||||||
|
JSR getbyte
|
||||||
|
BNE @char ; continue until end of line
|
||||||
|
|
||||||
|
LDA #$0D
|
||||||
|
JSR $FFD2 ; print RETURN
|
||||||
|
JSR $FFE1 ; RUN/STOP pressed?
|
||||||
|
BNE @next ; no RUN/STOP -> continue
|
||||||
|
@error:
|
||||||
|
; Akkumulator contains BASIC error code
|
||||||
|
|
||||||
|
; most likely error:
|
||||||
|
; A = $05 (DEVICE NOT PRESENT)
|
||||||
|
exit:
|
||||||
|
LDA #$02 ; filenumber 2
|
||||||
|
JSR $FFC3 ; call CLOSE
|
||||||
|
|
||||||
|
LDX #$00
|
||||||
|
JSR $FFC9 ; call CHKIN (keyboard now input device again)
|
||||||
|
RTS
|
||||||
|
|
||||||
|
getbyte:
|
||||||
|
JSR $FFB7 ; call READST (read status byte)
|
||||||
|
BNE @end ; read error or end of file
|
||||||
|
JMP $FFCF ; call CHRIN (read byte from directory)
|
||||||
|
@end:
|
||||||
|
PLA ; don't return to dir reading loop
|
||||||
|
PLA
|
||||||
|
JMP exit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dump_file:
|
||||||
|
LDA #fname_end-fname
|
||||||
|
LDX #<fname
|
||||||
|
LDY #>fname
|
||||||
|
JSR $FFBD ; call SETNAM
|
||||||
|
LDA #$02 ; file number 2
|
||||||
|
LDX $BA ; last used device number
|
||||||
|
BNE @skip
|
||||||
|
LDX #$08 ; default to device 8
|
||||||
|
@skip:
|
||||||
|
LDY #$02 ; secondary address 2
|
||||||
|
JSR $FFBA ; call SETLFS
|
||||||
|
|
||||||
|
JSR $FFC0 ; call OPEN
|
||||||
|
BCS @error ; if carry set, the file could not be opened
|
||||||
|
|
||||||
|
; check drive error channel here to test for
|
||||||
|
; FILE NOT FOUND error etc.
|
||||||
|
|
||||||
|
LDX #$02 ; filenumber 2
|
||||||
|
JSR $FFC6 ; call CHKIN (file 2 now used as input)
|
||||||
|
|
||||||
|
|
||||||
|
@loop:
|
||||||
|
JSR $FFB7 ; call READST (read status byte)
|
||||||
|
BNE @eof ; either EOF or read error
|
||||||
|
JSR $FFCF ; call CHRIN (get a byte from file)
|
||||||
|
JSR $FFD2 ; call CHROUT (print character)
|
||||||
|
JMP @loop ; next byte
|
||||||
|
|
||||||
|
@eof:
|
||||||
|
AND #$40 ; end of file?
|
||||||
|
BEQ @readerror
|
||||||
|
@close:
|
||||||
|
LDA #$02 ; filenumber 2
|
||||||
|
JSR $FFC3 ; call CLOSE
|
||||||
|
|
||||||
|
LDX #$00 ; filenumber 0 = keyboard
|
||||||
|
JSR $FFC6 ; call CHKIN (keyboard now input device again)
|
||||||
|
RTS
|
||||||
|
@error:
|
||||||
|
; Akkumulator contains BASIC error code
|
||||||
|
|
||||||
|
; most likely errors:
|
||||||
|
; A = $05 (DEVICE NOT PRESENT)
|
||||||
|
pha
|
||||||
|
ldax #error_code
|
||||||
|
jsr print
|
||||||
|
pla
|
||||||
|
jsr print_hex
|
||||||
|
|
||||||
|
JMP @close ; even if OPEN failed, the file has to be closed
|
||||||
|
@readerror:
|
||||||
|
; for further information, the drive error channel has to be read
|
||||||
|
jsr print_error
|
||||||
|
JMP @close
|
||||||
|
|
||||||
|
|
||||||
|
print_error:
|
||||||
|
LDX #$0F ; filenumber 15
|
||||||
|
JSR $FFC6 ; call CHKIN (file 15 now used as input)
|
||||||
|
@loop:
|
||||||
|
JSR $FFB7 ; call READST (read status byte)
|
||||||
|
BNE @end ; read error or end of file
|
||||||
|
JMP $FFCF ; call CHRIN (read byte from directory)
|
||||||
|
jsr print_a
|
||||||
|
JMP @loop ; next byte
|
||||||
|
@end:
|
||||||
|
.byte $92
|
||||||
|
rts
|
||||||
|
|
||||||
|
fname: .byte "tcp.s"
|
||||||
|
fname_end:
|
||||||
|
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
error_code:
|
error_code:
|
||||||
@ -103,38 +258,8 @@ failed:
|
|||||||
ok:
|
ok:
|
||||||
.byte "OK ", 0
|
.byte "OK ", 0
|
||||||
|
|
||||||
initializing:
|
dirname:
|
||||||
.byte "INITIALIZING ",0
|
.byte "$" ; filename used to access directory
|
||||||
track_no:
|
dirname_end:
|
||||||
.byte "TRACK ",0
|
|
||||||
|
|
||||||
|
|
||||||
sector_no:
|
|
||||||
.byte " SECTOR ",0
|
|
||||||
|
|
||||||
signon_message:
|
|
||||||
.byte "D64 UPLOADER V0.1",13,0
|
|
||||||
|
|
||||||
enter_filename:
|
|
||||||
.byte "SEND AS: ",0
|
|
||||||
|
|
||||||
drive_error:
|
|
||||||
.byte "DRIVE ACCESS ERROR - ",0
|
|
||||||
nb65_signature_not_found_message:
|
|
||||||
.byte "NO NB65 API FOUND",13,"PRESS ANY KEY TO RESET", 0
|
|
||||||
error_opening_channel:
|
|
||||||
.byte "ERROR OPENING CHANNEL $",0
|
|
||||||
|
|
||||||
disk_access:
|
|
||||||
.byte 13,13,13,13,13,"SENDING TO CHANNEL $",0
|
|
||||||
|
|
||||||
nb65_signature:
|
|
||||||
.byte $4E,$42,$36,$35 ; "NB65" - API signature
|
|
||||||
.byte ' ',0 ; so we can use this as a string
|
|
||||||
position_cursor_for_track_display:
|
|
||||||
; .byte $13,13,13,13,13,13,13,13,13,13,13," SENDING ",0
|
|
||||||
.byte $13,13,13,"SENDING ",0
|
|
||||||
position_cursor_for_error_display:
|
|
||||||
.byte $13,13,13,13,"LAST ",0
|
|
||||||
|
|
||||||
cname: .byte '#'
|
cname: .byte '#'
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user