Commit Graph

27 Commits

Author SHA1 Message Date
Kelvin Sherlock
fc62d0c9e7 'a' as an operand is ignored.
Based on testing with Merlin-16+ 4.12, this seems to apply in all cases

inc a -> equivalent to inc
lda a -> equivalent to lda (bad address mode error)

if you do have an 'a' label, you need to specify the address mode, eg

lda |a, lda >a, lda <a
2021-08-31 18:08:08 -04:00
Lane Roathe
bdbf62fe36
Merge pull request #53 from ksherlock/dw-star
qasm gs - update program counter w/in data operands
2020-10-12 08:46:02 -07:00
Kelvin Sherlock
4a380871cd ddb - update pcobjptr after each item. 2020-10-11 20:41:36 -04:00
Kelvin Sherlock
bc29319414 allow comma in quoted string during address check
example:

pea ',' or pea #',' previously generated a bad address mode error.

The addmode function expected an X,Y, or S after the , which is how it generated the error.

Changed to skip , search within the quoted string.

test case:

* previously caused an error
	pea #','
	pea ','
	pea #","
	pea ","
	pea ','+','

* still cause and error (as they should):
	pea ',',y
	pea #',',y
* unterminated string:
	pea  '
2020-10-10 22:52:56 -04:00
Lane Roathe
f7e30ea543
Merge pull request #50 from ksherlock/pass-1-errors
qasm iigs: print the line when an error is encountered on first pass
2020-06-08 09:44:50 -07:00
Kelvin Sherlock
8c94aa51c3 when an error is encountered in the first pass, print the line for better debugging. Previously, errors only printed the line on the second pass. 2020-06-06 18:03:54 -04:00
Kelvin Sherlock
f6408be2c0 tab to label column instead of using a space. This results in nicer output when line numbers increment in size (9 -> 10, 99 -> 110, etc) 2020-06-06 16:13:05 -04:00
Kelvin Sherlock
0976282d81 update program counter (for eval purposes) after each argument in data statements.
db,dw,da,adr,adrl all allow multiple arguments.  In merlin, the value of * is updated after each argument.  in qasm, the value of * is not updated.

Encountered assembling marinetti.
2020-05-31 16:06:14 -04:00
Lane Roathe
b5955278c3
Merge pull request #46 from ksherlock/label-15-2
qasm iigs: two more label length stragglers
2020-05-25 23:10:59 -07:00
Kelvin Sherlock
f5f3846a6d two more label length straglers 2020-05-25 18:32:17 -04:00
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
Lane Roathe
fb12ad70f7
Merge pull request #43 from ksherlock/sym32
Update label/symbol size from 15 to 31.
2020-05-24 16:18:58 -07:00
Kelvin Sherlock
89b7308c15 Update labels/symbol size from 15 to 31.
Magic number offsets are also replaced with named constants.

Merlin 16+ increased the label size from 12 to 26 at some point and the 15-char limit causes duplicate label errors on some Merlin source code.
2020-05-24 18:37:21 -04:00
Kelvin Sherlock
8f7427d11d symbol table needs to be no-cross-bank since qasm uses mvn to copy entries into it (mvn won't cross banks) 2020-05-24 17:53:33 -04:00
Kelvin Sherlock
275f49e43e ent label-list operand should only execute on the second pass, after all labels are defined. 2020-01-15 21:00:16 -05:00
Lane Roathe
9f510117c0
Merge pull request #38 from ksherlock/undo-illegal-address
(qasm iigs) - add back error checking disabled for relative value bug
2020-01-13 19:18:10 -08:00
Kelvin Sherlock
da1c2e8222 adds back error checking which was previously disabled due to the illegal relative value bug.
also fixes a couple tool macro typos that slipped in before
2020-01-13 22:13:16 -05:00
Kelvin Sherlock
861bb44d32 only add .S extension as necessary
modifies the asm command line, linker command line, and linker ASM/PUT/IF opcodes to only append a .S suffix if it's not already present.

this is more consistent with Merlin 16+ and less surprising for people who use the command-line asm or link commands.
2020-01-13 21:58:52 -05:00
Kelvin Sherlock
93a79855fb reset dumor to 0, not $8000, at DEND.
should fix a bug where DUM * (or DUM label) generates absolute values.
2020-01-11 19:01:41 -05:00
Kelvin Sherlock
7336daffbf fix y2k overflow.
_ReadTimeHex returns the year as an offset from 1900, so 2020 is 120, which overflows ('0' + 12 is ascii '<')

subtract 100, repeatedly, until it fits in 2 digits.  Should last into 2100.
2020-01-06 19:46:24 -05:00
Kelvin Sherlock
fa3554f6e5 missing macros :) 2020-01-05 23:56:11 -05:00
Kelvin Sherlock
a0bc5de359 assembler - use named tool macros 2020-01-05 19:11:28 -05:00
Kelvin Sherlock
b45553c992 tweaks to self-compile qasm with qasm.
other than USR opcode differences, it should build with merlin 16+ as well.
2020-01-05 18:06:32 -05:00
Lane Roathe
2e27f6e785
Merge pull request #29 from ksherlock/ksherlock-patch-2
fix internal macro expansion
2019-12-29 18:33:12 -08:00
ksherlock
937c527344
fix internal macro expansion
I'm not sure why that line was commented out, but y has an undefined value at this point so it will read a random offset into the line.
2019-12-28 14:30:45 -05:00
ksherlock
92cffed07b
stack imbalance printing the hours elapsed
probably never noticed because no assembly ever took that long.
2019-12-27 22:25:42 -05:00
Shawn Quick
b7cb4a9afa first commit 2019-11-11 15:56:03 -08:00