git-svn-id: http://svn.code.sf.net/p/netboot65/code@129 93682198-c243-4bdb-bd91-e943c89aac3b

This commit is contained in:
jonnosan 2009-04-25 12:04:27 +00:00
parent d725dad43e
commit 4ebb0a5ed3
5 changed files with 130 additions and 108 deletions

View File

@ -1,4 +1,6 @@
;use the NB65 API to send a d64 disk via TFTP
;
;
.ifndef NB65_API_VERSION_NUMBER
.define EQU =
@ -17,7 +19,17 @@
jsr print_a
.endmacro
;######### KERNEL functions
CHKIN = $ffc6
CHKOUT = $ffc9
CHRIN = $ffcf
CHROUT = $ffd2
CLALL = $FFE7
CLOSE = $ffc3
OPEN = $ffc0
READST = $ffb7
SETNAM = $ffbd
SETLFS = $ffba
.bss
current_byte: .res 1
@ -115,20 +127,30 @@ init:
; main program goes here:
;
jsr CLALL
; ldx #18
; stx track
; ldx #1
; stx sector
; ldx #21
; stx sectors_in_track
; ldax #sector_buffer
; jsr send_next_block
; rts
@send_1_image:
lda #$93 ;cls
jsr print_a
print #signon_message
jsr move_to_first_sector
jsr reset_counters_to_first_sector
print #enter_filename
ldax #filter_dns ;this is pretty close to being a filter for legal chars in file names as well
jsr get_filtered_input
bcs @no_filename_entered
stax nb65_param_buffer+NB65_TFTP_FILENAME
lda #15
jsr open_channel
print #position_cursor_for_track_display
ldax #send_next_block
stax nb65_param_buffer+NB65_TFTP_POINTER
@ -140,7 +162,7 @@ init:
jmp print_nb65_errorcode
:
lda #15 ; filenumber 15 - command channel
jsr $FFC3 ; call CLOSE
jsr CLOSE
print_cr
print #ok
print #press_a_key_to_continue
@ -169,10 +191,16 @@ send_next_block:
ldax #$100
rts
@not_last_sector:
; jsr dump_sector ;DEBUG
inc sector_buffer_address+1
jsr read_sector
jsr move_to_next_sector
ldax #$200
; jsr dump_sector ;DEBUG
rts
@past_last_track:
ldax #$0000
@ -207,57 +235,6 @@ print_current_sector:
rts
;open whatever channel is in A
.bss
channel_number: .res 1
.code
open_channel:
sta channel_number
LDA #0 ;zero length filename
JSR $FFBD ; call SETNAM
LDA channel_number ; file number
LDX #$08 ; default to device 8
LDA channel_number ; secondary address 2
JSR $FFBA ; call SETLFS
JSR $FFC0 ; call OPEN
beq @no_error
pha
print #error_opening_channel
lda channel_number
call #NB65_PRINT_HEX
pla
jsr print_a_as_errorcode
@no_error:
rts
;send ASCIIZ string in AX to channel Y
send_string_to_channel:
sty channel_number
stax temp_ptr
ldx channel_number
jsr $ffc9 ;CHKOUT
ldy #0
@send_one_byte:
lda (temp_ptr),y
bne @done
jsr $ffd2 ; call CHROUT (send byte through command channel)
beq @error
jmp @send_one_byte
@done:
ldx #0 ;send output to screen again
jsr $ffc9 ;CHKOUT
rts
@error:
pha
print #error_sending_to_channel
lda channel_number
call #NB65_PRINT_HEX
jsr $ffb7 ;READST
jsr print_a_as_errorcode
jsr get_key
rts
dump_sector:
;hex dump sector
@ -276,44 +253,74 @@ read_sector:
; - requires track and sector values be set first
; sector will be written to address whos value is stored in sector_data
; open the channel file
jsr make_read_sector_command
ldax command_buffer
ldy #15
jsr send_string_to_channel
jsr check_error_channel
lda #2
jsr open_channel
LDX #$02 ; filenumber 2
JSR $FFC6 ; call CHKIN (file 2 now used as input)
LDA sector_buffer_address
STA temp_ptr
LDA sector_buffer_address+1
STA temp_ptr+1
LDY #$00
jsr make_read_sector_command
lda #1
ldx #<cname
ldy #>cname
jsr SETNAM
lda #02
ldx #08
ldy #02
jsr SETLFS
jsr OPEN
bcs @error
ldx #<command_buffer
ldy #>command_buffer
lda #12
jsr SETNAM
lda #15
ldx $BA ;use whatever was last device #
ldy #15
jsr SETLFS
jsr OPEN
bcs @error
jsr check_error_channel
lda #$30
cmp error_buffer
beq @was_not_an_error
print #error_buffer
@was_not_an_error:
ldx #$02 ; filenumber 2
jsr CHKIN ;(file 2 now used as input)
lda sector_buffer_address
sta temp_ptr
lda sector_buffer_address+1
sta temp_ptr+1
ldy #$00
@loop:
JSR $FFCF ; call CHRIN (get a byte from file)
STA (temp_ptr),Y ; write byte to memory
INY
BNE @loop ; next byte, end when 256 bytes are read
jsr CHRIN ;(get a byte from file)
sta (temp_ptr),Y ; write byte to memory
iny
bne @loop ; next byte, end when 256 bytes are read
@close:
LDA #$02 ; filenumber 2
JSR $FFC3 ; call CLOSE
LDX #$00 ; filenumber 0 = keyboard
JSR $FFC6 ; call CHKIN (keyboard now input device again)
RTS
lda #15 ; filenumber 15
jsr CLOSE
lda #$02 ; filenumber 2
jsr CLOSE
ldx #$00 ; filenumber 0 = keyboard
jsr CHKIN ;(keyboard now input device again)
rts
@error:
pha
print #error_opening_channel
pla
call #NB65_PRINT_HEX
jmp @close
check_error_channel:
LDX #$0F ; filenumber 15
JSR $FFC6 ; call CHKIN (file 15 now used as input)
JSR CHKIN ;(file 15 now used as input)
LDY #$00
@loop:
JSR $FFB7 ; call READST (read status byte)
JSR READST ;(read status byte)
BNE @eof ; either EOF or read error
JSR $FFCF ; call CHRIN (get a byte from file)
JSR CHRIN ;(get a byte from file)
sta error_buffer,y
iny
JMP @loop ; next byte
@ -322,7 +329,7 @@ check_error_channel:
lda #0
sta error_buffer,y
LDX #$00 ; filenumber 0 = keyboard
JSR $FFC6 ; call CHKIN (keyboard now input device again)
JSR CHKIN ;(keyboard now input device again)
RTS
bad_boot:
@ -441,7 +448,7 @@ byte_to_ascii:
rts
move_to_first_sector:
reset_counters_to_first_sector:
ldx #1
stx track
dex
@ -505,6 +512,7 @@ initializing:
track_no:
.byte "TRACK ",0
sector_no:
.byte " SECTOR ",0
@ -520,9 +528,10 @@ drive_error:
.byte "NO NB65 API FOUND",13,"PRESS ANY KEY TO RESET", 0
error_opening_channel:
.byte "ERROR OPENING CHANNEL $",0
error_sending_to_channel:
.byte "ERROR SENDING TO CHANNEL $",0
disk_access:
.byte 13,13,13,13,13,"SENDING TO CHANNEL $",0
nb65_signature:
.byte $4E,$42,$36,$35 ; "NB65" - API signature
.byte ' ',0 ; so we can use this as a string
@ -531,5 +540,5 @@ position_cursor_for_track_display:
.byte $13,13,13,"SENDING ",0
position_cursor_for_error_display:
.byte $13,13,13,13,"LAST ",0
disk_error:
cname: .byte '#'

