tfv: get info screen printing actual data

This commit is contained in:
Vince Weaver 2021-02-11 23:54:45 -05:00
parent 5fd6aecff7
commit 3fc87c047d
7 changed files with 181 additions and 38 deletions

View File

@ -19,7 +19,7 @@ load_game:
sta HERO_LIMIT
lda #$03
sta HERO_LEVEL
lda #$50
lda #$13
sta HERO_XP
lda #$25
sta HERO_MONEY
@ -46,6 +46,11 @@ load_game:
sta TFV_Y
sta MAP_X
lda #$05
sta TIME_MINUTES
lda #$00
sta TIME_HOURS
lda #$ff
sta HERO_INVENTORY1
sta HERO_INVENTORY2

View File

@ -36,24 +36,8 @@ do_battle:
;======================
; update hp and mp
jsr update_hero_hp
jsr update_hero_mp
;======================
; copy in player name
ldx #0
load_name_loop:
lda HERO_NAME,X
bne load_name_zero
lda #' '
load_name_zero:
sta battle_name_string+2,X
inx
cpx #8
bne load_name_loop
really_done_load_name:
jsr update_hero_hp_menu
jsr update_hero_mp_menu
;=============
; start music

View File

@ -252,7 +252,7 @@ health_too_high:
sta HERO_HP_LO
health_is_good:
jsr update_hero_hp
jsr update_hero_hp_menu
rts
@ -288,7 +288,7 @@ damage_hero_do_sub:
damage_hero_done:
jsr update_hero_hp
jsr update_hero_hp_menu
rts
@ -312,7 +312,7 @@ hero_use_magic:
sta HERO_MP
cld
jsr update_hero_mp
jsr update_hero_mp_menu
done_hero_use_magic:

View File

@ -858,7 +858,7 @@ done_attack:
; one BCD byte
; put into mp_string
update_hero_mp:
update_hero_mp_menu:
lda #1
sta convert_bcd_to_string_leading_zero
@ -878,15 +878,24 @@ update_hero_mp:
; two BCD bytes
; put into hp_string
update_hero_hp:
lda #1
sta convert_bcd_to_string_leading_zero
update_hero_hp_menu:
; point to output
lda #<(hp_string+2)
sta OUTL
lda #>(hp_string+2)
sta OUTH
update_hero_hp:
; reset leading zero count
lda #1
sta convert_bcd_to_string_leading_zero
; if top byte is 00 then special case
lda HERO_HP_HI
bne update_hero_hp_top_byte
@ -917,6 +926,11 @@ update_hero_hp_bottom_byte:
; print two-digit BCD number into a string
;==========================================
;==========================================
; A is value to convert
; OUTL,OUTH points to output
; be sure to set convert_bcd_to_string_leading_zero properly
; after OUTL,OUTH points to next (useful for 16-bit printing)
convert_bcd_to_string:
pha ; store on stack

View File

@ -3,6 +3,124 @@
;===========================
print_info:
;======================
; update the stats
;======================
; level
lda #1
sta convert_bcd_to_string_leading_zero
lda #<(info_level_string+8)
sta OUTL
lda #>(info_level_string+8)
sta OUTH
lda HERO_LEVEL
jsr convert_bcd_to_string
; HP
lda #<(info_hp_string+7)
sta OUTL
lda #>(info_hp_string+7)
sta OUTH
jsr update_hero_hp
; HP Max
lda #1
sta convert_bcd_to_string_leading_zero
lda #<(info_hp_string+13)
sta OUTL
lda #>(info_hp_string+13)
sta OUTH
lda HERO_LEVEL
jsr convert_bcd_to_string
; MP
lda #1
sta convert_bcd_to_string_leading_zero
lda #<(info_mp_string+9)
sta OUTL
lda #>(info_mp_string+9)
sta OUTH
lda HERO_MP
jsr convert_bcd_to_string
; MP_MAX
lda #1
sta convert_bcd_to_string_leading_zero
lda #<(info_mp_string+15)
sta OUTL
lda #>(info_mp_string+15)
sta OUTH
lda HERO_MP_MAX
jsr convert_bcd_to_string
; Experience
lda #1
sta convert_bcd_to_string_leading_zero
lda #<(info_exp_string+16)
sta OUTL
lda #>(info_exp_string+16)
sta OUTH
lda HERO_XP
jsr convert_bcd_to_string
; Next Lev
; fixed right now
; Money
lda #1
sta convert_bcd_to_string_leading_zero
lda #<(info_money_string+11)
sta OUTL
lda #>(info_money_string+11)
sta OUTH
lda HERO_MONEY
jsr convert_bcd_to_string
; Time Hours
lda #0
sta convert_bcd_to_string_leading_zero
lda #<(info_time_string+8)
sta OUTL
lda #>(info_time_string+8)
sta OUTH
lda TIME_HOURS
jsr convert_bcd_to_string
; Time Minutes
lda #0
sta convert_bcd_to_string_leading_zero
lda #<(info_time_string+11)
sta OUTL
lda #>(info_time_string+11)
sta OUTH
lda TIME_MINUTES
jsr convert_bcd_to_string
;======================
; actually print things
;======================
lda #$a0
jsr clear_top_a
@ -270,10 +388,10 @@ item3_not_there:
info_name_string:
.byte 2,1,"DEATER ",0
.byte 2,1,"?????? ",0
info_level_string:
.byte 22,1,"LEVEL 1",0
.byte 22,1,"LEVEL ?",0
info_inventory_string:
.byte 2,3,"INVENTORY:",0
@ -282,22 +400,22 @@ info_stats_string:
.byte 22,3,"STATS",0
info_hp_string:
.byte 23,5,"HP: 123 / 456",0
.byte 23,5,"HP: ??? / ?00",0
info_mp_string:
.byte 23,6,"MP: 55 / 99",0
.byte 23,6,"MP: ?? / ??",0
info_exp_string:
.byte 22,8,"EXPERIENCE: 123",0
.byte 22,8,"EXPERIENCE: ??",0
info_nextlev_string:
.byte 22,9,"NEXT LEVEL: 123",0
.byte 22,9,"NEXT LEVEL: 30",0
info_money_string:
.byte 22,11,"MONEY: $123",0
.byte 22,11,"MONEY: $??",0
info_time_string:
.byte 22,13,"TIME: 00:00",0
.byte 22,13,"TIME: ??:??",0
item1_name_addr:
.word item1_cupcake

View File

@ -16,6 +16,26 @@
jsr init_multiply_tables
;================================
; Copy over Name
;================================
; both battle and info
ldx #0
load_name_loop:
lda HERO_NAME,X
bne load_name_zero
lda #' '
load_name_zero:
sta battle_name_string+2,X
sta info_name_string+2,X
inx
cpx #8
bne load_name_loop
really_done_load_name:
;================================
; Setup sound
;================================

View File

@ -137,11 +137,13 @@ HERO_STATE = $A4 ; state of hero
HERO_ON_BIRD = $01
HERO_ODD = $02 ; stand/walk position
HERO_DIRECTION = $04 ; 0=left, 1=right
HERO_STEPS = $A5 ; number of steps
HERO_STEPS = $A5 ; number of steps (30 steps = minute)
TIME_MINUTES = $A6 ; time in minutes
TIME_HOURS = $A7 ; time in hours
TFV_X = $A6 ; location on screen
TFV_Y = $A7 ; location on screen
MAP_X = $A8 ; which map region we're on
TFV_X = $A8 ; location on screen
TFV_Y = $A9 ; location on screen
MAP_X = $AA ; which map region we're on