mirror of
https://github.com/ksherlock/x65.git
synced 2024-12-28 04:31:46 +00:00
Fixing 16 vs 8 bit immediate load issue (again)
This commit is contained in:
parent
6e8a41acc1
commit
33b229d00a
@ -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.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.15063.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,14 +1,17 @@
|
|||||||
cpu 65816
|
cpu 65816
|
||||||
Test65816_ForceAddrMode:
|
Test65816_ForceAddrMode:
|
||||||
|
sep #$30
|
||||||
i8
|
i8
|
||||||
ldx #0
|
ldx #$1234
|
||||||
i16
|
|
||||||
ldx #0
|
|
||||||
a8
|
a8
|
||||||
lda #0
|
lda #$1234
|
||||||
|
lda.w #$1234
|
||||||
|
|
||||||
|
i16
|
||||||
|
ldx #$1234
|
||||||
a16
|
a16
|
||||||
lda #0
|
lda #$1234
|
||||||
lda.b #0
|
lda.b #$1234
|
||||||
|
|
||||||
{
|
{
|
||||||
jmp >$123456
|
jmp >$123456
|
||||||
|
BIN
test/compare/x65scope.prg
Normal file
BIN
test/compare/x65scope.prg
Normal file
Binary file not shown.
6
test/compare/x65scope.sym
Normal file
6
test/compare/x65scope.sym
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
.label ClearVICPage = $1000
|
||||||
|
.label LenStr = $1012
|
||||||
|
.label GetSkip = $1019 {
|
||||||
|
.label .addr = $1026
|
||||||
|
}
|
@ -73,6 +73,18 @@ echo x65macro.i test failed
|
|||||||
goto exit
|
goto exit
|
||||||
:x65macro_test_pass
|
:x65macro_test_pass
|
||||||
|
|
||||||
|
echo x65 Scope Test >>results\unittest.txt
|
||||||
|
..\bin\x64\x65 x65scope.s results\x65scope.prg -lst -sym results\x65scope.sym
|
||||||
|
if %errorlevel% GTR 0 goto x65scope_test_fail
|
||||||
|
fc /B compare\x65scope.prg results\x65scope.prg >>results\unittest.txt
|
||||||
|
if %errorlevel% GTR 0 goto x65scope_test_fail
|
||||||
|
fc compare\x65scope.sym results\x65scope.sym >>results\unittest.txt
|
||||||
|
if %errorlevel% EQU 0 goto x65scope_test_pass
|
||||||
|
:x65scope_test_fail
|
||||||
|
echo x65 Scope Test failed
|
||||||
|
goto exit
|
||||||
|
:x65scope_test_pass
|
||||||
|
|
||||||
echo Merlin LUP Test >>results\unittest.txt
|
echo Merlin LUP Test >>results\unittest.txt
|
||||||
echo --------------- >>results\unittest.txt
|
echo --------------- >>results\unittest.txt
|
||||||
..\bin\x64\x65 merlin_lup.s results\merlin_lup.bin -bin -org=$1000 -merlin -lst >>results\unittest.txt
|
..\bin\x64\x65 merlin_lup.s results\merlin_lup.bin -bin -org=$1000 -merlin -lst >>results\unittest.txt
|
||||||
|
38
test/x65scope.s
Normal file
38
test/x65scope.s
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// Test various features of scoping.
|
||||||
|
|
||||||
|
ClearVICPage:
|
||||||
|
{
|
||||||
|
lda #0
|
||||||
|
tax
|
||||||
|
ldy #$40
|
||||||
|
{
|
||||||
|
sta $4000,x
|
||||||
|
inx
|
||||||
|
bne !
|
||||||
|
inc !+2
|
||||||
|
dey
|
||||||
|
bne !
|
||||||
|
}
|
||||||
|
rts
|
||||||
|
}
|
||||||
|
|
||||||
|
LenStr:
|
||||||
|
{
|
||||||
|
dc.b %-! ; length of string plus this byte
|
||||||
|
TEXT "String"
|
||||||
|
}
|
||||||
|
|
||||||
|
GetSkip:
|
||||||
|
{
|
||||||
|
clc
|
||||||
|
tya
|
||||||
|
adc .addr+1
|
||||||
|
sta .addr+1
|
||||||
|
{
|
||||||
|
bcc %
|
||||||
|
inc .addr+1
|
||||||
|
}
|
||||||
|
.addr
|
||||||
|
lda $1234
|
||||||
|
rts
|
||||||
|
}
|
16
x65.cpp
16
x65.cpp
@ -5604,16 +5604,14 @@ StatusCode Asm::AddOpcode(strref line, int index, strref source_file) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case AMB_IMM: // 2 #$12
|
case AMB_IMM: // 2 #$12
|
||||||
if (op_param && (validModes&(AMM_IMM_DBL_A | AMM_IMM_DBL_XY)))
|
|
||||||
codeArg = op_param == 2 ? CA_TWO_BYTES : CA_ONE_BYTE;
|
|
||||||
else if ((validModes&(AMM_IMM_DBL_A | AMM_IMM_DBL_XY)) &&
|
|
||||||
expression[0]=='$' && (expression+1).len_hex()==4)
|
|
||||||
codeArg = CA_TWO_BYTES;
|
|
||||||
else if (((validModes&AMM_IMM_DBL_A) && accumulator_16bit) ||
|
|
||||||
((validModes&AMM_IMM_DBL_XY) && index_reg_16bit))
|
|
||||||
codeArg = CA_TWO_BYTES;
|
|
||||||
else
|
|
||||||
codeArg = CA_ONE_BYTE;
|
codeArg = CA_ONE_BYTE;
|
||||||
|
// check for double immediate
|
||||||
|
if( validModes & ( AMM_IMM_DBL_A | AMM_IMM_DBL_XY ) ) {
|
||||||
|
if( op_param ) { codeArg = op_param == 2 ? CA_TWO_BYTES : CA_ONE_BYTE; }
|
||||||
|
else if( ( ( validModes&AMM_IMM_DBL_A ) && accumulator_16bit ) ||
|
||||||
|
( ( validModes&AMM_IMM_DBL_XY ) && index_reg_16bit ) ) { codeArg = CA_TWO_BYTES; }
|
||||||
|
else { codeArg = CA_ONE_BYTE; }
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AMB_ACC: // 9 A
|
case AMB_ACC: // 9 A
|
||||||
|
Loading…
Reference in New Issue
Block a user