aboutsummaryrefslogtreecommitdiff
path: root/console.s
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2021-05-19 16:19:35 -0400
committerB. Watson <yalhcru@gmail.com>2021-05-19 16:19:35 -0400
commitc89875818d478c4a579a2f5af4e64fa35c7f78b6 (patch)
treee564b00f43db5a3d6da5877d0098df82df880598 /console.s
parente2ea1b0c217a9714b6b5d231b202b5fd1eefa2c9 (diff)
downloadtaipan-c89875818d478c4a579a2f5af4e64fa35c7f78b6.tar.gz
"Play again?" default to Y; save 5 bytes, now 8839
Diffstat (limited to 'console.s')
-rw-r--r--console.s43
1 files changed, 43 insertions, 0 deletions
diff --git a/console.s b/console.s
index 0eb4ab1..70cffe3 100644
--- a/console.s
+++ b/console.s
@@ -350,8 +350,51 @@ _set_orders:
rts
@returnx:
stx _orders
+done1:
rts
+; extern void __fastcall__ print_score_msg(long *scoreptr)
+
+; asm replacement for this C code:
+
+; /* score is a *signed* long. */
+; if(score < 0)
+; print_msg(M_stay_on_shore);
+; else if(score < 100)
+; print_msg(M_land_based_job);
+
+; This turns out to actually waste 3 bytes: my code is the same
+; length as what cc65 generates, plus 3 bytes for the jsr to this
+; function. Ugh.
+
+;; .import _M_stay_on_shore, _M_land_based_job
+;; .export _print_score_msg
+;;_print_score_msg:
+;; sta FR0
+;; stx FR0+1
+;; ldy #3
+;; lda (FR0),y ; look at MSB of score
+;; bpl @notneg ; is it negative?
+;; lda #<_M_stay_on_shore ; if so, print this message
+;; ldx #>_M_stay_on_shore
+;;@pm:
+;; jmp _print_msg
+;;@notneg: ; else...
+;; bne done1 ; if MSB non-zero, score is at least 2^24+1, no message
+;; dey
+;; lda (FR0),y
+;; dey
+;; ora (FR0),y
+;; bne done1 ; if either of these is non-zero, score is >= 256, no message
+;; dey
+;; lda (FR0),y ; here, the top 3 bytes are zero, so check the LSB.
+;; cmp #100 ; is it < 100?
+;; bcs done1 ; if not, no message. or,
+;; lda #<_M_land_based_job ; if so, print this message
+;; ldx #>_M_land_based_job
+;; bne @pm ; branch always (since message is not in zero page)
+
+
.rodata
orders_tbl: .byte "frt"