aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-03-07 17:33:14 -0500
committerB. Watson <urchlay@slackware.uk>2025-03-07 17:33:14 -0500
commite0d1c62907032ba74b533762d9dcc5cd591cc840 (patch)
tree2d7a48bdb09de44e500a3fc6936b6f23b0c279f9
parent5ee1d2c2506ca2d44bf948e28422753a27b9bbaa (diff)
downloadbw-atari8-tools-e0d1c62907032ba74b533762d9dcc5cd591cc840.tar.gz
listamsb: tweak -D option some more.
-rw-r--r--listamsb.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/listamsb.c b/listamsb.c
index a9f6505..bd92aa0 100644
--- a/listamsb.c
+++ b/listamsb.c
@@ -480,8 +480,13 @@ void unlock_program(void) {
exit(0);
}
-void write_code(int ptr, int lineno, const char *code) {
- /* TODO */
+void write_code(int addr, int lineno, const unsigned char *code) {
+ fputc(addr & 0xff, outfile);
+ fputc((addr >> 8) & 0xff, outfile);
+ fputc(lineno & 0xff, outfile);
+ fputc((lineno >> 8) & 0xff, outfile);
+ fputs((char *)code, outfile);
+ fputc(0x00, outfile);
}
int crunch_line(void) {
@@ -538,12 +543,7 @@ int crunch_line(void) {
codelen += 4; /* account for ptr and lineno */
addr += codelen;
- fputc(addr & 0xff, outfile);
- fputc((addr >> 8) & 0xff, outfile);
- fputc(lineno & 0xff, outfile);
- fputc((lineno >> 8) & 0xff, outfile);
- fputs((char *)code, outfile);
- fputc(0x00, outfile);
+ write_code(addr, lineno, code);
return codelen;
}
@@ -588,7 +588,8 @@ int need_space_between(unsigned char t1, unsigned char t2) {
a keyword, but put it in for neatness. examples:
OPEN #1,"D:X" INPUT
IF A$="FOO" THEN 10
- these look weird with the space before INPUT or THEN. */
+ PRINT "YOUR IQ IS" IQ
+ these look weird without the space after the " */
if(t1last == '|' && isalnum(t2first)) return 1;
return(isalnum(t1last) && isalnum(t2first));
@@ -641,12 +642,7 @@ int decrunch_line(void) {
codelen += 4; /* account for ptr and lineno */
addr += codelen;
- fputc(addr & 0xff, outfile);
- fputc((addr >> 8) & 0xff, outfile);
- fputc(lineno & 0xff, outfile);
- fputc((lineno >> 8) & 0xff, outfile);
- fputs((char *)code, outfile);
- fputc(0x00, outfile);
+ write_code(addr, lineno, code);
return codelen;
}