aboutsummaryrefslogtreecommitdiff
path: root/console.s
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2021-04-20 13:46:30 -0400
committerB. Watson <yalhcru@gmail.com>2021-04-20 13:46:30 -0400
commit1faab1ce210840391abe150c71cd44c228585af8 (patch)
tree3306e314468f91c6d20469ccdd7d807206fed948 /console.s
parenteedb858a9f384ccccd5b1c0860f55d2ef788966d (diff)
downloadtaipan-1faab1ce210840391abe150c71cd44c228585af8.tar.gz
Save 8 bytes
Diffstat (limited to 'console.s')
-rw-r--r--console.s56
1 files changed, 56 insertions, 0 deletions
diff --git a/console.s b/console.s
index 99b264e..554b03d 100644
--- a/console.s
+++ b/console.s
@@ -12,6 +12,7 @@
.export _cputc0, _set_orders, _pluralize, _print_combat_msg
.export _rvs_on, _rvs_off
.export _prepare_report, _clear_msg_window
+ .export _print_status_desc, _print_month
.importzp tmp3 ; ditto
.import _revflag ; conio/revers.s
@@ -21,6 +22,8 @@
.import _cprintulong, _cputc, _cprint_taipan, _timed_getch, _orders
.import _turbo
.import _print_msg, _cspaces
+ .import _st, _month, _cputs
+ .import _cprintuint
.ifdef CART_TARGET
.segment "HIGHCODE"
@@ -281,6 +284,43 @@ _pluralize:
bne _cputc_s
rts
+; extern void __fastcall__ _print_status_desc(char status);
+; replaces this C code:
+; cputs(st[status / 20]);
+; status ranges 0 to 100 (it's the seaworthiness percentage),
+; the st[] array has elements 0 to 5. 5 is "Perfect" and only
+; used when status == 100.
+_print_status_desc:
+ lsr
+ lsr ; now 0-25
+ ldx #$ff
+ sec
+@div5loop:
+ inx
+ sbc #5
+ bcs @div5loop
+ txa
+ asl
+ tay
+ lda _st,y
+ ldx _st+1,y
+ jmp _cputs
+
+; extern void __fastcall__ print_month(void);
+; _month is a global, ranges 1 to 12.
+
+_print_month:
+ lda _month
+ asl
+ asl ; carry will be left clear
+ adc #<(months-4)
+ pha
+ lda #>(months-4)
+ adc #0
+ tax
+ pla
+ jmp _cputs
+
; extern void set_orders(void);
_set_orders:
lda _turbo ; in turbo fight mode?
@@ -314,3 +354,19 @@ _set_orders:
.rodata
orders_tbl: .byte "frt"
+
+; inverse "Jan\0Feb\0Mar\0Apr\0May\0Jun\0Jul\0Aug\0Sep\0Oct\0Nov\0Dec\0"
+months:
+ .byte $ca, $e1, $ee, $00
+ .byte $c6, $e5, $e2, $00
+ .byte $cd, $e1, $f2, $00
+ .byte $c1, $f0, $f2, $00
+ .byte $cd, $e1, $f9, $00
+ .byte $ca, $f5, $ee, $00
+ .byte $ca, $f5, $ec, $00
+ .byte $c1, $f5, $e7, $00
+ .byte $d3, $e5, $f0, $00
+ .byte $cf, $e3, $f4, $00
+ .byte $ce, $ef, $f6, $00
+ .byte $c4, $e5, $e3, $00
+