Commit Graph

70 Commits (main)

Author SHA1 Message Date
xenia e15991af44 run workflow on all branches 2024-02-22 20:23:15 +01:00
xenia 154e6e2dbc Update rev generation 2024-02-14 22:09:07 +01:00
xenia 4d8d3d1c48 Update gitignore 2024-02-04 11:24:58 +01:00
xenia bfd40db93b Remove windows workflow 2024-02-03 16:00:01 +01:00
xenia 96e1bf0808 Add patching phase to make binary run on non-nixos 2024-02-03 15:39:19 +01:00
xenia bff644b664 Upload artifact 2024-02-03 12:58:58 +01:00
xenia 6006d366c2 test nix actions? 2024-02-03 12:56:27 +01:00
xenia 672c88559c mjau 2024-02-03 12:48:54 +01:00
xenia c9c40cdc1c Enable github actions for github-actions branch 2024-02-03 12:47:20 +01:00
xenia 758b9c9cb7 Add devshell 2024-02-03 12:02:29 +01:00
xenia 91023adad3 Handle builds outside nix 2024-02-03 12:00:36 +01:00
xenia 7b15ea828c Short revision 2024-02-03 11:57:07 +01:00
xenia f3f6de5b0b Remove vergen and use nix instead 2024-02-03 11:56:04 +01:00
xenia 867e75eeb7 flakeify 2024-02-03 11:55:45 +01:00
Ry bedf8d54c4
Merge pull request #14 from eiowlta/main
Register Pointer Offsets, optional low hanging optimization, fixedwidth shift/bit operands
2023-07-23 14:25:13 -07:00
eiowlta b5d88f735a
Merge branch 'fox32-arch:main' into main 2023-07-23 14:37:49 +03:00
eiowlta 4647b9fe63 add support for optional optimization, shorter bit operations and register pointer offsets 2023-07-21 18:34:51 +03:00
Ry 6e2691f50b
Merge pull request #13 from eiowlta/main
support inc r, # in assembler
2023-07-20 15:55:21 -07:00
eiowlta 36a8432411 support inc r, # in assembler 2023-07-20 16:53:30 +03:00
Ry a049f839f2 Add `#include_bin_optional` 2023-03-03 17:26:10 -08:00
Ry 007caeb23f
Merge pull request #12 from neuschaefer/dev
Don't parse _123 as a decimal number
2023-02-03 15:27:49 -08:00
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