From 8eeda87d254425a9ba0233d0fe6af67cbacc1654 Mon Sep 17 00:00:00 2001 From: ikari Date: Fri, 6 Nov 2009 09:59:51 +0100 Subject: [PATCH] WIP Display game list --- snes/Makefile | 4 +++- snes/const.a65 | 18 ------------------ snes/data.a65 | 24 +++++++++++++++++++----- snes/main.a65 | 47 ++++++++++++++++++----------------------------- src/main.c | 2 +- 5 files changed, 41 insertions(+), 54 deletions(-) diff --git a/snes/Makefile b/snes/Makefile index 12389b3..df04b01 100644 --- a/snes/Makefile +++ b/snes/Makefile @@ -1,7 +1,9 @@ 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 -all: menu.bin +all: menu.bin menu.smc +menu.smc: menu.bin + cat menu.bin sd2snes.rom > $@ menu.bin: $(OBJS) sneslink -fsmc -o $@ $^ diff --git a/snes/const.a65 b/snes/const.a65 index c43caa7..90f38c4 100644 --- a/snes/const.a65 +++ b/snes/const.a65 @@ -84,22 +84,4 @@ hdma_math_src .byt 1 .byt 1 .byt $00, $e0 .byt 0 -hello -.byt " _ " -.byt " \\`*-. " -.byt " ) _`-. " -.byt " . : `. . " -.byt " : _ ' \\ " -.byt " ",$3b," *` _. `*-._ " -.byt " `-.-' `-. " -.byt " ",$3b," ` `. " -.byt " :. . \\ " -.byt " . \\ . : .-' . " -.byt " ' `+.",$3b," ",$3b," ' : " -.byt " : ' | ",$3b," ",$3b,"-. " -.byt " ",$3b," ' : :`-: _.`* ",$3b," " -.byt " [bug] .*' / .*' ",$3b," .*`- +' `*' " -.byt " `*-* `*-* `*-*' ", 0 - -lohello .byt "Miau", 0 diff --git a/snes/data.a65 b/snes/data.a65 index a2cdc50..126db9d 100644 --- a/snes/data.a65 +++ b/snes/data.a65 @@ -1,8 +1,15 @@ .data ;don't anger the stack! -dirlog .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 +dirptr_addr .word 0 +dirptr_bank .byt 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 +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 .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 @@ -40,9 +47,14 @@ bar_yl .byt 0 ; logical y position of select bar bar_x .byt 0 ; pixel x position of select bar 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) +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" -file_path ; assembled current path +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 @@ -51,7 +63,9 @@ file_path ; assembled current path .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 ;----------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 diff --git a/snes/main.a65 b/snes/main.a65 index 8a7fcd9..3a63292 100644 --- a/snes/main.a65 +++ b/snes/main.a65 @@ -10,10 +10,11 @@ GAME_MAIN: jsr colortest sep #$20 : .as lda #$00 - sta @$AVR_CMD - sta @$AVR_BANK + sta @AVR_CMD + sta @AVR_PARAM rep #$20 : .al - sta @$AVR_ADDR + sta @AVR_PARAM+1 + jsr menu_init sep #$20 : .as jsr menuloop cli @@ -137,37 +138,13 @@ tests: stz $2121 lda #$0f sta $2100 ;screen on, full brightness - lda #0 - sta print_x - lda #10 - sta print_y - lda #^hello - ldx #!hello - sta print_bank - stx print_src - jsr hiprint - lda #^version - ldx #!version - sta print_bank - stx print_src - stz print_x - lda #8 - sta print_y - jsr loprint - lda #3 - sta print_y - stz print_x - lda #$C0 - ldx #$B000 - sta print_bank - stx print_src - jsr loprint - lda #10 + lda #9 sta bar_yl rts snes_init: sep #$20 : .as ;8-bit accumulator + rep #$10 : .xl ;16-bit index lda #$01 sta $420d ; FAAAAAST lda #$8f @@ -256,5 +233,17 @@ snes_init: stz $420a ; stz $420b ; stz $420c ; +;clear WRAM lower page +; ldx #$0200 +; stx $2181 +; lda #$00 +; sta $2183 +; DMA0(#$08, #$FF00, #^zero, #!zero, #$80) +; ldx #$0000 +; stx $2181 +; lda #$00 +; sta $2183 +; DMA0(#$08, #$1e0, #^zero, #!zero, #$80) + rts diff --git a/src/main.c b/src/main.c index 61ff2e6..ad23f56 100644 --- a/src/main.c +++ b/src/main.c @@ -183,7 +183,7 @@ int main(void) { load_sram((uint8_t*)"/sd2snes/sd2snes.db", SRAM_DB_ADDR); load_sram((uint8_t*)"/sd2snes/sd2snes.dir", SRAM_DIR_ADDR); } - +// save_sram((uint8_t*)"/debug.smc", 0x400000, 0); // uart_putc('['); // load_sram((uint8_t*)"/test.srm", SRAM_SAVE_ADDR); // uart_putc(']');