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

This commit is contained in:
jonnosan 2009-01-25 14:27:24 +00:00
parent 167d0009d0
commit 836f3b24a6
5 changed files with 219 additions and 12 deletions

View File

@ -4,10 +4,16 @@ LD=ld65
CFLAGS=-Oirs -t $(TARGET)
AFLAGS=
INCFILES=\
../inc/common.i\
../inc/commonprint.i\
../inc/net.i\
../inc/menu.i\
%.o: %.c
$(CC) -c $(CFLAGS) $<
%.o: %.s ../inc/print.i
%.o: %.s $(INCFILES)
$(AS) $(AFLAGS) $<
IP65LIB=../ip65/ip65.lib
@ -17,11 +23,7 @@ APPLE2NETLIB=../drivers/apple2net.lib
BOOTA2.PG2=../../server/boot/BOOTA2.PG2
INCFILES=\
../inc/common.i\
../inc/commonprint.i\
../inc/net.i\
all: \
rrnetboot.bin \
utherboot.dsk \

View File

@ -11,7 +11,10 @@
.include "../inc/common.i"
.include "../inc/commonprint.i"
.include "../inc/net.i"
.include "../inc/menu.i"
.import cls
.import get_key
.importzp tftp_filename
.import tftp_load_address
@ -53,8 +56,6 @@ bin_file_jmp: .res 3
.bss
tftp_dir_buffer: .res 1024
filename_locations: .res 256
.segment "STARTUP"
@ -137,14 +138,17 @@ startup_copymem:
.code
init:
init:
jsr cls
jsr select_filename_from_dir
ldax #startup_msg
jsr print
jsr print_cr
init_ip_via_dhcp
bcc :+
jmp bad_boot
@ -241,6 +245,7 @@ init:
jmp disable_language_card
bad_boot:
jmp $3d0
@ -264,12 +269,68 @@ download:
rts
select_filename_from_dir:
ldax #tftp_dir_buffer
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 "
getting_dir_listing_msg: .asciiz "RETRIEVING TFTP DIRECTORY "
getting_dir_listing_msg: .asciiz "FETCHING TFTP DIRECTORY FOR "
tftp_dir_listing_fail_msg:
.asciiz "DIR LISTING FAILED"

View File

@ -17,7 +17,7 @@ DRIVERS=\
all: $(DRIVERS)
apple2net.lib: a2print.o uthernet.o a2timer.o a2kernal.o
apple2net.lib: a2print.o uthernet.o a2timer.o a2kernal.o a2input.o
ar65 a apple2net.lib $^
c64net.lib: c64print.o rr-net.o c64timer.o c64kernal.o

5
client/drivers/a2input.s Normal file
View File

@ -0,0 +1,5 @@
.export get_key
.code
get_key:
jmp $fd1b

139
client/inc/menu.i Normal file
View File

@ -0,0 +1,139 @@
OPTIONS_PER_PAGE = 5
.bss
number_of_options: .res 1
current_option: .res 1
first_option_this_page: .res 1
options_shown_this_page: .res 1
option_description_pointers: .res 256 ;table of addresses of up to 128 filenames
.code
select_option_from_menu:
@display_first_page_of_options:
lda #0
; lda #15
sta first_option_this_page
@print_current_page:
jsr cls
ldax #select_from_following_options
jsr print
lda #'('
jsr print_a
lda #'$'
jsr print_a
lda first_option_this_page
sta current_option
clc
adc #1
jsr print_hex
lda #'/'
jsr print_a
lda #'$'
jsr print_a
lda number_of_options
jsr print_hex
lda #')'
jsr print_a
jsr print_cr
lda #0
sta options_shown_this_page
@print_loop:
lda options_shown_this_page
clc
adc #'A'
jsr print_a
lda #'-'
jsr print_a
lda current_option
asl
tax
lda option_description_pointers,x
tay
lda option_description_pointers+1,x
tax
tya
jsr print
jsr print_cr
inc current_option
lda current_option
cmp number_of_options
beq @get_keypress
inc options_shown_this_page
lda options_shown_this_page
cmp #OPTIONS_PER_PAGE
beq @get_keypress
jmp @print_loop
@get_keypress:
jsr get_key
; jsr print_hex ;for debugging
cmp #$95
beq @forward_one_page
cmp #$8a
beq @forward_one_page
cmp #$8b
beq @back_one_page
cmp #$88
beq @back_one_page
ora #$e0 ;make it a lower case letter with high bit set
sec
sbc #$e1
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
@got_valid_option:
clc
adc first_option_this_page
cmp number_of_options
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.
rts
jmp @get_keypress
@forward_one_page:
clc
lda first_option_this_page
adc #OPTIONS_PER_PAGE
sta first_option_this_page
cmp number_of_options
bmi @not_last_page_of_options
jmp @display_first_page_of_options
@not_last_page_of_options:
jmp @print_current_page
@back_one_page:
sec
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
sta first_option_this_page
jmp @print_current_page
; ldax #tftp_dir_buffer
; stax temp_filename_ptr
.rodata
select_from_following_options: .byte "SELECT ONE OF THE FOLLOWING OPTIONS:",13,0