From 7277c08fa69a1f9194cfc9244e9bd1b1a1255b14 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 14 Jan 2021 22:51:09 +0100 Subject: [PATCH] added textio.spc(). assem tweaks. --- compiler/res/prog8lib/c64/textio.p8 | 9 ++- compiler/res/prog8lib/cx16/textio.p8 | 9 ++- compiler/res/prog8lib/diskio.p8 | 5 +- examples/compilerperformance/perf.p8 | 16 ++-- examples/compilerperformance/perf10.p8 | 16 ++-- examples/compilerperformance/perf2.p8 | 16 ++-- examples/compilerperformance/perf3.p8 | 16 ++-- examples/compilerperformance/perf4.p8 | 16 ++-- examples/compilerperformance/perf5.p8 | 16 ++-- examples/compilerperformance/perf6.p8 | 16 ++-- examples/compilerperformance/perf7.p8 | 16 ++-- examples/compilerperformance/perf8.p8 | 16 ++-- examples/compilerperformance/perf9.p8 | 16 ++-- examples/cx16/assembler/assem.p8 | 103 ++++++++++++++++--------- examples/cx16/mandelbrot.p8 | 2 +- examples/test.p8 | 23 +++++- examples/textelite.p8 | 16 ++-- 17 files changed, 193 insertions(+), 134 deletions(-) diff --git a/compiler/res/prog8lib/c64/textio.p8 b/compiler/res/prog8lib/c64/textio.p8 index 643708321..aa72c22a1 100644 --- a/compiler/res/prog8lib/c64/textio.p8 +++ b/compiler/res/prog8lib/c64/textio.p8 @@ -19,14 +19,19 @@ sub clear_screen() { txt.chrout(147) } +sub home() { + txt.chrout(19) +} + sub nl() { txt.chrout('\n') } -sub home() { - txt.chrout(19) +sub spc() { + txt.chrout(' ') } + asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) { ; ---- fill the character screen with the given fill character and character color. ; (assumes screen and color matrix are at their default addresses) diff --git a/compiler/res/prog8lib/cx16/textio.p8 b/compiler/res/prog8lib/cx16/textio.p8 index f319dc69b..d8f45cfaa 100644 --- a/compiler/res/prog8lib/cx16/textio.p8 +++ b/compiler/res/prog8lib/cx16/textio.p8 @@ -19,14 +19,19 @@ sub clear_screen() { txt.chrout(147) } +sub home() { + txt.chrout(19) +} + sub nl() { txt.chrout('\n') } -sub home() { - txt.chrout(19) +sub spc() { + txt.chrout(' ') } + asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) { ; ---- fill the character screen with the given fill character and character color. %asm {{ diff --git a/compiler/res/prog8lib/diskio.p8 b/compiler/res/prog8lib/diskio.p8 index d929fdfee..07ea6bca5 100644 --- a/compiler/res/prog8lib/diskio.p8 +++ b/compiler/res/prog8lib/diskio.p8 @@ -30,7 +30,7 @@ diskio { ubyte low = c64.CHRIN() ubyte high = c64.CHRIN() txt.print_uw(mkword(high, low)) - txt.chrout(' ') + txt.spc() ubyte @zp char repeat { char = c64.CHRIN() @@ -295,7 +295,8 @@ _in_buffer sta $ffff ; Routine to read text lines from a text file. Lines must be less than 255 characters. ; Reads characters from the input file UNTIL a newline or return character (or EOF). ; The line read will be 0-terminated in the buffer (and not contain the end of line character). - ; The length of the line is returned in Y. + ; The length of the line is returned in Y. Note that an empty line is okay and is length 0! + ; I/O error status should be checked by the caller itself via READST() routine. %asm {{ sta P8ZP_SCRATCH_W1 sty P8ZP_SCRATCH_W1+1 diff --git a/examples/compilerperformance/perf.p8 b/examples/compilerperformance/perf.p8 index d207b779d..8ccee0f55 100644 --- a/examples/compilerperformance/perf.p8 +++ b/examples/compilerperformance/perf.p8 @@ -482,7 +482,7 @@ galaxy { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet.name = make_current_planet_name() planet.display(true) txt.print(" (") @@ -853,9 +853,9 @@ planet { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -864,7 +864,7 @@ planet { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -883,15 +883,15 @@ planet { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -956,7 +956,7 @@ util { sub print_right(ubyte width, uword st) { repeat width - string.length(st) { - txt.chrout(' ') + txt.spc() } txt.print(st) } diff --git a/examples/compilerperformance/perf10.p8 b/examples/compilerperformance/perf10.p8 index c9abb6eaa..e2da74771 100644 --- a/examples/compilerperformance/perf10.p8 +++ b/examples/compilerperformance/perf10.p8 @@ -472,7 +472,7 @@ galaxy10 { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet10.name = make_current_planet10_name() planet10.display(true) txt.print(" (") @@ -843,9 +843,9 @@ planet10 { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -854,7 +854,7 @@ planet10 { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -873,15 +873,15 @@ planet10 { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -946,7 +946,7 @@ util10 { sub print_right(ubyte width, uword st) { repeat width - string.length(st) { - txt.chrout(' ') + txt.spc() } txt.print(st) } diff --git a/examples/compilerperformance/perf2.p8 b/examples/compilerperformance/perf2.p8 index 6778c94e0..f4c7754d7 100644 --- a/examples/compilerperformance/perf2.p8 +++ b/examples/compilerperformance/perf2.p8 @@ -472,7 +472,7 @@ galaxy2 { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet2.name = make_current_planet2_name() planet2.display(true) txt.print(" (") @@ -843,9 +843,9 @@ planet2 { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -854,7 +854,7 @@ planet2 { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -873,15 +873,15 @@ planet2 { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -946,7 +946,7 @@ util2 { sub print_right(ubyte width, uword st) { repeat width - string.length(st) { - txt.chrout(' ') + txt.spc() } txt.print(st) } diff --git a/examples/compilerperformance/perf3.p8 b/examples/compilerperformance/perf3.p8 index ebb90b838..1d4de1996 100644 --- a/examples/compilerperformance/perf3.p8 +++ b/examples/compilerperformance/perf3.p8 @@ -472,7 +472,7 @@ galaxy3 { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet3.name = make_current_planet3_name() planet3.display(true) txt.print(" (") @@ -843,9 +843,9 @@ planet3 { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -854,7 +854,7 @@ planet3 { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -873,15 +873,15 @@ planet3 { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -946,7 +946,7 @@ util3 { sub print_right(ubyte width, uword st) { repeat width - string.length(st) { - txt.chrout(' ') + txt.spc() } txt.print(st) } diff --git a/examples/compilerperformance/perf4.p8 b/examples/compilerperformance/perf4.p8 index 2bfe81bc2..e1f3e20d6 100644 --- a/examples/compilerperformance/perf4.p8 +++ b/examples/compilerperformance/perf4.p8 @@ -472,7 +472,7 @@ galaxy4 { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet4.name = make_current_planet4_name() planet4.display(true) txt.print(" (") @@ -843,9 +843,9 @@ planet4 { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -854,7 +854,7 @@ planet4 { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -873,15 +873,15 @@ planet4 { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -946,7 +946,7 @@ util4 { sub print_right(ubyte width, uword st) { repeat width - string.length(st) { - txt.chrout(' ') + txt.spc() } txt.print(st) } diff --git a/examples/compilerperformance/perf5.p8 b/examples/compilerperformance/perf5.p8 index 2ea13de43..24d232f96 100644 --- a/examples/compilerperformance/perf5.p8 +++ b/examples/compilerperformance/perf5.p8 @@ -472,7 +472,7 @@ galaxy5 { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet5.name = make_current_planet5_name() planet5.display(true) txt.print(" (") @@ -843,9 +843,9 @@ planet5 { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -854,7 +854,7 @@ planet5 { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -873,15 +873,15 @@ planet5 { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -946,7 +946,7 @@ util5 { sub print_right(ubyte width, uword st) { repeat width - string.length(st) { - txt.chrout(' ') + txt.spc() } txt.print(st) } diff --git a/examples/compilerperformance/perf6.p8 b/examples/compilerperformance/perf6.p8 index 4417ef00e..6c36587ad 100644 --- a/examples/compilerperformance/perf6.p8 +++ b/examples/compilerperformance/perf6.p8 @@ -472,7 +472,7 @@ galaxy6 { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet6.name = make_current_planet6_name() planet6.display(true) txt.print(" (") @@ -843,9 +843,9 @@ planet6 { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -854,7 +854,7 @@ planet6 { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -873,15 +873,15 @@ planet6 { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -946,7 +946,7 @@ util6 { sub print_right(ubyte width, uword st) { repeat width - string.length(st) { - txt.chrout(' ') + txt.spc() } txt.print(st) } diff --git a/examples/compilerperformance/perf7.p8 b/examples/compilerperformance/perf7.p8 index 87482f91b..0dd9c5a9e 100644 --- a/examples/compilerperformance/perf7.p8 +++ b/examples/compilerperformance/perf7.p8 @@ -472,7 +472,7 @@ galaxy7 { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet7.name = make_current_planet7_name() planet7.display(true) txt.print(" (") @@ -843,9 +843,9 @@ planet7 { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -854,7 +854,7 @@ planet7 { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -873,15 +873,15 @@ planet7 { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -946,7 +946,7 @@ util7 { sub print_right(ubyte width, uword st) { repeat width - string.length(st) { - txt.chrout(' ') + txt.spc() } txt.print(st) } diff --git a/examples/compilerperformance/perf8.p8 b/examples/compilerperformance/perf8.p8 index cb3e592a6..26ad74a98 100644 --- a/examples/compilerperformance/perf8.p8 +++ b/examples/compilerperformance/perf8.p8 @@ -472,7 +472,7 @@ galaxy8 { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet8.name = make_current_planet8_name() planet8.display(true) txt.print(" (") @@ -843,9 +843,9 @@ planet8 { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -854,7 +854,7 @@ planet8 { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -873,15 +873,15 @@ planet8 { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -946,7 +946,7 @@ util8 { sub print_right(ubyte width, uword st) { repeat width - string.length(st) { - txt.chrout(' ') + txt.spc() } txt.print(st) } diff --git a/examples/compilerperformance/perf9.p8 b/examples/compilerperformance/perf9.p8 index 6a478c4df..cb68b7a66 100644 --- a/examples/compilerperformance/perf9.p8 +++ b/examples/compilerperformance/perf9.p8 @@ -472,7 +472,7 @@ galaxy9 { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet9.name = make_current_planet9_name() planet9.display(true) txt.print(" (") @@ -843,9 +843,9 @@ planet9 { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -854,7 +854,7 @@ planet9 { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -873,15 +873,15 @@ planet9 { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -946,7 +946,7 @@ util9 { sub print_right(ubyte width, uword st) { repeat width - string.length(st) { - txt.chrout(' ') + txt.spc() } txt.print(st) } diff --git a/examples/cx16/assembler/assem.p8 b/examples/cx16/assembler/assem.p8 index 27d17ada0..5cc243c51 100644 --- a/examples/cx16/assembler/assem.p8 +++ b/examples/cx16/assembler/assem.p8 @@ -12,18 +12,22 @@ main { sub start() { - txt.print("\n65c02 file based assembler.\n") + txt.print("\n65c02 file based assembler.\n\nfilename or enter for interactive: ") - ; user_input() - file_input() + str filename = "?" * 20 + if txt.input_chars(filename) + file_input(filename) + else + user_input() - ; test_stack.test() + test_stack.test() } sub user_input() { txt.lowercase() parser.print_emit_bytes = true - txt.print("Empty line to stop.\n") + parser.program_counter = $4000 + txt.print("\nEmpty line to stop.\n") repeat { ubyte input_length = 0 txt.chrout('A') @@ -42,55 +46,67 @@ main { if not parser.process_line() break } + parser.done() } - sub file_input() { + sub file_input(uword filename) { parser.print_emit_bytes = false - str filename = "romdis.asm" + ubyte success = false - txt.print("\nread file: ") + txt.print("\nreading ") txt.print(filename) - txt.nl() + txt.spc() if diskio.f_open(8, filename) { c64.SETTIM(0,0,0) uword line=0 repeat { - if diskio.f_readline(parser.input_line) { - line++ - if not lsb(line) - txt.chrout('.') + void diskio.f_readline(parser.input_line) + line++ - if not parser.process_line() { - txt.print("\nerror. last line was ") - txt.print_uw(line) - txt.chrout(':') - txt.print(parser.word_addrs[0]) - txt.chrout(' ') + if not lsb(line) + txt.chrout('.') + + if not parser.process_line() { + txt.print("\nerror. last line was ") + txt.print_uw(line) + txt.print(": ") + txt.print(parser.word_addrs[0]) + if parser.word_addrs[1] { + txt.spc() txt.print(parser.word_addrs[1]) - txt.chrout(' ') + } + if parser.word_addrs[2] { + txt.spc() txt.print(parser.word_addrs[2]) - txt.nl() - break } - if c64.READST() - break - if c64.STOP2() { - txt.print("?break\n") - break - } - } else + txt.nl() break + } + if c64.READST() { + success = c64.READST()&64==64 ; end of file? + break + } + if c64.STOP2() { + txt.print("?break\n") + break + } } diskio.f_close() + parser.done() - print_summary(line) + if success + print_summary(line, parser.pc_min, parser.pc_max) + } else { + txt.print(diskio.status(8)) } } - sub print_summary(uword lines) { - txt.print("\n\nfinal address: ") - txt.print_uwhex(parser.program_counter, 1) + sub print_summary(uword lines, uword start_address, uword end_address) { + txt.print("\n\nstart address: ") + txt.print_uwhex(start_address, 1) + txt.print("\n end address: ") + txt.print_uwhex(end_address, 1) txt.print("\n lines: ") txt.print_uw(lines) @@ -115,8 +131,10 @@ parser { str input_line = "?" * 160 uword[3] word_addrs - uword program_counter = $4000 - ubyte print_emit_bytes = true + uword program_counter = $ffff + ubyte print_emit_bytes + uword pc_min = $ffff + uword pc_max = $0000 sub process_line() -> ubyte { string.lower(input_line) @@ -131,6 +149,11 @@ parser { return false } + sub done() { + if program_counter>pc_max + pc_max = program_counter + } + sub do_assign() -> ubyte { ; target is in word_addrs[0], value is in word_addrs[2] ('=' is in word_addrs[1]) if not word_addrs[2] { @@ -152,6 +175,10 @@ parser { txt.print("\n* = ") txt.print_uwhex(program_counter, true) txt.nl() + if program_counterpc_max + pc_max = program_counter } else { symbols.setvalue(word_addrs[0], cx16.r15) } @@ -275,7 +302,7 @@ parser { ubyte num_operand_bytes = operand_size[addr_mode] if print_emit_bytes { - txt.chrout(' ') + txt.spc() txt.print_uwhex(program_counter, 1) txt.print(" ") } @@ -406,7 +433,7 @@ parser { return false } if print_emit_bytes { - txt.chrout(' ') + txt.spc() txt.print_uwhex(program_counter, 1) txt.print(" ") } @@ -489,7 +516,7 @@ _is_2_entry if print_emit_bytes { txt.print_ubhex(value, 0) - txt.chrout(' ') + txt.spc() } } diff --git a/examples/cx16/mandelbrot.p8 b/examples/cx16/mandelbrot.p8 index 429d49836..a92e46529 100644 --- a/examples/cx16/mandelbrot.p8 +++ b/examples/cx16/mandelbrot.p8 @@ -34,7 +34,7 @@ main { iter++ } txt.color2(1, max_iter-iter) - txt.chrout(' ') + txt.spc() } txt.nl() } diff --git a/examples/test.p8 b/examples/test.p8 index 44e80c9ae..624bcfcd9 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -7,7 +7,28 @@ main { sub start() { - txt.print("hello\n") + str filename="?"*40 + txt.print("> ") + ubyte il = txt.input_chars(filename) + txt.print_ub(il) + txt.nl() + txt.print_ubhex(filename[0],1) + txt.print_ubhex(filename[1],1) + txt.print_ubhex(filename[2],1) + txt.nl() + txt.print(filename) + txt.nl() + + txt.print("> ") + il = txt.input_chars(filename) + txt.print_ub(il) + txt.nl() + txt.print_ubhex(filename[0],1) + txt.print_ubhex(filename[1],1) + txt.print_ubhex(filename[2],1) + txt.nl() + txt.print(filename) + txt.nl() } } diff --git a/examples/textelite.p8 b/examples/textelite.p8 index 67614f29e..26ee5865a 100644 --- a/examples/textelite.p8 +++ b/examples/textelite.p8 @@ -472,7 +472,7 @@ galaxy { txt.chrout('*') else txt.chrout('-') - txt.chrout(' ') + txt.spc() planet.name = make_current_planet_name() planet.display(true) txt.print(" (") @@ -843,9 +843,9 @@ planet { print_name_uppercase() txt.print(" TL:") txt.print_ub(techlevel+1) - txt.chrout(' ') + txt.spc() txt.print(econnames[economy]) - txt.chrout(' ') + txt.spc() txt.print(govnames[govtype]) } else { txt.print("\n\nSystem: ") @@ -854,7 +854,7 @@ planet { txt.print_ub(x) txt.chrout('\'') txt.print_ub(y) - txt.chrout(' ') + txt.spc() txt.chrout('#') txt.print_ub(number) txt.print("\nEconomy: ") @@ -873,15 +873,15 @@ planet { if species_is_alien { if species_size < len(species_sizes) { txt.print(species_sizes[species_size]) - txt.chrout(' ') + txt.spc() } if species_color < len(species_colors) { txt.print(species_colors[species_color]) - txt.chrout(' ') + txt.spc() } if species_look < len(species_looks) { txt.print(species_looks[species_look]) - txt.chrout(' ') + txt.spc() } if species_kind < len(species_kinds) { txt.print(species_kinds[species_kind]) @@ -946,7 +946,7 @@ util { sub print_right(ubyte width, uword s) { repeat width - string.length(s) { - txt.chrout(' ') + txt.spc() } txt.print(s) }