Simplified test program sources by using exe headers from cc65 libs.

This commit is contained in:
Oliver Schmidt 2013-12-19 22:04:19 +01:00
parent 7b5522ba27
commit adfd056abd
15 changed files with 294 additions and 714 deletions

View File

@ -1,25 +1,26 @@
SYMBOLS {
__EXEHDR__: type = import;
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
__LOADSIZE__: type = weak, value = __BSS_RUN__ - __STARTUP_RUN__;
}
MEMORY {
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 = $803, size = $8000, file = %O, define=yes;
PAGE3: start = $2C0, size = 272;
ZP: start = $00, size = $08;
IP65ZP: start = $E0, size = $00; #zero size as we hand allocate all ZP locations
HEADER: start = $0800, size = $04, file = %O;
RAM: start = $0803, size = $77FC, file = %O;
}
SEGMENTS {
EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM,run=RAM, type = ro, define = yes, optional=yes;
CODE: load = RAM, run=RAM, type = ro, define = yes;
RODATA: load = RAM, run=RAM, type = ro , define = yes;
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;
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;
BSS: load=RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp , optional=yes;
IP65ZP: load = IP65ZP, type = zp,optional=yes;
ZEROPAGE: load = ZP, type = zp;
IP65ZP: load = IP65ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
SELF_MODIFIED_CODE: load = RAM, type = rw, optional = yes;
IP65_DEFAULTS: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
APP_SCRATCH: load = RAM, type = bss, optional = yes;
TCP_VARS: load = RAM, type = bss, optional = yes;
HTTP_VARS: load = RAM, type = bss, optional = yes;
}

View File

@ -1,29 +1,27 @@
SYMBOLS {
__LOADADDR__: type = import;
__EXEHDR__: type = import;
}
MEMORY {
ZP: start = $02, size = $1A, type = rw ;
IP65ZP: start = $5f, size = $10, type = rw;
RAM: start = $07FF, size = $77ab, file = %O;
RAM3000: start = $3000, size = $4800, type=rw;
RAM4000: start = $4000, size = $3800, type=rw;
RAM6000: start = $6000, size = $1800, type=rw;
DISCARD: start = $77FF, size = $10;
ZP: start = $02, size = $1A;
IP65ZP: start = $5F, size = $10;
LOADADDR: start = $07FF, size = $02, file = %O;
HEADER: start = $0801, size = $0C, file = %O;
RAM: start = $080D, size = $77F3, file = %O;
}
SEGMENTS {
STARTUP: load = RAM, type = ro ,define = yes, optional=yes;
CODE: load = RAM, type = ro,define = yes;
DATA: load = RAM, type = rw,define = yes;
SELF_MODIFIED_CODE: load = RAM, type = rw,define = yes, optional=yes;
VIC_DATA: load = RAM, type = rw,align = $800, optional=yes;
RODATA: load = RAM, type = ro,define = yes, optional=yes;
IP65_DEFAULTS: load = RAM, type = rw,define = yes, optional=yes;
BSS: load = RAM, type = bss, optional=yes;
SAFE_BSS: load = RAM3000, type = bss, optional=yes;
BSS4K: load = RAM4000, type = bss, optional=yes;
DATA6K: load = RAM, run = RAM6000, type = rw, define = yes, optional=yes;
APP_SCRATCH: load = RAM, type = bss, optional=yes;
ZEROPAGE: load = ZP, type = zp, optional=yes;
IP65ZP: load = IP65ZP, type = zp, optional=yes;
EXEHDR: load = DISCARD, type = ro, optional=yes;
TCP_VARS: load = RAM, type = bss, optional=yes;
HTTP_VARS: load = RAM, type = bss, optional=yes;
ZEROPAGE: load = ZP, type = zp;
IP65ZP: load = IP65ZP, type = zp, optional = yes;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro, optional = yes;
DATA: load = RAM, type = rw;
SELF_MODIFIED_CODE: load = RAM, type = rw, optional = yes;
IP65_DEFAULTS: load = RAM, type = rw, optional = yes;
BSS: load = RAM, type = bss;
APP_SCRATCH: load = RAM, type = bss, optional = yes;
TCP_VARS: load = RAM, type = bss, optional = yes;
HTTP_VARS: load = RAM, type = bss, optional = yes;
}

View File

