Commit Graph

31 Commits

Author SHA1 Message Date
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
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