Browse Source

menu: display file sizes

ikari 13 years ago
parent
commit
b1a04c5f05
4 changed files with 41 additions and 12 deletions
  1. 1 0
      snes/const.a65
  2. 1 1
      snes/data.a65
  3. 38 10
      snes/menu.a65
  4. 1 1
      snes/text.a65

+ 1 - 0
snes/const.a65

@@ -121,3 +121,4 @@ 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 $00
+text_dirmark	.byt "    <dir>", 0

+ 1 - 1
snes/data.a65

@@ -41,7 +41,7 @@ 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?
+print_done	.word 0  ;how many characters were printed?
 ;----------parameters for dma----------
 dma_a_bank	.byt 0
 dma_a_addr	.word 0

+ 38 - 10
snes/menu.a65

@@ -12,7 +12,7 @@ menu_init:
 	stx dirstart_addr
 	stz menu_state
 	stz dirend_onscreen
-	lda #$04
+	lda #$02
 	sta cursor_x
 	lda #$09
 	sta cursor_y
@@ -58,7 +58,9 @@ menu_cleanup_loop
 	pha
 	clc
 	adc #$09
+        inc
 	sta print_y
+        stz print_x
 	lda #^space64
 	ldx #!space64
 	sta print_bank
@@ -215,6 +217,11 @@ redraw_filelist_out
 	brl menu_redraw_out
 
 print_direntry:
+        lda cursor_y
+        sta print_y
+	inc
+        sta cursor_y
+
 	lda dirent_bank
 	ldx dirent_addr
 
@@ -233,37 +240,34 @@ dirent_is_dir
 	sta @print_pal
 	bra dirent_type_cont
 dirent_is_file
-	lda #$00
+	lda #$09
 	sta @fd_fnoff	;no offset
 	lda #$00
 	sta @print_pal	;palette 0 (white)
 dirent_type_cont
+        rep #$20 : .al
 	txa
 	clc
 	adc @fd_fnoff
 	tax
 	sep #$20 : .as
 	lda !0, x	;load offset of leaf (file) name
-	clc
-	adc #1
+        inc
 	rep #$20 : .al
 	and #$00ff	;kill hi byte
 	sta @fd_fnoff
 	txa
+	clc
 	adc @fd_fnoff
 	sta @fd_fnoff
 	plb
 
-	lda cursor_y
-	sta print_y
-	inc
-	sta cursor_y
 	lda cursor_x
 	sta print_x
 
 	sep #$20 : .as
 	ldx fd_fnoff
-	lda #58
+	lda #52
 	sta print_count
 	stx print_src
 	lda dirent_bank
@@ -274,7 +278,8 @@ dirent_type_cont
 	clc
 	adc print_done
 	sta print_x
-	lda #58
+
+	lda #52
 	sec
 	sbc print_done
 	sta print_count
@@ -284,6 +289,29 @@ dirent_type_cont
 	stx print_src
 	jsr hiprint
 
+	sep #$20 : .as
+        lda dirent_type
+        cmp #$80
+        bne dirent_is_file_2
+        lda #^text_dirmark
+        ldx #!text_dirmark
+        inx
+        sta print_bank
+        stx print_src
+        bra dirent_type_cont_2
+dirent_is_file_2
+        lda dirent_bank
+        ldx dirent_addr
+        inx
+        sta print_bank 
+        stx print_src
+dirent_type_cont_2
+        lda #54
+        sta print_x
+        lda #8
+        sta print_count
+        jsr hiprint
+        
 	rts
 	
 menu_key_down:

+ 1 - 1
snes/text.a65

@@ -4,8 +4,8 @@ hiprint:
 	sep #$20 : .as
 	lda print_count
 	sta print_count_tmp
-	stz print_done
 	rep #$30 : .xl : .al
+	stz print_done
 	lda print_x
 	and #$00ff
 	lsr