Procházet zdrojové kódy

WIP Display game list

ikari před 14 roky
rodič
revize
8eeda87d25
5 změnil soubory, kde provedl 41 přidání a 54 odebrání
  1. 3 1
      snes/Makefile
  2. 0 18
      snes/const.a65
  3. 19 5
      snes/data.a65
  4. 18 29
      snes/main.a65
  5. 1 1
      src/main.c

+ 3 - 1
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 $@ $^
 

+ 0 - 18
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
 

+ 19 - 5
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

+ 18 - 29
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
 

+ 1 - 1
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(']');