5
dist/make_dist.rb vendored
View File

@ -19,13 +19,16 @@ end
#["client/nb65/nb65_rrnet.bin","c64/"],
["client/nb65/nb65_c64_ram.prg","c64/"],
["client/nb65/nb65_std_cart.bin","c64/"],
#["client/nb65/d64_upload.prg","boot/"],
["client/nb65/d64_upload.prg","boot/"],
["server/lib/tftp_server.rb","lib"],
["server/bin/tftp_only_server.rb","bin/tftp_server.rb"],
["server/bin/import_ags_games.rb","bin"],
["server/boot/BOOTA2.PG2","boot"],
["doc/README.Apple2.html","a2"],
["doc/README.C64.html","c64"],
["doc/netboot65.html","doc/index.html"],
["doc/README.Apple2.html","doc"],
["doc/README.C64.html","doc"],
["doc/nb65_api_technical_reference.doc","doc"],
["client/inc/common.i","inc"],
["client/inc/nb65_constants.i","inc"],

View File

@ -54,17 +54,17 @@ These may be fixed in a future release.
<li>TFTP extension to IP65 - Jonno Downes - jonno@jamtronix.com
<h2>INSPIRATION</h2>
<li>Apple 2 Game Server - http://a2gameserver.berlios.de/
<li>AppleWin - http://applewin.berlios.de/
<li>comp.sys.apple2 regulars - http://groups.google.com.au/group/comp.sys.apple2/
<li><a href=http://a2gameserver.berlios.de/>Apple 2 Game Server</a>
<li><a href=http://applewin.berlios.de/>AppleWin</a>
<li><a href=http://groups.google.com.au/group/comp.sys.apple2/>comp.sys.apple2 regulars</a>
<h2>LICENSE</h2>
NETBOOT65 is licensed under the same terms as IP65, the Mozilla Public License Version 1.1.
For details, please visit http://www.mozilla.org/MPL/
NETBOOT65 is licensed under the same terms as IP65, the <a href=http://www.mozilla.org/MPL/>Mozilla Public License Version 1.1.</a>
<h2>SOURCE CODE</h2>
Available at http://sourceforge.net/svn/?group_id=250168
Browse online at <a href=http://netboot65.svn.sourceforge.net/viewvc/netboot65/>http://netboot65.svn.sourceforge.net/viewvc/netboot65/</a> or else download the whole tree through SVN with the following instruction set:
<pre>svn co https://netboot65.svn.sourceforge.net/svnroot/netboot65 netboot65 </pre>
<h2>AUTHOR</h2>
Jonno Downes - jonno@jamtronix.com