@ -26,26 +26,30 @@ prg: \
cifs_tcp.prg \
dns.prg \
dottedquad.prg \
getc.prg \
geturl_tcp.prg \
httpd.prg \
parsequerystring.prg \
parser_tcp.prg \
ping_tcp.prg \
sntp.prg \
tcp_tcp.prg \
tftp.prg \
vic20.prg \
# vic20.prg \
wiznet.prg
bin: \
ip65 \
drivers \
cifs_tcp.bin \
dns.bin \
dottedquad.bin \
lancegs.bin \
geturl_tcp.bin \
parsequerystring.bin \
parser_tcp.bin \
ping_tcp.bin \
sntp.bin \
tcp_tcp.bin \
tftp.bin
tftp.bin \
# lancegs.bin
ip65:
make -C ../ip65 all
@ -61,16 +65,16 @@ dsk: ip65.dsk
$(AS) $(AFLAGS) $<
%.prg: %.o $(IP65LIB) $(C64RRNETLIB) $(INCFILES) ../cfg/c64prg.cfg
$(LD) -o $*.prg -C ../cfg/c64prg.cfg -m $*.c64.map -vm $< $(IP65LIB) $(C64RRNETLIB)
$(LD) -o $*.prg -C ../cfg/c64prg.cfg -m $*.c64.map -vm $< $(IP65LIB) $(C64RRNETLIB) c64.lib
%_tcp.prg: %.o $(IP65TCPLIB) $(C64RRNETLIB) $(INCFILES) ../cfg/c64prg.cfg
$(LD) -o $(subst _tcp,,$*).prg -C ../cfg/c64prg.cfg -m $(subst _tcp,,$*).c64.map -vm $< $(IP65TCPLIB) $(C64RRNETLIB)
$(LD) -o $(subst _tcp,,$*).prg -C ../cfg/c64prg.cfg -m $(subst _tcp,,$*).c64.map -vm $< $(IP65TCPLIB) $(C64RRNETLIB) c64.lib
%.bin: %.o $(IP65LIB) $(A2UTHERLIB) $(INCFILES) ../cfg/a2bin.cfg
$(LD) -o $*.bin -C ../cfg/a2bin.cfg -m $*.a2.map -vm $< $(IP65LIB) $(A2UTHERLIB)
$(LD) -o $*.bin -C ../cfg/a2bin.cfg -m $*.a2.map -vm $< $(IP65LIB) $(A2UTHERLIB) apple2.lib
%_tcp.bin: %.o $(IP65TCPLIB) $(A2UTHERLIB) $(INCFILES) ../cfg/a2bin.cfg
$(LD) -o $(subst _tcp,,$*).bin -C ../cfg/a2bin.cfg -m $(subst _tcp,,$*).a2.map -vm $< $(IP65TCPLIB) $(A2UTHERLIB)
$(LD) -o $(subst _tcp,,$*).bin -C ../cfg/a2bin.cfg -m $(subst _tcp,,$*).a2.map -vm $< $(IP65TCPLIB) $(A2UTHERLIB) apple2.lib
wiznet.prg: wiznet.o $(IP65WIZNETLIB) $(C64WIZNETLIB) $(INCFILES) ../cfg/c64prg.cfg
$(LD) -o wiznet.prg -C ../cfg/c64prg.cfg -m wiznet.map -vm $< $(IP65WIZNETLIB) $(C64WIZNETLIB)
@ -96,6 +100,10 @@ ip65.dsk: bin
cp prodos.dsk $@
java -jar $(AC) -cc65 $@ dns bin 0 < dns.bin
java -jar $(AC) -cc65 $@ dottedquad bin 0 < dottedquad.bin
java -jar $(AC) -cc65 $@ geturl bin 0 < geturl.bin
java -jar $(AC) -cc65 $@ parser bin 0 < parser.bin
java -jar $(AC) -cc65 $@ ping bin 0 < ping.bin
java -jar $(AC) -cc65 $@ sntp bin 0 < sntp.bin
java -jar $(AC) -cc65 $@ tcp bin 0 < tcp.bin
java -jar $(AC) -cc65 $@ tftp bin 0 < tftp.bin

View File

@ -1,66 +1,39 @@
.include "../inc/common.i"
.include "../inc/commonprint.i"
.include "../inc/net.i"
.import exit_to_basic
.import cfg_get_configuration_ptr
.import cifs_l1_encode
.import cifs_l1_decode
.import cifs_start
.import __CODE_LOAD__
.import __CODE_SIZE__
.import __RODATA_SIZE__
.import __DATA_SIZE__
.import __IP65_DEFAULTS_SIZE__
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
.segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2
.addr __CODE_LOAD__-$11 ; Start address
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+__IP65_DEFAULTS_SIZE__+4 ; Size
jmp init
.code
init:
lda #$0E ;change to lower case
jsr print_a
jsr print_cr
init_ip_via_dhcp
; jsr ip65_init
ldx #3
:
lda static_ip,x
sta cfg_ip,x
dex
bpl :-
jsr print_ip_config
ldax #hostname_1
jsr do_encoding_test
jsr do_encoding_test
ldax #hostname_2
jsr do_encoding_test
jsr do_encoding_test
ldax #hostname_3
jsr do_encoding_test
@ -69,7 +42,6 @@ init:
jsr cifs_start
jmp exit_to_basic
do_encoding_test:
stax hostname_ptr
jsr print
@ -91,8 +63,7 @@ do_encoding_test:
rts
.rodata
.rodata
hostname_ptr: .res 2

