aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-23 17:22:47 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-23 17:22:47 -0500
commitf898176dd3871dcb15ecfbb3eca46f539d284b8b (patch)
tree20ac19068e95c907728bacb434b50d55d3335de9
parente9736c53375784e3b4910ae3419da9bd04c119cd (diff)
downloadtaipan-f898176dd3871dcb15ecfbb3eca46f539d284b8b.tar.gz
modify conio so it no longer needs carriage returns, now 7454 bytes free
-rw-r--r--conio/README13
-rw-r--r--conio/cputc.s36
-rw-r--r--console.s5
-rw-r--r--newtitle.s2
-rw-r--r--taipan.c230
-rw-r--r--textcomp.c6
-rw-r--r--textdecomp.s7
7 files changed, 157 insertions, 142 deletions
diff --git a/conio/README b/conio/README
index bfe8187..d63ed27 100644
--- a/conio/README
+++ b/conio/README
@@ -4,12 +4,23 @@ More particularly, the standard cc65 conio always draws a cursor, whether
the cursor is enabled or not. When it's disabled, the cursor is drawn
as a space character.
+Also, the cputc() here no longer requires \r\n to move the cursor
+to the start of the next line. \n alone does it, and \r isn't
+treated specially (it's just a ctrl-R, prints a graphics character).
+
+The cputcxy() routine has been deleted, since taipan doesn't use it.
+
Benefits of doing this:
- Faster and smoother screen updates
-- Slightly smaller code (20-30 bytes)
+- Slightly smaller code (100-odd bytes)
- No more "cursor ghosts" at timed prompts
- No need for a hide_cursor() function
+- print_msg() from textdecomp.s is simplified, it no longer has
+ to print a carriage return every time it sees a newline in a
+ compressed message.
+- In taipan.c, cputs("foo\r\n") no longer requires the \r, saves
+ one byte per string.
Disadvantage: Have to draw the cursor myself when needed. It turns out
that only agetc() needs to do this, so not a big deal. Also had to
diff --git a/conio/cputc.s b/conio/cputc.s
index 5955b42..fb60ffc 100644
--- a/conio/cputc.s
+++ b/conio/cputc.s
@@ -1,3 +1,10 @@
+; this file modified for use with taipan:
+; - \n treated like \r\n used to: moves cursor to
+; start of next line.
+; - \r no longer special (prints a graphics character)
+; - $0a no longer treated as as \n (prints graphics char)
+; - _cputcxy removed as taipan never uses it
+
;
; Mark Keates, Christian Groessler
;
@@ -5,7 +12,8 @@
; void cputc (char c);
;
- .export _cputcxy, _cputc
+ ;.export _cputcxy, _cputc
+ .export _cputc
.export plot, cputdirect, putchar
.import popa, _gotoxy, mul40
.importzp tmp4,ptr4
@@ -13,21 +21,21 @@
.include "atari.inc"
-_cputcxy:
- pha ; Save C
- jsr popa ; Get Y
- jsr _gotoxy ; Set cursor, drop x
- pla ; Restore C
+;_cputcxy:
+ ;pha ; Save C
+ ;jsr popa ; Get Y
+ ;jsr _gotoxy ; Set cursor, drop x
+ ;pla ; Restore C
_cputc:
- cmp #$0D ; CR
- bne L4
- lda #0
- sta COLCRS
- beq plot ; return
+; cmp #$0D ; CR
+; bne L4
+; lda #0
+; sta COLCRS
+; beq plot ; return
-L4: cmp #$0A ; LF
- beq newline
+L4: ;cmp #$0A ; LF
+ ;beq newline
cmp #ATEOL ; Atari-EOL?
beq newline
@@ -55,6 +63,8 @@ cputdirect: ; accepts screen code
.export newline
newline:
+ lda #0
+ sta COLCRS
inc ROWCRS
lda ROWCRS
cmp #24
diff --git a/console.s b/console.s
index 1122722..05445bd 100644
--- a/console.s
+++ b/console.s
@@ -1,7 +1,7 @@
.include "atari.inc"
- .export _clrtobot, _clrtoeol, _clr_screen, _clrtoline, _cspaces, _cblank, _backspace, _cprint_pipe, _cprint_bang, _cspace, _cputc_s, _comma_space, _cprint_colon_space, _cprint_question_space, _cprint_period, _cprint_taipan_prompt
+ .export _clrtobot, _clrtoeol, _clr_screen, _clrtoline, _cspaces, _cblank, _backspace, _cprint_pipe, _cprint_bang, _cspace, _cputc_s, _comma_space, _cprint_colon_space, _cprint_question_space, _cprint_period, _cprint_taipan_prompt, _crlf
.export _rvs_on, _rvs_off
.import mul40 ; from cc65's runtime
@@ -206,4 +206,7 @@ _cprint_period:
.byte $2c
_cprint_bang:
lda #'!'
+ .byte $2c
+_crlf:
+ lda #$9b
jmp _cputc
diff --git a/newtitle.s b/newtitle.s
index f2138f4..3a5c73c 100644
--- a/newtitle.s
+++ b/newtitle.s
@@ -27,7 +27,7 @@ origin = *
sound_disabled = $03c0
; since we're changing the font and colors, we'll save the old
- ; ones here. If you change these, change them in taipan.c
+ ; ones here. If you change these, change them in taipan.c and soundasm.s
; also.
fontsave = $03c1
color1save = $03c2
diff --git a/taipan.c b/taipan.c
index 72f2db0..301290c 100644
--- a/taipan.c
+++ b/taipan.c
@@ -118,6 +118,7 @@ extern void clrtoeol(void);
extern void __fastcall__ cspaces(unsigned char count);
/* each prints one specific character */
+extern void crlf(void);
extern void cspace(void);
extern void cputc_s(void);
extern void cprint_bang(void);
@@ -157,19 +158,6 @@ extern void redraw_port_stat(void);
# pragma code-name (push, "HIGHCODE")
#endif
-/* used to set the background/text colors here, but now the
- title screen does it (newtitle.s) */
-void atari_text_setup() {
- jsleep(1);
- POKE(560, PEEK(212)); // restore the
- POKE(561, PEEK(213)); // display list
- jsleep(1);
- POKE(559, 34); // turn on the screen (normal playfield)
- jsleep(1);
- POKE(756, FONT_ADDR / 256); // use our custom font
- POKE(731, 1); // disable keyclick on XL/XE (does nothing on 400/800)
-}
-
/* this didn't work out, bummer. */
// extern void __fastcall__ waitvcount(unsigned char c);
@@ -453,14 +441,16 @@ void how_much_will_you(void) {
}
void cprint_bad_joss() {
- // cputs("Bad Joss!!\r\n");
+ // cputs("Bad Joss!!\n");
print_msg(M_bad_joss);
}
+/*
void crlf(void) {
- // cputs("\r\n");
+ // cputs("\n");
print_msg(M_crlf);
}
+*/
void cprint_taipan(void) {
// cputs("Taipan");
@@ -680,13 +670,13 @@ void prepare_report(void) {
void compradores_report(void) {
prepare_report();
- // cputs("Comprador's Report\r\n\n");
+ // cputs("Comprador's Report\n\n");
print_msg(M_compradors_report);
}
void captains_report(void) {
prepare_report();
- // cputs(" Captain's Report\r\n\n");
+ // cputs(" Captain's Report\n\n");
print_msg(M_captains_report);
}
@@ -730,7 +720,7 @@ void new_ship(void) {
} else {
cputs("fine");
}
- // cputs("\r\nship for one with 50 more capacity by\r\npaying an additional ");
+ // cputs("\nship for one with 50 more capacity by\npaying an additional ");
print_msg(M_ship_for_one);
cprintuchar(50);
print_msg(M_more_capacity);
@@ -763,7 +753,7 @@ void new_gun(void) {
}
compradores_report();
- // cputs("Do you wish to buy a ship's gun\r\nfor ");
+ // cputs("Do you wish to buy a ship's gun\nfor ");
print_msg(M_gun_offer);
cprintfancy(amount);
cprint_taipan_prompt();
@@ -1037,7 +1027,7 @@ char sea_battle(char id, int num_ships) {
plus_or_space(num_ships > num_on_screen);
gotoxy(0, 16);
- // cputs("\r\n");
+ // cputs("\n");
crlf();
set_orders();
@@ -1048,7 +1038,7 @@ char sea_battle(char id, int num_ships) {
gotoxy(0, 3);
clrtoeol();
cprint_taipan_comma();
- // cputs("what shall we do??\r\n(Fight, Run, Throw cargo)");
+ // cputs("what shall we do??\n(Fight, Run, Throw cargo)");
print_msg(M_what_shall_we_do);
under_attack_sound();
@@ -1519,14 +1509,14 @@ void cash_or_guns(void) {
clr_screen();
cprint_Do_you_want();
- // cputs("to start . . .\r\n\n");
+ // cputs("to start . . .\n\n");
print_msg(M_to_start);
- // cputs(" 1) With cash (and a debt)\r\n\n");
+ // cputs(" 1) With cash (and a debt)\n\n");
cputs(" 1");
print_msg(M_with_cash);
cspaces(16);
- cputs("-- or --\r\n\n 2");
- // cputs(" 2) With five guns and no cash\r\n");
+ cputs("-- or --\n\n 2");
+ // cputs(" 2) With five guns and no cash\n");
print_msg(M_with_5_guns);
cspaces(16);
// cputs("(But no debt!)");
@@ -1768,9 +1758,9 @@ void mchenry(void) {
compradores_report();
cprint_taipan_comma();
/*
- cputs("Mc Henry from the Hong Kong\r\n"
- "Shipyards has arrived!! He says, 'I see\r\n"
- "ye've a wee bit of damage to yer ship.'\r\n"
+ cputs("Mc Henry from the Hong Kong\n"
+ "Shipyards has arrived!! He says, 'I see\n"
+ "ye've a wee bit of damage to yer ship.'\n"
"Will ye be wanting repairs? ");
*/
print_msg(M_mchenry_has_arrived);
@@ -1795,10 +1785,10 @@ void mchenry(void) {
// cputs("Och, 'tis a pity to be ");
print_msg(M_tis_a_pity);
cprintuint(percent);
- // cputs("% damaged.\r\nWe can fix yer whole ship for ");
+ // cputs("% damaged.\nWe can fix yer whole ship for ");
print_msg(M_percent_damaged);
cprintulong(repair_price);
- // cputs(",\r\nor make partial repairs if you wish.\r\n");
+ // cputs(",\nor make partial repairs if you wish.\n");
print_msg(M_or_partial_repairs);
how_much();
// cputs("will ye spend? ");
@@ -1834,7 +1824,7 @@ void retire_blanks(void) {
crlf();
// above loop saves a measly 6 bytes over this:
- // cputs(" \r\n");
+ // cputs(" \n");
}
*/
@@ -1887,7 +1877,7 @@ void retire(void) {
#ifdef BIGNUM
aire();
#else
- cputs(" M I L L I O N A I R E ! \r\n");
+ cputs(" M I L L I O N A I R E ! \n");
#endif
// cspaces(29);
// crlf();
@@ -1937,7 +1927,7 @@ void final_stats(void)
port_stat_dirty = 1;
clr_screen();
- // cputs("Your final status:\r\n\n"
+ // cputs("Your final status:\n\n"
// "Net cash: ");
print_msg(M_your_final_status);
#ifdef BIGNUM
@@ -1945,13 +1935,13 @@ void final_stats(void)
#else
cprintfancy(finalcash);
#endif
- // cputs("\r\nShip size: ");
+ // cputs("\nShip size: ");
print_msg(M_ship_size);
cprintulong(capacity);
// cputs(" units with ");
print_msg(M_units_with);
cprintuint(guns);
- // cputs(" guns\r\n\n"
+ // cputs(" guns\n\n"
// "You traded for ");
print_msg(M_you_traded_for);
cprintuint(years);
@@ -1970,7 +1960,7 @@ void final_stats(void)
{
cputc_s();
}
- cputs("\r\n\n");
+ cputs("\n\n");
rvs_on();
// cputs("Your score is ");
print_msg(M_your_score_is);
@@ -1979,21 +1969,21 @@ void final_stats(void)
#else
cprintulong(score);
#endif
- cputs(".\r\n");
+ cputs(".\n");
rvs_off();
if ((score < 100) && (score >= 0))
{
- // cputs("Have you considered a land based job?\r\n\n\n");
+ // cputs("Have you considered a land based job?\n\n\n");
print_msg(M_land_based_job);
} else if (score < 0) {
- // cputs("The crew has requested that you stay on\r\n"
- // "shore for their safety!!\r\n\n");
+ // cputs("The crew has requested that you stay on\n"
+ // "shore for their safety!!\n\n");
print_msg(M_stay_on_shore);
} else {
- // cputs("\r\n\n\n");
+ // cputs("\n\n\n");
print_msg(M_3_nls);
}
- // cputs("Your Rating:\r\n");
+ // cputs("Your Rating:\n");
print_msg(M_your_rating);
cputc(17); // upper left corner
chline(31);
@@ -2009,7 +1999,7 @@ void final_stats(void)
print_msg(M_ma_tsu);
rvs_off();
cspaces(9);
- cputs("50,000 and over |\r\n|");
+ cputs("50,000 and over |\n|");
if ((score < 50000L) && (score > 7999L))
{
@@ -2018,7 +2008,7 @@ void final_stats(void)
// cputs("Master Taipan");
print_msg(M_master_taipan);
rvs_off();
- cputs(" 8,000 to 49,999|\r\n|");
+ cputs(" 8,000 to 49,999|\n|");
// cprint_pipe();
if ((score < 8000L) && (score > 999L))
@@ -2028,7 +2018,7 @@ void final_stats(void)
cprint_taipan();
rvs_off();
cspaces(10);
- cputs("1,000 to 7,999|\r\n|");
+ cputs("1,000 to 7,999|\n|");
// cprint_pipe();
if ((score < 1000) && (score > 499))
@@ -2039,7 +2029,7 @@ void final_stats(void)
print_msg(M_compradore);
rvs_off();
cspaces(8);
- cputs("500 to 999|\r\n|");
+ cputs("500 to 999|\n|");
// cprint_pipe();
if (score < 500)
@@ -2050,7 +2040,7 @@ void final_stats(void)
print_msg(M_galley_hand);
rvs_off();
cspaces(7);
- cputs("less than 500|\r\n");
+ cputs("less than 500|\n");
cputc(26); // lower left corner
chline(31);
@@ -2159,7 +2149,7 @@ void transfer(void)
how_much();
// cputs(item[i]);
print_msg(item[i]);
- // cputs(" shall I move\r\nto the warehouse");
+ // cputs(" shall I move\nto the warehouse");
print_msg(M_move_to_whouse);
cprint_taipan_prompt();
@@ -2186,7 +2176,7 @@ void transfer(void)
good_joss_sound();
} else {
gotoxy(0, 21);
- // cputs("Your warehouse will only hold an\r\nadditional ");
+ // cputs("Your warehouse will only hold an\nadditional ");
print_msg(M_whouse_only_hold);
cprintuint(10000 - in_use);
cprint_taipan_bang();
@@ -2200,7 +2190,7 @@ void transfer(void)
// clrtobot();
you_have_only();
cprintulong(hold_[i]);
- // cputs(", Taipan.\r\n");
+ // cputs(", Taipan.\n");
cprint_taipan_period();
good_joss_sound();
@@ -2218,7 +2208,7 @@ void transfer(void)
how_much();
// cputs(item[i]);
print_msg(item[i]);
- // cputs(" shall I move\r\naboard ship");
+ // cputs(" shall I move\naboard ship");
print_msg(M_move_aboard);
cprint_taipan_prompt();
@@ -2240,7 +2230,7 @@ void transfer(void)
you_have_only();
cprintuint(hkw_[i]);
cprint_taipan_period();
- // cputs("\r\n");
+ // cputs("\n");
crlf();
timed_getch();
@@ -2264,7 +2254,7 @@ void quit(void)
compradores_report();
cprint_taipan_comma();
do_you_wish();
- // cputs("me to go to:\r\n");
+ // cputs("me to go to:\n");
print_msg(M_me_to_go_to);
for(choice = 1; choice < 8; ++choice) {
@@ -2278,8 +2268,8 @@ void quit(void)
cprint_question_space();
/*
- cputs("1) Hong Kong, 2) Shanghai, 3) Nagasaki,\r\n"
- "4) Saigon, 5) Manila, 6) Singapore, or\r\n"
+ cputs("1) Hong Kong, 2) Shanghai, 3) Nagasaki,\n"
+ "4) Saigon, 5) Manila, 6) Singapore, or\n"
"7) Batavia ? ");
*/
@@ -2292,7 +2282,7 @@ void quit(void)
if (choice == port)
{
- // cputs("\r\n\nYou're already here");
+ // cputs("\n\nYou're already here");
print_msg(M_already_here);
cprint_taipan_period();
good_joss_sound();
@@ -2362,7 +2352,7 @@ void quit(void)
if (li > 0)
{
- // cputs("Good joss!! They let us be!!\r\n");
+ // cputs("Good joss!! They let us be!!\n");
print_msg(M_they_let_us_be);
bad_joss_sound();
@@ -2376,7 +2366,7 @@ void quit(void)
cprintuint(num_ships);
/* "ships" will always be plural (at least 5 of them) */
- // cputs(" ships of Li Yuen's pirate\r\nfleet");
+ // cputs(" ships of Li Yuen's pirate\nfleet");
print_msg(M_ships_of_fleet);
cprint_taipan_bangbang();
under_attack_sound();
@@ -2400,7 +2390,7 @@ void quit(void)
captains_report();
if (result == 1)
{
- // cputs("We captured some booty.\r\n"
+ // cputs("We captured some booty.\n"
// "It's worth ");
print_msg(M_captured_some_booty);
cprintfancy(booty);
@@ -2415,7 +2405,7 @@ void quit(void)
// cputs("The buggers got us");
print_msg(M_buggers_got_us);
cprint_taipan_bangbang();
- // cputs("!\r\nIt's all over, now!!!");
+ // cputs("!\nIt's all over, now!!!");
print_msg(M_all_over_now);
timed_getch();
@@ -2438,7 +2428,7 @@ void quit(void)
timed_getch();
if(one_chance_in(30)) {
- // cputs(" I think we're going down!!\r\n\n");
+ // cputs(" I think we're going down!!\n\n");
print_msg(M_think_going_down);
timed_getch();
@@ -2468,7 +2458,7 @@ void quit(void)
}
}
- // cputs(" We made it!!\r\n\n");
+ // cputs(" We made it!!\n\n");
print_msg(M_storm_we_made_it);
bad_joss_sound();
timed_getch();
@@ -2480,7 +2470,7 @@ void quit(void)
port = randi()%7 + 1;
clear_msg_window();
- // cputs("We've been blown off course\r\nto ");
+ // cputs("We've been blown off course\nto ");
print_msg(M_blown_off_course);
// cputs(location[port]);
print_msg(location[port]);
@@ -2582,7 +2572,7 @@ void li_yuen_extortion(void) {
// cputs(" asks ");
print_msg(M_asks);
cprintfancy(amount);
- // cputs(" in donation\r\nto the temple of Tin Hau, the Sea\r\nGoddess. Will you pay? ");
+ // cputs(" in donation\nto the temple of Tin Hau, the Sea\nGoddess. Will you pay? ");
print_msg(M_in_donation);
if(yngetc(0) == 'y') {
@@ -2592,14 +2582,14 @@ void li_yuen_extortion(void) {
} else {
clear_msg_window();
cprint_taipan_comma();
- // cputs("you do not have enough cash!!\r\n\n");
+ // cputs("you do not have enough cash!!\n\n");
print_msg(M_not_enough_cash);
timed_getch();
cprint_Do_you_want();
cprint_elder_brother_wu();
- // cputs("to make up\r\nthe difference for you? ");
+ // cputs("to make up\nthe difference for you? ");
print_msg(M_make_up_difference);
if(yngetc(0) == 'y') {
@@ -2611,10 +2601,10 @@ void li_yuen_extortion(void) {
cprint_elder_brother_wu();
/*
- cputs("has given Li Yuen the\r\n"
- "difference between what he wanted and\r\n"
- "your cash on hand and added the same\r\n"
- "amount to your debt.\r\n");
+ cputs("has given Li Yuen the\n"
+ "difference between what he wanted and\n"
+ "your cash on hand and added the same\n"
+ "amount to your debt.\n");
*/
print_msg(M_given_the_diff);
} else {
@@ -2624,8 +2614,8 @@ void li_yuen_extortion(void) {
print_msg(M_very_well);
cprint_elder_brother_wu();
/*
- cputs("will not pay\r\n"
- "Li Yuen the difference. I would be very\r\n"
+ cputs("will not pay\n"
+ "Li Yuen the difference. I would be very\n"
"wary of pirates if I were you.");
*/
print_msg(M_will_not_pay);
@@ -2650,11 +2640,11 @@ void you_only_have(unsigned char in_bank) {
cprintfancy_big(bank);
else
cprintfancy(cash);
- // cputs("\r\nin ");
+ // cputs("\nin ");
print_msg(M_nl_in_spc);
// cputs(in_bank ? "the bank" : "cash");
print_msg(in_bank ? M_the_bank : M_cash);
- cputs(".\r\n");
+ cputs(".\n");
good_joss_sound();
timed_getch();
@@ -2668,9 +2658,9 @@ void you_only_have(unsigned char in_bank) {
cprint_taipan_comma();
cputs("you only have ");
cprintfancy(in_bank ? bank : cash);
- cputs("\r\nin ");
+ cputs("\nin ");
cputs(in_bank ? "the bank" : "cash");
- cputs(".\r\n");
+ cputs(".\n");
good_joss_sound();
timed_getch();
@@ -2684,7 +2674,7 @@ void elder_brother_wu(void)
unsigned long wu = 0;
compradores_report();
- // cputs("Do you have business with Elder Brother\r\nWu, the moneylender? ");
+ // cputs("Do you have business with Elder Brother\nWu, the moneylender? ");
print_msg(M_do_you_have_biz_with_wu);
for (;;)
@@ -2715,13 +2705,13 @@ void elder_brother_wu(void)
{
compradores_report();
/*
- cputs("Elder Brother is aware of your plight,\r\n"
- "Taipan. He is willing to loan you an\r\n"
+ cputs("Elder Brother is aware of your plight,\n"
+ "Taipan. He is willing to loan you an\n"
"additional ");
*/
print_msg(M_aware_of_your_plight);
cprintuint(i);
- // cputs(" if you will pay back\r\n");
+ // cputs(" if you will pay back\n");
print_msg(M_if_you_will_pay_back);
cprintuint(j);
// cputs(". Are you willing");
@@ -2731,7 +2721,7 @@ void elder_brother_wu(void)
choice = agetc();
if(choice != 'y') {
compradores_report();
- // cputs("Very well, Taipan, the game is over!\r\n");
+ // cputs("Very well, Taipan, the game is over!\n");
print_msg(M_game_is_over);
under_attack_sound();
@@ -2744,7 +2734,7 @@ void elder_brother_wu(void)
port_stats();
compradores_report();
- // cputs("Very well, Taipan. Good joss!!\r\n");
+ // cputs("Very well, Taipan. Good joss!!\n");
print_msg(M_very_well_good_joss);
bad_joss_sound();
@@ -2759,7 +2749,7 @@ void elder_brother_wu(void)
compradores_report();
how_much();
do_you_wish();
- // cputs("to repay\r\nhim? ");
+ // cputs("to repay\nhim? ");
print_msg(M_to_repay_him);
wu = get_num();
@@ -2793,7 +2783,7 @@ void elder_brother_wu(void)
compradores_report();
how_much();
do_you_wish();
- // cputs("to \r\nborrow? ");
+ // cputs("to \nborrow? ");
print_msg(M_to_borrow);
wu = get_num();
@@ -2809,7 +2799,7 @@ void elder_brother_wu(void)
debt += wu;
break;
} else {
- // cputs("\r\n\nHe won't loan you so much");
+ // cputs("\n\nHe won't loan you so much");
print_msg(M_wont_loan);
cprint_taipan_bang();
good_joss_sound();
@@ -2835,8 +2825,8 @@ void elder_brother_wu(void)
cprint_bad_joss();
cprintuint(num);
/*
- cputs(" of your bodyguards have been killed\r\n"
- "by cutthroats and you have been robbed\r\n"
+ cputs(" of your bodyguards have been killed\n"
+ "by cutthroats and you have been robbed\n"
"of all of your cash");
*/
print_msg(M_bodyguards_killed);
@@ -2859,7 +2849,7 @@ void good_prices(void) {
print_msg(M_the_price_of);
// cputs(item[i]);
print_msg(item[i]);
- // cputs("\r\n has ");
+ // cputs("\n has ");
print_msg(M_nl_has_spc);
if(randi()&1) {
@@ -2877,7 +2867,7 @@ void good_prices(void) {
print_msg(M_spc_to_spc);
cprintulong(price[i]);
- // cputs("!!\r\n");
+ // cputs("!!\n");
print_msg(M_bang_bang_nl);
good_joss_sound();
@@ -2914,8 +2904,8 @@ int port_choices(void) {
/*
// original version:
// ===> free code space $0f32 (3890, 3.8K)
- cputs(" Opium: Silk:\r\n");
- cputs(" Arms: General:\r\n");
+ cputs(" Opium: Silk:\n");
+ cputs(" Arms: General:\n");
gotoxy(11, 19);
cprintulong(price[0]);
gotoxy(29, 19);
@@ -2960,7 +2950,7 @@ int port_choices(void) {
print_msg(M_shall_i_buy_sell);
if(port == 1)
- // cputs("Visit bank, Transfer\r\ncargo, ");
+ // cputs("Visit bank, Transfer\ncargo, ");
print_msg(M_bank_transfer);
if(!retire_ok) cputs("or ");
@@ -3180,7 +3170,7 @@ void sell(void) {
how_much();
// cputs(item[choice]);
print_msg(item[choice]);
- // cputs(" shall\r\nI sell, ");
+ // cputs(" shall\nI sell, ");
print_msg(M_shall_i_sell);
cprint_taipan_colon();
@@ -3216,10 +3206,10 @@ char would_overflow(unsigned long a, unsigned long b) {
void too_much_cash(void) {
clear_msg_window();
- // cputs("\r\nYou cannot carry so much cash");
+ // cputs("\nYou cannot carry so much cash");
print_msg(M_too_much_cash);
cprint_taipan_bang();
- // cputs("\r\nYour ship would sink under the weight\r\nof your riches.\r\n");
+ // cputs("\nYour ship would sink under the weight\nof your riches.\n");
print_msg(M_ship_would_sink);
bad_joss_sound();
timed_getch();
@@ -3351,7 +3341,15 @@ hangx: goto hangx;
int main(void) {
char choice;
- atari_text_setup();
+ /* newtitle.s saves the OS's display list pointer in FR0,
+ sets up its own DL, and uses narrow playfield mode. First
+ thing we do it put things back the way they were.
+ FONT_ADDR is set on the command line (see the Makefile). */
+ POKE(560, PEEK(212)); // restore the
+ POKE(561, PEEK(213)); // display list
+ POKE(756, FONT_ADDR / 256); // use our custom font
+ POKE(731, 1); // disable keyclick on XL/XE (does nothing on 400/800)
+ POKE(559, 34); // turn on the screen (normal playfield)
#ifdef MCHENRY_TEST
{
@@ -3362,7 +3360,7 @@ int main(void) {
crlf();
cputs("dmg? ");
damage = get_num();
- // cputs("\r\n");
+ // cputs("\n");
crlf();
cputs("cap? ");
capacity = get_num();
@@ -3395,14 +3393,14 @@ int main(void) {
under_attack_sound();
timed_getch();
compradores_report();
- // cputs("As the masked figure plunges the blade\r\n"
- // "into your heart, he says:\r\n");
+ // cputs("As the masked figure plunges the blade\n"
+ // "into your heart, he says:\n");
print_msg(M_assassinated_2);
timed_getch();
compradores_report();
cprint_elder_brother_wu();
- // cputs("regrets to inform you\r\n"
- // "that your account has been terminated\r\n"
+ // cputs("regrets to inform you\n"
+ // "that your account has been terminated\n"
// "with extreme prejudice.");
print_msg(M_assassinated_3);
timed_getch();
@@ -3424,7 +3422,7 @@ int main(void) {
// cputs("has sent ");
print_msg(M_has_sent);
cprintuint(braves);
- // cputs(" braves\r\nto escort you to the Wu mansion");
+ // cputs(" braves\nto escort you to the Wu mansion");
print_msg(M_braves_to_escort);
cprint_taipan_period();
crlf();
@@ -3434,9 +3432,9 @@ int main(void) {
clear_msg_window();
cprint_elder_brother_wu();
/*
- cputs("reminds you of the\r\n"
- "Confucian ideal of personal worthiness,\r\n"
- "and how this applies to paying one's\r\ndebts.\r\n");
+ cputs("reminds you of the\n"
+ "Confucian ideal of personal worthiness,\n"
+ "and how this applies to paying one's\ndebts.\n");
*/
print_msg(M_wu_warn_1);
@@ -3444,10 +3442,10 @@ int main(void) {
clear_msg_window();
/*
- cputs("He is reminded of a fabled barbarian\r\n"
- "who came to a bad end, after not caring\r\n"
- "for his obligations.\r\n\n"
- "He hopes no such fate awaits you, his\r\nfriend");
+ cputs("He is reminded of a fabled barbarian\n"
+ "who came to a bad end, after not caring\n"
+ "for his obligations.\n\n"
+ "He hopes no such fate awaits you, his\nfriend");
*/
print_msg(M_wu_warn_2);
cprint_taipan_period();
@@ -3483,8 +3481,8 @@ int main(void) {
compradores_report();
cprint_bad_joss();
- // cputs("The local authorities have seized your\r\n"
- // "Opium cargo and have also fined you\r\n");
+ // cputs("The local authorities have seized your\n"
+ // "Opium cargo and have also fined you\n");
print_msg(M_siezed_opium);
cprintfancy(fine);
cprint_taipan_bang();
@@ -3508,7 +3506,7 @@ int main(void) {
port_stats();
compradores_report();
- // cputs("Messenger reports large theft\r\nfrom warehouse");
+ // cputs("Messenger reports large theft\nfrom warehouse");
print_msg(M_whouse_theft);
cprint_taipan_period();
crlf();
@@ -3525,9 +3523,9 @@ int main(void) {
compradores_report();
cprint_li_yuen();
/*
- cputs(" has sent a Lieutenant,\r\n"
- "Taipan. He says his admiral wishes\r\n"
- "to see you in Hong Kong, posthaste!\r\n");
+ cputs(" has sent a Lieutenant,\n"
+ "Taipan. He says his admiral wishes\n"
+ "to see you in Hong Kong, posthaste!\n");
*/
print_msg(M_has_sent_lieutenant);
bad_joss_sound();
@@ -3547,7 +3545,7 @@ int main(void) {
compradores_report();
cprint_bad_joss();
- // cputs("You've been beaten up and\r\nrobbed of ");
+ // cputs("You've been beaten up and\nrobbed of ");
print_msg(M_beaten_robbed);
cprintfancy(robbed);
// cputs(" in cash");
diff --git a/textcomp.c b/textcomp.c
index bb0b4c0..2412f15 100644
--- a/textcomp.c
+++ b/textcomp.c
@@ -62,9 +62,9 @@
The task of replacing cputs("some string") with print_msg(M_some_string)
is done manually.
- When a newline is printed, the decoder always prints a carriage
- return first. Any \r sequences listed in messages.pl are discarded
- before encoding is done.
+ When a newline is printed, our modified conio moves the cursor to the
+ start of the next line, so no \r's are needed. Any \r sequences listed
+ in messages.pl are discarded before encoding is done.
Actually, no prompts ever use capital X or Z. These should be used for
dictionary lookups. Maybe X is followed by a 3-bit dict ID, for the 8
diff --git a/textdecomp.s b/textdecomp.s
index 5d629ba..a19d460 100644
--- a/textdecomp.s
+++ b/textdecomp.s
@@ -72,13 +72,6 @@ _print_msg:
@printit:
sty ysave ; _cputc trashes Y
-
- cmp #$9b ; always print a \r after a \n
- bne @nocr
- lda #$0d ; \r
- jsr _cputc
- lda #$9b
-@nocr:
jsr _cputc
ldy ysave
lda #0