diff options
author | B. Watson <urchlay@slackware.uk> | 2025-03-07 17:33:14 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2025-03-07 17:33:14 -0500 |
commit | e0d1c62907032ba74b533762d9dcc5cd591cc840 (patch) | |
tree | 2d7a48bdb09de44e500a3fc6936b6f23b0c279f9 | |
parent | 5ee1d2c2506ca2d44bf948e28422753a27b9bbaa (diff) | |
download | bw-atari8-tools-e0d1c62907032ba74b533762d9dcc5cd591cc840.tar.gz |
listamsb: tweak -D option some more.
-rw-r--r-- | listamsb.c | 26 |
1 files changed, 11 insertions, 15 deletions
@@ -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; } |