mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-05-28 20:41:33 +00:00
git-svn-id: http://svn.code.sf.net/p/netboot65/code@28 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
836f3b24a6
commit
56621dd6c2
|
@ -53,8 +53,8 @@ bin_file_jmp: .res 3
|
|||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.bss
|
||||
tftp_dir_buffer: .res 1024
|
||||
|
||||
tftp_dir_buffer = $4000
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
|
@ -141,9 +141,7 @@ startup_copymem:
|
|||
init:
|
||||
|
||||
jsr cls
|
||||
|
||||
jsr select_filename_from_dir
|
||||
|
||||
|
||||
ldax #startup_msg
|
||||
jsr print
|
||||
jsr print_cr
|
||||
|
@ -180,7 +178,8 @@ init:
|
|||
ldax #$0000 ;load address will be first 2 bytes of file we download (LO/HI order)
|
||||
stax tftp_load_address
|
||||
|
||||
jsr select_filename_from_dir
|
||||
ldax #tftp_dir_buffer
|
||||
jsr select_option_from_menu
|
||||
stax tftp_filename
|
||||
|
||||
ldax #downloading_msg
|
||||
|
@ -194,6 +193,7 @@ init:
|
|||
@dir_failed:
|
||||
|
||||
ldax #tftp_dir_listing_fail_msg
|
||||
|
||||
jsr print
|
||||
jsr print_cr
|
||||
|
||||
|
@ -268,65 +268,6 @@ download:
|
|||
clc
|
||||
rts
|
||||
|
||||
select_filename_from_dir:
|
||||
ldax #downloading_msg
|
||||
stax option_description_pointers
|
||||
ldax #tftp_dir_listing_fail_msg
|
||||
stax option_description_pointers+2
|
||||
ldax #tftp_download_ok_msg
|
||||
stax option_description_pointers+4
|
||||
ldax #downloading_msg
|
||||
stax option_description_pointers+6
|
||||
ldax #tftp_dir_listing_fail_msg
|
||||
stax option_description_pointers+8
|
||||
ldax #tftp_download_ok_msg
|
||||
stax option_description_pointers+10
|
||||
ldax #downloading_msg
|
||||
stax option_description_pointers+12
|
||||
ldax #tftp_dir_listing_fail_msg
|
||||
stax option_description_pointers+14
|
||||
ldax #tftp_download_ok_msg
|
||||
stax option_description_pointers+16
|
||||
ldax #downloading_msg
|
||||
stax option_description_pointers+18
|
||||
ldax #tftp_dir_listing_fail_msg
|
||||
stax option_description_pointers+20
|
||||
ldax #tftp_download_ok_msg
|
||||
stax option_description_pointers+22
|
||||
ldax #downloading_msg
|
||||
stax option_description_pointers+24
|
||||
ldax #tftp_dir_listing_fail_msg
|
||||
stax option_description_pointers+26
|
||||
ldax #tftp_download_ok_msg
|
||||
stax option_description_pointers+28
|
||||
ldax #downloading_msg
|
||||
stax option_description_pointers+30
|
||||
ldax #tftp_dir_listing_fail_msg
|
||||
stax option_description_pointers+32
|
||||
ldax #tftp_download_ok_msg
|
||||
stax option_description_pointers+34
|
||||
ldax #downloading_msg
|
||||
stax option_description_pointers+36
|
||||
ldax #tftp_dir_listing_fail_msg
|
||||
stax option_description_pointers+38
|
||||
ldax #tftp_download_ok_msg
|
||||
stax option_description_pointers+40
|
||||
ldax #downloading_msg
|
||||
stax option_description_pointers+42
|
||||
ldax #tftp_dir_listing_fail_msg
|
||||
stax option_description_pointers+44
|
||||
ldax #tftp_download_ok_msg
|
||||
stax option_description_pointers+46
|
||||
|
||||
lda #24
|
||||
sta number_of_options
|
||||
|
||||
jsr select_option_from_menu
|
||||
sta current_option
|
||||
jsr print_hex
|
||||
@fixme:
|
||||
jmp @fixme
|
||||
rts
|
||||
.rodata
|
||||
downloading_msg: .asciiz "DOWNLOADING "
|
||||
|
||||
|
@ -348,4 +289,3 @@ tftp_download_ok_msg:
|
|||
.asciiz "DOWNLOAD OK"
|
||||
|
||||
startup_msg: .byte "UTHERNET NETWORK BOOT CLIENT V0.1",0
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
OPTIONS_PER_PAGE = 5
|
||||
OPTIONS_PER_PAGE = 7
|
||||
.bss
|
||||
|
||||
number_of_options: .res 1
|
||||
|
@ -13,11 +13,51 @@ option_description_pointers: .res 256 ;table of addresses of up to 128 filename
|
|||
.code
|
||||
|
||||
|
||||
;on entry, AX should point to the list of null terminated option strings to be selected from
|
||||
;on exit, AX points to the selected string
|
||||
select_option_from_menu:
|
||||
|
||||
stax @lda_from_options_source+1
|
||||
ldy #0
|
||||
sty number_of_options
|
||||
|
||||
|
||||
@copy_one_pointer:
|
||||
jsr @lda_from_options_source
|
||||
beq @found_last_option_string
|
||||
|
||||
lda @lda_from_options_source+1
|
||||
sta option_description_pointers,y
|
||||
lda @lda_from_options_source+2
|
||||
sta option_description_pointers+1,y
|
||||
iny
|
||||
iny
|
||||
|
||||
inc number_of_options
|
||||
|
||||
@scan_for_null_byte:
|
||||
jsr @move_to_next_byte
|
||||
jsr @lda_from_options_source
|
||||
bne @scan_for_null_byte
|
||||
|
||||
jsr @move_to_next_byte
|
||||
jmp @copy_one_pointer
|
||||
|
||||
@lda_from_options_source:
|
||||
lda $FFFF ;filled in from above
|
||||
rts
|
||||
|
||||
@move_to_next_byte:
|
||||
inc @lda_from_options_source+1
|
||||
bne :+
|
||||
inc @lda_from_options_source+2
|
||||
:
|
||||
rts
|
||||
|
||||
@found_last_option_string:
|
||||
|
||||
@display_first_page_of_options:
|
||||
lda #0
|
||||
; lda #15
|
||||
sta first_option_this_page
|
||||
|
||||
@print_current_page:
|
||||
|
@ -42,6 +82,7 @@ select_option_from_menu:
|
|||
lda #')'
|
||||
jsr print_a
|
||||
jsr print_cr
|
||||
jsr print_cr
|
||||
lda #0
|
||||
sta options_shown_this_page
|
||||
|
||||
|
@ -52,9 +93,12 @@ select_option_from_menu:
|
|||
adc #'A'
|
||||
jsr print_a
|
||||
|
||||
lda #'-'
|
||||
lda #')'
|
||||
jsr print_a
|
||||
|
||||
|
||||
lda #' '
|
||||
jsr print_a
|
||||
|
||||
lda current_option
|
||||
asl
|
||||
tax
|
||||
|
@ -77,8 +121,8 @@ select_option_from_menu:
|
|||
jmp @print_loop
|
||||
|
||||
@get_keypress:
|
||||
lda #'?'
|
||||
jsr get_key
|
||||
; jsr print_hex ;for debugging
|
||||
cmp #$95
|
||||
beq @forward_one_page
|
||||
cmp #$8a
|
||||
|
@ -94,7 +138,7 @@ select_option_from_menu:
|
|||
bcc @get_keypress ;if we have underflowed, it wasn't a valid option
|
||||
cmp #OPTIONS_PER_PAGE-1
|
||||
beq @got_valid_option
|
||||
bpl@get_keypress ;if we have underflowed, it wasn't a valid option
|
||||
bpl @get_keypress ;if we have underflowed, it wasn't a valid option
|
||||
|
||||
@got_valid_option:
|
||||
|
||||
|
@ -104,8 +148,14 @@ select_option_from_menu:
|
|||
bcs @get_keypress ;this cmp/bcs is to check the case where we are on the last page of options (which can have less than then
|
||||
;normal number of options) and have pressed a letter that is not a valid option for this page, but is for all other
|
||||
;pages.
|
||||
;a now contains the index of the selected option
|
||||
asl ;double it
|
||||
tay
|
||||
lda option_description_pointers+1,y
|
||||
tax
|
||||
lda option_description_pointers,y
|
||||
rts
|
||||
jmp @get_keypress
|
||||
|
||||
|
||||
@forward_one_page:
|
||||
clc
|
||||
|
@ -114,6 +164,7 @@ jmp @get_keypress
|
|||
sta first_option_this_page
|
||||
cmp number_of_options
|
||||
bmi @not_last_page_of_options
|
||||
@back_to_first_page:
|
||||
jmp @display_first_page_of_options
|
||||
@not_last_page_of_options:
|
||||
jmp @print_current_page
|
||||
|
@ -123,13 +174,13 @@ jmp @get_keypress
|
|||
lda first_option_this_page
|
||||
sbc #OPTIONS_PER_PAGE
|
||||
bcc @show_last_page_of_options
|
||||
@back_to_first_page:
|
||||
sta first_option_this_page
|
||||
jmp @print_current_page
|
||||
@show_last_page_of_options:
|
||||
sec
|
||||
lda number_of_options
|
||||
sbc #OPTIONS_PER_PAGE
|
||||
bcc @back_to_first_page
|
||||
sta first_option_this_page
|
||||
jmp @print_current_page
|
||||
; ldax #tftp_dir_buffer
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;########################
|
||||
; minimal tftp implementation (client only)
|
||||
; supports file download (not upload) and directory listing per http://www.watersprings.org/pub/id/draft-johnston-tftp-directory-01.txt draft RFC
|
||||
; supports file download (not upload) and custom directory listing (using opcode of 0x65)
|
||||
; written by jonno@jamtronix.com 2009
|
||||
;
|
||||
;########################
|
||||
|
@ -103,7 +103,7 @@ tftp_opcode: .res 2 ; will be set to 4 if we are doing a RRQ, or 7 if we are doi
|
|||
.code
|
||||
|
||||
tftp_directory_listing:
|
||||
ldax #$0700 ;opcode 07 = DIR (http://www.watersprings.org/pub/id/draft-johnston-tftp-directory-01.txt draft RFC)
|
||||
ldax #$6500 ;opcode 65 = netboot65 DIR (non-standard opcode)
|
||||
jmp set_tftp_opcode
|
||||
|
||||
tftp_download:
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#
|
||||
# minimal TFTP server implementation for use with netboot65
|
||||
#
|
||||
# supports RRQ and DIR requests per http://www.watersprings.org/pub/id/draft-johnston-tftp-directory-01.txt
|
||||
# however, DIR "information string" contains file size only (as an ASCII string), NOT the full UTC timestamp
|
||||
# supports RRQ and a custom DIR request (opcode 0x65 - returns null terminated list of filenames that match specified filemask)
|
||||
# Jonno Downes (jonno@jamtronix.com) - January, 2009
|
||||
#
|
||||
#
|
||||
|
@ -16,7 +15,7 @@ class Netboot65TFTPServer
|
|||
3=>'DATA',
|
||||
4=>'ACK',
|
||||
5=>'ERROR',
|
||||
7=>'DIR',
|
||||
0x65=>'DIR',
|
||||
}
|
||||
|
||||
TFTP_ERRORCODES={
|
||||
|
@ -115,7 +114,7 @@ class Netboot65TFTPServer
|
|||
send_error(client_ip,client_port,1,"'#{filename}' not found")
|
||||
end
|
||||
end
|
||||
when 7 : #DIR REQUEST
|
||||
when 0x65 : #DIR REQUEST
|
||||
opcode,filemask_and_mode=data.unpack("nA*")
|
||||
filemask,mode=filemask_and_mode.split(0.chr)
|
||||
log_msg "DIR for #{filemask} (#{mode})"
|
||||
|
@ -124,7 +123,7 @@ class Netboot65TFTPServer
|
|||
else
|
||||
data_to_send=""
|
||||
Dir.chdir(bootfile_dir) do
|
||||
Dir.glob(filemask).each {|filename| data_to_send<<"#{filename}\000#{File.size(filename)}\000"}
|
||||
Dir.glob(filemask).each {|filename| data_to_send<<"#{filename}\000"}
|
||||
end
|
||||
data_to_send<<0.chr
|
||||
Thread.new {send_data(client_ip,client_port,"DIR of #{filemask}",data_to_send)}
|
||||
|
|
Loading…
Reference in New Issue
Block a user