aboutsummaryrefslogtreecommitdiff
path: root/taipan.c
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-01-17 04:08:52 -0500
committerB. Watson <yalhcru@gmail.com>2016-01-17 04:08:52 -0500
commitd72f8556e703eb8c84d055bfc5a8dcb2620ad61e (patch)
tree51326271fb66ee562b42911422c35ec9b28be362 /taipan.c
parentb9c1931a80c5d700ba356f9090e9a72f075377f7 (diff)
downloadtaipan-d72f8556e703eb8c84d055bfc5a8dcb2620ad61e.tar.gz
restore colors/font on exit, fix bank withdrawal bug, rename bignum stuff
Diffstat (limited to 'taipan.c')
-rw-r--r--taipan.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/taipan.c b/taipan.c
index 97d2271..fc3bb7b 100644
--- a/taipan.c
+++ b/taipan.c
@@ -1860,10 +1860,21 @@ void final_stats(void)
return;
}
- /* restore ROM character set. TODO: save old PEEK(756)
- in newtitle.s, restore that here instead of using
- hardcoded value. */
- POKE(756, 224);
+
+ /* exit(0) works by itself in DOS 2.0S or 2.5, or any DUP.SYS
+ style DOS that reopens the E: device when entering the menu.
+ However, command-line DOSes (XL and Sparta) don't do this,
+ which results in garbage on screen and wrong colors. So: */
+
+ /* restore CHBAS to its original value, generally the ROM font.
+ This is called fontsave in newtitle.s. */
+ POKE(756, PEEK(0x6fc));
+
+ /* restore COLOR1 and COLOR2. These locations are called
+ color1save and color2save in newtitle.s. */
+ POKE(709, PEEK(0x6fd));
+ POKE(710, PEEK(0x6fe));
+
exit(0);
}
@@ -2919,10 +2930,14 @@ void visit_bank(void)
continue;
}
- big_sub(bank, bank, bigamt);
- big_add(bigcash, bigcash, bigamt);
- big_to_ulong(bigcash, &cash);
- break;
+ if(big_cmp(bank, bigamt) < 0) {
+ you_only_have(1);
+ } else {
+ big_sub(bank, bank, bigamt);
+ big_add(bigcash, bigcash, bigamt);
+ big_to_ulong(bigcash, &cash);
+ break;
+ }
#else
if (amount == -1)
{