View File

@ -9,38 +9,10 @@
.import dns_ip
.import dns_status
.import cfg_get_configuration_ptr
.import __CODE_LOAD__
.import __CODE_SIZE__
.import __RODATA_SIZE__
.import __DATA_SIZE__
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
.segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2
.addr __CODE_LOAD__-$11 ; Start address
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; Size
jmp init
.code
init:
;switch to lower case charset
lda #23
@ -51,7 +23,7 @@ init:
init_ip_via_dhcp
; jsr overwrite_with_hardcoded_dns_server
jsr print_ip_config
ldax #hostname_1
jsr do_dns_query
@ -72,7 +44,6 @@ init:
jmp exit_to_basic
do_dns_query:
pha
jsr print
@ -89,7 +60,7 @@ do_dns_query:
ldax #dns_lookup_failed_msg
jsr print
jmp @print_dns_status
:
:
ldax #dns_ip
jsr print_dotted_quad
@print_dns_status:
@ -111,8 +82,7 @@ overwrite_with_hardcoded_dns_server:
rts
.rodata
.rodata
hostname_1:

View File

@ -1,42 +1,15 @@
.include "../inc/common.i"
.include "../inc/commonprint.i"
.include "../inc/net.i"
.import exit_to_basic
.import exit_to_basic
.import parse_dotted_quad
.import dotted_quad_value
.import __CODE_LOAD__
.import __CODE_SIZE__
.import __RODATA_SIZE__
.import __DATA_SIZE__
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
.segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2
.addr __CODE_LOAD__-$11 ; Start address
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; Size
jmp init
.code
init:
;switch to lower case charset
lda #23
@ -45,25 +18,25 @@ init:
jsr print_cr
ldax #dotted_quad_1
jsr test_dotted_quad_string
jsr test_dotted_quad_string
ldax #dotted_quad_2
jsr test_dotted_quad_string
jsr test_dotted_quad_string
ldax #dotted_quad_3
jsr test_dotted_quad_string
jsr test_dotted_quad_string
ldax #dotted_quad_4
jsr test_dotted_quad_string
jsr test_dotted_quad_string
ldax #dotted_quad_5
jsr test_dotted_quad_string
jsr test_dotted_quad_string
ldax #dotted_quad_6
jsr test_dotted_quad_string
jsr test_dotted_quad_string
ldax #dotted_quad_7
jsr test_dotted_quad_string
jsr test_dotted_quad_string
jmp exit_to_basic
@ -87,11 +60,15 @@ test_dotted_quad_string:
jsr print
jsr print_cr
rts
.bss
temp_ax: .res 2
.rodata
.rodata
dotted_quad_1:
@ -117,7 +94,6 @@ dotted_quad_7:
;-- LICENSE FOR testdottedquad.s --
; 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

View File

