Merlin 8/16/16+ Compatible 6502/65816 assembler/linker suite in C++ for linux
Go to file
Kelvin Sherlock b4bf2c1611 fix to macro operand parsing for quoted strings
macro operand parsing code was a little too clever and had problems if both ' and " delimiters were present.

new code uses separate loops for handing delimited strings and raw strings, to keep things simpler and more correct.

```
xx	mac
	asc ]1
	eom

	xx '"hello"'
	xx "'hello'"
	xx 'hello'
	xx "hello"
	xx 'abc',00
	xx ff

 ```
before:
```
Assembling macstr.s

Bad operand in line: 5.

Bad operand in line: 6.
                     1 xx           mac
                     2              asc  ]1
                     3              eom
                     4
008000:              5              xx   '"hello"'
008000: 22 68 65 6C  5              asc  '"hello"'

008004: 6C 6F 22
                     5              eom
008007:              6              xx   "'hello'"
008007: A7 E8 E5 EC  6              asc  "'hello'"

00800B: EC EF A7
                     6              eom
00800E:              7              xx   'hello'
00800E: 68 65 6C 6C  7              asc  'hello'
008012: 6F
                     7              eom
008013:              8              xx   "hello"
008013: E8 E5 EC EC  8              asc  "hello"
008017: EF
                     8              eom
008018:              9              xx   'abc',00
008018: 61 62 63 00  9              asc  'abc',00
                     9              eom
00801C:              10             xx   ff
00801C: FF           10             asc  ff
                     10             eom

End of QuickASM assembly. 29 bytes, 2 errors, 22 lines, 1 symbols.

Elapsed time = < 1 second.
```

after:
```
Assembling macstr.s

                     1 xx           mac
                     2              asc  ]1
                     3              eom
                     4
008000:              5              xx   '"hello"'
008000: 22 68 65 6C  5              asc  '"hello"'
008004: 6C 6F 22
                     5              eom
008007:              6              xx   "'hello'"
008007: A7 E8 E5 EC  6              asc  "'hello'"
00800B: EC EF A7
                     6              eom
00800E:              7              xx   'hello'
00800E: 68 65 6C 6C  7              asc  'hello'
008012: 6F
                     7              eom
008013:              8              xx   "hello"
008013: E8 E5 EC EC  8              asc  "hello"
008017: EF
                     8              eom
008018:              9              xx   'abc',00
008018: 61 62 63 00  9              asc  'abc',00
                     9              eom
00801C:              10             xx   ff
00801C: FF           10             asc  ff
                     10             eom

End of QuickASM assembly. 29 bytes, 0 errors, 22 lines, 1 symbols.

Elapsed time = < 1 second.
```
2020-05-25 16:14:13 -04:00
ciderpress test 2019-11-16 17:36:22 -08:00
cmake
qasm.xcodeproj Remove broken links in project file, fix run to use relocated test file 2020-01-14 16:49:48 -08:00
src fix to macro operand parsing for quoted strings 2020-05-25 16:14:13 -04:00
testdata Remove broken links in project file, fix run to use relocated test file 2020-01-14 16:49:48 -08:00
.gitignore
app.h
asm.cpp Fix some type conversion warnings 2019-12-03 09:44:50 -07:00
asm.h fixes for nested DO/IF/ELSE/FIN 2019-11-21 19:20:59 -08:00
CMakeLists.txt test 2019-11-16 22:48:24 -08:00
config.h parser regex complete 2019-11-19 08:38:49 -08:00
eval.cpp Fix some type conversion warnings 2019-12-03 09:44:50 -07:00
eval.h fixes for nested DO/IF/ELSE/FIN 2019-11-21 19:20:59 -08:00
libpal
LICENSE
Makefile more mods for testruns 2019-11-20 10:39:28 -08:00
merlintests.sh Get merlintests.sh working on my system 2019-12-03 12:04:18 -07:00
opcodes.cpp Add USR opcode. This uses the Merlin and QAsm opcode hashing scheme. 2019-12-19 20:05:49 -05:00
psuedo.cpp Add USR opcode. This uses the Merlin and QAsm opcode hashing scheme. 2019-12-19 20:05:49 -05:00
psuedo.h Add USR opcode. This uses the Merlin and QAsm opcode hashing scheme. 2019-12-19 20:05:49 -05:00
qasm
qasm.cpp added --syntax option 2019-11-19 09:59:03 -08:00
qasm.h test 2019-11-15 18:40:12 -08:00
qasm.ini work on <>|^ operators to match M32 2019-11-19 13:41:27 -08:00
README Add note about ERR support to readme 2019-12-11 10:35:39 -08:00
runtests.sh more mods for testruns 2019-11-20 10:38:23 -08:00
todo.txt all tests assemble, ]vars seem to be working 2019-11-19 11:27:17 -08:00

Merlin Compatible assembler/linker (and more) for linux

This project is FAR from complete...as I have just gotten it to compile all 256 65816 opcodes.

Update (11/19/2019) - All code generating opcodes/psuedo-ops complete.

The program will read/compile linux based Merlin syntax files (.s), as well as original Merlin 
8/16/16+ files in Merlin format
(high bit set), compressed spaces, and only a <CR> to end lines.  I plan on adding a mode that 
will process and convert to linux style so files can be converted for easy editing under linux.

Merlin32 is great, but there are aspects of it that I don't like (always outputting assembly 
status and creating .txt file listings, etc)

Along time ago, in the mid 1980's I wrote a Merlin compatible assembler and programming shell 
(with the help of Lane Roathe) for the Apple //GS
Recently, Lane sent me the source code to that assembler. Unfortunately, because of some of the 
features we added to the assembler, it will not compile under Merlin or Merlin32.  (We actually used 
qasm to build qasm).

This project will be a linux compatible version, that will compile/link the original source. 
However, due to speed and everything 'linux' I doubt the original will be used much.

I also would like to interface with the CiderPress library to allow output from the assembler/linker 
to write files directly to Prodos based .2MG (or other) images.  That way, after a compile, the code 
under test can be immediately run from a GS emulator.

This early version relies on the Poco Foundation libraries. You must have these installed.
Additionally, this repo relies on another repo here called 'libpal'.  Both repositories must 
be cloned at the same level.

libpal does not have to be built. The 'qasm' compile will build all of those source files.

'cmake' is used to build the Makefiles.  There is a generic Makefile in the base directory that does 
all of the 'cmake' stuff for you. (in a 'build' directory)

For example:
mkdir workdir
cd workdir
git clone git://github.com/marketideas/libpal libpal
git clone git://github.com/marketideas/qasm qasm

cd qasm
make clean
make

To test:
./qasm src/testfile.s


Some notes on compatibility:

ERR does not support the ($300)-$4C style of checking, because we are not running on Apple // hardware, so there is no need to check for a USR vector having been setup in this manner.