View File

@ -7,7 +7,7 @@
</ol>
<h2>TO USE WITH VICE</h2>
Run VICE with the nb65_std_cart.bin cartridge image attached (e.g. "x64.exe -cart8 nb65_std_cart.bin")
Run <a href=http://www.viceteam.org/>VICE</a> with the nb65_std_cart.bin cartridge image attached (e.g. "x64.exe -cart8 nb65_std_cart.bin")
<h2>TO USE WITH A REAL C64</h2>
<h3>Option 1 - Hardcore</h3>
@ -16,7 +16,6 @@ Run VICE with the nb65_std_cart.bin cartridge image attached (e.g. "x64.exe -car
<h3>Option 2 - Just dabbling</h3>
You can just run the nb65_c64_ram.prg program (which is essentially the cartridge image plus a loader prg to insert the image into the right place in RAM).
<h2>USING THE CARTRIDGE</h2>
When the cartridge starts, it will attempt to configure the IP stack via DHCP. If the DHCP config fails (either by timing out, or the user press RUN/STOP)
@ -55,12 +54,11 @@ Due to a limitation in the menu selection code, only the first 128 PRG files in
<li>a working ruby installation</li>
</ol>
<h2>LICENSE</h2>
NETBOOT65 is licensed under the same terms as IP65, the Mozilla Public License Version 1.1.
For details, please visit http://www.mozilla.org/MPL/
NETBOOT65 is licensed under the same terms as IP65, the <a href=http://www.mozilla.org/MPL/>Mozilla Public License Version 1.1.</a>
<h2>SOURCE CODE</h2>
Available at http://sourceforge.net/svn/?group_id=250168
Browse online at <a href=http://netboot65.svn.sourceforge.net/viewvc/netboot65/>http://netboot65.svn.sourceforge.net/viewvc/netboot65/</a> or else download the whole tree through SVN with the following instruction set:
<pre>svn co https://netboot65.svn.sourceforge.net/svnroot/netboot65 netboot65 </pre>
<h2>AUTHOR</h2>
Jonno Downes - jonno@jamtronix.com

View File

@ -79,7 +79,14 @@ td {
<h1>netboot65</h1>
<p>
netboot65 is a project to support network booting C64 and Apple ][computers. It is based on the <a href=http://ip65.sourceforge.net/>IP65 TCP/IP stack</a> .
netboot65 is a project to support network booting C64 and Apple ][computers. It is based on the <a href=http://ip65.sourceforge.net/>IP65 TCP/IP stack</a>. Current components are:
<ul>
<li>a server (written in <a href=http://www.ruby-lang.org/>ruby</a> for maximum portability) that provides a TFTP server with some proprietary extensions to allow clients to request a directory listing.
<li>clients (currently available as a disk image for Apple ][, and either a cartridge or a standalone prg file for C64) that initialises an IP stack, acquires an IP address via DHCP, queries the local LAN for a TFTP server,
and then allows a program file to be downloaded via TFTP and executed. Currently only 'single load' programs are supported, but many old games and utility programs can be run in this way.
<li>the NB65 API (currently for C64 only) that allows for IP aware applications to be developed without being tied to a specific MAC address, IP address or network device, as is the case with most existing
IP libraries for 6502 computers.
</ul>
</p>
<h2>Status</h2>
@ -89,18 +96,23 @@ netboot65 is a project to support network booting C64 and Apple ][computers. It
<ul>
<li><a href=README.C64.html>C64 documentation</a>
<li><a href=README.Apple2.html>Apple ][ documentation</a>
<li><a href="http://netboot65.svn.sourceforge.net/viewvc/netboot65/doc/nb65_api_technical_reference.doc">NB65 API Technical Reference (word doc)</a>
<li><a href="nb65_api_technical_reference.doc">NB65 API Technical Reference (word doc)</a>
</ul>
<h2>Download</h2>
<a href="https://sourceforge.net/project/showfiles.php?group_id=250168">Latest release</a> (sourceforge.net)<p>
<h2>License</h2>
This project is released under the Mozilla Public License Version 1.1.
For details, please visit <a href="http://www.mozilla.org/MPL/">http://www.mozilla.org/MPL/</a>.
<h2>Source Code</h2>
Browse online at <a href=http://netboot65.svn.sourceforge.net/viewvc/netboot65/>http://netboot65.svn.sourceforge.net/viewvc/netboot65/</a> or else download the whole tree through SVN with the following instruction set:
<pre>svn co https://netboot65.svn.sourceforge.net/svnroot/netboot65 netboot65 </pre>
<p>
<a href="http://sourceforge.net/">
Project Web Hosted by <img src="http://sflogo.sourceforge.net/sflogo.php?group_id=250168&amp;type=3" alt="SourceForge.net" />