mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-03-20 11:29:37 +00:00
refactor to allow more granular allocation of zero page variables
git-svn-id: http://svn.code.sf.net/p/netboot65/code@332 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
f272791fd2
commit
9c6f0f97c3
@ -35,15 +35,15 @@ drivers:
|
||||
tokenize_asoft < $*.applesoft > $*.bas
|
||||
|
||||
%.pg2: %.o $(IP65LIB) $(A2UTHERLIB) $(INCFILES) ../cfg/a2bin.cfg
|
||||
$(LD) -vm --mapfile $*.map -C ../cfg/a2bin.cfg -o $*.pg2 $(AFLAGS) $< $(IP65LIB) $(A2UTHERLIB)
|
||||
$(LD) -vm --mapfile $*.map -C ../cfg/a2bin.cfg -o $*.pg2 $(AFLAGS) $< $(IP65TCPLIB) $(A2UTHERLIB)
|
||||
|
||||
amper.dsk: autoexec.pg2 autoexec.bas amper.pg2
|
||||
amper.dsk: autoexec.bas amper.pg2 hello.bas
|
||||
ripxplore.rb amper.dsk --init AppleDos
|
||||
ripxplore.rb amper.dsk -a autoexec.pg2 -t AppleBinary
|
||||
ripxplore.rb amper.dsk -a amper.pg2 -t AppleBinary
|
||||
cp autoexec.bas hello
|
||||
cp hello.bas hello
|
||||
ripxplore.rb amper.dsk -a hello -t Applesoft
|
||||
rm hello
|
||||
ripxplore.rb amper.dsk -a autoexec.bas -t Applesoft
|
||||
|
||||
clean:
|
||||
rm -f *.o *.pg2 *.map *.lst
|
||||
|
@ -5,12 +5,33 @@
|
||||
|
||||
.import exit_to_basic
|
||||
.import cfg_get_configuration_ptr
|
||||
|
||||
.import dns_ip
|
||||
.import dns_resolve
|
||||
.import dns_set_hostname
|
||||
.import icmp_ping
|
||||
.import icmp_echo_ip
|
||||
|
||||
|
||||
.import copymem
|
||||
.importzp copy_src
|
||||
|
||||
.importzp copy_dest
|
||||
.importzp buffer_ptr
|
||||
|
||||
.import http_parse_request
|
||||
.import http_get_value
|
||||
.import http_variables_buffer
|
||||
|
||||
.import tcp_inbound_data_ptr
|
||||
.import tcp_inbound_data_length
|
||||
.import tcp_send_data_len
|
||||
.import tcp_send
|
||||
.import check_for_abort_key
|
||||
.import tcp_connect_remote_port
|
||||
.import tcp_remote_ip
|
||||
.import tcp_listen
|
||||
.import tcp_callback
|
||||
.import tcp_close
|
||||
|
||||
.import __CODE_LOAD__
|
||||
.import __CODE_SIZE__
|
||||
@ -20,7 +41,7 @@
|
||||
.import __BSS_RUN__
|
||||
.import __BSS_SIZE__
|
||||
|
||||
END_OF_BSS = __BSS_RUN__+__BSS_SIZE__
|
||||
END_OF_BSS = __BSS_RUN__+__BSS_SIZE__
|
||||
|
||||
.segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2
|
||||
.addr __CODE_LOAD__-$03 ; Start address
|
||||
@ -29,20 +50,16 @@
|
||||
.code
|
||||
|
||||
init:
|
||||
|
||||
|
||||
;BASIC keywords installed, now bring up the ip65 stack
|
||||
|
||||
jsr ip65_init
|
||||
bcc @init_ok
|
||||
ldax #@no_nic
|
||||
jsr print
|
||||
@reboot:
|
||||
|
||||
jmp exit_to_basic
|
||||
@no_nic:
|
||||
.byte "NO NETWORK CARD FOUND - UNINSTALLING",0
|
||||
.byte "NO NIC - UNINSTALLING",0
|
||||
@install_msg:
|
||||
.byte " FOUND",13,"APPLESOFT ON ALES IN $801-$"
|
||||
.byte " FOUND",13,"APPLESOFT.NET USING $801-$"
|
||||
|
||||
.byte 0
|
||||
@init_ok:
|
||||
@ -60,21 +77,538 @@ init:
|
||||
ldax #amper_handler
|
||||
stax AMPERSAND_VECTOR+1
|
||||
|
||||
ldax #END_OF_BSS
|
||||
lda #$FF
|
||||
sta CURLIN+1 ;put into 'immediate' mode
|
||||
ldax #END_OF_BSS+1
|
||||
stax TXTTAB
|
||||
lda #0
|
||||
sta END_OF_BSS ;if the byte before the start of the BASIC is not zero, we
|
||||
;get a weird 'SYNTAX ERROR IN LINE' because
|
||||
;STXTPT (called by RUN) sets TXTPTR (address of next BASIC token) to be TXTTAB-1
|
||||
;if this byte is zero, then NEWSTT tries to execute that byte
|
||||
jsr SCRTCH ;reset BASIC now we have updated the start address
|
||||
|
||||
lday #chain_cmd
|
||||
jsr STROUT
|
||||
jmp exit_to_basic
|
||||
|
||||
|
||||
print_error:
|
||||
jsr print
|
||||
ldax #error
|
||||
jsr print
|
||||
lda ip65_error
|
||||
jsr print_hex
|
||||
jsr print_cr
|
||||
sec
|
||||
rts
|
||||
amper_handler:
|
||||
|
||||
;see if & is followed by one of our keywords
|
||||
|
||||
ldx #0
|
||||
ldy #0
|
||||
lda keyword_table
|
||||
|
||||
@check_one_handler:
|
||||
cmp #$FF ;end of table?
|
||||
beq exit_to_old_handler
|
||||
cmp (TXTPTR),y ;char in line
|
||||
beq @this_char_ok
|
||||
@skip_to_next_handler_loop:
|
||||
inx
|
||||
lda keyword_table,x
|
||||
bne @skip_to_next_handler_loop
|
||||
inx ;skip first part of handler address
|
||||
inx ;skip next part of handler address
|
||||
ldy #$FF
|
||||
@this_char_ok:
|
||||
iny
|
||||
inx
|
||||
lda keyword_table,x ;get cmd char
|
||||
bne @check_one_handler
|
||||
;if we get here, we have matched a keyword, and X points to the zero terminating the keyword, Y is length of keyword
|
||||
lda keyword_table+2,x ;get high byte of handler address
|
||||
pha
|
||||
lda keyword_table+1,x ;get low byte of handler address
|
||||
pha
|
||||
jmp ADDON ;fix-up TXTPTR - on return control will transfer to address we just pushed
|
||||
|
||||
exit_to_old_handler:
|
||||
jmp $ffff
|
||||
old_amper_handler=exit_to_old_handler+1
|
||||
|
||||
get_optional_byte:
|
||||
jsr CHRGOT
|
||||
beq @no_param ;leave X as it was
|
||||
jmp COMBYTE
|
||||
@no_param:
|
||||
rts
|
||||
|
||||
extract_string:
|
||||
jsr FRMEVL
|
||||
jsr FRESTR ;if not string, will create type mismatch error
|
||||
sta param_length
|
||||
tay
|
||||
lda #0
|
||||
sta transfer_buffer,y
|
||||
dey
|
||||
@loop:
|
||||
lda (INDEX),y
|
||||
sta transfer_buffer,y
|
||||
dey
|
||||
bpl @loop
|
||||
rts
|
||||
|
||||
get_ip_parameter:
|
||||
stax buffer_ptr
|
||||
jsr extract_string
|
||||
ldax #transfer_buffer
|
||||
|
||||
jsr dns_set_hostname
|
||||
|
||||
bcs @error
|
||||
jsr dns_resolve
|
||||
bcc @ok
|
||||
@error:
|
||||
ldax #address_resolution
|
||||
jmp print_error
|
||||
|
||||
@ok:
|
||||
ldax #dns_ip
|
||||
ldx #4
|
||||
@copy_dns_ip:
|
||||
lda dns_ip,y
|
||||
sta (buffer_ptr),y
|
||||
iny
|
||||
dex
|
||||
bne @copy_dns_ip
|
||||
rts
|
||||
|
||||
ipcfg_handler:
|
||||
jmp print_ip_config
|
||||
|
||||
lda #'*'
|
||||
jmp print_a
|
||||
ping_handler:
|
||||
ldax #icmp_echo_ip
|
||||
jsr get_ip_parameter
|
||||
bcc @no_error
|
||||
rts
|
||||
@no_error:
|
||||
;is there an optional parameter?
|
||||
ldx #3
|
||||
jsr get_optional_byte
|
||||
stx ping_counter
|
||||
|
||||
ldax #pinging
|
||||
jsr print
|
||||
ldax #dns_ip
|
||||
jsr print_dotted_quad
|
||||
jsr print_cr
|
||||
|
||||
@ping_loop:
|
||||
jsr icmp_ping
|
||||
bcs @error
|
||||
lda #'.'
|
||||
@print_and_loop:
|
||||
jsr print_a
|
||||
lda $c000 ;key pressed
|
||||
sta $c010 ;clear keyboard
|
||||
cmp #$9B ;escape
|
||||
beq @done
|
||||
dec ping_counter
|
||||
bne @ping_loop
|
||||
@done:
|
||||
jmp print_cr
|
||||
@error:
|
||||
lda #'!'
|
||||
jmp @print_and_loop
|
||||
|
||||
|
||||
dhcp_handler:
|
||||
jsr dhcp_init
|
||||
bcc @init_ok
|
||||
jsr ip65_init ;if DHCP failed, then reinit the IP stack (which will reset IP address etc that DHCP messed with to default values)
|
||||
|
||||
@init_failed:
|
||||
ldax #dhcp
|
||||
jmp print_error
|
||||
@init_ok:
|
||||
rts
|
||||
|
||||
myip_handler:
|
||||
ldax #cfg_ip
|
||||
jmp get_ip_parameter
|
||||
|
||||
dns_handler:
|
||||
ldax #cfg_dns
|
||||
jmp get_ip_parameter
|
||||
|
||||
gateway_handler:
|
||||
ldax #cfg_gateway
|
||||
jmp get_ip_parameter
|
||||
|
||||
netmask_handler:
|
||||
ldax #cfg_netmask
|
||||
jmp get_ip_parameter
|
||||
|
||||
|
||||
skip_comma_get_integer:
|
||||
jsr CHKCOM
|
||||
get_integer:
|
||||
jsr CHRGOT
|
||||
jsr LINGET
|
||||
ldax LINNUM
|
||||
rts
|
||||
|
||||
|
||||
|
||||
httpd_handler:
|
||||
jsr flush_handler ;clean out the last connection
|
||||
jsr get_integer
|
||||
stax httpd_port_number
|
||||
tsx
|
||||
stx top_of_stack
|
||||
|
||||
ldax #listening
|
||||
jsr print
|
||||
ldax #cfg_ip
|
||||
jsr print_dotted_quad
|
||||
lda #':'
|
||||
jsr print_a
|
||||
ldax httpd_port_number
|
||||
jsr print_integer
|
||||
jsr print_cr
|
||||
|
||||
@listen:
|
||||
jsr tcp_close
|
||||
ldax httpd_io_buffer
|
||||
stax tcp_buffer_ptr
|
||||
|
||||
ldax #http_callback
|
||||
stax tcp_callback
|
||||
ldax httpd_port_number
|
||||
|
||||
jsr tcp_listen
|
||||
bcc @connect_ok
|
||||
jmp END4
|
||||
|
||||
@connect_ok:
|
||||
ldax #connection_from
|
||||
jsr print
|
||||
ldax #tcp_remote_ip
|
||||
jsr print_dotted_quad
|
||||
lda #':'
|
||||
jsr print_a
|
||||
ldax tcp_connect_remote_port
|
||||
|
||||
jsr print_integer
|
||||
jsr print_cr
|
||||
lda #0
|
||||
sta connection_closed
|
||||
sta found_eol
|
||||
sta polling_counter
|
||||
|
||||
@main_polling_loop:
|
||||
jsr ip65_process
|
||||
jsr ISCNTC ;check for ^C, if so print error message, warm start BASIC
|
||||
|
||||
lda found_eol
|
||||
bne @got_eol
|
||||
lda #75
|
||||
jsr $fca8 ;wait for about 15ms - this gives a total timeout of ~4seconds
|
||||
inc polling_counter
|
||||
bne @main_polling_loop
|
||||
jmp @listen
|
||||
|
||||
@got_eol:
|
||||
|
||||
jsr reset_output_buffer
|
||||
|
||||
ldy #$FF
|
||||
:
|
||||
iny
|
||||
lda status_ok,y
|
||||
sta status_code_buffer,y
|
||||
bne :-
|
||||
|
||||
ldy #$FF
|
||||
:
|
||||
iny
|
||||
lda text_html,y
|
||||
sta content_type_buffer,y
|
||||
bne :-
|
||||
|
||||
sta sent_header
|
||||
|
||||
ldax httpd_io_buffer
|
||||
jmp got_http_request
|
||||
|
||||
http_callback:
|
||||
lda tcp_inbound_data_length+1
|
||||
cmp #$ff
|
||||
bne @not_eof
|
||||
inc connection_closed
|
||||
@done:
|
||||
rts
|
||||
@not_eof:
|
||||
lda found_eol
|
||||
bne @done
|
||||
|
||||
;copy this chunk to our input buffer
|
||||
ldax tcp_buffer_ptr
|
||||
stax copy_dest
|
||||
ldax tcp_inbound_data_ptr
|
||||
stax copy_src
|
||||
ldax tcp_inbound_data_length
|
||||
jsr copymem
|
||||
|
||||
;increment the pointer into the input buffer
|
||||
clc
|
||||
lda tcp_buffer_ptr
|
||||
adc tcp_inbound_data_length
|
||||
sta tcp_buffer_ptr
|
||||
sta copy_src
|
||||
lda tcp_buffer_ptr+1
|
||||
adc tcp_inbound_data_length+1
|
||||
sta tcp_buffer_ptr+1
|
||||
sta copy_src+1
|
||||
|
||||
;put a null byte at the end (assumes we have set copy_src already)
|
||||
lda #0
|
||||
tay
|
||||
sta (copy_src),y
|
||||
|
||||
;look for CR or LF in input
|
||||
sta found_eol
|
||||
ldax httpd_io_buffer
|
||||
stax get_next_byte+1
|
||||
|
||||
@look_for_eol:
|
||||
jsr get_next_byte
|
||||
cmp #$0a
|
||||
beq @found_eol
|
||||
cmp #$0d
|
||||
bne @not_eol
|
||||
@found_eol:
|
||||
inc found_eol
|
||||
rts
|
||||
@not_eol:
|
||||
cmp #0
|
||||
bne @look_for_eol
|
||||
rts
|
||||
|
||||
|
||||
|
||||
reset_output_buffer:
|
||||
ldax httpd_io_buffer
|
||||
sta xmit_a_ptr+1
|
||||
stx xmit_a_ptr+2
|
||||
lda #0
|
||||
sta output_buffer_length
|
||||
sta output_buffer_length+1
|
||||
rts
|
||||
|
||||
|
||||
send_buffer:
|
||||
ldax output_buffer_length
|
||||
stax tcp_send_data_len
|
||||
ldax httpd_io_buffer
|
||||
jsr tcp_send
|
||||
jmp reset_output_buffer
|
||||
|
||||
|
||||
emit_string:
|
||||
stax copy_src
|
||||
ldy #0
|
||||
@next_byte:
|
||||
lda (copy_src),y
|
||||
beq @done
|
||||
jsr xmit_a
|
||||
iny
|
||||
bne @next_byte
|
||||
@done:
|
||||
rts
|
||||
|
||||
got_http_request:
|
||||
jsr http_parse_request
|
||||
ldax #path
|
||||
jsr print
|
||||
lda #$02
|
||||
jsr http_get_value
|
||||
stax copy_src
|
||||
jsr print
|
||||
jsr print_cr
|
||||
|
||||
;now restore stack to how it was when &HTTPD was called, and return to BASIC
|
||||
ldx top_of_stack
|
||||
txs
|
||||
rts
|
||||
|
||||
|
||||
bang_handler:
|
||||
jsr extract_string
|
||||
lda sent_header
|
||||
bne :+
|
||||
jsr send_header
|
||||
:
|
||||
ldy #0
|
||||
sty string_ptr
|
||||
@loop:
|
||||
lda transfer_buffer,y
|
||||
jsr xmit_a
|
||||
inc string_ptr
|
||||
ldy string_ptr
|
||||
cpy param_length
|
||||
bne @loop
|
||||
rts
|
||||
|
||||
send_header:
|
||||
inc sent_header
|
||||
ldax #http_version
|
||||
jsr emit_string
|
||||
ldax #status_code_buffer
|
||||
jsr emit_string
|
||||
ldax #crlf
|
||||
jsr emit_string
|
||||
ldax #content_type
|
||||
jsr emit_string
|
||||
ldax #content_type_buffer
|
||||
jsr emit_string
|
||||
ldax #end_of_header
|
||||
jmp emit_string
|
||||
|
||||
flush_handler:
|
||||
lda output_buffer_length
|
||||
bne :+
|
||||
ldx output_buffer_length+1
|
||||
bne :+
|
||||
rts
|
||||
:
|
||||
jmp send_buffer
|
||||
|
||||
.rodata
|
||||
keyword_table:
|
||||
.byte "IPCFG",0
|
||||
.word ipcfg_handler-1
|
||||
.byte "DHCP",0
|
||||
.word dhcp_handler-1
|
||||
.byte "PING",0
|
||||
.word ping_handler-1
|
||||
.byte "MYIP",0
|
||||
.word myip_handler-1
|
||||
.byte "DNS",0
|
||||
.word dns_handler-1
|
||||
.byte "G",$c5,"EWAY",0 ;$C5 is token for 'AT'
|
||||
.word gateway_handler-1
|
||||
.byte "NETMASK",0
|
||||
.word netmask_handler-1
|
||||
.byte "HTTPD",0
|
||||
.word httpd_handler-1
|
||||
.byte "!",0
|
||||
.word bang_handler-1
|
||||
.byte "FLUSH",0
|
||||
.word flush_handler-1
|
||||
|
||||
.byte $ff
|
||||
|
||||
keyword_table_size=*-keyword_table
|
||||
.if keyword_table_size>255
|
||||
.error "KEYWORD TABLE TOO BIG!"
|
||||
.endif
|
||||
|
||||
CR=$0D
|
||||
LF=$0A
|
||||
|
||||
dhcp:
|
||||
.byte "DHCP",0
|
||||
address_resolution:
|
||||
.byte "ADDRESS RESOLUTION",0
|
||||
error:
|
||||
.byte " ERROR $",0
|
||||
pinging:
|
||||
.byte "PINGING ",0
|
||||
|
||||
path:
|
||||
.byte "PATH: ",0
|
||||
http_version:
|
||||
.byte "HTTP/1.0 ",0
|
||||
|
||||
status_ok:
|
||||
.byte "200 OK",0
|
||||
status_error:
|
||||
.byte "500 "
|
||||
system_error:
|
||||
.byte "SYSTEM ERROR",0
|
||||
content_type:
|
||||
.byte "Content-Type: ",0
|
||||
text_html:
|
||||
.byte "text/html",0
|
||||
|
||||
end_of_header:
|
||||
.byte CR,LF
|
||||
.byte "Connection: Close",CR,LF
|
||||
.byte "Server: AppleSoft.NET/0.2",CR,LF
|
||||
crlf:
|
||||
.byte CR,LF,0
|
||||
|
||||
connection_from: .byte "CONNECTION FROM ",0
|
||||
chain_cmd:
|
||||
|
||||
.byte 13,4,"RUN AUTOEXEC.BAS",13,0
|
||||
|
||||
listening:
|
||||
.byte"LISTENING ON ",0
|
||||
|
||||
|
||||
|
||||
.data
|
||||
|
||||
|
||||
httpd_io_buffer: .word __httpd_io_buffer
|
||||
httpd_port_number: .word 80
|
||||
|
||||
|
||||
get_next_byte:
|
||||
lda $ffff
|
||||
inc get_next_byte+1
|
||||
bne @skip
|
||||
inc get_next_byte+2
|
||||
@skip:
|
||||
rts
|
||||
|
||||
|
||||
xmit_a:
|
||||
|
||||
xmit_a_ptr:
|
||||
sta $ffff
|
||||
inc xmit_a_ptr+1
|
||||
bne :+
|
||||
inc xmit_a_ptr+2
|
||||
:
|
||||
inc output_buffer_length
|
||||
bne :+
|
||||
inc output_buffer_length+1
|
||||
lda output_buffer_length+1
|
||||
cmp #2
|
||||
bne :+
|
||||
stx temp_x
|
||||
jsr send_buffer
|
||||
ldx temp_x
|
||||
:
|
||||
rts
|
||||
|
||||
.bss
|
||||
|
||||
transfer_buffer: .res 256
|
||||
param_length: .res 1
|
||||
ping_counter: .res 1
|
||||
handler_address: .res 2
|
||||
temp_x: .res 1
|
||||
output_buffer_length: .res 2
|
||||
sent_header: .res 1
|
||||
content_type_buffer: .res 128
|
||||
status_code_buffer: .res 128
|
||||
found_eol: .byte 0
|
||||
connection_closed: .byte 0
|
||||
tcp_buffer_ptr: .res 2
|
||||
top_of_stack: .res 1
|
||||
polling_counter: .res 1
|
||||
string_ptr: .res 1
|
||||
__httpd_io_buffer: .res 1024 ;temp buffer for storing inbound requests.
|
||||
|
||||
|
@ -1 +1,15 @@
|
||||
10 PRINT CHR$(4);"BRUN AMPER.PG2"
|
||||
10 PRINT "HELLO FROM BASIC"
|
||||
20 &MYIP"1.2.3.4"
|
||||
21 &NETMASK"255.0.255.0"
|
||||
22 &GATEWAY"7.6.5.4"
|
||||
23 &DNS"8.8.7.6"
|
||||
25 &IPCFG
|
||||
30 &DHCP
|
||||
40 &IPCFG
|
||||
50 &PING "192.168.10.2"
|
||||
60 &PING "192.168.10.2" , 5
|
||||
100 &HTTPD 8080
|
||||
1000 PRINT "HELLO FOO!"
|
||||
1010 &!"HOWDY DOODY DOO!"
|
||||
1020 &FLUSH
|
||||
1030 GOTO 100
|
Binary file not shown.
@ -1,11 +1,5 @@
|
||||
.include "../inc/common.i"
|
||||
.include "../inc/commonprint.i"
|
||||
.include "../inc/net.i"
|
||||
|
||||
.import cfg_get_configuration_ptr
|
||||
.import copymem
|
||||
.importzp copy_src
|
||||
.importzp copy_dest
|
||||
.include "../inc/a2const.i"
|
||||
.import exit_to_basic
|
||||
|
||||
|
||||
@ -13,19 +7,18 @@
|
||||
.import __CODE_SIZE__
|
||||
.import __RODATA_SIZE__
|
||||
.import __DATA_SIZE__
|
||||
.import __IP65_DEFAULTS_SIZE__
|
||||
|
||||
.segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2
|
||||
.addr __CODE_LOAD__-$03 ; Start address
|
||||
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+__IP65_DEFAULTS_SIZE__+4 ; file size
|
||||
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; file size
|
||||
jmp init
|
||||
|
||||
.code
|
||||
|
||||
init:
|
||||
cld
|
||||
jsr print_cr
|
||||
init_ip_via_dhcp
|
||||
jsr print_ip_config
|
||||
jsr print_cr
|
||||
lday #chain_cmd
|
||||
jsr STROUT
|
||||
|
||||
jmp exit_to_basic
|
||||
|
||||
chain_cmd:
|
||||
.byte 13,4,"CATALOG",13,0
|
1
client/a2/hello.applesoft
Normal file
1
client/a2/hello.applesoft
Normal file
@ -0,0 +1 @@
|
||||
10 PRINT CHR$(4);"BRUN AMPER.PG2"
|
Binary file not shown.
@ -954,7 +954,6 @@ yield_keyword:
|
||||
.endif
|
||||
jmp httpd_start
|
||||
|
||||
gosub:
|
||||
|
||||
bang_keyword:
|
||||
jsr extract_string
|
||||
|
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
|
||||
MEMORY {
|
||||
ZP: start = $00, size = $08, type = rw, define = yes;
|
||||
IP65ZP: start = $0f, size = $10, type = rw, define = yes;
|
||||
ZP: start = $00, size = $08, type = rw, define = yes; #zero size as we hand allocate all ZP locations
|
||||
IP65ZP: start = $E0, size = $0, type = rw, define = yes; #zero size as we hand allocate all ZP locations
|
||||
HEADER: start = $0000, size = $10, file = %O;
|
||||
RAM: start = $800, size = $8000, file = %O, define=yes;
|
||||
PAGE3: start = $2C0, size = 272;
|
||||
@ -14,11 +14,12 @@ SEGMENTS {
|
||||
IP65_DEFAULTS: load = RAM, run=RAM, type = ro , define = yes;
|
||||
DATA: load = RAM, run=RAM, type = rw , define = yes;
|
||||
PAGE3: load = RAM,run=PAGE3, type = rw, define = yes, optional=yes;
|
||||
BSS: load=RAM, type = bss, define = yes;
|
||||
HTTP_VARS: load = RAM, run=RAM, type = rw, optional=yes;
|
||||
TCP_VARS: load = RAM, type = bss, optional=yes;
|
||||
APP_SCRATCH: load = RAM, type = bss , optional=yes;
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
IP65ZP: load = IP65ZP, type = zp;
|
||||
BSS: load=RAM, type = bss, define = yes;
|
||||
ZEROPAGE: load = ZP, type = zp , optional=yes;
|
||||
IP65ZP: load = IP65ZP, type = zp,optional=yes;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,19 +27,19 @@ DRIVERS=\
|
||||
|
||||
all: $(DRIVERS)
|
||||
|
||||
a2lancegs.lib: a2print.o lan91c96.o a2timer.o a2kernal.o a2input.o a2charconv.o
|
||||
a2lancegs.lib: a2print.o lan91c96.o a2timer.o a2kernal.o a2input.o a2charconv.o a2_zero_page.o
|
||||
ar65 a $@ $^
|
||||
|
||||
a2uther.lib: a2print.o uthernet.o a2timer.o a2kernal.o a2input.o a2charconv.o cs8900a.o
|
||||
a2uther.lib: a2print.o uthernet.o a2timer.o a2kernal.o a2input.o a2charconv.o cs8900a.o a2_zero_page.o
|
||||
ar65 a $@ $^
|
||||
|
||||
c64rrnet.lib: c64print.o rr-net.o c64timer.o c64kernal.o c64inputs.o cbm_disk_access.o petscii_charconv.o c64_vt100.o cs8900a.o
|
||||
c64rrnet.lib: c64print.o rr-net.o c64timer.o c64kernal.o c64inputs.o cbm_disk_access.o petscii_charconv.o c64_vt100.o cs8900a.o generic_zero_page.o
|
||||
ar65 a $@ $^
|
||||
|
||||
c64wiznet.lib: w5100.o c64print.o c64timer.o c64kernal.o c64inputs.o cbm_disk_access.o petscii_charconv.o c64_vt100.o
|
||||
c64wiznet.lib: w5100.o c64print.o c64timer.o c64kernal.o c64inputs.o cbm_disk_access.o petscii_charconv.o c64_vt100.o generic_zero_page.o
|
||||
ar65 a $@ $^
|
||||
|
||||
vic20rrnet.lib: vic20print.o vic20-rr-net.o vic20timer.o vic20input.o cbm_disk_access.o petscii_charconv.o cs8900a.o
|
||||
vic20rrnet.lib: vic20print.o vic20-rr-net.o vic20timer.o vic20input.o cbm_disk_access.o petscii_charconv.o cs8900a.o generic_zero_page.o
|
||||
ar65 a $@ $^
|
||||
|
||||
|
||||
|
38
client/drivers/a2_zero_page.s
Normal file
38
client/drivers/a2_zero_page.s
Normal file
@ -0,0 +1,38 @@
|
||||
;zero page definitions
|
||||
;On the Apple ][ with AppleSoft running there are not enough contiguous zero page locations
|
||||
;to allow LD65 to handle assignment
|
||||
;so we need to manually assign ZP pointers to known free locations
|
||||
|
||||
.exportzp copy_src
|
||||
.exportzp copy_dest
|
||||
.exportzp dns_hostname
|
||||
.exportzp tftp_filename
|
||||
.exportzp buffer_ptr
|
||||
.exportzp eth_packet
|
||||
|
||||
|
||||
copy_src =$06 ;also $07
|
||||
copy_dest =$08 ;also $09
|
||||
dns_hostname =$18 ;also $19
|
||||
tftp_filename =$1D ;also $1E
|
||||
buffer_ptr =$EB ;also $EC
|
||||
eth_packet =$ED ;also $EE
|
||||
|
||||
;-- LICENSE --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
; Version 1.1 (the "License"); you may not use this file except in
|
||||
; compliance with the License. You may obtain a copy of the License at
|
||||
; http://www.mozilla.org/MPL/
|
||||
;
|
||||
; Software distributed under the License is distributed on an "AS IS"
|
||||
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
; License for the specific language governing rights and limitations
|
||||
; under the License.
|
||||
;
|
||||
; The Original Code is ip65.
|
||||
;
|
||||
; The Initial Developer of the Original Code is Jonno Downes,
|
||||
; jonno@jamtronix.com.
|
||||
; Portions created by the Initial Developer are Copyright (C) 2013
|
||||
; Jonno Downes. All Rights Reserved.
|
||||
; -- LICENSE END --
|
@ -33,7 +33,8 @@
|
||||
.import cs_tx_len
|
||||
|
||||
.import cfg_mac
|
||||
|
||||
.importzp eth_packet
|
||||
|
||||
.import ip65_error
|
||||
|
||||
.macro write_page page, value
|
||||
@ -44,9 +45,6 @@
|
||||
.endmacro
|
||||
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
eth_packet: .res 2
|
||||
|
||||
|
||||
|
||||
|
43
client/drivers/generic_zero_page.s
Normal file
43
client/drivers/generic_zero_page.s
Normal file
@ -0,0 +1,43 @@
|
||||
;zero page definitions
|
||||
;this 'generic' file just puts everything into a ZP segment
|
||||
;and lets LD65 in conjunction with cfg files assign zero page locations
|
||||
;however this can be overridden in the case that all necessary zp variables
|
||||
;cant be crammed into a contiguous segment, e.g. on the Apple ][
|
||||
|
||||
|
||||
.exportzp copy_src
|
||||
.exportzp copy_dest
|
||||
.exportzp dns_hostname
|
||||
.exportzp tftp_filename
|
||||
.exportzp buffer_ptr
|
||||
.exportzp eth_packet
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
copy_src: .res 2 ; source pointer
|
||||
copy_dest: .res 2 ; destination pointer
|
||||
dns_hostname: .res 2
|
||||
tftp_filename: .res 2 ;name of file to d/l or filemask to get directory listing for
|
||||
buffer_ptr: .res 2 ; source pointer
|
||||
eth_packet: .res 2
|
||||
|
||||
|
||||
|
||||
;-- LICENSE --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
; Version 1.1 (the "License"); you may not use this file except in
|
||||
; compliance with the License. You may obtain a copy of the License at
|
||||
; http://www.mozilla.org/MPL/
|
||||
;
|
||||
; Software distributed under the License is distributed on an "AS IS"
|
||||
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
; License for the specific language governing rights and limitations
|
||||
; under the License.
|
||||
;
|
||||
; The Original Code is ip65.
|
||||
;
|
||||
; The Initial Developer of the Original Code is Jonno Downes,
|
||||
; jonno@jamtronix.com.
|
||||
; Portions created by the Initial Developer are Copyright (C) 2013
|
||||
; Jonno Downes. All Rights Reserved.
|
||||
; -- LICENSE END --
|
@ -23,7 +23,8 @@
|
||||
.import eth_outp_len
|
||||
|
||||
.import cfg_mac
|
||||
|
||||
.importzp eth_packet
|
||||
|
||||
; LANceGS hardware addresses
|
||||
ethbsr := $c00E ; Bank select register R/W (2B)
|
||||
|
||||
@ -60,10 +61,6 @@ ethmgmt := $c008 ; Management interface R/W (2B)
|
||||
ethrev := $c00A ; Revision register R/W (2B)
|
||||
ethercv := $c00C ; Early RCV register R/W (2B)
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
eth_packet: .res 2
|
||||
|
||||
.data
|
||||
|
||||
;initialize the ethernet adaptor
|
||||
|
@ -117,6 +117,7 @@
|
||||
CURLSV = $F6
|
||||
REMSTK = $F8
|
||||
HGR_ROTATION = $F9
|
||||
|
||||
M_NEG = $D0C7
|
||||
M_EQU = $D0CA
|
||||
M_REL = $D0CD
|
||||
@ -155,6 +156,7 @@ STEP = $D7AF
|
||||
NEWSTT = $D7D2
|
||||
TRACE_ = $D805
|
||||
GOEND = $D826
|
||||
EXECUTE_STATEMENT=$D828
|
||||
COLON_ = $D842
|
||||
SYNERR_1 = $D846
|
||||
SETDA = $D853
|
||||
@ -298,7 +300,7 @@ JERR = $E432
|
||||
PUTEMP = $E435
|
||||
GETSPA = $E452
|
||||
GARBAG = $E484
|
||||
CAT = $E597
|
||||
CAT = $E597
|
||||
MOVINS = $E5D4
|
||||
MOVSTR = $E5E2
|
||||
FRESTR = $E5FD
|
||||
@ -307,16 +309,17 @@ FRETMP = $E604
|
||||
FRETMS = $E635
|
||||
CHRSTR = $E646
|
||||
MIDSTR = $E691
|
||||
LEN = $E6D6
|
||||
LEN = $E6D6
|
||||
GETSTR = $E6DC
|
||||
ASC = $E6E5
|
||||
ASC = $E6E5
|
||||
GOIQ = $E6F2
|
||||
GTBYTC = $E6F5
|
||||
GETBYT = $E6F8
|
||||
CONINT = $E6FB
|
||||
VAL = $E707
|
||||
VAL = $E707
|
||||
POINT = $E73D
|
||||
GTNUM = $E746
|
||||
COMBYTE = $E74C
|
||||
GETADR = $E752
|
||||
PEEK = $E764
|
||||
POKE = $E77B
|
||||
|
@ -18,6 +18,18 @@ COMMON__I__ = 1
|
||||
.endmacro
|
||||
|
||||
|
||||
; load A/y macro
|
||||
.macro lday arg
|
||||
.if (.match (.left (1, arg), #)) ; immediate mode
|
||||
lda #<(.right (.tcount (arg)-1, arg))
|
||||
ldy #>(.right (.tcount (arg)-1, arg))
|
||||
.else ; assume absolute or zero page
|
||||
lda arg
|
||||
ldy 1+(arg)
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro phax
|
||||
pha
|
||||
txa
|
||||
|
@ -30,10 +30,9 @@
|
||||
.import timer_read
|
||||
.import timer_timeout
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
ap: .res 2
|
||||
|
||||
.importzp copy_src
|
||||
ap=copy_src
|
||||
|
||||
ARP_TIMEOUT_MS=100
|
||||
|
||||
.bss
|
||||
|
@ -2,15 +2,8 @@
|
||||
|
||||
|
||||
.export copymem
|
||||
.exportzp copy_src
|
||||
.exportzp copy_dest
|
||||
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
; pointers for copying
|
||||
copy_src: .res 2 ; source pointer
|
||||
copy_dest: .res 2 ; destination pointer
|
||||
.importzp copy_src
|
||||
.importzp copy_dest
|
||||
|
||||
|
||||
.bss
|
||||
|
@ -16,12 +16,7 @@
|
||||
.import eth_outp, eth_outp_len
|
||||
.import ip_outp
|
||||
.import udp_outp
|
||||
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
cptr: .res 2
|
||||
|
||||
.importzp copy_src
|
||||
|
||||
.code
|
||||
|
||||
@ -113,7 +108,7 @@ console_out = $ffd2
|
||||
;inputs: AX = address of (null terminated) string to print
|
||||
;outputs: none
|
||||
console_strout:
|
||||
stax cptr
|
||||
stax copy_src
|
||||
|
||||
pha
|
||||
txa
|
||||
@ -121,7 +116,7 @@ console_strout:
|
||||
tya
|
||||
pha
|
||||
ldy #0
|
||||
: lda (cptr),y
|
||||
: lda (copy_src),y
|
||||
beq @done
|
||||
jsr console_out
|
||||
iny
|
||||
|
@ -37,9 +37,8 @@
|
||||
.import check_for_abort_key
|
||||
.import timer_read
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
.importzp dns_hostname
|
||||
|
||||
dns_hostname: .res 2
|
||||
|
||||
.bss
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
.export ip_inp
|
||||
.export ip_outp
|
||||
.export ip_broadcast
|
||||
.exportzp ip_cksum_ptr
|
||||
.exportzp ip_ver_ihl
|
||||
.exportzp ip_tos
|
||||
.exportzp ip_len
|
||||
@ -58,12 +57,11 @@
|
||||
.import tcp_process
|
||||
.endif
|
||||
.importzp copy_src
|
||||
.importzp copy_dest
|
||||
.exportzp ip_cksum_ptr
|
||||
ip_cksum_ptr=copy_dest
|
||||
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
; checksum
|
||||
ip_cksum_ptr: .res 2 ; pointer to data to be checksummed
|
||||
|
||||
|
||||
.bss
|
||||
@ -140,6 +138,7 @@ ip_process:
|
||||
jsr verifyheader ; ver, ihl, len, frag, checksum
|
||||
bcc @ok
|
||||
@badpacket:
|
||||
|
||||
sec
|
||||
rts
|
||||
@ok:
|
||||
@ -194,6 +193,22 @@ verifyheader:
|
||||
: lda ip_inp + ip_frag + 1
|
||||
bne @badpacket
|
||||
|
||||
|
||||
;it is possible that the checksum has not been set in inbound packets
|
||||
;this is especially likely to happen if we are running in an emulator on a host machine that
|
||||
;does checksum offloading (i.e. where the NIC calculates the checksum) and then
|
||||
;try to send traffic from the host to the emulated computer (e.g. ip65 running on AppleWin or VICE)
|
||||
;in this case the traffic will be seen by the emulated computer BEFORE the host NIC
|
||||
;has calculated the checksum
|
||||
;so if the checksum field in the inbound packet is 0000, ignore it
|
||||
lda ip_inp+10
|
||||
bne @has_cksum
|
||||
lda ip_inp+11
|
||||
bne @has_cksum
|
||||
clc
|
||||
rts
|
||||
|
||||
@has_cksum:
|
||||
ldax #ip_inp ; verify checksum
|
||||
stax ip_cksum_ptr
|
||||
ldax #20
|
||||
@ -206,6 +221,7 @@ verifyheader:
|
||||
clc
|
||||
rts
|
||||
@badpacket:
|
||||
brk
|
||||
inc bad_header
|
||||
bne :+
|
||||
inc bad_header + 1
|
||||
|
@ -31,7 +31,6 @@ MAX_SNTP_MESSAGES_SENT=8
|
||||
.import check_for_abort_key
|
||||
.import timer_read
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
|
||||
.data
|
||||
|
@ -701,7 +701,7 @@ check_current_connection:
|
||||
; none but if connection was found, an outbound message may be created, overwriting eth_outp
|
||||
; also tcp_state and other tcp variables may be modified
|
||||
tcp_process:
|
||||
|
||||
|
||||
lda #tcp_flag_RST
|
||||
bit tcp_inp+tcp_flags_field
|
||||
beq @not_reset
|
||||
|
@ -45,10 +45,7 @@
|
||||
.import telnet_menu
|
||||
.import telnet_on_connection
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
; pointer for moving through buffers
|
||||
buffer_ptr: .res 2 ; source pointer
|
||||
.importzp buffer_ptr
|
||||
|
||||
.code
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
.include "../inc/kipper_constants.i"
|
||||
.endif
|
||||
|
||||
.exportzp tftp_filename
|
||||
.export tftp_load_address
|
||||
.export tftp_ip
|
||||
.export tftp_download
|
||||
@ -51,10 +50,7 @@
|
||||
|
||||
.import timer_read
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
tftp_filename: .res 2 ;name of file to d/l or filemask to get directory listing for
|
||||
|
||||
.importzp tftp_filename
|
||||
.bss
|
||||
|
||||
;packet offsets
|
||||
|
@ -1 +1 @@
|
||||
.byte "2013-04-10"
|
||||
.byte "2013-04-11"
|
||||
|
@ -2,7 +2,7 @@
|
||||
# default is for GAME=1, EXROM=0,
|
||||
|
||||
MEMORY {
|
||||
IP65ZP: start = $A3, size = $0E, type = rw, define = yes;
|
||||
IP65ZP: start = $A3, size = $11, type = rw, define = yes;
|
||||
HEADER: start = $8000, size = $18, file = %O;
|
||||
DEFAULTS: start = $8018, size = $1F, file = %O;
|
||||
ROM: start = $8037, size = $1FC9, define = yes, file = %O;
|
||||
|
Loading…
x
Reference in New Issue
Block a user