From f1799614fcadc8cf718f9c81ec7fe3cfa9e7a799 Mon Sep 17 00:00:00 2001 From: Andre Fachat Date: Tue, 14 Nov 2023 21:32:35 +0100 Subject: [PATCH] beta 5 --- xa/ChangeLog | 21 ++++++--- xa/README.1st | 21 ++++++--- xa/attic/README | 2 + xa/{ => attic}/doc/README | 0 xa/{ => attic}/doc/fileformat.txt | 0 xa/{ => attic}/doc/xa-de.log | 0 xa/{ => attic}/doc/xa-de.txt | 0 xa/{ => attic}/doc/xa.html | 0 xa/{ => attic}/doc/xa.log | 0 xa/{ => attic}/doc/xa.txt | 0 xa/{ => attic}/doc/xaannounce | 0 xa/man/README | 2 +- xa/man/file65.1 | 2 +- xa/man/ldo65.1 | 2 +- xa/man/printcbm.1 | 14 +++++- xa/man/reloc65.1 | 2 +- xa/man/uncpk.1 | 2 +- xa/man/xa.1 | 76 +++++++++++++++---------------- xa/misc/printcbm.c | 2 + xa/tests/README | 13 ++++-- xa/tests/expando/ok | 1 + xa/tests/expando/test.s | 23 ++++++++++ xa/tests/harness | 26 ++++++++--- 23 files changed, 141 insertions(+), 68 deletions(-) rename xa/{ => attic}/doc/README (100%) rename xa/{ => attic}/doc/fileformat.txt (100%) rename xa/{ => attic}/doc/xa-de.log (100%) rename xa/{ => attic}/doc/xa-de.txt (100%) rename xa/{ => attic}/doc/xa.html (100%) rename xa/{ => attic}/doc/xa.log (100%) rename xa/{ => attic}/doc/xa.txt (100%) rename xa/{ => attic}/doc/xaannounce (100%) create mode 100644 xa/tests/expando/ok create mode 100644 xa/tests/expando/test.s diff --git a/xa/ChangeLog b/xa/ChangeLog index 723713b..2ca4359 100644 --- a/xa/ChangeLog +++ b/xa/ChangeLog @@ -399,7 +399,8 @@ xa-2.3.14 xa-2.4.0 - * Listing feature in plain text or HTML. + * Listing feature in plain text or HTML, along with .listbytes to control + how hex bytes get listed in the output. * Add -E commandline option to not stop after 20 errors, but show all of them. * Introduce -X compatibility set commandline option, to distinguish @@ -407,7 +408,7 @@ xa-2.4.0 0x and 0 to specify hex or octal. As a result, -M is now deprecated, and colons in comments may become the default in a future version. * Implement CA65 "cheap local labels", ":=" label definitions, - and various pseudo opcodes (.include, .import, .importzp, + and various pseudo-opcodes (.include, .import, .importzp, .zeropage, .proc (anonymous only), .endproc, .code, .org, .reloc). * -U option to allow all undefined labels in relocation mode; this allows exporting them to an o65 file and link at a later time (or @@ -419,15 +420,21 @@ xa-2.4.0 * Main Makefile fixes. * Fixed parallel make in tests, incorporating a patch from Sergei Trofimovich. + * Added a test case that failed in 2.3.14 from Tom Hargreaves. * Some 2.3.x features still allowed with -XXA23, which is obviously deprecated. * The quote escape character is now the \ (backslash), except if -XXA23. * Recursive /* */ comments are no longer allowed, except if -XXA23. * XA_MAJOR and XA_MINOR predefined macros, except if -XXA23. - * Testsuite expanded. - * Deprecated options (16-bit mvn/mvp argument, -S, -x) finally removed. - If you need this support, you must use 2.3.x. + * Testsuite greatly expanded. + * The old loader/ testsuite and doc/ archive are now in attic/, which is + the repository for old unsupported components. It may be purged in a + future version. + * -M is now deprecated (use -XMASM), just in case you forgot. + * printcbm(1) is now deprecated (use VICE petcat, it does a lot more). + * Previously deprecated options (16-bit mvn/mvp argument, -S, -x) finally + removed. If you need this support, you must use 2.3.x. - -- André Fachat 13 October, 2023 - -- Cameron Kaiser XXX + -- André Fachat and + -- Cameron Kaiser , 17 November, 2023 diff --git a/xa/README.1st b/xa/README.1st index 1df29df..d7e4ede 100644 --- a/xa/README.1st +++ b/xa/README.1st @@ -5,10 +5,18 @@ under most ANSI C compilers. It is distributed under the GNU Public License The current version is 2.4.0, the first new feature release literally in years. It builds upon the improvements in 2.3.x and its unified 6502/65816 -assembler core, removes deprecated features, and adds listing capability, -greater flexibility with relocatable objects, and greater cross-compatibility -with other popular cross-assemblers (notably ca65) because once you use xa, -you'll want to keep on using it. :) +assembler core by adding listing capability, greater flexibility with +relocatable objects, and better cross-compatibility with other popular +cross-assemblers (notably ca65) because once you use xa, you'll want to keep +on using it. :) + +Certain long-deprecated options and non-standard syntaxes have also been +removed in this release, so it is possible some very old code may not +assemble without errors. These changes have been a long time coming and we +gave lots of warnings, so if you require these features and cannot change +your code to work without them, you must use xa 2.3.14. Fortunately, most +code should continue to work just fine and the test suite is even bigger to +catch these sorts of regressions. To install on a generic Unixy thing, you should be able to just type @@ -19,9 +27,8 @@ To install on a generic Unixy thing, you should be able to just type This will create xa along with its various support utilities. Try assembling the cpk depacker in examples/ as a test. xa also comes with uncpk (a program for generating cpk archives) and printcbm (a program for listing Commodore -BASIC test) and file65, ldo65 and reloc65 for displaying, linking and -relocating o65 files in Andre's relocatable format (see doc/fileformats.txt). -The loader/ directory also has goodies for managing relocatable binaries. +BASIC test, now deprecated as of 2.4) and file65, ldo65 and reloc65 for +displaying, linking and relocating o65 files in Andre's relocatable format. Don't forget the man pages in man/. Install these into your MANPATH at your leisure, or read them with nroff -man (and/or groff -man). diff --git a/xa/attic/README b/xa/attic/README index 2448e56..90b909e 100644 --- a/xa/attic/README +++ b/xa/attic/README @@ -1,4 +1,6 @@ These are files that have been superseded and may be removed in the future. loader/ Rewritten as tests/loader/ +doc/ Replaced by man/ + (for o65, see http://www.6502.org/users/andre/o65/ ) diff --git a/xa/doc/README b/xa/attic/doc/README similarity index 100% rename from xa/doc/README rename to xa/attic/doc/README diff --git a/xa/doc/fileformat.txt b/xa/attic/doc/fileformat.txt similarity index 100% rename from xa/doc/fileformat.txt rename to xa/attic/doc/fileformat.txt diff --git a/xa/doc/xa-de.log b/xa/attic/doc/xa-de.log similarity index 100% rename from xa/doc/xa-de.log rename to xa/attic/doc/xa-de.log diff --git a/xa/doc/xa-de.txt b/xa/attic/doc/xa-de.txt similarity index 100% rename from xa/doc/xa-de.txt rename to xa/attic/doc/xa-de.txt diff --git a/xa/doc/xa.html b/xa/attic/doc/xa.html similarity index 100% rename from xa/doc/xa.html rename to xa/attic/doc/xa.html diff --git a/xa/doc/xa.log b/xa/attic/doc/xa.log similarity index 100% rename from xa/doc/xa.log rename to xa/attic/doc/xa.log diff --git a/xa/doc/xa.txt b/xa/attic/doc/xa.txt similarity index 100% rename from xa/doc/xa.txt rename to xa/attic/doc/xa.txt diff --git a/xa/doc/xaannounce b/xa/attic/doc/xaannounce similarity index 100% rename from xa/doc/xaannounce rename to xa/attic/doc/xaannounce diff --git a/xa/man/README b/xa/man/README index 4d54849..50282cd 100644 --- a/xa/man/README +++ b/xa/man/README @@ -1,3 +1,3 @@ -Also look at ../doc/ for previous documentation files and the Change log. +Also look at ../attic/doc/ for previous documentation files. Cameron Kaiser diff --git a/xa/man/file65.1 b/xa/man/file65.1 index d1ad8f0..cd1f70e 100644 --- a/xa/man/file65.1 +++ b/xa/man/file65.1 @@ -1,4 +1,4 @@ -.TH FILE65 "1" "11 April 2006" +.TH FILE65 "1" "17 November 2023" .SH NAME file65 \- print information for o65 object files diff --git a/xa/man/ldo65.1 b/xa/man/ldo65.1 index 461ca2c..fa1a894 100644 --- a/xa/man/ldo65.1 +++ b/xa/man/ldo65.1 @@ -1,4 +1,4 @@ -.TH LDO65 "1" "11 April 2006" +.TH LDO65 "1" "17 November 2023" .SH NAME ldo65 \- linker for o65 object files diff --git a/xa/man/printcbm.1 b/xa/man/printcbm.1 index a327a4c..a79b64a 100644 --- a/xa/man/printcbm.1 +++ b/xa/man/printcbm.1 @@ -1,7 +1,17 @@ -.TH PRINTCBM "1" "11 April 2006" +.TH PRINTCBM "1" "DEPRECATED" .SH NAME -printcbm \- list a Commodore BASIC file +printcbm \- list a Commodore BASIC file (DEPRECATED) + +.SH NOTICE +As of +.B xa +2.4, +.B printcbm +is deprecated and will be removed in a future version. Please consider +migrating your usage to VICE +.BR petcat(1) , +which has many more options. .SH SYNOPSIS .B printcbm diff --git a/xa/man/reloc65.1 b/xa/man/reloc65.1 index 751b08f..80ad465 100644 --- a/xa/man/reloc65.1 +++ b/xa/man/reloc65.1 @@ -1,4 +1,4 @@ -.TH RELOC65 "1" "11 April 2006" +.TH RELOC65 "1" "17 November 2023" .SH NAME reloc65 \- relocator for o65 object files diff --git a/xa/man/uncpk.1 b/xa/man/uncpk.1 index 3be6e34..ec46ea1 100644 --- a/xa/man/uncpk.1 +++ b/xa/man/uncpk.1 @@ -1,4 +1,4 @@ -.TH UNCPK "1" "11 April 2006" +.TH UNCPK "1" "17 November 2023" .SH NAME uncpk \- manage c64 cpk archives diff --git a/xa/man/xa.1 b/xa/man/xa.1 index ff17196..5226057 100644 --- a/xa/man/xa.1 +++ b/xa/man/xa.1 @@ -1,4 +1,4 @@ -.TH XA "1" "24 November 2021" +.TH XA "1" "17 November 2023" .SH NAME xa \- 6502/R65C02/65816 cross-assembler @@ -125,7 +125,7 @@ preprocessor macros. This option is inherently deprecated and may be removed in the next 2.x or 3.x release. .TP .B \-M -This option is deprecated; use +This option is deprecated and will be removed in a future version; use .B \-XMASM instead. Allows colons to appear in comments for MASM compatibility. This does not affect colon interpretation elsewhere, and may become the default in a @@ -480,12 +480,10 @@ or zero page value, do not attempt to optimize to a zero page argument for those opcodes that support it (i.e., keep as 16 bit word) .TP .B @ -render as 24-bit quantity for 65816 (must specify +render as 24-bit quantity for 65816, even if smaller than 24 bits (must specify .B \-w command-line option, must not specify -.BR \-XCA65 ). -.B This is required to specify any -.B 24-bit quantity! +.BR \-XCA65 ) .TP .B ` force further optimization, even if the length of the instruction cannot @@ -609,7 +607,8 @@ repetitions of will be inserted into the assembled object. For example, .B .dsb 5,$10 will insert five bytes, each being 16 decimal, into the object. The arguments -may be expressions. See +may be expressions. If only a single argument is provided, then the argument +is treated as a number of null bytes to insert. See .B LINKING for how to use this pseudo-op to link multiple objects. .TP @@ -618,8 +617,10 @@ Inlines a binary file without further interpretation specified by .B filename from offset .B offset -to length -.BR length . +(relative to the beginning of the file) +for +.B length +bytes. This allows you to insert data such as a previously assembled object file or an image or other binary data structure, inlined directly into this file's object. If @@ -644,7 +645,7 @@ one level deep). Sixteen levels of scoping are permitted. .IP .B \.block is accepted as a synonym for -.BR \&.) , +.BR \&.( , as well as .B \.proc (but you cannot specify an explicit scope name as in @@ -657,7 +658,6 @@ Closes a block. or .B .endproc are accepted as synonyms. -. .TP .B \.as \.al \.xs \.xl Only relevant in 65816 mode (with the @@ -715,19 +715,30 @@ Includes another file in place of the pseudo-op, as if the preprocessor had done so with an .B #include directive (see -.BR PREPROCESSOR ). +.BR PREPROCESSOR ), +but at the assembler +phase after preprocessing has already occurred. + +.LP +The following pseudo-op applies to listing mode. +.TP +.B \.listbytes number +In the listing output, sets the maximum number of hex bytes to be printed +in the listing for pseudo-ops like +.BR .byt , +by default 8. The special argument +.B unlimited +sets no upper limit. If listing mode is disabled, this pseudo-op has no +observable effect. .LP The following pseudo-ops apply primarily to relocatable .B .o65 objects. A full discussion of the relocatable format is beyond the -scope of this manpage. Documentation -on the proposed v1.2 format is in -.B doc/fileformat.txt -within the -.B xa -installation directory. +scope of this manpage; see +.B http://www.6502.org/users/andre/o65/ +for the most current specification. .TP .B .text .data .bss .zero These pseudo-ops switch between the different segments, @@ -743,7 +754,7 @@ being uninitialized zero page space for allocation. In and .BR .zero , only labels are evaluated. These pseudo-ops -are valid in relative and absolute modes. +are valid in relocating and absolute modes. .TP .B .code For @@ -761,7 +772,7 @@ compatibility, this is currently mapped to Aligns the current segment to a byte boundary (2, 4 or 256) as specified by .B value -(and places it in the header when relative mode is enabled). Other values +(and places it in the header when relocating mode is enabled). Other values generate an error. .TP .B .fopt type, value1, value2, value3, ... @@ -941,12 +952,6 @@ satisfied, then the source code between the directive and its terminating .B #endif are expunged and not assembled. Up to fifteen levels of nesting are supported. .TP -.B #endif -Closes a conditional block. -.TP -.B #else -Implements alternate path for a conditional block. -.TP .B #ifdef DEFINE True only if macro .B DEFINE @@ -977,6 +982,12 @@ is defined .I and assigned with a value. .I This works on labels, not macros! +.TP +.B #else +Implements alternate path for a conditional block. +.TP +.B #endif +Closes a conditional block. .LP Unclosed conditional blocks at the end of included files generate warnings; unclosed conditional blocks at the end of assembly generate an error. @@ -1160,17 +1171,6 @@ Indiscriminately forcing the issue can be fraught with peril, however, and is not recommended; to discourage this, the assembler will complain about its use in addressing mode situations where no ambiguity exists, such as indirect indexed, branching and so on. -.LP -Also, as a further consequence of the way optimization is managed, we repeat -that -.B all -24-bit quantities and labels that reference a 24-bit quantity in 65816 mode, -anteriorly declared or otherwise, -.B MUST -be prepended with the -.B @ -prefix. Otherwise, the assembler will attempt to optimize to 16 bits, which -may be undesirable. .SH "SEE ALSO" .BR file65 (1), @@ -1188,7 +1188,7 @@ Original xa package (C)1989-1997 Andre Fachat. Additional changes (C)1989-2023 Andre Fachat, Jolse Maginnis, David Weinehall, Cameron Kaiser. The official maintainer is Cameron Kaiser. -.SH 30 YEARS OF XA +.SH OVER 30 YEARS OF XA Yay us? .SH WEBSITE diff --git a/xa/misc/printcbm.c b/xa/misc/printcbm.c index 83ea360..e00124b 100644 --- a/xa/misc/printcbm.c +++ b/xa/misc/printcbm.c @@ -46,6 +46,8 @@ void usage(FILE *fp) fprintf(fp, "Usage: %s [OPTION]... [FILE]...\n" "List CBM BASIC programs\n" + "This tool is deprecated as of xa 2.4 and will be removed in a future version.\n" + "Please consider migrating to VICE petcat, which has many more options.\n" "\n" " --version output version information and exit\n" " --help display this help and exit\n", diff --git a/xa/tests/README b/xa/tests/README index d67202a..e1f1028 100644 --- a/xa/tests/README +++ b/xa/tests/README @@ -1,13 +1,19 @@ This is a directory of test suites for complex or pathological cases that have been repaired (?) in the current version. It is primarily for internal -testing, but is here for your interest. +testing, but is here for your interest. It requires a reasonably compatible +`make` and Perl. -Starting with 2.3.6, you should not normally need to run these directly -unless 'make test' fails. If you do, use harness: +You can run specific tests from the main source directory with + +make test TESTS=test,test,test,... + +or, if `make test` doesn't work right on your system, you can run the Perl +harness directly: ./harness -cc=... -cflags=... -make=... -tests=testdir,testdir,testdir,... If -tests is omitted, all tests are run. + Don't run the makefiles directly, if they exist; they may not work properly. If a Makefile is not present, then the test harness assembles "test.s" and compares it with "ok". @@ -52,6 +58,7 @@ recucom/ Recursive comments test aserror/ Tests of .assert and #error syntax/function loader/ Old ../loader tests, moved into test suite proper reset_segment/ Verifies conditions under which a segment is reset +expando/ Test of preprocessor expansion (thanks Tom Hargreaves) Cameron Kaiser, André Fachat diff --git a/xa/tests/expando/ok b/xa/tests/expando/ok new file mode 100644 index 0000000..e4eb9c0 --- /dev/null +++ b/xa/tests/expando/ok @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/xa/tests/expando/test.s b/xa/tests/expando/test.s new file mode 100644 index 0000000..2cc1a1a --- /dev/null +++ b/xa/tests/expando/test.s @@ -0,0 +1,23 @@ +PBI=6 + +#define NIB(x) PBI+((x&1)>>0), \ + PBI+((x&2)>>1), \ + PBI+((x&4)>>2), \ + PBI+((x&8)>>3) +tab0 + .byt NIB(10),NIB(12),NIB(0), NIB(0) + .byt NIB(10),NIB(12),NIB(15),NIB(0) + .byt NIB(10),NIB(12),NIB(0), NIB(15) + .byt NIB(10),NIB(12),NIB(15),NIB(15) + +; oh well. +tab1 + .byt PBI+0,PBI+1,PBI+0,PBI+1,PBI+0,PBI+0,PBI+1,PBI+1 + .byt PBI+0,PBI+0,PBI+0,PBI+0,PBI+0,PBI+0,PBI+0,PBI+0 + .byt PBI+0,PBI+1,PBI+0,PBI+1,PBI+0,PBI+0,PBI+1,PBI+1 + .byt PBI+1,PBI+1,PBI+1,PBI+1,PBI+0,PBI+0,PBI+0,PBI+0 + .byt PBI+0,PBI+1,PBI+0,PBI+1,PBI+0,PBI+0,PBI+1,PBI+1 + .byt PBI+0,PBI+0,PBI+0,PBI+0,PBI+1,PBI+1,PBI+1,PBI+1 + .byt PBI+0,PBI+1,PBI+0,PBI+1,PBI+0,PBI+0,PBI+1,PBI+1 + .byt PBI+1,PBI+1,PBI+1,PBI+1,PBI+1,PBI+1,PBI+1,PBI+1 + diff --git a/xa/tests/harness b/xa/tests/harness index f93c820..f770e55 100755 --- a/xa/tests/harness +++ b/xa/tests/harness @@ -27,8 +27,6 @@ CC = $cc CFLAGS = $cflags MAKE = $make MAKEFLAGS = $makeflags -tests to run: $dtests - EOF # Get a list of all directories. If there is a Makefile there, do it. @@ -36,9 +34,26 @@ EOF # Otherwise, do nothing (acknowledge and ignore directories we don't grok). opendir(D, ".") || die("test harness failed: $!\n"); -W: while($x = readdir(D)) { - next W if ($x =~ /^\./); - next W if (length($tests) && ($tests !~ /$x/)); +while($x = readdir(D)) { + next if ($x =~ /^\./ || $x =~ /\s/); + next if (length($tests) && ($tests !~ /$x/)); + next if (! -d $x); + if (-r "$x/Makefile") { + push(@mtests, $x); + } else { + push(@stests, $x); + } +} +closedir(D); + +@tests = (); +push(@tests, sort @mtests) if (scalar(@mtests)); +push(@tests, sort @stests) if (scalar(@stests)); +print "matching tests: "; +print join(",", @tests); +print "\n\n"; + +W: foreach $x (@tests) { next W if (!chdir($x)); $x = substr($x . " " . ("." x 79), 0, 50); print STDOUT "$x > "; @@ -69,7 +84,6 @@ W: while($x = readdir(D)) { } chdir(".."); } -closedir(D); print STDOUT "=" x 79, "\n"; if ($ntests) { # ntestacy is a terrible thing print STDOUT "\n## ALL SELECTED TESTS PASS ($dtests, n=$ntests) ##\n";