mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-07-09 23:28:56 +00:00
git-svn-id: http://svn.code.sf.net/p/netboot65/code@183 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
f2266d9290
commit
f04be850f9
@ -1,10 +1,10 @@
|
||||
TARGET=c64
|
||||
|
||||
|
||||
.PHONY: ip65 drivers test clean distclean nb65 kipper
|
||||
.PHONY: ip65 drivers test clean distclean nb65 kipper examples
|
||||
|
||||
|
||||
all: ip65 drivers test nb65 kipper
|
||||
all: ip65 drivers test nb65 kipper examples
|
||||
|
||||
ip65:
|
||||
make -C ip65 all
|
||||
@ -15,6 +15,9 @@ drivers:
|
||||
kipper:
|
||||
make -C kipper all
|
||||
|
||||
examples:
|
||||
make -C examples all
|
||||
|
||||
test:
|
||||
make -C test TARGET=$(TARGET) all
|
||||
|
||||
|
@ -15,7 +15,8 @@ SEGMENTS {
|
||||
IP65_DEFAULTS: load = DEFAULTS, type = ro;
|
||||
CODE: load = ROM, type = ro;
|
||||
RODATA: load = ROM, run=ROM, type = ro;
|
||||
DATA: load = ROM, run = RAM, type = rw, define = yes;
|
||||
DATA: load = ROM, run = RAM, type = rw, define = yes;
|
||||
SELF_MODIFIED_CODE: load = ROM, run = RAM2, type = rw, define = yes;
|
||||
BSS: load = RAM, type = bss;
|
||||
APP_SCRATCH: load = RAM3, type = bss;
|
||||
TCP_VARS: load = RAM2, type = bss;
|
||||
|
@ -1,17 +1,20 @@
|
||||
MEMORY {
|
||||
ZP: start = $02, size = $1A, type = rw, define = yes;
|
||||
IP65ZP: start = $5f, size = $10, type = rw, define = yes;
|
||||
RAM: start = $07FF, size = $77ab, define = yes, file = %O;
|
||||
DISCARD: start = $77FF, size = $10, define = yes;
|
||||
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;
|
||||
DISCARD: start = $77FF, size = $10;
|
||||
}
|
||||
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;
|
||||
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;
|
||||
APP_SCRATCH: load = RAM, type = bss, optional=yes;
|
||||
ZEROPAGE: load = ZP, type = zp, optional=yes;
|
||||
IP65ZP: load = IP65ZP, type = zp, optional=yes;
|
||||
|
@ -5,7 +5,7 @@ MEMORY {
|
||||
IP65ZP: start = $A3, size = $0E, type = rw, define = yes;
|
||||
HEADER: start = $8000, size = $18, file = %O;
|
||||
DEFAULTS: start = $8018, size = $1E, file = %O;
|
||||
ROM: start = $8036, size = $1FC8, define = yes, file = %O;
|
||||
ROM: start = $8036, size = $1FCA, define = yes, file = %O;
|
||||
RAM: start = $C010, size = $0fE0, define = yes;
|
||||
|
||||
|
||||
|
@ -6,9 +6,8 @@ AFLAGS=
|
||||
|
||||
|
||||
IP65TCPLIB=../ip65/ip65_tcp.lib
|
||||
|
||||
C64PROGLIB=../drivers/c64prog.lib
|
||||
|
||||
#C64PROGLIB=../drivers/c64prog.lib
|
||||
#NT2PLAY=nt2play.o
|
||||
INCFILES=\
|
||||
../inc/common.i\
|
||||
../inc/commonprint.i\
|
||||
@ -16,19 +15,21 @@ INCFILES=\
|
||||
|
||||
all: \
|
||||
comatomx.prg \
|
||||
|
||||
%.o: %.s
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
%.o: %.s sine_data.i
|
||||
comatomx.o: comatomx.s sine_data.i
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
sine_data.i: make_sine_data.rb
|
||||
ruby make_sine_data.rb
|
||||
|
||||
%.prg: %.o $(IP65LIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64prg.cfg
|
||||
$(LD) -m $*.map -vm -C ../cfg/c64prg.cfg -o $*.prg $(AFLAGS) $< $(IP65TCPLIB) $(C64PROGLIB)
|
||||
|
||||
comatomx.prg: comatomx.o nt2play.o $(IP65TCPLIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64prg.cfg
|
||||
$(LD) -m comatomx.map -vm -C ../cfg/c64prg.cfg -o comatomx.prg $(AFLAGS) $< $(IP65TCPLIB) $(C64PROGLIB) $(NT2PLAY)
|
||||
cp comatomx.prg ../../server/boot/
|
||||
clean:
|
||||
rm -f *.o *.pg2 *.prg
|
||||
rm -f ip65test.dsk
|
||||
rm -f *.o *.pg2 *.prg *.map
|
||||
|
||||
distclean: clean
|
||||
rm -f *~
|
||||
|
@ -1,27 +1,16 @@
|
||||
|
||||
.include "../inc/common.i"
|
||||
.include "../inc/commonprint.i"
|
||||
.include "../inc/net.i"
|
||||
|
||||
.ifndef NB65_API_VERSION_NUMBER
|
||||
.define EQU =
|
||||
.include "../inc/nb65_constants.i"
|
||||
.endif
|
||||
|
||||
print_a = $ffd2
|
||||
|
||||
.import get_key
|
||||
.import copymem
|
||||
.importzp copy_src
|
||||
.importzp copy_dest
|
||||
|
||||
temp_buff=copy_dest
|
||||
|
||||
.import url_download
|
||||
.import url_download_buffer
|
||||
.import url_download_buffer_length
|
||||
.import parser_init
|
||||
.import parser_skip_next
|
||||
|
||||
|
||||
SCREEN_RAM = $0400
|
||||
COLOUR_RAM = $d800
|
||||
VIC_CTRL_A = $d011
|
||||
@ -33,6 +22,9 @@ VIC_IRQ_FLAG = $d019
|
||||
|
||||
IRQ_VECTOR=$fffe
|
||||
|
||||
MUSIC_BASE=$1000 ;where we relocate our music routine to
|
||||
PLAYER_INIT=0
|
||||
PLAYER_PLAY=3
|
||||
|
||||
BORDER_COLOR = $d020
|
||||
BACKGROUND_COLOR_0 = $d021
|
||||
@ -86,23 +78,14 @@ LIGHT_GRAY = 15
|
||||
beq @loop
|
||||
.endmacro
|
||||
|
||||
.bss
|
||||
current_input_ptr_ptr: .res 2
|
||||
param_offset: .res 1
|
||||
.macro nb65call function_number
|
||||
ldy function_number
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
.endmacro
|
||||
|
||||
scroll_state: .res 1
|
||||
|
||||
download_buffer:
|
||||
download_buffer_length=7600
|
||||
.res download_buffer_length
|
||||
|
||||
scroll_buffer_0:
|
||||
.res 2000
|
||||
|
||||
scroll_buffer_1:
|
||||
.res 2000
|
||||
|
||||
string_offset: .res 1
|
||||
.zeropage
|
||||
temp_buff: .res 2
|
||||
pptr: .res 2
|
||||
|
||||
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
|
||||
|
||||
@ -122,8 +105,42 @@ basicstub:
|
||||
|
||||
init:
|
||||
|
||||
jsr ip65_init
|
||||
jsr dhcp_init
|
||||
ldax #NB65_CART_SIGNATURE ;where signature should be in cartridge (if cart is banked in)
|
||||
jsr look_for_signature
|
||||
bcc @found_nb65_signature
|
||||
|
||||
ldax #NB65_RAM_STUB_SIGNATURE ;where signature should be in a RAM stub
|
||||
jsr look_for_signature
|
||||
bcs @nb65_signature_not_found
|
||||
jsr NB65_RAM_STUB_ACTIVATE ;we need to turn on NB65 cartridge
|
||||
jmp @found_nb65_signature
|
||||
|
||||
@nb65_signature_not_found:
|
||||
ldax #nb65_api_not_found_message
|
||||
jsr print
|
||||
rts
|
||||
@found_nb65_signature:
|
||||
|
||||
lda NB65_API_VERSION
|
||||
cmp #02
|
||||
bpl @version_ok
|
||||
ldax #incorrect_version
|
||||
jsr print
|
||||
jmp reset_after_keypress
|
||||
@version_ok:
|
||||
ldax #init_msg
|
||||
jsr print
|
||||
nb65call #NB65_INITIALIZE
|
||||
bcc @init_ok
|
||||
jsr print_cr
|
||||
ldax #failed_msg
|
||||
jsr print
|
||||
jsr print_cr
|
||||
jsr print_errorcode
|
||||
jmp reset_after_keypress
|
||||
@init_ok:
|
||||
|
||||
;if we got here, we have found the NB65 API and initialised the IP stack
|
||||
|
||||
jsr setup_static_scroll_text
|
||||
|
||||
@ -134,8 +151,41 @@ init:
|
||||
lda #YELLOW
|
||||
sta BACKGROUND_COLOR_0
|
||||
|
||||
|
||||
|
||||
;copy our music data up to a temp buffer (in case it gets overwritten by
|
||||
;one of the other unpacking moves)
|
||||
ldax #musicdata+2 ;skip over the 2 byte address
|
||||
stax nb65_param_buffer+NB65_BLOCK_SRC
|
||||
ldax #download_buffer
|
||||
stax nb65_param_buffer+NB65_BLOCK_DEST
|
||||
ldax #musicdata_size-2 ;don't copy the 2 byte address
|
||||
stax nb65_param_buffer+NB65_BLOCK_SIZE
|
||||
ldax #nb65_param_buffer
|
||||
nb65call #NB65_BLOCK_COPY
|
||||
|
||||
;copy our font data and the sprite data to $2000..$2fff
|
||||
ldax #charset_font
|
||||
stax nb65_param_buffer+NB65_BLOCK_SRC
|
||||
ldax #$2000
|
||||
stax nb65_param_buffer+NB65_BLOCK_DEST
|
||||
ldax #MUSIC_BASE
|
||||
stax nb65_param_buffer+NB65_BLOCK_SIZE
|
||||
ldax #nb65_param_buffer
|
||||
nb65call #NB65_BLOCK_COPY
|
||||
|
||||
lda #<(charset_font >>10)+$10
|
||||
;should now be now safe to copy the music data back down
|
||||
;copy our music data to $1000..$1fff
|
||||
ldax #download_buffer
|
||||
stax nb65_param_buffer+NB65_BLOCK_SRC
|
||||
ldax #MUSIC_BASE
|
||||
stax nb65_param_buffer+NB65_BLOCK_DEST
|
||||
ldax #musicdata_size-2 ;don't copy the 2 byte address
|
||||
stax nb65_param_buffer+NB65_BLOCK_SIZE
|
||||
ldax #nb65_param_buffer
|
||||
nb65call #NB65_BLOCK_COPY
|
||||
|
||||
lda #$18 ; use charset at $2000
|
||||
sta VIC_MEMORY_CTRL
|
||||
|
||||
|
||||
@ -158,14 +208,22 @@ init:
|
||||
|
||||
|
||||
;copy KERNAL to the RAM underneath, in case any ip65 routines need it
|
||||
|
||||
ldax #$e000
|
||||
stax copy_src
|
||||
stax copy_dest
|
||||
stax nb65_param_buffer+NB65_BLOCK_SRC
|
||||
stax nb65_param_buffer+NB65_BLOCK_DEST
|
||||
ldax #$1FFF
|
||||
|
||||
jsr copymem
|
||||
stax nb65_param_buffer+NB65_BLOCK_SIZE
|
||||
ldax #nb65_param_buffer
|
||||
nb65call #NB65_BLOCK_COPY
|
||||
|
||||
;copy NB65 cart to the RAM underneath, so we can swap it out and modify the IRQ vector
|
||||
ldax #$8000
|
||||
stax nb65_param_buffer+NB65_BLOCK_SRC
|
||||
stax nb65_param_buffer+NB65_BLOCK_DEST
|
||||
ldax #$4000
|
||||
stax nb65_param_buffer+NB65_BLOCK_SIZE
|
||||
ldax #nb65_param_buffer
|
||||
nb65call #NB65_BLOCK_COPY
|
||||
|
||||
|
||||
lda #$35 ;we turn off the BASIC and KERNAL rom here, so we can overwrite the IRQ vector at $fffe
|
||||
@ -174,6 +232,9 @@ init:
|
||||
|
||||
jsr setup_sprites
|
||||
|
||||
jsr setup_music
|
||||
|
||||
|
||||
jsr set_next_irq_jump
|
||||
cli ;enable maskable interrupts again
|
||||
|
||||
@ -189,26 +250,28 @@ init:
|
||||
;now download the feed
|
||||
@download_feed:
|
||||
|
||||
ldax #download_buffer
|
||||
stax url_download_buffer
|
||||
ldax #download_buffer_length
|
||||
stax url_download_buffer_length
|
||||
ldax #feed_url
|
||||
jsr url_download
|
||||
stax nb65_param_buffer+NB65_URL
|
||||
ldax #download_buffer
|
||||
stax nb65_param_buffer+NB65_URL_DOWNLOAD_BUFFER
|
||||
ldax #download_buffer_length
|
||||
stax nb65_param_buffer+NB65_URL_DOWNLOAD_BUFFER_LENGTH
|
||||
ldax #nb65_param_buffer
|
||||
nb65call #NB65_DOWNLOAD_RESOURCE
|
||||
|
||||
bcs @download_feed ;if at first we don't succeed, try try again
|
||||
|
||||
lda #1
|
||||
sta scroll_state
|
||||
|
||||
ldax #scroll_buffer_1
|
||||
stax current_output_ptr
|
||||
jsr emit_titles
|
||||
|
||||
; jsr emit_titles
|
||||
ldax #scroll_buffer_1
|
||||
stax current_input_ptr_ptr ;will get picked up once we have finished going through the message once
|
||||
|
||||
|
||||
@endless_loop:
|
||||
jsr ip65_process
|
||||
jsr NB65_PERIODIC_PROCESSING_VECTOR
|
||||
jmp @endless_loop
|
||||
|
||||
reset_input_buffer:
|
||||
@ -216,8 +279,31 @@ reset_input_buffer:
|
||||
stax current_input_ptr
|
||||
rts
|
||||
|
||||
;look for NB65 signature at location pointed at by AX
|
||||
look_for_signature:
|
||||
stax temp_buff
|
||||
ldy #3
|
||||
@check_one_byte:
|
||||
lda (temp_buff),y
|
||||
cmp nb65_signature,y
|
||||
bne @bad_match
|
||||
dey
|
||||
bpl @check_one_byte
|
||||
clc
|
||||
rts
|
||||
@bad_match:
|
||||
sec
|
||||
rts
|
||||
|
||||
|
||||
;set up the tune
|
||||
setup_music:
|
||||
lda #$00 ;init subtune 0
|
||||
jsr MUSIC_BASE+PLAYER_INIT
|
||||
rts
|
||||
|
||||
setup_sprites:
|
||||
|
||||
;turn on all 8 sprites
|
||||
lda #$FF
|
||||
sta $d015
|
||||
@ -242,7 +328,7 @@ setup_sprites:
|
||||
lda sprite_text,x
|
||||
sbc #'A'
|
||||
clc
|
||||
adc #<(sprite_font/64)
|
||||
adc #<($2800/64) ;sprite font should be relocated to $2000
|
||||
sta SCREEN_RAM+$03f8,x
|
||||
dex
|
||||
bpl @setup_sprite
|
||||
@ -467,7 +553,7 @@ setup_static_scroll_text:
|
||||
|
||||
@loaded_offset:
|
||||
sta param_offset
|
||||
jsr cfg_get_configuration_ptr ;ax=base config, carry flag clear
|
||||
nb65call #NB65_GET_IP_CONFIG
|
||||
adc param_offset
|
||||
bcc :+
|
||||
inx
|
||||
@ -557,6 +643,24 @@ emit_decimal: ;emit byte in A as a decimal number
|
||||
|
||||
rts
|
||||
|
||||
reset_after_keypress:
|
||||
ldax #press_a_key_to_continue
|
||||
jsr print
|
||||
@wait_key:
|
||||
jsr $f142 ;not officially documented - where F13E (GETIN) falls through to if device # is 0 (KEYBD)
|
||||
beq @wait_key
|
||||
jmp $fce2 ;do a cold start
|
||||
|
||||
print_errorcode:
|
||||
ldax #error_code
|
||||
jsr print
|
||||
nb65call #NB65_GET_LAST_ERROR
|
||||
nb65call #NB65_PRINT_HEX
|
||||
jmp print_cr
|
||||
|
||||
|
||||
|
||||
|
||||
top_sprite_color_irq:
|
||||
start_irq
|
||||
wait_next_raster
|
||||
@ -572,12 +676,26 @@ bottom_sprite_color_irq:
|
||||
inc $d026 ;sprite multicolor register 1
|
||||
jmp exit_from_irq
|
||||
|
||||
|
||||
update_nb65_counters_irq:
|
||||
start_irq
|
||||
jsr NB65_VBL_VECTOR
|
||||
jmp exit_from_irq
|
||||
|
||||
|
||||
play_music_irq:
|
||||
inc BORDER_COLOR
|
||||
start_irq
|
||||
jsr MUSIC_BASE+PLAYER_PLAY
|
||||
dec BORDER_COLOR
|
||||
jmp exit_from_irq
|
||||
|
||||
emit_titles:
|
||||
ldax #download_buffer
|
||||
jsr parser_init
|
||||
@next_title:
|
||||
ldax #title
|
||||
jsr parser_skip_next
|
||||
jsr parser_skip_next
|
||||
bcs @done
|
||||
|
||||
jsr emit_tag_contents
|
||||
@ -589,6 +707,8 @@ emit_titles:
|
||||
jsr emit_a
|
||||
jmp @next_title
|
||||
@done:
|
||||
lda #0
|
||||
jsr emit_a
|
||||
rts
|
||||
|
||||
emit_tag_contents:
|
||||
@ -638,7 +758,25 @@ emit_tag_contents:
|
||||
@done:
|
||||
rts
|
||||
|
||||
print:
|
||||
sta pptr
|
||||
stx pptr + 1
|
||||
|
||||
@print_loop:
|
||||
ldy #0
|
||||
lda (pptr),y
|
||||
beq @done_print
|
||||
jsr print_a
|
||||
inc pptr
|
||||
bne @print_loop
|
||||
inc pptr+1
|
||||
bne @print_loop ;if we ever get to $ffff, we've probably gone far enough ;-)
|
||||
@done_print:
|
||||
rts
|
||||
|
||||
print_cr:
|
||||
lda #13
|
||||
jmp print_a
|
||||
|
||||
.data
|
||||
|
||||
@ -674,14 +812,18 @@ raster_jump_table:
|
||||
;table needs to be sorted by scanlines
|
||||
.byte $0,$01
|
||||
.word scroll_text_irq
|
||||
.byte $0,$1b
|
||||
; .word top_sprite_color_irq
|
||||
; .byte $0,$20
|
||||
.byte $0,$20
|
||||
.word pixel_scroll_irq
|
||||
.byte $0,$80
|
||||
; .word bottom_sprite_color_irq
|
||||
; .byte $0,255
|
||||
.word move_sprites_irq
|
||||
|
||||
.byte $0,$30
|
||||
.word update_nb65_counters_irq
|
||||
|
||||
.byte $0,$80
|
||||
.word play_music_irq
|
||||
|
||||
|
||||
.byte $80,$05
|
||||
.word move_sprites_irq
|
||||
|
||||
.byte $ff ;end of list
|
||||
|
||||
@ -703,7 +845,7 @@ scroll_template:
|
||||
sprite_text:
|
||||
.byte "COMATOMX"
|
||||
|
||||
.byte " configured via dhcp - ip: %i / gateway: %g / dns server %d / polling %f /"
|
||||
.byte " / ip: %i / gateway: %g / dns server %d / polling %f /"
|
||||
.byte " ",0
|
||||
|
||||
|
||||
@ -714,8 +856,59 @@ feed_url:
|
||||
title:
|
||||
.byte "<title>",0
|
||||
|
||||
.segment "VIC_DATA"
|
||||
nb65_api_not_found_message:
|
||||
.byte "ERROR - NB65 API NOT FOUND.",13,0
|
||||
incorrect_version:
|
||||
.byte "ERROR - NB65 API MUST BE AT LEAST VERSION 2.",13,0
|
||||
|
||||
failed_msg:
|
||||
.byte "FAILED", 0
|
||||
|
||||
ok_msg:
|
||||
.byte "OK", 0
|
||||
|
||||
|
||||
init_msg:
|
||||
.byte " INITIALIZING ",0
|
||||
|
||||
press_a_key_to_continue:
|
||||
.byte "PRESS A KEY TO CONTINUE",13,0
|
||||
|
||||
nb65_signature:
|
||||
.byte $4E,$42,$36,$35 ; "NB65" - API signature
|
||||
|
||||
error_code:
|
||||
.asciiz "ERROR CODE: "
|
||||
|
||||
charset_font:
|
||||
.incbin "font16x8.bin"
|
||||
sprite_font:
|
||||
.incbin "spud_letters.spr"
|
||||
musicdata:
|
||||
;.incbin "tune.bin"
|
||||
.incbin "powertrain.bin"
|
||||
musicdata_size=*-musicdata
|
||||
|
||||
.segment "SAFE_BSS"
|
||||
;we want our variables to start at $3000, out of the way of our music player and the font data
|
||||
current_input_ptr_ptr: .res 2
|
||||
param_offset: .res 1
|
||||
|
||||
temp_bin: .res 1
|
||||
temp_bcd: .res 2
|
||||
|
||||
scroll_state: .res 1
|
||||
|
||||
nb65_param_buffer: .res $20
|
||||
|
||||
download_buffer:
|
||||
download_buffer_length=4000
|
||||
.res download_buffer_length
|
||||
|
||||
scroll_buffer_0:
|
||||
.res 1000
|
||||
|
||||
scroll_buffer_1:
|
||||
.res 2000
|
||||
|
||||
string_offset: .res 1
|
||||
|
BIN
client/examples/gamemusic.bin
Normal file
BIN
client/examples/gamemusic.bin
Normal file
Binary file not shown.
BIN
client/examples/powertrain.bin
Normal file
BIN
client/examples/powertrain.bin
Normal file
Binary file not shown.
@ -21,7 +21,7 @@
|
||||
.export tftp_server_msg
|
||||
.import ip65_error
|
||||
.export print_errorcode
|
||||
|
||||
.export press_a_key_to_continue
|
||||
.import arp_cache
|
||||
.importzp ac_size
|
||||
|
||||
@ -379,3 +379,5 @@ dns_lookup_failed_msg:
|
||||
error_code:
|
||||
.asciiz "ERROR CODE: "
|
||||
|
||||
press_a_key_to_continue:
|
||||
.byte "PRESS A KEY TO CONTINUE",13,0
|
||||
|
@ -46,6 +46,8 @@ NB65_TFTP_CALLBACK_UPLOAD EQU $25 ;upload: AX points to a TFTP transfer par
|
||||
NB65_DNS_RESOLVE EQU $30 ;inputs: AX points to a DNS parameter structure, outputs: DNS param structure updated with
|
||||
;NB65_DNS_HOSTNAME_IP updated with IP address corresponding to hostname.
|
||||
|
||||
NB65_DOWNLOAD_RESOURCE EQU $40 ;inputs: AX points to a URL download structure, outputs: none
|
||||
|
||||
|
||||
NB65_PRINT_ASCIIZ EQU $80 ;inputs: AX=pointer to null terminated string to be printed to screen, outputs: none
|
||||
NB65_PRINT_HEX EQU $81 ;inputs: A=byte digit to be displayed on screen as (zero padded) hex digit, outputs: none
|
||||
@ -59,6 +61,7 @@ NB65_INPUT_PORT_NUMBER EQU $92 ;no inputs, outputs: AX = port number ent
|
||||
|
||||
NB65_BLOCK_COPY EQU $A0 ;inputs: AX points to a block copy structure, outputs: none
|
||||
|
||||
|
||||
NB65_GET_LAST_ERROR EQU $FF ;no inputs, outputs A EQU error code (from last function that set the global error value, not necessarily the
|
||||
;last function that was called)
|
||||
|
||||
@ -110,6 +113,17 @@ NB65_PAYLOAD_LENGTH EQU $08 ;2 byte length of payload
|
||||
; in a TCP connection, if the length is $FFFF, this actually means "end of connection"
|
||||
NB65_PAYLOAD_POINTER EQU $0A ;2 byte pointer to payload of packet (after all headers)
|
||||
|
||||
|
||||
;offsets in URL download structure
|
||||
;inputs:
|
||||
NB65_URL EQU $00 ;2 byte pointer to null terminated URL (NB - must be ASCII not "native" string)
|
||||
NB65_URL_DOWNLOAD_BUFFER EQU $02 ;2 byte pointer to buffer that resource specified by URL will be downloaded into
|
||||
NB65_URL_DOWNLOAD_BUFFER_LENGTH EQU $04 ;2 byte length of buffer (download will truncate when buffer is full)
|
||||
|
||||
;AX = address of URL string
|
||||
; url_download_buffer - points to a buffer that url will be downloaded into
|
||||
; url_download_buffer_length - length of buffer
|
||||
|
||||
;error codes (as returned by NB65_GET_LAST_ERROR)
|
||||
NB65_ERROR_PORT_IN_USE EQU $80
|
||||
NB65_ERROR_TIMEOUT_ON_RECEIVE EQU $81
|
||||
|
@ -437,6 +437,35 @@ ip_configured:
|
||||
nonzero_octets: .res 1
|
||||
.code
|
||||
|
||||
cpy #NB65_DOWNLOAD_RESOURCE
|
||||
bne :+
|
||||
.import url_download
|
||||
.import url_download_buffer
|
||||
.import url_download_buffer_length
|
||||
|
||||
|
||||
ldy #NB65_URL_DOWNLOAD_BUFFER
|
||||
lda (nb65_params),y
|
||||
sta url_download_buffer
|
||||
iny
|
||||
lda (nb65_params),y
|
||||
sta url_download_buffer+1
|
||||
|
||||
ldy #NB65_URL_DOWNLOAD_BUFFER_LENGTH
|
||||
lda (nb65_params),y
|
||||
sta url_download_buffer_length
|
||||
iny
|
||||
lda (nb65_params),y
|
||||
sta url_download_buffer_length+1
|
||||
|
||||
ldy #NB65_URL+1
|
||||
lda (nb65_params),y
|
||||
tax
|
||||
dey
|
||||
lda (nb65_params),y
|
||||
jmp url_download
|
||||
:
|
||||
|
||||
cpy #NB65_TCP_CONNECT
|
||||
bne :+
|
||||
.import tcp_connect
|
||||
|
@ -19,9 +19,9 @@ search_string=copy_dest
|
||||
.endif
|
||||
|
||||
.bss
|
||||
int_value: .res 2
|
||||
temp_ptr: .res 2
|
||||
.data
|
||||
|
||||
.segment "SELF_MODIFIED_CODE"
|
||||
get_next_byte:
|
||||
current_string_ptr=get_next_byte+1
|
||||
lda $ffff
|
||||
|
@ -1,4 +1,4 @@
|
||||
;routine for parsing a URL
|
||||
;routines for parsing a URL, and downloading an URL
|
||||
|
||||
|
||||
.include "../inc/common.i"
|
||||
@ -46,7 +46,8 @@ target_string=copy_src
|
||||
search_string=copy_dest
|
||||
selector_buffer=output_buffer
|
||||
|
||||
.bss
|
||||
.segment "TCP_VARS"
|
||||
|
||||
url_string: .res 2
|
||||
url_ip: .res 4 ;will be set with ip address of host in url
|
||||
url_port: .res 2 ;will be set with port number of url
|
||||
@ -277,7 +278,6 @@ skip_to_hostname:
|
||||
ldax #colon_slash_slash
|
||||
jmp parser_skip_next
|
||||
|
||||
.code
|
||||
|
||||
|
||||
;download a resource specified by an URL
|
||||
@ -290,7 +290,7 @@ skip_to_hostname:
|
||||
; of specified resource (with an extra 2 null bytes at the end),
|
||||
; AX = length of resource downloaded.
|
||||
url_download:
|
||||
jsr url_parse
|
||||
jsr url_parse
|
||||
bcc @url_parsed_ok
|
||||
rts
|
||||
@url_parsed_ok:
|
||||
|
@ -22,7 +22,7 @@ APPLE2PROGLIB=../drivers/apple2prog.lib
|
||||
BOOTA2.PG2=../../server/boot/BOOTA2.PG2
|
||||
|
||||
#all: utherboot.dsk $(BOOTA2.PG2) nb65_rrnet.bin nb65_std_cart.bin nb65_c64_ram.prg d64_upload.prg c64boot.d64 d64_upload.d64
|
||||
all: nb65_std_cart.bin nb65_tcp_cart.bin
|
||||
all: nb65_std_cart.bin nb65_tcp_cart.bin nb65_tcp_cart_rr.bin
|
||||
|
||||
nb65_c64_ram.o: nb65_c64.s $(INCFILES)
|
||||
$(AS) -DBANKSWITCH_SUPPORT=0 $(AFLAGS) -o $@ $<
|
||||
@ -61,6 +61,11 @@ nb65_rrnet.bin: nb65_rrnet.o $(IP65LIB) $(C64NB65LIB) $(INCFILES) ../cfg/rrbin.c
|
||||
$(LD) -m nb65_rrnet.map -Ln nb65_rr.lab -vm -C ../cfg/rrbin.cfg -o $@ $< $(IP65LIB) $(C64NB65LIB)
|
||||
ruby fix_cart.rb $@ 8193
|
||||
|
||||
nb65_tcp_cart_rr.bin: nb65_tcp_cart.bin
|
||||
cp crt8040.obj rrnet_header.bin
|
||||
cat rrnet_header.bin nb65_tcp_cart.bin > nb65_tcp_cart_rr.bin
|
||||
ruby fix_cart.rb $@ 32768
|
||||
|
||||
utherboot.pg2: utherboot.o $(IP65LIB) $(APPLE2PROGLIB) $(INCFILES) ../cfg/a2language_card.cfg
|
||||
$(LD) -m utherboot.map -C ../cfg/a2language_card.cfg -o $@ $< $(IP65LIB) $(APPLE2PROGLIB)
|
||||
|
||||
|
BIN
client/nb65/crt8040.obj
Normal file
BIN
client/nb65/crt8040.obj
Normal file
Binary file not shown.
107
client/nb65/crt8040.src
Normal file
107
client/nb65/crt8040.src
Normal file
@ -0,0 +1,107 @@
|
||||
;taken from DocBacardi's CRT8040 tool - http://freenet-homepage.de/LittleDreamLand/CRT8040.html
|
||||
|
||||
#segdef "zp", $57-$72
|
||||
#segdef "bank0", $8000-$9f10, force, fillup
|
||||
#segdef "common", $df10-$e000, force, fillup
|
||||
|
||||
#outfile @, $00, "bank0", "common"
|
||||
|
||||
;--------------------------------------
|
||||
; init the startadr of all segments
|
||||
|
||||
.segment "zp"
|
||||
* = $57
|
||||
|
||||
.segment "bank0"
|
||||
* = $8000
|
||||
|
||||
.segment "common"
|
||||
* = $df10
|
||||
|
||||
;--------------------------------------
|
||||
; init the rr registers and copy
|
||||
; bank 3 to ram
|
||||
|
||||
.segment "bank0"
|
||||
|
||||
.DW Bank0_Reset ;Reset vector
|
||||
.DW $fe5e ;NMI vector is not used here, points to system
|
||||
.PET "CBM80" ;Reset Magic
|
||||
|
||||
Bank0_Reset:
|
||||
lda #%01000111 ;Standard Memory Map, No Freeze, No Banking in $DF00 (+ allow access to accessory connector - Jonno 2009-08-20)
|
||||
sta $de01
|
||||
|
||||
ldx #kickStack_len-1
|
||||
copyKickStack:
|
||||
lda kickStack_org,x
|
||||
sta kickStack,x
|
||||
dex
|
||||
bpl copyKickStack
|
||||
jmp kickStack
|
||||
|
||||
kickStack_org:
|
||||
.pseudopc $0900
|
||||
kickStack:
|
||||
|
||||
ldx #$1f
|
||||
ldy #0
|
||||
copyCrt:
|
||||
lda #%00101011 ; switch to bank 1
|
||||
sta $de00
|
||||
delay0:
|
||||
nop
|
||||
iny
|
||||
bne delay0
|
||||
copyPage0:
|
||||
smod0:
|
||||
lda $e000,y
|
||||
sta $0400,y
|
||||
iny
|
||||
bne copyPage0
|
||||
lda #%00110011 ; switch to bank 2
|
||||
sta $de00
|
||||
delay1:
|
||||
nop
|
||||
iny
|
||||
bne delay1
|
||||
copyPage1:
|
||||
lda $0400,y
|
||||
smod1:
|
||||
sta $8000,y
|
||||
iny
|
||||
bne copyPage1
|
||||
inc smod0+2
|
||||
inc smod1+2
|
||||
inc $d020
|
||||
dex
|
||||
bpl copyCrt
|
||||
|
||||
lda #%00110001 ; switch to 8040
|
||||
sta $de00
|
||||
delay2:
|
||||
nop
|
||||
iny
|
||||
bne delay2
|
||||
|
||||
|
||||
; during the copy process occured some irqs, clear them
|
||||
lda $dc0d
|
||||
lda $dd0d
|
||||
asl $d019
|
||||
|
||||
; set registers
|
||||
; NV-BDIZC
|
||||
lda #%00110111
|
||||
pha
|
||||
lda #$c3
|
||||
ldx #$00
|
||||
plp
|
||||
|
||||
jmp ($8000)
|
||||
|
||||
kickStack_len = *-kickStack
|
||||
.realpc
|
||||
|
||||
;--------------------------------------
|
||||
|
@ -79,6 +79,7 @@
|
||||
.import cfg_dns
|
||||
.import cfg_tftp_server
|
||||
|
||||
|
||||
.import print_dotted_quad
|
||||
.import print_hex
|
||||
.import print_errorcode
|
||||
@ -91,7 +92,8 @@
|
||||
.import gateway_msg
|
||||
.import dns_server_msg
|
||||
.import tftp_server_msg
|
||||
|
||||
.import press_a_key_to_continue
|
||||
|
||||
.import print_a
|
||||
.import print_cr
|
||||
.import print
|
||||
@ -102,6 +104,10 @@
|
||||
.import __DATA_LOAD__
|
||||
.import __DATA_RUN__
|
||||
.import __DATA_SIZE__
|
||||
.import __SELF_MODIFIED_CODE_LOAD__
|
||||
.import __SELF_MODIFIED_CODE_RUN__
|
||||
.import __SELF_MODIFIED_CODE_SIZE__
|
||||
|
||||
.import cfg_tftp_server
|
||||
tftp_dir_buffer = $6020
|
||||
nb65_param_buffer = $6000
|
||||
@ -183,6 +189,18 @@ init:
|
||||
ldax #__DATA_SIZE__
|
||||
jsr copymem
|
||||
|
||||
|
||||
;relocate the self-modifying code (if necessary)
|
||||
.if (BANKSWITCH_SUPPORT=$03)
|
||||
ldax #__SELF_MODIFIED_CODE_LOAD__
|
||||
stax copy_src
|
||||
ldax #__SELF_MODIFIED_CODE_RUN__
|
||||
stax copy_dest
|
||||
ldax #__SELF_MODIFIED_CODE_SIZE__
|
||||
jsr copymem
|
||||
.endif
|
||||
|
||||
|
||||
;copy the RAM stub to RAM
|
||||
ldax #nb65_ram_stub
|
||||
stax copy_src
|
||||
@ -739,8 +757,6 @@ tftp_file:
|
||||
no_files_on_server:
|
||||
.byte "NO MATCHING FILES",13,0
|
||||
|
||||
press_a_key_to_continue:
|
||||
.byte "PRESS A KEY TO CONTINUE",13,0
|
||||
|
||||
resolving:
|
||||
.byte "RESOLVING ",0
|
||||
|
@ -19,7 +19,7 @@ INCFILES=\
|
||||
../inc/net.i\
|
||||
|
||||
all: \
|
||||
ip65test.dsk \
|
||||
# ip65test.dsk \
|
||||
testdns.prg \
|
||||
test_disk_io.prg \
|
||||
test_disk_io.d64 \
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user