mirror of
https://github.com/ksherlock/x65.git
synced 2025-01-15 17:31:19 +00:00
Fixed 16 bit immediate mode, tweaked unit tests, added |/! as WDC syntax for absolute addressing
This commit is contained in:
parent
1cf3546460
commit
ed188ea42b
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,3 +18,4 @@
|
|||||||
*.obj.enc
|
*.obj.enc
|
||||||
*.user
|
*.user
|
||||||
*.db*
|
*.db*
|
||||||
|
test/results/*
|
Binary file not shown.
BIN
bin/x65_x64.zip
BIN
bin/x65_x64.zip
Binary file not shown.
@ -23,7 +23,7 @@
|
|||||||
<ProjectGuid>{57EFF4A4-7BF2-43F0-AD62-A79092DA67D1}</ProjectGuid>
|
<ProjectGuid>{57EFF4A4-7BF2-43F0-AD62-A79092DA67D1}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>dump_x65</RootNamespace>
|
<RootNamespace>dump_x65</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<ProjectGuid>{2823019A-A423-4A40-BB9C-5CE242019BD0}</ProjectGuid>
|
<ProjectGuid>{2823019A-A423-4A40-BB9C-5CE242019BD0}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>x65</RootNamespace>
|
<RootNamespace>x65</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
cpu 65816
|
cpu 65816
|
||||||
Test65816_ForceAddrMode:
|
Test65816_ForceAddrMode:
|
||||||
|
i8
|
||||||
|
ldx #0
|
||||||
|
i16
|
||||||
|
ldx #0
|
||||||
|
a8
|
||||||
|
lda #0
|
||||||
|
a16
|
||||||
|
lda #0
|
||||||
|
lda.b #0
|
||||||
|
|
||||||
{
|
{
|
||||||
jmp >$123456
|
jmp >$123456
|
||||||
lda >$123456,x
|
lda >$123456,x
|
||||||
@ -33,6 +43,25 @@ Test65816_ForceAddrMode:
|
|||||||
endif
|
endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
lda <$101030 // <addr zero page
|
||||||
|
if !((*-!) == 2)
|
||||||
|
err Expected zero page instruction
|
||||||
|
endif
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
lda |$101030 // |addr force absolute
|
||||||
|
if !((*-!) == 3)
|
||||||
|
err Expected zero page instruction
|
||||||
|
endif
|
||||||
|
}
|
||||||
|
{
|
||||||
|
lda >$101030 // .l force long
|
||||||
|
if !((*-!) == 4)
|
||||||
|
err Expected zero page instruction
|
||||||
|
endif
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
jmp [$1010]
|
jmp [$1010]
|
||||||
|
77
test/local_label.s
Normal file
77
test/local_label.s
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
CheckLocalPeriod:
|
||||||
|
lda #0
|
||||||
|
.loop
|
||||||
|
dex
|
||||||
|
sta $1000,x
|
||||||
|
bne .loop
|
||||||
|
|
||||||
|
CheckLocalColon:
|
||||||
|
lda #0
|
||||||
|
:loop
|
||||||
|
dex
|
||||||
|
sta $1000,x
|
||||||
|
bne :loop
|
||||||
|
|
||||||
|
CheckLocalSnabelA:
|
||||||
|
lda #0
|
||||||
|
@loop
|
||||||
|
dex
|
||||||
|
sta $1000,x
|
||||||
|
bne @loop
|
||||||
|
|
||||||
|
CheckLocalExclamation:
|
||||||
|
lda #0
|
||||||
|
!loop
|
||||||
|
dex
|
||||||
|
sta $1000,x
|
||||||
|
bne !loop
|
||||||
|
|
||||||
|
CheckLocalDallasSign:
|
||||||
|
lda #0
|
||||||
|
loop$
|
||||||
|
dex
|
||||||
|
dex
|
||||||
|
sta $1000,x
|
||||||
|
bne loop$
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CheckLocalPeriod2:
|
||||||
|
lda #0
|
||||||
|
.loop
|
||||||
|
dex
|
||||||
|
sta $1000,x
|
||||||
|
bne .loop
|
||||||
|
|
||||||
|
CheckLocalColon2:
|
||||||
|
lda #0
|
||||||
|
:loop
|
||||||
|
dex
|
||||||
|
sta $1000,x
|
||||||
|
bne :loop
|
||||||
|
|
||||||
|
CheckLocalSnabelA2:
|
||||||
|
lda #0
|
||||||
|
@loop
|
||||||
|
dex
|
||||||
|
sta $1000,x
|
||||||
|
bne @loop
|
||||||
|
|
||||||
|
CheckLocalExclamation2:
|
||||||
|
lda #0
|
||||||
|
!loop
|
||||||
|
dex
|
||||||
|
sta $1000,x
|
||||||
|
bne !loop
|
||||||
|
|
||||||
|
CheckLocalDallasSign2:
|
||||||
|
lda #0
|
||||||
|
loop$
|
||||||
|
dex
|
||||||
|
sta $1000,x
|
||||||
|
bne loop$
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,74 +1,83 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
echo Unit tests for x65 assembler >unittest.txt
|
if NOT EXIST results mkdir results
|
||||||
echo >>unittest.txt
|
|
||||||
|
|
||||||
echo 65816 OpCodes Test >>unittest.txt
|
echo Unit tests for x65 assembler >results\unittest.txt
|
||||||
..\bin\x64\x65 Test65816_OpCodes.s -cpu=65816 -lst >> unittest.txt
|
echo >>results\unittest.txt
|
||||||
if %errorlevel% EQU 0 goto opcodes_65816_pass
|
|
||||||
:opcodes_65816_fail
|
|
||||||
echo 65816 OpCodes failed
|
|
||||||
goto exit
|
|
||||||
:opcodes_65816_pass
|
|
||||||
|
|
||||||
|
echo 65816 Force Addressing Mode Test >>results\unittest.txt
|
||||||
echo 65816 Force Addressing Mode Test >>unittest.txt
|
..\bin\x64\x65 AddrMode_65816.s -cpu=65816 -lst >>results\unittest.txt
|
||||||
..\bin\x64\x65 AddrMode_65816.s -cpu=65816 -lst >> unittest.txt
|
|
||||||
if %errorlevel% EQU 0 goto addrmode_pass
|
if %errorlevel% EQU 0 goto addrmode_pass
|
||||||
:addrmode_fail
|
:addrmode_fail
|
||||||
echo Force Addressing Mode failed
|
echo Force Addressing Mode failed
|
||||||
goto exit
|
goto exit
|
||||||
:addrmode_pass
|
:addrmode_pass
|
||||||
|
|
||||||
echo Merlin Macro Test >>unittest.txt
|
echo 65816 Local Label Symbol Test >>results\unittest.txt
|
||||||
echo ----------------- >>unittest.txt
|
..\bin\x64\x65 local_label.s -cpu=65816 -lst >>results\unittest.txt
|
||||||
..\bin\x64\x65 merlin_macro.s merlin_macro.bin -bin -org=$1000 -merlin -lst >>unittest.txt
|
if %errorlevel% EQU 0 goto locallabel_pass
|
||||||
|
:locallabel_feil
|
||||||
|
echo Local Label Symbol Test failed
|
||||||
|
goto exit
|
||||||
|
:locallabel_pass
|
||||||
|
|
||||||
|
echo 65816 OpCodes Test >>results\unittest.txt
|
||||||
|
..\bin\x64\x65 Test65816_OpCodes.s -cpu=65816 -lst >>results\unittest.txt
|
||||||
|
if %errorlevel% EQU 0 goto opcodes_65816_pass
|
||||||
|
:opcodes_65816_fail
|
||||||
|
echo 65816 OpCodes failed
|
||||||
|
goto exit
|
||||||
|
:opcodes_65816_pass
|
||||||
|
|
||||||
|
echo Merlin Macro Test >>results\unittest.txt
|
||||||
|
echo ----------------- >>results\unittest.txt
|
||||||
|
..\bin\x64\x65 merlin_macro.s results\merlin_macro.bin -bin -org=$1000 -merlin -lst >>results\unittest.txt
|
||||||
if %errorlevel% GTR 0 goto mermac_fail
|
if %errorlevel% GTR 0 goto mermac_fail
|
||||||
fc /B compare\merlin_macro_cmp.bin merlin_macro.bin >>unittest.txt
|
fc /B compare\merlin_macro_cmp.bin results\merlin_macro.bin >>results\unittest.txt
|
||||||
if %errorlevel% EQU 0 goto mermac_pass
|
if %errorlevel% EQU 0 goto mermac_pass
|
||||||
:mermac_fail
|
:mermac_fail
|
||||||
echo Merlin macro test failed
|
echo Merlin macro test failed
|
||||||
goto exit
|
goto exit
|
||||||
:mermac_pass
|
:mermac_pass
|
||||||
|
|
||||||
echo 8BitDiff Test >>unittest.txt
|
echo 8BitDiff Test >>results\unittest.txt
|
||||||
echo ------------- >>unittest.txt
|
echo ------------- >>results\unittest.txt
|
||||||
..\bin\x64\x65 8BitDiff_6502.s 8BitDiff_6502.prg -kickasm -sym 8BitDiff_6502.sym -lst >>unittest.txt
|
..\bin\x64\x65 8BitDiff_6502.s results\8BitDiff_6502.prg -kickasm -sym results\8BitDiff_6502.sym -lst >>results\unittest.txt
|
||||||
if %errorlevel% GTR 0 goto 8BitDiff_6502_fail
|
if %errorlevel% GTR 0 goto 8BitDiff_6502_fail
|
||||||
fc /B compare\8BitDiff_6502_cmp.prg 8BitDiff_6502.prg >>unittest.txt
|
fc /B compare\8BitDiff_6502_cmp.prg results\8BitDiff_6502.prg >>results\unittest.txt
|
||||||
if %errorlevel% EQU 0 goto 8BitDiff_6502_pass
|
if %errorlevel% EQU 0 goto 8BitDiff_6502_pass
|
||||||
:8BitDiff_6502_fail
|
:8BitDiff_6502_fail
|
||||||
echo 8BitDiff_6502 test failed
|
echo 8BitDiff_6502 test failed
|
||||||
goto exit
|
goto exit
|
||||||
:8BitDiff_6502_pass
|
:8BitDiff_6502_pass
|
||||||
|
|
||||||
echo Alias Test >>unittest.txt
|
echo Alias Test >>results\unittest.txt
|
||||||
echo ---------- >>unittest.txt
|
echo ---------- >>results\unittest.txt
|
||||||
..\bin\x64\x65 alias_test.s alias_test.prg -sym alias_test.sym -lst >>unittest.txt
|
..\bin\x64\x65 alias_test.s results\alias_test.prg -sym results\alias_test.sym -lst >>results\unittest.txt
|
||||||
if %errorlevel% GTR 0 goto alias_test_fail
|
if %errorlevel% GTR 0 goto alias_test_fail
|
||||||
fc /B compare\alias_test_cmp.prg alias_test.prg >>unittest.txt
|
fc /B compare\alias_test_cmp.prg results\alias_test.prg >>results\unittest.txt
|
||||||
if %errorlevel% EQU 0 goto alias_test_pass
|
if %errorlevel% EQU 0 goto alias_test_pass
|
||||||
:alias_test_fail
|
:alias_test_fail
|
||||||
echo Alias test failed
|
echo Alias test failed
|
||||||
goto exit
|
goto exit
|
||||||
:alias_test_pass
|
:alias_test_pass
|
||||||
|
|
||||||
echo x65macro.i Test >>unittest.txt
|
echo x65macro.i Test >>results\unittest.txt
|
||||||
echo --------------- >>unittest.txt
|
echo --------------- >>results\unittest.txt
|
||||||
..\bin\x64\x65 x65macro_test.s x65macro_test.prg -org=$1000 -sym x65macro_test.sym -lst >>unittest.txt
|
..\bin\x64\x65 x65macro_test.s results\x65macro_test.prg -org=$1000 -sym results\x65macro_test.sym -lst >>results\unittest.txt
|
||||||
if %errorlevel% GTR 0 goto x65macro_test_fail
|
if %errorlevel% GTR 0 goto x65macro_test_fail
|
||||||
fc /B compare\x65macro_test_cmp.prg x65macro_test.prg >>unittest.txt
|
fc /B compare\x65macro_test_cmp.prg results\x65macro_test.prg >>results\unittest.txt
|
||||||
if %errorlevel% EQU 0 goto x65macro_test_pass
|
if %errorlevel% EQU 0 goto x65macro_test_pass
|
||||||
:x65macro_test_fail
|
:x65macro_test_fail
|
||||||
echo x65macro.i test failed
|
echo x65macro.i test failed
|
||||||
goto exit
|
goto exit
|
||||||
:x65macro_test_pass
|
:x65macro_test_pass
|
||||||
|
|
||||||
echo Merlin LUP Test >>unittest.txt
|
echo Merlin LUP Test >>results\unittest.txt
|
||||||
echo --------------- >>unittest.txt
|
echo --------------- >>results\unittest.txt
|
||||||
..\bin\x64\x65 merlin_lup.s merlin_lup.bin -bin -org=$1000 -merlin -lst >>unittest.txt
|
..\bin\x64\x65 merlin_lup.s results\merlin_lup.bin -bin -org=$1000 -merlin -lst >>results\unittest.txt
|
||||||
if %errorlevel% GTR 0 goto merlup_fail
|
if %errorlevel% GTR 0 goto merlup_fail
|
||||||
fc /B compare\merlin_lup_cmp.bin merlin_lup.bin >>unittest.txt
|
fc /B compare\merlin_lup_cmp.bin results\merlin_lup.bin >>results\unittest.txt
|
||||||
if %errorlevel% EQU 0 goto merlup_pass
|
if %errorlevel% EQU 0 goto merlup_pass
|
||||||
:merlup_fail
|
:merlup_fail
|
||||||
echo Merlin LUP test failed
|
echo Merlin LUP test failed
|
||||||
|
25
x65.cpp
25
x65.cpp
@ -5372,6 +5372,23 @@ StatusCode Asm::GetAddressMode(strref line, bool flipXY, uint32_t &validModes, A
|
|||||||
} else {
|
} else {
|
||||||
addrMode = AMB_ZP; validModes &= AMM_ZP;
|
addrMode = AMB_ZP; validModes &= AMM_ZP;
|
||||||
}
|
}
|
||||||
|
} else if (c == '<') {
|
||||||
|
validModes &= AMM_ZP | AMM_ZP_X | AMM_ZP_REL_X | AMM_ZP_Y_REL |
|
||||||
|
AMM_ZP_REL | AMM_ZP_ABS | AMM_ZP_REL_L | AMM_ZP_REL_Y_L | AMM_FLIPXY;
|
||||||
|
} else if( c == '|' || c == '!' ) {
|
||||||
|
++line; line.trim_whitespace();
|
||||||
|
strref suffix = line.after( ',' ); suffix.skip_whitespace();
|
||||||
|
expression = line.before_or_full( ',' ); expression.trim_whitespace();
|
||||||
|
addrMode = AMB_NON;
|
||||||
|
if( suffix ) {
|
||||||
|
if( suffix.get_first() == 'x' || suffix.get_first() == 'X' ) {
|
||||||
|
addrMode = AMB_ABS_X; validModes &= AMM_ABS_X;
|
||||||
|
} else if( suffix.get_first() == 'y' || suffix.get_first() == 'Y' ) {
|
||||||
|
addrMode = AMB_ABS_Y; validModes &= AMM_ABS_Y;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addrMode = AMB_ABS; validModes &= AMM_ABS;
|
||||||
|
}
|
||||||
} else if( c == '>' ) {
|
} else if( c == '>' ) {
|
||||||
++line; line.trim_whitespace();
|
++line; line.trim_whitespace();
|
||||||
strref suffix = line.after( ',' ); suffix.skip_whitespace();
|
strref suffix = line.after( ',' ); suffix.skip_whitespace();
|
||||||
@ -5385,20 +5402,16 @@ StatusCode Asm::GetAddressMode(strref line, bool flipXY, uint32_t &validModes, A
|
|||||||
else {
|
else {
|
||||||
addrMode = AMB_ABS_L; validModes &= AMM_ABS_L;
|
addrMode = AMB_ABS_L; validModes &= AMM_ABS_L;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (c == '#') {
|
} else if (c == '#') {
|
||||||
++line;
|
++line;
|
||||||
addrMode = AMB_IMM;
|
addrMode = AMB_IMM;
|
||||||
validModes &= AMM_IMM;
|
validModes &= AMM_IMM | AMM_IMM_DBL_A | AMM_IMM_DBL_XY;
|
||||||
expression = line;
|
expression = line;
|
||||||
} else if (c == '<') {
|
|
||||||
validModes &= AMM_ZP | AMM_ZP_X | AMM_ZP_REL_X | AMM_ZP_Y_REL |
|
|
||||||
AMM_ZP_REL | AMM_ZP_ABS | AMM_ZP_REL_L | AMM_ZP_REL_Y_L | AMM_FLIPXY;
|
|
||||||
} else if (line) {
|
} else if (line) {
|
||||||
if (line[0]=='.' && strref::is_ws(line[2])) {
|
if (line[0]=='.' && strref::is_ws(line[2])) {
|
||||||
switch (strref::tolower(line[1])) {
|
switch (strref::tolower(line[1])) {
|
||||||
case 'z': force_zp = true; line += 3; need_more = true; len = 1; break;
|
case 'z': force_zp = true; line += 3; need_more = true; len = 1; break;
|
||||||
case 'b': line += 3; need_more = true; len = 1; break;
|
case 'b': line += 3; need_more = true; len = 1; validModes &= ~(AMM_IMM_DBL_A | AMM_IMM_DBL_XY); break;
|
||||||
case 'w': line += 3; need_more = true; len = 2; break;
|
case 'w': line += 3; need_more = true; len = 2; break;
|
||||||
case 'l': force_24 = true; line += 3; need_more = true; len = 3; break;
|
case 'l': force_24 = true; line += 3; need_more = true; len = 3; break;
|
||||||
case 'a': force_abs = true; line += 3; need_more = true; break;
|
case 'a': force_abs = true; line += 3; need_more = true; break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user