diff --git a/include/c64/kernalio.c b/include/c64/kernalio.c index 7b8e026..269f8b3 100644 --- a/include/c64/kernalio.c +++ b/include/c64/kernalio.c @@ -54,7 +54,7 @@ bool krnio_open(char fnum, char device, char channel) { krnio_pstatus[fnum] = KRNIO_OK; - __asm + return __asm { lda #0 sta accu @@ -75,7 +75,7 @@ bool krnio_open(char fnum, char device, char channel) lda #1 sta accu E2: - } + }; } @@ -94,13 +94,13 @@ void krnio_close(char fnum) krnioerr krnio_status(void) { - __asm + return __asm { jsr $ffb7 // readst sta accu lda #0 sta accu + 1 - } + }; } #pragma native(krnio_status) @@ -108,7 +108,7 @@ krnioerr krnio_status(void) bool krnio_load(char fnum, char device, char channel) { - __asm + return __asm { lda fnum ldx device @@ -124,14 +124,14 @@ bool krnio_load(char fnum, char device, char channel) rol eor #1 sta accu - } + }; } #pragma native(krnio_load) bool krnio_save(char device, const char* start, const char* end) { - __asm + return __asm { lda #0 ldx device @@ -147,14 +147,14 @@ bool krnio_save(char device, const char* start, const char* end) rol eor #1 sta accu - } + }; } #pragma native(krnio_save) bool krnio_chkout(char fnum) { - __asm + return __asm { ldx fnum jsr $ffc9 // chkout @@ -163,14 +163,14 @@ bool krnio_chkout(char fnum) rol eor #1 sta accu - } + }; } #pragma native(krnio_chkout) bool krnio_chkin(char fnum) { - __asm + return __asm { ldx fnum jsr $ffc6 // chkin @@ -179,7 +179,7 @@ bool krnio_chkin(char fnum) rol eor #1 sta accu - } + }; } #pragma native(krnio_chkin) @@ -196,23 +196,23 @@ void krnio_clrchn(void) bool krnio_chrout(char ch) { - __asm + return __asm { lda ch jsr $ffd2 // chrout sta accu - } + }; } #pragma native(krnio_chrout) char krnio_chrin(void) { - __asm + return __asm { jsr $ffcf // chrin sta accu - } + }; } #pragma native(krnio_chrin) diff --git a/include/c64/kernalio.h b/include/c64/kernalio.h index 8d29f64..44dcdfd 100644 --- a/include/c64/kernalio.h +++ b/include/c64/kernalio.h @@ -44,7 +44,7 @@ krnioerr krnio_status(void); bool krnio_load(char fnum, char device, char channel); -__noinline bool krnio_save(char device, const char* start, const char* end); +bool krnio_save(char device, const char* start, const char* end); // select the given file for stream output diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index cf168ca..524e9ce 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -802,6 +802,16 @@ bool NativeCodeInstruction::IsUsedResultInstructions(NumberSet& requiredTemps) requiredTemps += mAddress; requiredTemps += mAddress + 1; break; + + case ASMIM_IMMEDIATE: + if (mFlags & NICF_TMPREF) + { + if (mFlags & NCIF_LOWER) + requiredTemps += mAddress; + if (mFlags & NCIF_UPPER) + requiredTemps += mAddress + 1; + } + break; } // check carry flags @@ -13330,13 +13340,23 @@ NativeCodeInstruction NativeCodeBasicBlock::DecodeNative(const InterInstruction* address = lobj->mData[offset++]; if (lref) { - d.mMode = ASMIM_IMMEDIATE_ADDRESS; - linkerObject = lref->mRefObject; - address = lref->mRefOffset; - if (lref->mFlags & LREF_LOWBYTE) - flags = NCIF_LOWER; + if (lref->mFlags & LREF_TEMPORARY) + { + address = lobj->mTemporaries[lref->mRefOffset]; + flags |= NICF_TMPREF | NCIF_LOWER; + if (lobj->mTempSizes[lref->mRefOffset] > 1) + flags |= NCIF_UPPER; + } else - flags = NCIF_UPPER; + { + d.mMode = ASMIM_IMMEDIATE_ADDRESS; + linkerObject = lref->mRefObject; + address = lref->mRefOffset; + if (lref->mFlags & LREF_LOWBYTE) + flags = NCIF_LOWER; + else + flags = NCIF_UPPER; + } } break; } diff --git a/oscar64/NativeCodeGenerator.h b/oscar64/NativeCodeGenerator.h index f07b4da..82e6416 100644 --- a/oscar64/NativeCodeGenerator.h +++ b/oscar64/NativeCodeGenerator.h @@ -122,6 +122,7 @@ static const uint32 NCIF_FEXEC = 0x00000040; static const uint32 NCIF_JSRFLAGS = 0x00000080; static const uint32 NICT_INDEXFLIPPED = 0x00000100; static const uint32 NICT_ZPFLIPPED = 0x00000200; +static const uint32 NICF_TMPREF = 0x00000400; static const uint32 NCIF_USE_CPU_REG_A = 0x00001000; static const uint32 NCIF_USE_CPU_REG_X = 0x00002000;