aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2021-04-10 15:37:43 -0400
committerB. Watson <yalhcru@gmail.com>2021-04-10 15:37:43 -0400
commit773cf3bd07f9e2d0a878e7929df873070a7977bc (patch)
tree99859f93c8bbc37b6ceeacf0762260d6801d21e8
parentf35a2797f0f96c6c15e25d2b980a0f60360c244a (diff)
downloadtaipan-773cf3bd07f9e2d0a878e7929df873070a7977bc.tar.gz
port stat: save some bytes, slight speedup
-rw-r--r--Makefile2
-rw-r--r--PORTSTAT.DATbin640 -> 600 bytes
-rw-r--r--mkportstats.c2
-rw-r--r--portstat.s9
-rw-r--r--taipan.c35
5 files changed, 28 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 5d83419..91fca46 100644
--- a/Makefile
+++ b/Makefile
@@ -293,7 +293,7 @@ taifont: convfont romfont font
# the H: device enabled, pointed at the current directory, and set
# to writable.
PORTSTAT.DAT: mkportstats.xex
- atari800 -nobasic mkportstats.xex
+ atari800 -H1 . -hreadwrite -nobasic mkportstats.xex
touch portstat.s
# Host tool that builds our custom font from the data ripped out of
diff --git a/PORTSTAT.DAT b/PORTSTAT.DAT
index 0af616c..10c9f4a 100644
--- a/PORTSTAT.DAT
+++ b/PORTSTAT.DAT
Binary files differ
diff --git a/mkportstats.c b/mkportstats.c
index 0d4d374..d4358cc 100644
--- a/mkportstats.c
+++ b/mkportstats.c
@@ -48,7 +48,7 @@ int main(void) {
char *screenmem = PEEK(88)+256*PEEK(89);
FILE *f = fopen("H:PORTSTAT.DAT", "wb");
port_stats();
- fwrite(screenmem, 40, 16, f);
+ fwrite(screenmem + 40, 40, 15, f);
fclose(f);
cgetc();
return 0;
diff --git a/portstat.s b/portstat.s
index fa68b9f..9aa54ee 100644
--- a/portstat.s
+++ b/portstat.s
@@ -29,17 +29,22 @@ partial = <screenlen
; compared to using memcpy().
; void redraw_port_stat(void);
_redraw_port_stat:
- lda _port_stat_dirty
- beq @done
+ ;lda _port_stat_dirty
+ ;beq @done
lda #<_port_stat_screen
sta srcptr
lda #>_port_stat_screen
sta srcptr+1
+ ; add 40 because PORTSTAT.DAT no longer contains the all-blank
+ ; first line.
lda SAVMSC
+ clc
+ adc #$28
sta dstptr
lda SAVMSC+1
+ adc #$00
sta dstptr+1
; copy screenpages pages
diff --git a/taipan.c b/taipan.c
index 03af06b..c07bca0 100644
--- a/taipan.c
+++ b/taipan.c
@@ -1677,24 +1677,27 @@ unsigned int warehouse_in_use() {
void port_stats(void) {
int i, in_use, status = get_ship_status();
- if(port_stat_dirty) bank_dirty = 1;
-
- /* all the static text that used to be in port_stats() has
- been moved to mkportstats.c, which creates a .xex file which
- will get prepended to taipan.xex and loaded into a chunk of memory
- cc65 won't use. When it's time to print it, it'll get copied
- into *SAVMSC. */
- redraw_port_stat();
+ if(port_stat_dirty) {
+ bank_dirty = 1;
+
+ /* all the static text that used to be in port_stats() has
+ been moved to mkportstats.c, which creates a .xex file which
+ will get prepended to taipan.xex and loaded into a chunk of memory
+ cc65 won't use. When it's time to print it, it'll get copied
+ into *SAVMSC. */
+ redraw_port_stat();
+
+ gotoxy(0, 0);
+ cspaces(firmpos);
+ // cputs("Firm: ");
+ cprint_firm_colon();
+ cputs(firm);
+ comma_space();
+ // cputs(location[1]);
+ print_msg(M_hong_kong);
+ }
/* dynamic stuff: */
- gotoxy(firmpos, 0);
- // cputs("Firm: ");
- cprint_firm_colon();
- cputs(firm);
- comma_space();
- // cputs(location[1]);
- print_msg(M_hong_kong);
-
gotoxy(21, 4);
in_use = warehouse_in_use();
cprintuint(in_use);