Skip to content

Commit

Permalink
rewrite arch-65816
Browse files Browse the repository at this point in the history
  • Loading branch information
randomdude999 committed Jan 22, 2024
1 parent 499b685 commit 22d283c
Show file tree
Hide file tree
Showing 8 changed files with 576 additions and 206 deletions.
759 changes: 560 additions & 199 deletions src/asar/arch-65816.cpp

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/asar/errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ static asar_error_mapping asar_errors[] =
{ ERR(missing_org), "Missing org or freespace command." },

{ ERR(unclosed_block_comment), "Unclosed block comment." },

{ ERR(bad_addr_mode), "This addressing mode is not valid for this instruction." },
{ ERR(bad_access_width), "This addressing mode can accept %s arguments, but the provided argument is %d-bit." },
};
// RPG Hacker: Sanity check. This makes sure that the element count of asar_error
// matches with the number of constants in asar_error_id. This is important, because
Expand Down
3 changes: 3 additions & 0 deletions src/asar/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ enum asar_error_id : int
error_id_missing_org,
error_id_unclosed_block_comment,

error_id_bad_addr_mode,
error_id_bad_access_width,

error_id_end,
error_id_count = error_id_end - error_id_start - 1,
};
Expand Down
1 change: 1 addition & 0 deletions src/asar/warnings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ static asar_warning_mapping asar_warnings[] =
{ WRN(65816_yy_x_does_not_exist), "($yy),x does not exist, assuming $yy,x." },
{ WRN(65816_xx_y_assume_16_bit), "%s $xx,y is not valid with 8-bit parameters, assuming 16-bit." },
{ WRN(spc700_assuming_8_bit), "This opcode does not exist with 16-bit parameters, assuming 8-bit." },
{ WRN(assuming_address_mode), "The addressing mode %s is not valid for this instruction, assuming %s.%s" },

{ WRN(cross_platform_path), "This patch may not assemble cleanly on all platforms. Please use / instead." },

Expand Down
1 change: 1 addition & 0 deletions src/asar/warnings.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum asar_warning_id : int
warning_id_65816_yy_x_does_not_exist,
warning_id_65816_xx_y_assume_16_bit,
warning_id_spc700_assuming_8_bit,
warning_id_assuming_address_mode,

warning_id_cross_platform_path,

Expand Down
6 changes: 3 additions & 3 deletions tests/bank_shorthand.asm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
;`A9 00 00 A9 03 00 A9 02 00
org $008000
main:
lda #<:main
lda #<:test_label
lda #bank(other_test)
lda.w #<:main
lda.w #<:test_label
lda.w #bank(other_test)

base $038000
test_label:
Expand Down
4 changes: 2 additions & 2 deletions tests/datasize_freespace.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
org $008000
main:

lda #datasize(my_table) ;3
lda #datasize(other_label) ;0xFFFFFF
lda.w #datasize(my_table) ;3
lda.w #datasize(other_label) ;0xFFFFFF
autoclean jsl my_table
freecode
my_table:
Expand Down
5 changes: 3 additions & 2 deletions tests/labela.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
;`F0 FE
;`errEbad_addr_mode

; used to work, now nuked
org 32768
a:
BEQ a
BEQ a

0 comments on commit 22d283c

Please sign in to comment.