mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-02-23 15:28:59 +00:00
git-svn-id: http://svn.code.sf.net/p/netboot65/code@93 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
3ffe25098b
commit
18075ccfd3
@ -23,7 +23,10 @@
|
||||
.endmacro
|
||||
|
||||
|
||||
.ifndef NB65_API_VERSION_NUMBER
|
||||
.define EQU =
|
||||
.include "../inc/nb65_constants.i"
|
||||
.endif
|
||||
.include "../inc/common.i"
|
||||
.include "../inc/menu.i"
|
||||
.include "../inc/c64keycodes.i"
|
||||
@ -57,9 +60,11 @@
|
||||
.data
|
||||
exit_cart:
|
||||
lda #$02
|
||||
sta $de00 ;turns off RR cartridge - obviously we need to execut this from RAM else we fall into never-never land :-)
|
||||
jmp_to_downloaded_prg:
|
||||
jmp $0000 ;overwritten when we load a file
|
||||
sta $de00 ;turns off RR cartridge - obviously we need to execute this from RAM else we fall into never-never land :-)
|
||||
call_downloaded_prg:
|
||||
jsr $0000 ;overwritten when we load a file
|
||||
jsr $c004 ;bank cartridge in again
|
||||
jmp init
|
||||
|
||||
.bss
|
||||
|
||||
@ -130,7 +135,7 @@ init:
|
||||
|
||||
@exit_to_basic:
|
||||
ldax #$fe66 ;do a wam start
|
||||
jmp exit_to_cart_via_ax
|
||||
jmp exit_cart_via_ax
|
||||
|
||||
@tftp_boot:
|
||||
|
||||
@ -232,12 +237,12 @@ init:
|
||||
sty $2e ;save end-of-BASIC pointer (hi byte)
|
||||
jsr $a659 ; CLR (reset variables)
|
||||
ldax #$a7ae ; jump to BASIC interpreter loop
|
||||
jmp exit_to_cart_via_ax
|
||||
jmp exit_cart_via_ax
|
||||
|
||||
@not_a_basic_file:
|
||||
ldax nb65_param_buffer+NB65_TFTP_POINTER
|
||||
exit_to_cart_via_ax:
|
||||
stax jmp_to_downloaded_prg+1
|
||||
exit_cart_via_ax:
|
||||
stax call_downloaded_prg+1
|
||||
jmp exit_cart
|
||||
|
||||
print_errorcode:
|
||||
@ -302,7 +307,7 @@ cfg_get_configuration_ptr:
|
||||
.rodata
|
||||
|
||||
startup_msg:
|
||||
.byte "NETBOOT65 - C64 NETWORK BOOT CLIENT V0.3",13
|
||||
.byte "NETBOOT65 - C64 NETWORK BOOT CLIENT V0.4",13
|
||||
.byte "F1=TFTP BOOT, F3=BASIC",13
|
||||
.byte 0
|
||||
|
||||
|
257
client/examples/dasm_example.asm
Normal file
257
client/examples/dasm_example.asm
Normal file
@ -0,0 +1,257 @@
|
||||
;NB65 API example in DASM format (http://www.atari2600.org/DASM/)
|
||||
processor 6502
|
||||
|
||||
include "../inc/nb65_constants.i"
|
||||
|
||||
;useful macros
|
||||
mac ldax
|
||||
lda [{1}]
|
||||
ldx [{1}]+1
|
||||
endm
|
||||
|
||||
mac ldaxi
|
||||
lda #<[{1}]
|
||||
ldx #>[{1}]
|
||||
endm
|
||||
|
||||
mac stax
|
||||
sta [{1}]
|
||||
stx [{1}]+1
|
||||
endm
|
||||
|
||||
mac cout
|
||||
lda [{1}]
|
||||
jsr print_a
|
||||
endm
|
||||
|
||||
mac print_cr
|
||||
cout #13
|
||||
jsr print_a
|
||||
endm
|
||||
|
||||
mac nb65call
|
||||
ldy [{1}]
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
endm
|
||||
|
||||
mac print
|
||||
|
||||
ldaxi [{1}]
|
||||
ldy #NB65_PRINT_ASCIIZ
|
||||
jsr NB65_DISPATCH_VECTOR
|
||||
endm
|
||||
|
||||
|
||||
;some routines & zero page variables
|
||||
print_a equ $ffd2
|
||||
temp_ptr equ $FB ; scratch space in page zero
|
||||
|
||||
|
||||
;start of code
|
||||
;BASIC stub
|
||||
org $801
|
||||
dc.b $0b,$08,$d4,$07,$9e,$32,$30,$36,$31,$00,$00,$00
|
||||
|
||||
|
||||
ldaxi #NB65_CART_SIGNATURE ;where signature should be in cartridge (if cart is banked in)
|
||||
jsr look_for_signature
|
||||
bcc found_nb65_signature
|
||||
|
||||
ldaxi #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
|
||||
ldaxi #nb65_api_not_found_message
|
||||
jsr print_ax
|
||||
rts
|
||||
|
||||
found_nb65_signature
|
||||
|
||||
print #initializing
|
||||
nb65call #NB65_INITIALIZE
|
||||
bcc .init_ok
|
||||
print_cr
|
||||
print #failed
|
||||
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
|
||||
;print out the current configuration
|
||||
nb65call #NB65_PRINT_IP_CONFIG
|
||||
|
||||
;test out DNS resolution:
|
||||
|
||||
ldaxi #test_hostname
|
||||
stax nb65_param_buffer+NB65_DNS_HOSTNAME
|
||||
|
||||
nb65call #NB65_PRINT_ASCIIZ
|
||||
|
||||
print #space_colon_space
|
||||
|
||||
ldaxi #nb65_param_buffer
|
||||
nb65call #NB65_DNS_RESOLVE
|
||||
bcc .no_dns_error
|
||||
print #dns_lookup_failed_msg
|
||||
print_cr
|
||||
jsr print_errorcode
|
||||
jmp reset_after_keypress
|
||||
.no_dns_error
|
||||
|
||||
ldaxi #nb65_param_buffer+NB65_DNS_HOSTNAME_IP
|
||||
nb65call #NB65_PRINT_DOTTED_QUAD
|
||||
print_cr
|
||||
|
||||
;now set up for the nb65callback test
|
||||
|
||||
ldaxi #64 ;listen on port 64
|
||||
stax nb65_param_buffer+NB65_UDP_LISTENER_PORT
|
||||
ldaxi #udp_nb65callback
|
||||
stax nb65_param_buffer+NB65_UDP_LISTENER_nb65callBACK
|
||||
ldaxi #nb65_param_buffer
|
||||
nb65call #NB65_UDP_ADD_LISTENER
|
||||
bcc .add_listener_ok
|
||||
print #failed
|
||||
jsr print_errorcode
|
||||
jmp reset_after_keypress
|
||||
.add_listener_ok
|
||||
|
||||
print #listening
|
||||
|
||||
|
||||
.loop_forever
|
||||
jsr NB65_PERIODIC_PROCESSING_VECTOR
|
||||
jmp .loop_forever
|
||||
|
||||
|
||||
;here is the code that will execute whenever a UDP packet arrives on port 64
|
||||
udp_nb65callback subroutine
|
||||
|
||||
|
||||
ldaxi #nb65_param_buffer
|
||||
nb65call #NB65_GET_INPUT_PACKET_INFO
|
||||
|
||||
print_cr
|
||||
print #recv_from
|
||||
ldaxi #nb65_param_buffer+NB65_REMOTE_IP
|
||||
nb65call #NB65_PRINT_DOTTED_QUAD
|
||||
print #port
|
||||
lda nb65_param_buffer+NB65_REMOTE_PORT+1
|
||||
nb65call #NB65_PRINT_HEX
|
||||
lda nb65_param_buffer+NB65_REMOTE_PORT
|
||||
nb65call #NB65_PRINT_HEX
|
||||
print_cr
|
||||
print #length
|
||||
lda nb65_param_buffer+NB65_PAYLOAD_LENGTH+1
|
||||
nb65call #NB65_PRINT_HEX
|
||||
lda nb65_param_buffer+NB65_PAYLOAD_LENGTH
|
||||
nb65call #NB65_PRINT_HEX
|
||||
print_cr
|
||||
print #data
|
||||
ldax nb65_param_buffer+NB65_PAYLOAD_POINTER
|
||||
stax temp_ptr
|
||||
ldx nb65_param_buffer+NB65_PAYLOAD_LENGTH ;assumes length is < 255
|
||||
ldy #0
|
||||
.next_byte
|
||||
lda (temp_ptr),y
|
||||
jsr print_a
|
||||
iny
|
||||
dex
|
||||
bpl .next_byte
|
||||
|
||||
|
||||
print_cr
|
||||
|
||||
;make and send a reply
|
||||
ldaxi #reply_message
|
||||
stax nb65_param_buffer+NB65_PAYLOAD_POINTER
|
||||
|
||||
ldaxi #reply_message_length
|
||||
stax nb65_param_buffer+NB65_PAYLOAD_LENGTH
|
||||
|
||||
ldaxi #nb65_param_buffer
|
||||
nb65call #NB65_SEND_UDP_PACKET
|
||||
bcc .sent_ok
|
||||
jmp print_errorcode
|
||||
.sent_ok
|
||||
print #reply_sent
|
||||
|
||||
rts
|
||||
|
||||
|
||||
;look for NB65 signature at location pointed at by AX
|
||||
look_for_signature subroutine
|
||||
stax temp_ptr
|
||||
ldy #3
|
||||
.check_one_byte
|
||||
lda (temp_ptr),y
|
||||
cmp nb65_signature,y
|
||||
bne .bad_match
|
||||
dey
|
||||
bpl .check_one_byte
|
||||
clc
|
||||
rts
|
||||
.bad_match
|
||||
sec
|
||||
rts
|
||||
|
||||
print_ax subroutine
|
||||
stax temp_ptr
|
||||
ldy #0
|
||||
.next_char
|
||||
lda (temp_ptr),y
|
||||
beq .done
|
||||
jsr print_a
|
||||
iny
|
||||
jmp .next_char
|
||||
.done
|
||||
rts
|
||||
|
||||
get_key
|
||||
jsr $ffe4
|
||||
cmp #0
|
||||
beq get_key
|
||||
rts
|
||||
|
||||
reset_after_keypress
|
||||
print #press_a_key_to_continue
|
||||
jsr get_key
|
||||
jmp $fce2 ;do a cold start
|
||||
|
||||
|
||||
print_errorcode
|
||||
print #error_code
|
||||
nb65call #NB65_GET_LAST_ERROR
|
||||
nb65call #NB65_PRINT_HEX
|
||||
print_cr
|
||||
rts
|
||||
|
||||
|
||||
|
||||
;constants
|
||||
nb65_api_not_found_message dc.b "ERROR - NB65 API NOT FOUND.",13,0
|
||||
nb65_signature dc.b $4E,$42,$36,$35 ; "NB65" - API signature
|
||||
initializing dc.b "INITIALIZING ",13,0
|
||||
error_code dc.b "ERROR CODE: $",0
|
||||
press_a_key_to_continue dc.b "PRESS A KEY TO CONTINUE",13,0
|
||||
failed dc.b "FAILED ", 0
|
||||
ok dc.b "OK ", 0
|
||||
test_hostname dc.b "RETROHACKERS.COM",0 ;this should be an A record
|
||||
dns_lookup_failed_msg dc.b "DNS LOOKUP FAILED", 0
|
||||
recv_from dc.b"RECEIVED FROM: ",0
|
||||
listening dc.b "LISTENING ON UDP PORT 64",13,0
|
||||
reply_sent dc.b "REPLY SENT.",0
|
||||
port dc.b " PORT: $",0
|
||||
length dc.b "LENGTH: $",0
|
||||
data dc.b "DATA: ",0
|
||||
space_colon_space dc.b " : ",0
|
||||
reply_message dc.b "PONG!"
|
||||
reply_message_length equ 5
|
||||
|
||||
;variables
|
||||
nb65_param_buffer DS.B $20
|
||||
|
@ -1,4 +1,7 @@
|
||||
.include "../inc/nb65_constants.i"
|
||||
.ifndef NB65_API_VERSION_NUMBER
|
||||
.define EQU =
|
||||
.include "../inc/nb65_constants.i"
|
||||
.endif
|
||||
|
||||
.export print_hex
|
||||
.export print_ip_config
|
||||
|
@ -1,84 +1,84 @@
|
||||
.ifndef NB65_API_VERSION_NUMBER
|
||||
|
||||
NB65_API_VERSION_NUMBER=$01
|
||||
;constants for accessing the NB65 API file
|
||||
;to use this file under CA65, then add " .define EQU =" to your code before this file is included.
|
||||
|
||||
|
||||
NB65_CART_SIGNATURE = $8009
|
||||
NB65_API_VERSION = $800d
|
||||
NB65_BANKSWITCH_SUPPORT = $800e
|
||||
NB65_DISPATCH_VECTOR = $800f
|
||||
NB65_PERIODIC_PROCESSING_VECTOR = $8012
|
||||
NB65_VBL_VECTOR = $8015
|
||||
NB65_RAM_STUB_SIGNATURE = $C000
|
||||
NB65_RAM_STUB_ACTIVATE = $C004
|
||||
NB65_API_VERSION_NUMBER EQU $01
|
||||
|
||||
|
||||
NB65_CART_SIGNATURE EQU $8009
|
||||
NB65_API_VERSION EQU $800d
|
||||
NB65_BANKSWITCH_SUPPORT EQU $800e
|
||||
NB65_DISPATCH_VECTOR EQU $800f
|
||||
NB65_PERIODIC_PROCESSING_VECTOR EQU $8012
|
||||
NB65_VBL_VECTOR EQU $8015
|
||||
NB65_RAM_STUB_SIGNATURE EQU $C000
|
||||
NB65_RAM_STUB_ACTIVATE EQU $C004
|
||||
|
||||
;function numbers
|
||||
;to make a function call:
|
||||
; Y = function number
|
||||
; AX = pointer to parameter buffer (for functions that take parameters)
|
||||
; Y EQU function number
|
||||
; AX EQU pointer to parameter buffer (for functions that take parameters)
|
||||
; then JSR NB65_DISPATCH_VECTOR
|
||||
; on return, carry flag is set if there is an error, or clear otherwise
|
||||
; some functions return results in AX directly, others will update the parameter buffer they were called with.
|
||||
; any register not specified in outputs will have an undefined value on exit
|
||||
|
||||
NB65_INITIALIZE =$01 ;no inputs or outputs - initializes IP stack, also sets IRQ chain to call NB65_VBL_VECTOR at @ 60hz
|
||||
NB65_GET_IP_CONFIG =$02 ;no inputs, outputs AX=pointer to IP configuration structure
|
||||
NB65_TFTP_DIRECTORY_LISTING =$03 ;inputs: AX points to a TFTP parameter structure, outputs: none
|
||||
NB65_TFTP_DOWNLOAD =$04 ;inputs: AX points to a TFTP parameter structure, outputs: TFTP param structure updated with
|
||||
NB65_INITIALIZE EQU $01 ;no inputs or outputs - initializes IP stack, also sets IRQ chain to call NB65_VBL_VECTOR at @ 60hz
|
||||
NB65_GET_IP_CONFIG EQU $02 ;no inputs, outputs AX=pointer to IP configuration structure
|
||||
NB65_TFTP_DIRECTORY_LISTING EQU $03 ;inputs: AX points to a TFTP parameter structure, outputs: none
|
||||
NB65_TFTP_DOWNLOAD EQU $04 ;inputs: AX points to a TFTP parameter structure, outputs: TFTP param structure updated with
|
||||
;NB65_TFTP_POINTER updated to reflect actual load address (if load address $0000 originally passed in)
|
||||
NB65_DNS_RESOLVE =$05 ;inputs: AX points to a DNS parameter structure, outputs: DNS param structure updated with
|
||||
NB65_DNS_RESOLVE EQU $05 ;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_UDP_ADD_LISTENER =$06 ;inputs: AX points to a UDP listener parameter structure, outputs: none
|
||||
NB65_GET_INPUT_PACKET_INFO =$07 ;inputs: AX points to a UDP packet parameter structure, outputs: UDP packet structure filled in
|
||||
NB65_SEND_UDP_PACKET =$08 ;inputs: AX points to a UDP packet parameter structure, outputs: none packet is sent
|
||||
NB65_DEACTIVATE =$09 ;inputs: none, outputs: none (removes call to NB65_VBL_VECTOR on IRQ chain)
|
||||
NB65_UDP_ADD_LISTENER EQU $06 ;inputs: AX points to a UDP listener parameter structure, outputs: none
|
||||
NB65_GET_INPUT_PACKET_INFO EQU $07 ;inputs: AX points to a UDP packet parameter structure, outputs: UDP packet structure filled in
|
||||
NB65_SEND_UDP_PACKET EQU $08 ;inputs: AX points to a UDP packet parameter structure, outputs: none packet is sent
|
||||
NB65_DEACTIVATE EQU $09 ;inputs: none, outputs: none (removes call to NB65_VBL_VECTOR on IRQ chain)
|
||||
|
||||
NB65_PRINT_ASCIIZ =$80 ;inputs: AX= pointer to null terminated string to be printed to screen, outputs: none
|
||||
NB65_PRINT_HEX =$81 ;inputs: A = byte digit to be displayed on screen as (zero padded) hex digit, outputs: none
|
||||
NB65_PRINT_DOTTED_QUAD =$82 ;inputs: AX= pointer to 4 bytes that will be displayed as a decimal dotted quad (e.g. 192.168.1.1)
|
||||
NB65_PRINT_IP_CONFIG =$83 ;no inputs, no outputs, prints to screen current IP configuration
|
||||
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
|
||||
NB65_PRINT_DOTTED_QUAD EQU $82 ;inputs: AX=pointer to 4 bytes that will be displayed as a decimal dotted quad (e.g. 192.168.1.1)
|
||||
NB65_PRINT_IP_CONFIG EQU $83 ;no inputs, no outputs, prints to screen current IP configuration
|
||||
|
||||
|
||||
NB65_GET_LAST_ERROR =$FF ;no inputs, outputs A = error code (from last function that set the global error value, not necessarily the
|
||||
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)
|
||||
|
||||
;offsets in IP configuration structure (used by NB65_GET_IP_CONFIG)
|
||||
NB65_CFG_MAC = $00 ;6 byte MAC address
|
||||
NB65_CFG_IP = $06 ;4 byte local IP address (will be overwritten by DHCP)
|
||||
NB65_CFG_NETMASK = $0A ;4 byte local netmask (will be overwritten by DHCP)
|
||||
NB65_CFG_GATEWAY = $0D ;4 byte local gateway (will be overwritten by DHCP)
|
||||
NB65_CFG_DNS_SERVER = $12 ;4 byte IP address of DNS server (will be overwritten by DHCP)
|
||||
NB65_CFG_DHCP_SERVER = $16 ;4 byte IP address of DHCP server (will only be set by DHCP initialisation)
|
||||
NB65_DRIVER_NAME = $1A ;2 byte pointer to name of driver
|
||||
NB65_CFG_MAC EQU $00 ;6 byte MAC address
|
||||
NB65_CFG_IP EQU $06 ;4 byte local IP address (will be overwritten by DHCP)
|
||||
NB65_CFG_NETMASK EQU $0A ;4 byte local netmask (will be overwritten by DHCP)
|
||||
NB65_CFG_GATEWAY EQU $0D ;4 byte local gateway (will be overwritten by DHCP)
|
||||
NB65_CFG_DNS_SERVER EQU $12 ;4 byte IP address of DNS server (will be overwritten by DHCP)
|
||||
NB65_CFG_DHCP_SERVER EQU $16 ;4 byte IP address of DHCP server (will only be set by DHCP initialisation)
|
||||
NB65_DRIVER_NAME EQU $1A ;2 byte pointer to name of driver
|
||||
|
||||
;offsets in TFTP parameter structure (used by NB65_TFTP_DIRECTORY_LISTING & NB65_TFTP_DOWNLOAD)
|
||||
NB65_TFTP_IP = $00 ;4 byte IP address of TFTP server
|
||||
NB65_TFTP_FILENAME = $04 ;2 byte pointer to asciiz filename (or filemask in case of NB65_TFTP_DIRECTORY_LISTING)
|
||||
NB65_TFTP_POINTER = $06 ;2 byte pointer to memory location data to be stored in
|
||||
NB65_TFTP_IP EQU $00 ;4 byte IP address of TFTP server
|
||||
NB65_TFTP_FILENAME EQU $04 ;2 byte pointer to asciiz filename (or filemask in case of NB65_TFTP_DIRECTORY_LISTING)
|
||||
NB65_TFTP_POINTER EQU $06 ;2 byte pointer to memory location data to be stored in
|
||||
|
||||
;offsets in DNS parameter structure (used by NB65_DNS_RESOLVE)
|
||||
NB65_DNS_HOSTNAME = $00 ;2 byte pointer to asciiz hostname to resolve (can also be a dotted quad string)
|
||||
NB65_DNS_HOSTNAME_IP= $00 ;4 byte IP address (filled in on succesful resolution of hostname)
|
||||
NB65_DNS_HOSTNAME EQU $00 ;2 byte pointer to asciiz hostname to resolve (can also be a dotted quad string)
|
||||
NB65_DNS_HOSTNAME_IP EQU $00 ;4 byte IP address (filled in on succesful resolution of hostname)
|
||||
|
||||
;offsets in UDP listener parameter structure
|
||||
NB65_UDP_LISTENER_PORT = $00 ;2 byte port number
|
||||
NB65_UDP_LISTENER_CALLBACK = $02 ;2 byte address of routine to call when UDP packet arrives for specified port
|
||||
NB65_UDP_LISTENER_PORT EQU $00 ;2 byte port number
|
||||
NB65_UDP_LISTENER_CALLBACK EQU $02 ;2 byte address of routine to call when UDP packet arrives for specified port
|
||||
|
||||
;offsets in UDP packet parameter structure
|
||||
NB65_REMOTE_IP = $00 ;4 byte IP address of remote machine (src of inbound packets, dest of outbound packets)
|
||||
NB65_REMOTE_PORT = $04 ;2 byte port number of remote machine (src of inbound packets, dest of outbound packets)
|
||||
NB65_LOCAL_PORT = $06 ;2 byte port number of local machine (src of outbound packets, dest of inbound packets)
|
||||
NB65_PAYLOAD_LENGTH = $08 ;2 byte length of payload of packet (after all ethernet,IP,UDP headers)
|
||||
NB65_PAYLOAD_POINTER =$0A ;2 byte pointer to payload of packet (after all headers)
|
||||
NB65_REMOTE_IP EQU $00 ;4 byte IP address of remote machine (src of inbound packets, dest of outbound packets)
|
||||
NB65_REMOTE_PORT EQU $04 ;2 byte port number of remote machine (src of inbound packets, dest of outbound packets)
|
||||
NB65_LOCAL_PORT EQU $06 ;2 byte port number of local machine (src of outbound packets, dest of inbound packets)
|
||||
NB65_PAYLOAD_LENGTH EQU $08 ;2 byte length of payload of packet (after all ethernet,IP,UDP headers)
|
||||
NB65_PAYLOAD_POINTER EQU $0A ;2 byte pointer to payload of packet (after all headers)
|
||||
|
||||
;error codes (as returned by NB65_GET_LAST_ERROR)
|
||||
NB65_ERROR_PORT_IN_USE = $80
|
||||
NB65_ERROR_TIMEOUT_ON_RECEIVE = $81
|
||||
NB65_ERROR_TRANSMIT_FAILED = $82
|
||||
NB65_ERROR_TRANSMISSION_REJECTED_BY_PEER = $83
|
||||
NB65_ERROR_INPUT_TOO_LARGE = $84
|
||||
NB65_ERROR_DEVICE_FAILURE = $85
|
||||
NB65_ERROR_OPTION_NOT_SUPPORTED = $FE
|
||||
NB65_ERROR_FUNCTION_NOT_SUPPORTED = $FF
|
||||
|
||||
.endif
|
||||
NB65_ERROR_PORT_IN_USE EQU $80
|
||||
NB65_ERROR_TIMEOUT_ON_RECEIVE EQU $81
|
||||
NB65_ERROR_TRANSMIT_FAILED EQU $82
|
||||
NB65_ERROR_TRANSMISSION_REJECTED_BY_PEER EQU $83
|
||||
NB65_ERROR_INPUT_TOO_LARGE EQU $84
|
||||
NB65_ERROR_DEVICE_FAILURE EQU $85
|
||||
NB65_ERROR_OPTION_NOT_SUPPORTED EQU $FE
|
||||
NB65_ERROR_FUNCTION_NOT_SUPPORTED EQU $FF
|
||||
|
@ -3,7 +3,10 @@
|
||||
;this whole file could (and should) be greatly optimised by making it all table driven, but since this file is probably only going to be used in a bankswitched ROM where
|
||||
;space is not at such a premium, I'll go with the gross hack for now.
|
||||
|
||||
.include "../inc/nb65_constants.i"
|
||||
.ifndef NB65_API_VERSION_NUMBER
|
||||
.define EQU =
|
||||
.include "../inc/nb65_constants.i"
|
||||
.endif
|
||||
.include "../inc/common.i"
|
||||
.include "../inc/commonprint.i"
|
||||
.export nb65_dispatcher
|
||||
|
@ -1,5 +1,8 @@
|
||||
;test the "NETBOOT65 Cartridge API"
|
||||
.include "../inc/nb65_constants.i"
|
||||
.ifndef NB65_API_VERSION_NUMBER
|
||||
.define EQU =
|
||||
.include "../inc/nb65_constants.i"
|
||||
.endif
|
||||
|
||||
; load A/X macro
|
||||
.macro ldax arg
|
||||
@ -64,7 +67,8 @@ basicstub:
|
||||
.word 0
|
||||
|
||||
|
||||
look_for_signature: ;look for NB65 signature at location pointed at by AX
|
||||
;look for NB65 signature at location pointed at by AX
|
||||
look_for_signature:
|
||||
stax temp_ptr
|
||||
ldy #3
|
||||
@check_one_byte:
|
||||
|
8
dist/make_dist.rb
vendored
8
dist/make_dist.rb
vendored
@ -8,7 +8,7 @@ require 'ftools'
|
||||
|
||||
WORKING_DIR=File.expand_path(File.dirname(__FILE__)+"/netboot65")
|
||||
SRC_DIR=File.expand_path(File.dirname(__FILE__)+"/../")
|
||||
["","client","lib","bin","boot","doc"].each do |dir_suffix|
|
||||
["","client","lib","bin","boot","doc","inc","examples"].each do |dir_suffix|
|
||||
dir_path="#{WORKING_DIR}/#{dir_suffix}"
|
||||
Dir.mkdir(dir_path) unless File.exist?(dir_path)
|
||||
end
|
||||
@ -21,9 +21,9 @@ end
|
||||
["server/bin/import_ags_games.rb","bin"],
|
||||
["server/boot/BOOTA2.PG2","boot"],
|
||||
["doc/README.*.txt","doc"],
|
||||
["doc/netboot65_api.txt","doc"],
|
||||
["client/inc/nb65_constants.i","doc"],
|
||||
["client/test/test_cart_api.s","doc"],
|
||||
["doc/nb65_api_technical_reference.doc","doc"],
|
||||
["client/inc/nb65_constants.i","inc"],
|
||||
["client/test/test_cart_api.s","examples"],
|
||||
].each do |args|
|
||||
dest="#{WORKING_DIR}/#{args[1]}"
|
||||
Dir["#{SRC_DIR}/#{args[0]}"].each do |src|
|
||||
|
@ -1,29 +0,0 @@
|
||||
The purpose of this API is to allow applications to be developed that use network functionality in a netboo65 cartridge/card.
|
||||
|
||||
The API is a jump table that lives at a fixed location within the cartridge/card.
|
||||
The jump table entries and their location in a C64 cartridge are:
|
||||
|
||||
NB65_DISPATCH_VECTOR = $800d
|
||||
NB65_PERIODIC_PROCESSING_VECTOR =$8010
|
||||
NB65_VBL_VECTOR =$8013
|
||||
|
||||
Immediately before this jump table are the bytes "NB65" (so an app can check the API is available to it)
|
||||
|
||||
To use the API, an app should do the following:
|
||||
|
||||
1) turn on the cartridge ROM (LDA #$01 / STA $de00) - the netboot65 code turns the cartridge ROM just before exiting to BASIC or starting whatever program it has loaded via tftp.
|
||||
|
||||
2) make sure that NB65_VBL_VECTOR routine is called 60 times a second. This is automatically inserted into the IRQ handler chain by the NB65_INIT_IP function, but if you install your own IRQ handler and don't chain (i.e call the previous contents of $314, then you should do a JSR to NB65_VBL_VECTOR every vertical blank. (This routine ends with a RTS not RTI). All this routine does is count clock ticks, so it uses very little raster time. If you miss the occasional VBL, it won't matter too much.
|
||||
|
||||
3) use whatever network functions are desired, by setting up an appropriate buffer of parameters, then setting the function number of the desired function into Y, setting AX to point to the buffer of paramaters, and then calling (via JSR) NB65_DISPATCH_VECTOR. Every function uses the carry flag to indicate errors (set on error, clear otherwise). Some functions return values, either in A, AX, or by updating the buffer that was originally passed in.
|
||||
|
||||
4) it is necessary to call the NB65_PERIODIC_PROCESSING_VECTOR several times a second to check for any inbound packets. If a packet has arrived, it will be processed, and potentially a callback handler may create and send an outbound message in response. This means processing time can vary, and ocassionaly be quite long. Therefore this routine should not be called inside time critical code e..g. an interrupt service routine.
|
||||
|
||||
Functions are defined in the file nb65_constants.i
|
||||
|
||||
Some sample code (in ca65 format) is in test_cart_api.s
|
||||
|
||||
|
||||
---
|
||||
2009-04-06
|
||||
jonno@jamtronix.com
|
Loading…
x
Reference in New Issue
Block a user