@ -1,196 +0,0 @@
.ifndef KIPPER_API_VERSION_NUMBER
.define EQU =
.include "../inc/kipper_constants.i"
.endif
.include "../inc/common.i"
.include "../inc/commonprint.i"
.import print_a
.import cfg_get_configuration_ptr
.import io_device_no
.import io_sector_no
.import io_track_no
.import io_read_sector
.import io_write_sector
.import io_read_file_with_callback
.import io_read_file
.import io_filename
.import io_filesize
.import io_load_address
.import io_callback
.import get_key
.import ip65_error
.import ip65_process
.import io_read_catalogue_ex
.macro cout arg
lda arg
jsr print_a
.endmacro
.bss
sector_buffer: .res 256
output_buffer: .res 520
.export output_buffer
current_byte_in_row: .res 1
current_byte_in_sector: .res 1
start_of_current_row: .res 1
directory_buffer: .res 4096
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
init:
lda #14
jsr print_a ;switch to lower case
lda $dc08 ;read deci-seconds - start clock ticking
sta $dc08
jsr load_buffer
@loop:
lda #5 ;timeout period
jsr getc
bcs @done
jsr print_a
jmp @loop
@done:
rts
load_buffer:
ldax #buffer
stax next_char_ptr
ldax #buffer_length
stax buff_length
rts
getc:
sta getc_timeout_seconds
clc
lda $dc09 ;time of day clock: seconds (in BCD)
sed
adc getc_timeout_seconds
cmp #$60
bcc @timeout_set
sec
sbc #$60
@timeout_set:
cld
sta getc_timeout_end
@poll_loop:
jsr ip65_process
jsr next_char
bcs @no_char
rts ;done!
@no_char:
lda $dc09 ;time of day clock: seconds
cmp getc_timeout_end
bne @poll_loop
sec
rts
next_char:
lda buff_length
bne @not_eof
lda buff_length+1
bne @not_eof
sec
rts
@not_eof:
next_char_ptr=*+1
lda $ffff
pha
inc next_char_ptr
bne :+
inc next_char_ptr+1
:
sec
lda buff_length
sbc #1
sta buff_length
lda buff_length+1
sbc #0
sta buff_length+1
pla
clc
rts
.rodata
buffer:
.byte "this is a test1!",13
.byte "this is a test2!",13
.byte "this is a test3!",13
.byte "this is a test4!",13
.byte "this is a test5!",13
.byte "this is a test6!",13
.byte "this is a test7!",13
.byte "this is a test8!",13
.byte "this is a test9!",13
.byte "this is a test10!",13
.byte "this is a test1@",13
.byte "this is a test2@",13
.byte "this is a test3@",13
.byte "this is a test4@",13
.byte "this is a test5@",13
.byte "this is a test6@",13
.byte "this is a test7@",13
.byte "this is a test8@",13
.byte "this is a test9@",13
.byte "this is a test10@",13
.byte "this is a test1*",13
.byte "this is a test2*",13
.byte "this is a test3*",13
.byte "this is a test4*",13
.byte "this is a test5*",13
.byte "this is a test6*",13
.byte "this is a test7*",13
.byte "this is a test8*",13
.byte "this is a test9*",13
.byte "this is a test10*",13
buffer_length=*-buffer
.bss
getc_timeout_end: .res 1
getc_timeout_seconds: .res 1
buff_length: .res 2
;-- LICENSE FOR test_getc.s --
; 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) 2009
; Jonno Downes. All Rights Reserved.
; -- LICENSE END --

View File

@ -10,38 +10,20 @@
.import parser_skip_next
.importzp copy_src
.importzp copy_dest
.import url_ip
.import url_port
.import url_selector
.import url_ip
.import url_port
.import url_selector
.import url_resource_type
.import url_parse
.import url_download
.import url_download_buffer
.import url_download_buffer_length
temp_buff=copy_dest
.bss
string_offset: .res 1
selector_ptr: .res 2
temp_url_ptr: .res 2
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
init:
;switch to lower case charset
lda #23
@ -55,7 +37,7 @@ init:
ldax #url_2
; jsr test_url_download
rts
test_url_download:
@ -89,13 +71,12 @@ test_url_download:
@done:
rts
wait_key:
ldax #press_a_key
jsr print
jmp get_key
print_tag_contents:
stax temp_buff
lda #0
@ -114,7 +95,10 @@ print_tag_contents:
@done:
rts
.data
.data
title:
.byte "<title>",0
@ -126,7 +110,13 @@ url_2:
downloading: .asciiz "DOWNLOADING "
press_a_key: .byte "PRESS ANY KEY TO CONTINUE",13,0
.bss
.bss
string_offset: .res 1
selector_ptr: .res 2
temp_url_ptr: .res 2
dl_buffer_length=8092
dl_buffer: .res dl_buffer_length

View File

