From 1faab1ce210840391abe150c71cd44c228585af8 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 20 Apr 2021 13:46:30 -0400 Subject: Save 8 bytes --- console.s | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'console.s') 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 + -- cgit v1.2.3