dir navigation (forward only)

This commit is contained in:
ikari 2009-11-09 11:15:06 +01:00
parent a9fe8dd09d
commit ecfe7d9831
7 changed files with 76 additions and 36 deletions

View File

@ -1,4 +1,4 @@
OBJS = header.ips reset.o65 main.o65 font.o65 palette.o65 data.o65 const.o65 logo.o65 text.o65 dma.o65 menu.o65 # gfx.o65 # vars.o65
OBJS = header.ips reset.o65 main.o65 font.o65 palette.o65 data.o65 const.o65 logo.o65 text.o65 dma.o65 menu.o65 pad.o65 # gfx.o65 # vars.o65
all: menu.bin menu.smc

View File

@ -80,8 +80,17 @@ hdma_math_src .byt 1
.byt 1
.byt $00, $e0
.byt 10
.byt $20, $f0
.byt $20, $ea
.byt 1
.byt $00, $e0
.byt 0
space64 .byt $20, $20, $20, $20, $20, $20, $20, $20
.byt $20, $20, $20, $20, $20, $20, $20, $20
.byt $20, $20, $20, $20, $20, $20, $20, $20
.byt $20, $20, $20, $20, $20, $20, $20, $20
.byt $20, $20, $20, $20, $20, $20, $20, $20
.byt $20, $20, $20, $20, $20, $20, $20, $20
.byt $20, $20, $20, $20, $20, $20, $20, $20
.byt $20, $20, $20, $20, $20, $20, $20, $20
.byt $00

View File

@ -2,14 +2,20 @@
;don't anger the stack!
dirptr_addr .word 0
dirptr_bank .byt 0
dirstart_addr .word 0
dirstart_bank .byt 0
dirend_addr .word 0
dirend_bank .byt 0
dirend_idx .word 0
dirptr_idx .word 0
dirptr_table .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dirptr_table .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dirent_addr .word 0
dirent_bank .byt 0
dirent_type .byt 0
.byt 0
dirlog .word 0,0,0,0,0,0,0,0,0,0,0,0
dirend_onscreen .byt 0
dirlog_idx .byt 0
dirlog .word 0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
@ -31,8 +37,11 @@ print_y .byt 0 ;y coordinate
.byt 0
print_src .word 0 ;source data address
print_bank .byt 0 ;source data bank
print_pal .byt 0 ;palette number for text output
print_pal .word 0 ;palette number for text output
print_temp .word 0 ;work variable
print_count .byt 0 ;how many characters may be printed?
print_count_tmp .byt 0 ;work variable
print_done .byt 0 ;how many characters were printed?
;----------parameters for dma----------
dma_a_bank .byt 0
dma_a_addr .word 0
@ -49,23 +58,15 @@ bar_y .byt 0 ; pixel y position of select bar
bar_w .byt 0 ; bar width
menu_state .byt 0 ; menu state (0=file select)
menu_dirty .byt 0 ; menu dirty (e.g. after state change or when redraw is needed)
menu_sel .word 0 ; selected item #
cursor_x .byt 0 ; current cursor position (x)
cursor_y .byt 0 ; current cursor position (y)
fd_addr .word 0 ; address of current "file descriptor"
fd_bank .byt 0 ; bank of current "file descriptor"
fd_fnoff .word 0 ; offset of filename in file descriptor
fd_data ; contents of a "file descriptor"
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0
pad1mem .word 0
pad1trig .word 0
pad1delay .word 0
;----------hdma tables in WRAM (must be stable when cartridge is cut off)
hdma_pal .byt 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byt 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

View File

@ -131,7 +131,7 @@ tests:
lda #$03 ;enable BG1+BG2
sta $212c ;BG Main
sta $212d ;BG Sub
lda #$00 ;224
lda #$00 ;224 (01=448)
sta $2133 ;
lda #$00
sta $2130

View File

@ -1,8 +1,8 @@
palette .byt $42, $08, $ff, $7f, $00, $00, $18, $63
.byt $42, $08, $ff, $43, $00, $00, $18, $63
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $42, $08, $ff, $43, $00, $00, $18, $63
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42

View File

@ -12,6 +12,7 @@
; NMI - called on VBlank
NMI_ROUTINE:
sep #$20 : .as
rep #$10 : .xl
lda #$00
pha
plb

View File

@ -1,8 +1,12 @@
.text
#include "memmap.i65"
hiprint:
sep #$20 : .as
lda print_count
sta print_count_tmp
stz print_done
rep #$30 : .xl : .al
lda !print_x
lda print_x
and #$00ff
lsr
bcs print_bg1
@ -18,7 +22,7 @@ print_bg1
phx
bra print_bg_cont
print_bg_cont
sta !print_x
sta !print_temp
lda !print_y
and #$00ff
asl
@ -27,14 +31,14 @@ print_bg_cont
asl
asl
clc
adc !print_x
adc !print_temp
asl ; double the offset for WRAM addressing
tay ; zonday
plx
phy ; offset from tilemap start
stx !print_x
stx !print_temp
clc
adc !print_x
adc !print_temp
; we need to transfer to WRAM and from there to VRAM via DMA during VBLANK
; because VRAM can only be accessed during VBLANK and forced blanking.
sta $2181
@ -51,17 +55,31 @@ print_loop_inner
lda !0,x
asl
sta @$2180
lda #$00
lda @print_pal
asl
asl
adc #$00
sta @$2180
lda @print_done
inc
sta @print_done
inx
lda !0,x
beq print_loop2
inx
lda !0,x
beq print_loop2
inx
lda !0,x
lda @print_count_tmp
dec
dec
sta @print_count_tmp
beq print_loop2
bmi print_loop2
bra print_loop_inner
print_loop2
lda @print_count
dec
sta @print_count_tmp
lda #$00
pha
plb
@ -70,9 +88,9 @@ print_loop2
iny
pla ; offset from tilemap start
plx ; other tilemap addr
stx !print_x
stx !print_temp
clc
adc print_x ; tilemap+offset
adc !print_temp ; tilemap+offset
sta $2181
tyx
sep #$20 : .as
@ -83,15 +101,26 @@ print_loop2_inner
lda !0,x
asl
sta @$2180
lda #$00
lda @print_pal
asl
asl
adc #$00
sta @$2180
lda @print_done
inc
sta @print_done
inx
lda !0,x
beq print_end
inx
lda !0,x
beq print_end
lda @print_count_tmp
dec
dec
sta @print_count_tmp
beq print_end
bmi print_end
bra print_loop2_inner
print_end
lda #$00
@ -107,7 +136,7 @@ loprint:
asl ;double the offset for WRAM addressing
clc
adc #!BG2_TILE_BUF
sta !print_x
sta !print_temp
lda !print_y
and #$00ff
asl
@ -117,7 +146,7 @@ loprint:
asl
asl ;double the offset for WRAM addressing
clc
adc !print_x
adc !print_temp
; we need to transfer to WRAM and from there to VRAM via DMA during VBLANK
; because VRAM can only be accessed during VBLANK and forced blanking.
sta $2181