@ -21,25 +21,31 @@
.macro stax arg
sta arg
stx 1+(arg)
.endmacro
.endmacro
print_a = $ffd2
.macro cout arg
lda arg
jsr print_a
.endmacro
.endmacro
.zeropage
temp_ptr: .res 2
.bss
kipper_param_buffer: .res $20
kipper_param_buffer: .res $20
block_number: .res $0
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
.macro print arg
ldax arg
@ -57,37 +63,23 @@ print_a = $ffd2
jsr KPR_DISPATCH_VECTOR
.endmacro
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
;look for KIPPER signature at location pointed at by AX
look_for_signature:
look_for_signature:
stax temp_ptr
ldy #5
@check_one_byte:
lda (temp_ptr),y
cmp kipper_signature,y
bne @bad_match
dey
bpl@check_one_byte
bne @bad_match
dey
bpl@check_one_byte
clc
rts
@bad_match:
sec
rts
init:
ldax #KPR_CART_SIGNATURE ;where signature should be in cartridge
jsr look_for_signature
@ -105,19 +97,18 @@ init:
sta $4000
ldax #print_vars
stax $4001
ldy #KPR_INITIALIZE
jsr KPR_DISPATCH_VECTOR
bcc :+
jsr KPR_DISPATCH_VECTOR
bcc :+
print #failed
jsr print_errorcode
jmp bad_boot
:
jmp bad_boot
:
print #ok
print_cr
call #KPR_PRINT_IP_CONFIG
print #listening
ldax #httpd_callback
@ -125,10 +116,9 @@ init:
call #KPR_HTTPD_START
jsr print_errorcode
rts
print_vars:
lda #'h'
call #KPR_HTTPD_GET_VAR_VALUE
bcs :+
@ -139,7 +129,7 @@ print_vars:
bcs :+
call #KPR_PRINT_ASCIIZ
print_cr
:
:
rts
bad_boot:
print #press_a_key_to_continue
@ -147,7 +137,6 @@ restart:
jsr get_key
jmp $fce2 ;do a cold start
print_errorcode:
print #error_code
call #KPR_GET_LAST_ERROR
@ -163,7 +152,7 @@ get_key:
cmp #0
beq get_key
rts
kipper_signature_not_found:
ldy #0
@ -180,9 +169,10 @@ httpd_callback:
ldy #2 ;text/html
clc
rts
.rodata
.rodata
kipper_signature:
.byte "KIPPER" ; API signature
@ -207,6 +197,8 @@ said:
html:
.byte "<h1>hello world</h1>%?mMessage recorded as '%$h:%$m'%.<form>Your Handle:<input name=h type=text length=20 value='%$h'><br>Your Message: <input type=text lengh=60 name='m'><br><input type=submit></form><br>",0
;-- LICENSE FOR test_httpd.s --
; 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

View File

@ -11,25 +11,8 @@
.import http_get_value
.bss
temp_ax: .res 2
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
init:
;switch to lower case charset
lda #23
@ -39,16 +22,16 @@ init:
ldax #query_1
jsr test_querystring
ldax #query_2
jsr test_querystring
jsr test_querystring
ldax #query_3
jsr test_querystring
jsr get_key
ldax #query_4
jsr test_querystring
ldax #query_5
jsr test_querystring
jsr test_querystring
ldax #query_6
jsr test_querystring
jsr test_querystring
rts
@ -58,7 +41,7 @@ test_querystring:
jsr print_cr
ldax temp_ax
jsr http_parse_request
lda #1
jsr print_var
lda #2
@ -92,7 +75,7 @@ print_var:
@found_var_value:
jsr print_ascii_as_native
jmp print_cr
@print_path:
ldax #path
jmp @print_caption
@ -102,7 +85,16 @@ print_var:
jsr print_ascii_as_native
jmp @print_equals
.rodata
.bss
temp_ax: .res 2
.rodata
path: .byte "path",0
method: .byte "method",0
@ -121,7 +113,6 @@ query_6:
;-- LICENSE FOR test_parse_querystring.s --
; 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

View File

@ -10,35 +10,17 @@
.import parser_skip_next
.importzp copy_src
.importzp copy_dest
.import url_ip
.import url_port
.import url_selector
.import url_ip
.import url_port
.import url_selector
.import url_resource_type
.import url_parse
temp_buff=copy_dest
.bss
string_offset: .res 1
selector_ptr: .res 2
temp_url_ptr: .res 2
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
init:
;switch to lower case charset
lda #23
@ -50,7 +32,6 @@ init:
ldax #url_1
jsr test_url_parse
jsr wait_key
ldax #url_2
jsr test_url_parse
@ -59,7 +40,7 @@ init:
ldax #url_4
jsr test_url_parse
jsr wait_key
ldax #url_5
jsr test_url_parse
ldax #url_6
@ -69,7 +50,7 @@ init:
ldax #url_8
jsr test_url_parse
jsr wait_key
ldax #url_9
jsr test_url_parse
ldax #url_a
@ -78,9 +59,8 @@ init:
jsr test_url_parse
ldax #url_c
jsr test_url_parse
jsr wait_key
ldax #atom_file
jsr parser_init
@ -89,14 +69,14 @@ init:
; jsr parser_skip_next
; bcs @done
@next_title:
@next_title:
ldax #title
jsr parser_skip_next
bcs @done
jsr print_tag_contents
jsr print_cr
jmp @next_title
@done:
rts
@ -157,9 +137,19 @@ wait_key:
ldax #press_a_key
jsr print
jmp get_key
.bss
string_offset: .res 1
selector_ptr: .res 2
temp_url_ptr: .res 2
.data
entry:
.byte "<entry>",0
title:
@ -212,10 +202,10 @@ press_a_key: .byte "PRESS ANY KEY TO CONTINUE",13,0
atom_file:
;.incbin "atom_test.xml"
.byte 0
;-- LICENSE FOR test_parser.s --
; 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

