lemm: percentage checking mostly working

not sure if it's worth all the bytes
This commit is contained in:
Vince Weaver 2022-03-22 18:50:06 -04:00
parent 671182cf46
commit 8100ab783e
8 changed files with 38 additions and 13 deletions

View File

@ -184,21 +184,25 @@ upr_out_tens:
lda PERCENT_RESCUED_H
bne print_the_message ; 100%, was a win
blip:
inx ; (1) NEEDED+20% < T < 100%
lda PERCENT_NEEDED
clc
adc #$20 ; FIXME: only if < 80%
cmp #$79
bcs percent_too_high
clc ; not needed?
adc #$20
cmp PERCENT_RESCUED_L
bcs print_the_message
bcc print_the_message
percent_too_high:
inx ; (2) NEEDED < T < NEEDED+20%
lda PERCENT_RESCUED_L
cmp PERCENT_NEEDED
lda PERCENT_NEEDED
cmp PERCENT_RESCUED_L
bcc print_the_message
inx ; (3) NEEDED == T
cmp PERCENT_NEEDED
cmp PERCENT_RESCUED_L
beq print_the_message
inx ; (4) T = NEEDED - 1
@ -213,7 +217,7 @@ blip:
sec
sbc #5
cmp PERCENT_NEEDED
bcs print_the_message
bcc print_the_message
inx ; (6) NEEDED/2 < T < NEEDED-5
lda PERCENT_RESCUED_L
@ -299,14 +303,14 @@ level_message1_text:
; NEEDED < T < NEEDED+20%
level_message2_text:
.byte 2, 6,"THAT LEVEL SEEMED NO PROBLEM TO YOU ON",0
.byte 3, 7,"THAT ATTEMPT. ONTO THE NEXT...",0
.byte 2, 6,"THAT LEVEL SEEMED NO PROBLEM TO YOU",0
.byte 3, 7,"ON THAT ATTEMPT. ONTO THE NEXT...",0
.byte $FF
; NEEDED == T
level_message3_text:
.byte 2, 6,"RIGHT ON. YOU CAN'T GET MUCH CLOSER THAN",0
.byte 3, 7,"THAT. LET'S TRY THE NEXT...",0
.byte 2, 6,"RIGHT ON. YOU CAN'T GET MUCH CLOSER",0
.byte 3, 7,"THAN THAT. LET'S TRY THE NEXT...",0
.byte $FF
; T = NEEDED - 1

View File

@ -48,7 +48,7 @@ do_level1:
lda #$10 ; BCD
sta PERCENT_NEEDED
sta PERCENT_ADD
;==============
; set up intro

View File

@ -48,6 +48,7 @@ do_level2:
lda #$10 ; BCD
sta PERCENT_NEEDED
sta PERCENT_ADD
;==============
; set up intro

View File

@ -48,6 +48,9 @@ do_level3:
lda #$10 ; BCD
sta PERCENT_NEEDED
lda #$2
sta PERCENT_ADD
;==============
; set up intro
;==============

View File

@ -62,6 +62,9 @@ do_level4:
lda #$00 ; BCD
sta PERCENT_NEEDED ; means 100%
lda #$10
sta PERCENT_ADD
;==============
; set up music

View File

@ -31,6 +31,8 @@ do_level5:
lda #$10 ; BCD
sta PERCENT_NEEDED
lda #$2
sta PERCENT_ADD
;==============
; set up intro

View File

@ -213,6 +213,17 @@ remove_lemming:
sec
sbc #1
sta LEMMINGS_OUT
lda PERCENT_RESCUED_L
clc
adc PERCENT_ADD
sta PERCENT_RESCUED_L
bcc no_percent_oflo
inc PERCENT_RESCUED_H
no_percent_oflo:
cld
jsr update_lemmings_out

View File

@ -78,6 +78,7 @@ APPLEII_MODEL = $8B
PERCENT_RESCUED_L = $8C
PERCENT_RESCUED_H = $8D
PERCENT_NEEDED = $8E
PERCENT_ADD = $8F
DOOR_X = $90 ; location of door
DOOR_Y = $91