From 4aaf0add1cd84215a5e96ca80a6ee85ff4f4e2e7 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 10 Apr 2021 16:38:58 -0400 Subject: Save 10 bytes, port_stats() timing --- taipan.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/taipan.c b/taipan.c index a52bf8a..1765399 100644 --- a/taipan.c +++ b/taipan.c @@ -45,6 +45,9 @@ /* define this to test the cprintfancy_big() routine */ // #define BIGNUM_TEST +/* define this to show frames/scanlines timing for port_stats() */ +// #define PORT_STAT_TIMER + /**** atari-specific stuff */ /* values returned by cgetc() for backspace/enter/delete keys */ @@ -1675,9 +1678,14 @@ unsigned int warehouse_in_use() { void port_stats(void) { - int i, in_use, status = get_ship_status(); + unsigned char i; + int in_use, status = get_ship_status(); +#ifdef PORT_STAT_TIMER + int startframe, startline, endframe, endline; +#endif if(port_stat_dirty) { + /* this stuff takes approx 1 jiffy */ bank_dirty = 1; /* all the static text that used to be in port_stats() has @@ -1698,15 +1706,23 @@ void port_stats(void) { } /* dynamic stuff: */ +#ifdef PORT_STAT_TIMER + startframe = PEEK(20); + startline = PEEK(54283U); +#endif + + + /* approx 73 VCOUNTs */ gotoxy(21, 4); in_use = warehouse_in_use(); cprintuint(in_use); cblankto(26); - gotoxy(21, 6); cprintuint(10000 - in_use); cblankto(26); + + /* approx 1 jiffy */ for(i = 0; i < 4; ++i) { gotoxy(12, i + 3); cprintuint(hkw_[i]); @@ -1768,6 +1784,23 @@ void port_stats(void) { clrtoeol(); bank_dirty = 0; } + +#ifdef PORT_STAT_TIMER + endframe = PEEK(20); + endline = PEEK(54283U); +#endif + +#ifdef PORT_STAT_TIMER + gotoxy(0, 15); + cprintuint(startframe); + cprint_pipe(); + cprintuint(startline); + cspace(); + cprintuint(endframe); + cprint_pipe(); + cprintuint(endline); + clrtoeol(); +#endif } void mchenry(void) { -- cgit v1.2.3