View File

@ -1,42 +1,20 @@
.include "../inc/common.i"
.include "../inc/commonprint.i"
.include "../inc/net.i"
.import exit_to_basic
.import cfg_get_configuration_ptr
.import copymem
.importzp copy_src
.importzp copy_dest
.import copymem
.importzp copy_src
.importzp copy_dest
.import icmp_echo_ip
.import icmp_ping
.import __CODE_LOAD__
.import __CODE_SIZE__
.import __RODATA_SIZE__
.import __DATA_SIZE__
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.code
init:
;switch to lower case charset
lda #23
@ -46,17 +24,17 @@ init:
init_ip_via_dhcp
jsr print_ip_config
jsr print_cr
;our default gateway is probably a safe thing to ping
ldx #$3
:
lda cfg_gateway,x
sta icmp_echo_ip,x
dex
bpl :-
bpl :-
ldax #pinging
jsr print
ldax #icmp_echo_ip
jsr print_dotted_quad
jsr print_cr
@ -68,17 +46,25 @@ init:
rts
@error:
jmp print_errorcode
.rodata
.rodata
ms: .byte " MS",13,0
pinging: .byte "PINGING ",0
.bss
.bss
block_number: .res 1
block_length: .res 2
buffer1: .res 256
buffer2: .res 256
;-- LICENSE FOR test_ping.s --
; 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

View File

@ -1,7 +1,7 @@
.include "../inc/common.i"
.include "../inc/commonprint.i"
.include "../inc/net.i"
.import exit_to_basic
.import cfg_get_configuration_ptr
.import dns_set_hostname
@ -11,36 +11,17 @@
.import sntp_ip
.import sntp_utc_timestamp
.import sntp_get_time
.import __CODE_LOAD__
.import __CODE_SIZE__
.import __RODATA_SIZE__
.import __DATA_SIZE__
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
init:
lda #14
jsr print_a ;switch to lower case
jsr print_cr
init_ip_via_dhcp
jsr print_ip_config
ldax #time_server_msg
jsr print
ldax #time_server_host
@ -53,11 +34,10 @@ init:
bcs @dns_error
ldx #3 ; set destination address
: lda dns_ip,x
sta sntp_ip,x
dex
bpl :-
sta sntp_ip,x
dex
bpl :-
ldax #sending_query
jsr print
ldax #sntp_ip
@ -69,23 +49,22 @@ init:
jmp @print_error
@ok:
ldy #3
:
:
lda sntp_utc_timestamp,y
jsr print_hex
dey
bpl :-
jmp exit_to_basic
@dns_error:
@dns_error:
ldax #dns_error
@print_error:
@print_error:
jsr print
jsr print_errorcode
jmp exit_to_basic
.data
.data
time_server_msg:
@ -95,20 +74,18 @@ time_server_host:
.byte "jamtronix.com",0
; .byte "150.101.112.134",0
.byte "0.POOL.SNTP.ORG",0
sending_query:
.byte "SENDING SNTP QUERY TO ",0
sntp_error:
.byte "ERROR DURING SNTP QUERY",13,0
dns_error:
.byte "ERROR RESOLVING HOSTNAME",13,0
divs:
.byte $02,$30,$00,$00
.byte $05,$00,$00,$00
;-- LICENSE FOR test_sntp.s --

View File

