jn
99438e5997
Don't parse _123 as a decimal number
...
Instead require that decimal numbers start with a digit.
This fixes the detection of things like _L4 and _4 as labels.
2023-02-03 15:21:05 +01:00
Ry
3453727735
Merge pull request #10 from neuschaefer/dev
...
Misc
2023-02-02 01:49:57 -08:00
jn
bb81c2df69
Don't pass Size by reference
...
It's a small value type.
2023-02-02 10:46:11 +01:00
jn
da654a216b
Deduplicate immediate to AstNode conversion
2023-02-02 10:46:11 +01:00
jn
b2212bfa24
Deduplicate condition to bits conversion
2023-02-02 10:46:11 +01:00
jn
fc1008cc10
Deduplicate operand to immediate conversion
2023-02-02 10:46:11 +01:00
jn
7371aed79f
Allow specifying immediates as target (right-hand side) operands
2023-02-02 10:46:00 +01:00
jn
b23f2b4315
Eliminate non-determinism due to use of HashMap
2023-02-02 10:46:00 +01:00
jn
226a0f1aff
Use println!("...") instead of print!("...\n")
...
And also use exit without module path.
2023-02-02 10:46:00 +01:00
Ry
def2b4fb92
Merge pull request #9 from neuschaefer/dev
...
Better error handling and nop.8
2023-02-01 14:53:42 -08:00
jn
0c47ce79af
Allow specifying width on zero-operand instructions
...
nop.8 exists and is valid, so fox32asm should assemble it.
It might be a good idea to reject some invalid instructions, though,
such as out.8.
2023-02-01 23:34:37 +01:00
jn
2c932cef4b
Print parse errors in a somewhat nicer way
...
Before:
fox32asm 0.3.0 (94dd0fe)
Generating raw binary
Parsing includes...
Parsing file...
thread 'main' panicked at 'parse was unsuccessful: Error { variant: ParsingError { positives: [EOI, origin, include_bin, data, constant, label_kind, size, instruction], negatives: [] }, location: Pos(4), line_col: Pos((1, 5)), path: None, line: "nop 42␊", continued_line: None }', src/main.rs:529:60
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
After:
fox32asm 0.3.0 (2abba95)
Generating raw binary
Parsing includes...
Parsing file...
Error {
variant: ParsingError {
positives: [
EOI,
origin,
include_bin,
data,
constant,
label_kind,
size,
instruction,
],
negatives: [],
},
location: Pos(
4,
),
line_col: Pos(
(
1,
5,
),
),
path: None,
line: "nop 42␊",
continued_line: None,
}
2023-02-01 23:34:37 +01:00
Ry
15f8a12307
Merge pull request #8 from neuschaefer/ci
...
GitHub CI: Bump actions/checkout to v3
2023-02-01 14:31:54 -08:00
jn
77d59050fc
GitHub CI: Bump actions/{checkout,upload-artifact} to v3
...
v2 is deprecated and causes a warning on the Actions page.
2023-02-01 23:30:46 +01:00
Ry
ebdf8e3ac5
Merge pull request #7 from neuschaefer/fixes
...
Fixes for data directives
2023-02-01 13:45:14 -08:00
Ry
7d18f37f80
Merge pull request #6 from neuschaefer/dev
...
Add data.strz directive for zero-terminated strings
2023-02-01 13:39:01 -08:00
jn
fc925e577d
Assemble data.8 CONST_LABEL correctly as one byte
...
Fixes #5
2023-02-01 21:24:11 +01:00
jn
e59e0ef83d
Reset CURRENT_SIZE to Size::Word before parsing a data directive
...
Previously, the following program:
push.16 0
data.16 0
... crashed fox32asm:
thread 'main' panicked at 'internal error: entered unreachable code', src/main.rs:620:22
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.63.0/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:142:14
2: core::panicking::panic
at /usr/src/rustc-1.63.0/library/core/src/panicking.rs:48:5
3: fox32asm::parse_data
4: fox32asm::build_ast_from_expression
5: fox32asm::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
The issue in line 620 is that parse_data expects a constant in the form
of AstNode::Immediate32, but finds an AstNode::Immediate16, because
CURRENT_SIZE was previously set to Half. Set CURRENT_SIZE to Word when
starting to parse a new data directive, in order to fix this issue.
Fixes #4
2023-02-01 21:22:24 +01:00
jn
eb32be33c8
Add data.strz directive for zero-terminated strings
...
A common pattern in fox32 software is this:
data.str "Some string here" data.8 0
i.e. a zero- or NUL-terminated string. To make such strings easier to
write, introduce a new directive data.strz, which adds the zero byte
automatically:
data.strz "Some string here"
2023-02-01 19:59:24 +01:00
Ry
abd160e6e5
Add support for imul
, idiv
, and irem
2023-01-27 15:21:40 -08:00
Ry
b40c8d50b6
Error and exit if a label is defined more than once
...
Fixes issue #2
2023-01-22 17:25:28 -08:00
Ry
2284d0fb11
Merge pull request #1 from neuschaefer/incl
...
Include filename in error message when #include fails
2023-01-20 15:08:05 -08:00
jn
cc4b819d6b
Include filename in error message when #include fails
2023-01-20 15:30:17 +01:00
Ry
cc4242b1fe
Allow using constants in data.8 and data.16
2022-10-12 13:32:14 -07:00
Ry
7d1f636239
Add rfp
register support
2022-09-18 16:34:14 -07:00
Ry
aae6632dfd
Add support for the resp
register
2022-09-16 17:40:00 -07:00
Ry
4afe69ed10
Add FLP instruction
2022-09-13 17:37:42 -07:00
Ry
b35bc82cf7
Add mse
, mcl
, and tlb
instructions, bump version to 0.3.0
2022-08-15 17:22:40 -07:00
Ry
ee98141e1d
Add int
instruction, bump version to 0.2.0
2022-08-09 01:43:13 -07:00
Ry
a40b9fccc6
Prepare for the 1st release
2022-07-31 17:20:28 -07:00
Ry
a6fc3f9762
Don't add relative labels to FXF's reloc table
2022-07-25 00:17:16 -07:00
Ry
9c79b3bba2
Remove unused extern
and global
tables from FXF
2022-06-21 19:04:31 -07:00
Ry
983b619a70
Print address table after assembling
2022-06-21 18:27:16 -07:00
Ry
522696054c
Build using GitHub Actions
2022-06-21 16:18:06 -07:00
Ry
90cd06cc99
Add .gitignore
2022-06-21 00:08:44 -07:00
Ry
c23666161b
fox32+fox32asm: Remove pow instruction
2022-05-30 00:48:19 -07:00
Ry
07a0026207
fox32asm: Add data.fill
2022-05-30 00:31:41 -07:00
Ry
8c24fe585c
fox32asm: Start implementing FXF support
...
Currently this only supports relocation.
2022-05-19 14:25:29 -07:00
Ry
74b080994a
fox32asm: Ensure consts are always Immediate32
2022-04-17 17:03:20 -07:00
Ry
9fb445f688
fox32+fox32asm: Add proper support for greater than and less than
...
This adds IFGT, IFGTEQ, IFLT, and IFLTEQ, which makes it easier to
check for these conditions.
2022-03-12 12:15:27 -08:00
Ry
492e8d51a1
fox32asm: Allow underscores in immediate values
...
Co-authored-by: Lua <lua@foxgirl.dev>
2022-03-12 11:58:00 -08:00
ry755
637e62ff38
fox32asm: Allow any character to be escaped in strings with '\'
2022-02-22 13:31:51 -08:00
ry755
0ec2787e0b
fox32+fox32asm: Make ImmediatePtr encoding consistent for src and dest
2022-02-02 04:43:23 -08:00
ry755
d0538c59e8
fox32asm: Allow labels to be used in sized instructions
...
Previously this would cause the CPU to panic with an invalid opcode
error, due to messed up alignment
2022-02-01 22:00:58 -08:00
ry755
94e02b8f09
fox32asm: Increase the max include limit from 8 to 128
...
The whole include system is just a huge hack, this really needs to be
replaced at some point.
2022-01-31 21:50:01 -08:00
ry755
dd6ebe86f8
Add unfinished READMEs
2022-01-31 03:11:08 -08:00
ry755
09987f5747
Add LICENSE
2022-01-31 01:51:26 -08:00
ry755
efdb08aba5
fox32asm: Show version info on startup
2022-01-27 18:35:15 -08:00
ry755
eeafe0cbb2
Initial commit
...
I should've made a git repo for this much sooner, oops :p
2022-01-26 22:21:21 -08:00