From 27df47e41a6d6974882eb7e6fc624606b7f8b761 Mon Sep 17 00:00:00 2001 From: jonnosan Date: Sat, 28 Mar 2009 13:58:41 +0000 Subject: [PATCH] git-svn-id: http://svn.code.sf.net/p/netboot65/code@72 93682198-c243-4bdb-bd91-e943c89aac3b --- client/inc/nb65_constants.i | 18 ++++++++++++------ dist/make_dist.rb | 6 ++++-- doc/netboot65_api.txt | 20 ++++++++++++++++++++ 3 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 doc/netboot65_api.txt diff --git a/client/inc/nb65_constants.i b/client/inc/nb65_constants.i index 762b8f8..1446516 100644 --- a/client/inc/nb65_constants.i +++ b/client/inc/nb65_constants.i @@ -3,12 +3,12 @@ NB65_API_VERSION=$0001 ;offsets in NB65 configuration structure -NB65_CFG_MAC = $00 ;6 byte MAC address -NB65_CFG_IP = NB65_CFG_MAC+$06 ;4 byte local IP address (will be overwritten by DHCP) -NB65_CFG_NETMASK = NB65_CFG_IP+$04 ;4 byte local netmask (will be overwritten by DHCP) -NB65_CFG_GATEWAY = NB65_CFG_NETMASK+$04 ;4 byte local gateway (will be overwritten by DHCP) -NB65_CFG_DNS_SERVER = NB65_CFG_GATEWAY+$04 ;4 byte IP address of DNS server (will be overwritten by DHCP) -NB65_CFG_DHCP_SERVER = NB65_CFG_DNS_SERVER+$04 ;4 byte IP address of DHCP server (will only be set by DHCP initialisation) +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) ;offsets in TFTP paramater structure NB65_TFTP_CALL_MODE = $00 ;1 byte for 'mode' : $00 means read/write from RAM, (and TFTP_POINTER is address to read from @@ -20,6 +20,12 @@ NB65_TFTP_POINTER = $07 ;2 byte pointer to memory location ;function numbers +;to make a function call: +; Y = function number +; AX = pointer to paramater buffer (for functions that take paramaters) +; 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 paramater buffer they were called with. NB65_GET_API_VERSION =$00 ;no inputs, outputs X=major version number, A=minor version number NB65_GET_DRIVER_NAME =$01 ;no inputs, outputs AX=pointer to asciiz driver name NB65_GET_IP_CONFIG_PTR =$02 ;no inputs, outputs AX=pointer to IP configuration structure (which can be modified) diff --git a/dist/make_dist.rb b/dist/make_dist.rb index 958b50e..36014e4 100644 --- a/dist/make_dist.rb +++ b/dist/make_dist.rb @@ -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",].each do |dir_suffix| +["","client","lib","bin","boot","doc"].each do |dir_suffix| dir_path="#{WORKING_DIR}/#{dir_suffix}" Dir.mkdir(dir_path) unless File.exist?(dir_path) end @@ -20,7 +20,9 @@ end ["server/bin/tftp_only_server.rb","bin/tftp_server.rb"], ["server/bin/import_ags_games.rb","bin"], ["server/boot/BOOTA2.PG2","boot"], -["doc/README.*.txt",""], +["doc/README.*.txt","doc"], +["doc/netboot65_api.txt","doc"], +["client/inc/nb65_constants.i","doc"], ].each do |args| dest="#{WORKING_DIR}/#{args[1]}" Dir["#{SRC_DIR}/#{args[0]}"].each do |src| diff --git a/doc/netboot65_api.txt b/doc/netboot65_api.txt new file mode 100644 index 0000000..623473b --- /dev/null +++ b/doc/netboot65_api.txt @@ -0,0 +1,20 @@ +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) set up a custom IRQ handler that will call the NB65_VBL_VECTOR routine 60 times a second - (this routine ends with a RTS not RTI). All this routine does is count clock ticks, so it uses very little raster time + +2) 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. + +3) 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 \ No newline at end of file