@ -1,12 +1,12 @@
.include "../inc/common.i"
.include "../inc/commonprint.i"
.include "../inc/net.i"
.import exit_to_basic
.import ascii_to_native
.import parse_dotted_quad
.import dotted_quad_value
.import tcp_listen
.import tcp_callback
.import ip65_random_word
@ -20,12 +20,6 @@
.import tcp_send
.import tcp_send_data_len
.import __CODE_LOAD__
.import __CODE_SIZE__
.import __RODATA_SIZE__
.import __DATA_SIZE__
.importzp acc32
.importzp op32
@ -39,39 +33,9 @@
.import sub_16_16
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
.segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2
.addr __CODE_LOAD__-$11 ; Start address
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; Size
jmp init
.bss
cxn_closed: .res 1
byte_counter: .res 1
.data
get_next_byte:
lda $ffff
rts
.code
init:
;switch to lower case charset
lda #23
@ -101,8 +65,7 @@ init:
stax acc16
ldax #$100
jsr test_sub_16_16
ldax #number1
stax acc32
stax op32
@ -133,12 +96,10 @@ init:
ldax #$1235
jsr test_cmp_16_16
ldax #$1234
stax acc16
ldax #$2234
jsr test_cmp_16_16
ldax #$0000
stax acc16
@ -148,16 +109,12 @@ init:
stax acc16
jsr test_cmp_16_16
ldax #number1
stax acc32
ldax #number2
stax op32
jsr test_add_32_32
ldax #number3
stax acc32
ldax #number4
@ -188,7 +145,6 @@ init:
stax op32
jsr test_add_32_32
ldax #number13
stax acc32
ldax #$1234
@ -214,16 +170,14 @@ init:
ldax #$158
jsr test_add_16_32
jsr print_cr
init_ip_via_dhcp
init_ip_via_dhcp
jsr print_ip_config
jsr print_cr
jsr print_random_number
jsr print_random_number
;connect to port 81 - should be rejected
ldax #tcp_callback_routine
@ -232,7 +186,7 @@ init:
stax tcp_connect_ip
ldax tcp_dest_ip+2
stax tcp_connect_ip+2
ldax #81
jsr tcp_connect
jsr check_for_error
@ -242,7 +196,7 @@ init:
ldax #http_get_msg
jsr tcp_send
jsr check_for_error
;now try to connect to port 80 - should be accepted
ldax #tcp_callback_routine
@ -251,8 +205,7 @@ init:
stax tcp_connect_ip
ldax tcp_dest_ip+2
stax tcp_connect_ip+2
ldax #80
jsr tcp_connect
jsr check_for_error
@ -272,9 +225,8 @@ init:
cmp cxn_closed
beq @loop_till_end
rts
rts
ldax #tcp_callback_routine
stax tcp_callback
@ -282,13 +234,11 @@ init:
stax tcp_connect_ip
ldax tcp_dest_ip+2
stax tcp_connect_ip+2
ldax #80
jsr tcp_connect
jsr check_for_error
ldax #4
stax tcp_send_data_len
ldax #http_get_msg
@ -300,41 +250,36 @@ init:
jsr tcp_send
jsr check_for_error
ldax #looping
jsr print
@loop_forever:
jsr ip65_process
jmp @loop_forever
jmp @loop_forever
rts
tcp_callback_routine:
lda tcp_inbound_data_length
cmp #$ff
bne @not_end_of_file
lda #1
sta cxn_closed
rts
@not_end_of_file:
lda #14
jsr print_a ;switch to lower case
ldax tcp_inbound_data_ptr
stax get_next_byte+1
lda #0
sta byte_counter
sta byte_counter+1
@print_one_byte:
jsr get_next_byte
jsr ascii_to_native
jsr print_a
inc get_next_byte+1
bne :+
@ -350,10 +295,8 @@ tcp_callback_routine:
ldax tcp_inbound_data_length
jsr cmp_16_16
bne @print_one_byte
rts
rts
check_for_error:
lda ip65_error
@ -365,7 +308,7 @@ check_for_error:
jsr print_cr
lda #0
sta ip65_error
@exit:
@exit:
rts
print_random_number:
@ -385,7 +328,7 @@ test_add_32_32:
jsr print_hex
dey
bpl :-
lda #'+'
jsr print_a
ldy #3
@ -394,12 +337,12 @@ test_add_32_32:
jsr print_hex
dey
bpl :-
lda #'='
jsr print_a
jsr add_32_32
ldy #3
ldy #3
:
lda (acc32),y
jsr print_hex
@ -408,8 +351,6 @@ test_add_32_32:
jsr print_cr
rts
;assumes acc32 & op32 already set
test_cmp_32_32:
ldy #3
@ -448,14 +389,14 @@ test_cmp_16_16:
jsr print_hex
lda acc16
jsr print_hex
lda #'='
jsr print_a
lda temp_ax+1
jsr print_hex
lda temp_ax
jsr print_hex
lda #':'
jsr print_a
ldax temp_ax
@ -470,17 +411,16 @@ test_cmp_16_16:
jsr print_cr
rts
;assumes acc32 & AX already set
test_add_16_32:
stax temp_ax
ldy #3
ldy #3
:
lda (acc32),y
jsr print_hex
dey
bpl :-
lda #'+'
jsr print_a
@ -494,7 +434,7 @@ test_add_16_32:
ldax temp_ax
jsr add_16_32
ldy #3
ldy #3
:
lda (acc32),y
jsr print_hex
@ -510,12 +450,12 @@ test_mul_8_16:
jsr print_hex
lda acc16
jsr print_hex
lda #'*'
jsr print_a
lda temp_ax
jsr print_hex
lda #'='
jsr print_a
lda temp_ax
@ -527,7 +467,6 @@ test_mul_8_16:
jsr print_cr
rts
;assumes acc16 & AX already set
test_sub_16_16:
stax temp_ax
@ -544,12 +483,12 @@ test_sub_16_16:
jsr print_hex
lda temp_ax
jsr print_hex
lda #'='
jsr print_a
ldax temp_ax
jsr sub_16_16
lda acc16+1
jsr print_hex
lda acc16
@ -558,58 +497,56 @@ test_sub_16_16:
jsr print_cr
rts
@error:
ldax #failed_msg
jsr print
jsr print_cr
rts
.bss
temp_ax: .res 2
.rodata
.data
temp_ax: .res 2
cxn_closed: .res 1
byte_counter: .res 1
.data
number1:
.byte $1,$2,$3,$f
number2:
.byte $10,$20,$30,$f0
number3:
.byte $ff,$ff,$ff,$ff
.byte $ff,$ff,$ff,$ff
number4:
.byte $1,$0,$0,$0
number5:
.byte $ff,$ff,$ff,$ff
.byte $ff,$ff,$ff,$ff
number6:
.byte $0,$0,$0,$0
number7:
.byte $ff,$ff,$ff,$fe
.byte $ff,$ff,$ff,$fe
number8:
.byte $1,$0,$0,$0
number9:
.byte $ff,$ff,$ff,$fe
.byte $ff,$ff,$ff,$fe
number10:
.byte $5,$0,$0,$0
number11:
.byte $ff,$0,$0,$e
number12:
.byte $5,$0,$0,$0
number13:
.byte $1,$2,$3,$4
number14:
.byte $ff,$ff,$ff,$ff
number15:
.byte $ff,$ff,$00,$00
number16:
.byte $00,$00,$00,$00
number17:
.byte $5b,$bc,$08,$a9
@ -618,13 +555,16 @@ tcp_dest_ip:
.byte 74,207,242,229
looping:
.asciiz "LOOPING..."
http_get_msg:
.byte "GET /blogx/ HTTP/1.0",13,10,13,10
http_get_msg_end:
http_get_length=http_get_msg_end-http_get_msg
get_next_byte:
lda $ffff
rts
;-- LICENSE FOR test_tcp.s --

View File

@ -1,15 +1,14 @@
.include "../inc/common.i"
.include "../inc/commonprint.i"
.include "../inc/net.i"
.import exit_to_basic
.import exit_to_basic
.import cfg_get_configuration_ptr
.import copymem
.importzp copy_src
.importzp copy_dest
.import copymem
.importzp copy_src
.importzp copy_dest
.import __CODE_LOAD__
.import __CODE_SIZE__
.import __RODATA_SIZE__
@ -20,31 +19,10 @@
.import tftp_ip
.import tftp_filesize
.importzp tftp_filename
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.word basicstub ; load address
basicstub:
.word @nextline
.word 2003
.byte $9e
.byte <(((init / 1000) .mod 10) + $30)
.byte <(((init / 100 ) .mod 10) + $30)
.byte <(((init / 10 ) .mod 10) + $30)
.byte <(((init ) .mod 10) + $30)
.byte 0
@nextline:
.word 0
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
.segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2
.addr __CODE_LOAD__-$11 ; Start address
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; Size
jmp init
.code
init:
;switch to lower case charset
lda #23
@ -65,17 +43,17 @@ init:
:
sta tftp_ip,x
dex
bpl :-
bpl :-
ldax #sending_via_callback
jsr print
jsr tftp_upload
bcs @error
print_ok
ldax #basic_file
stax tftp_filename
ldax #$2000
stax tftp_filesize
ldax #sending_ram
@ -85,7 +63,7 @@ init:
print_ok
rts
@error:
print_failed
rts
@ -103,28 +81,36 @@ upload_callback:
bne @next_byte
cmp #7
beq @last_block
ldax #512
ldax #512
jmp :+
@last_block:
ldax #129
:
:
stax block_length
jsr copymem
ldax block_length
rts
.rodata
.rodata
test_file: .byte "TESTFILE.BIN",0
basic_file: .byte "CBMBASIC.BIN",0
sending_via_callback: .byte "SENDING VIA CALLBACK...",0
sending_ram: .byte "SENDING RAM...",0
.bss
.bss
block_number: .res 1
block_length: .res 2
buffer1: .res 256
buffer2: .res 256
;-- LICENSE FOR testtftp.s --
; 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