mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-08-07 18:25:03 +00:00
Check for H/W/ access on BYTE loads
This commit is contained in:
BIN
PLASMA-SYS2.PO
BIN
PLASMA-SYS2.PO
Binary file not shown.
@@ -37,6 +37,12 @@ def defcpy(dst, defptr)#0
|
||||
*$0042 = dst
|
||||
call($C311, 0, 0, 0, $04) // CALL XMOVE with carry clear (AUX->MAIN) and ints disabled
|
||||
end
|
||||
//
|
||||
// Identify hardware addresses for certain byte sized access operations
|
||||
//
|
||||
def is_hwaddr(addr)
|
||||
return addr >= $C000 and addr < $C100
|
||||
end
|
||||
include "libsrc/jit16core.pla"
|
||||
//
|
||||
// Install JIT compiler
|
||||
|
@@ -671,6 +671,10 @@ def compiler(defptr)#0
|
||||
if A_IS_TOS
|
||||
^codeptr = $48; codeptr++ // PHA
|
||||
fin
|
||||
if is_hwaddr(dest)
|
||||
//
|
||||
// Ensure we only do byte sized accesses to H/W
|
||||
//
|
||||
codeptr=>0 = $20E2 // SEP #$20 -> 8 BIT ACCUM/MEM
|
||||
codeptr->2 = $AD // LDA abs
|
||||
codeptr=>3 = dest
|
||||
@@ -678,6 +682,13 @@ def compiler(defptr)#0
|
||||
codeptr->7 = $29 // AND #$00FF
|
||||
codeptr=>8 = $00FF
|
||||
codeptr = codeptr + 10
|
||||
else
|
||||
codeptr->0 = $AD // LDA abs
|
||||
codeptr=>1 = dest
|
||||
codeptr->3 = $29 // AND #$00FF
|
||||
codeptr=>4 = $00FF
|
||||
codeptr = codeptr + 6
|
||||
fin
|
||||
A_IS_TOS = TRUE // PHA
|
||||
break
|
||||
is $6A // LAW
|
||||
@@ -1163,6 +1174,10 @@ def compiler(defptr)#0
|
||||
if not A_IS_TOS
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
if is_hwaddr(dest)
|
||||
//
|
||||
// Ensure only byte sized accesses to H/W addresses
|
||||
//
|
||||
codeptr=>0 = $E785 // STA TMP
|
||||
codeptr=>2 = $20E2 // SEP #$20 -> 8 BIT ACCUM/MEM
|
||||
codeptr->4 = $AD // LDA abs
|
||||
@@ -1173,6 +1188,16 @@ def compiler(defptr)#0
|
||||
codeptr->12 = $18 // CLC
|
||||
codeptr=>13 = $E765 // ADC TMP
|
||||
codeptr = codeptr + 15
|
||||
else
|
||||
codeptr=>0 = $E785 // STA TMP
|
||||
codeptr->2 = $AD // LDA abs
|
||||
codeptr=>3 = dest
|
||||
codeptr->5 = $29 // AND #$00FF
|
||||
codeptr=>6 = $00FF
|
||||
codeptr->8 = $18 // CLC
|
||||
codeptr=>9 = $E765 // ADC TMP
|
||||
codeptr = codeptr + 15
|
||||
fin
|
||||
A_IS_TOS = TRUE // PHA
|
||||
break
|
||||
is $B6 // ADDAW
|
||||
@@ -1233,6 +1258,10 @@ def compiler(defptr)#0
|
||||
if not A_IS_TOS
|
||||
^codeptr = $68; codeptr++ // PLA
|
||||
fin
|
||||
if is_hwaddr(dest)
|
||||
//
|
||||
// Ensure only byte sized accesses to H/W addresses
|
||||
//
|
||||
codeptr=>0 = $E785 // STA TMP
|
||||
codeptr=>2 = $20E2 // SEP #$20 -> 8 BIT ACCUM/MEM
|
||||
codeptr->4 = $AD // LDA abs
|
||||
@@ -1242,6 +1271,15 @@ def compiler(defptr)#0
|
||||
codeptr=>10 = $00FF
|
||||
codeptr->12 = $0A // ASL
|
||||
codeptr=>13 = $E765 // ADC TMP
|
||||
else
|
||||
codeptr=>0 = $E785 // STA TMP
|
||||
codeptr->4 = $AD // LDA abs
|
||||
codeptr=>5 = dest
|
||||
codeptr->9 = $29 // AND #$00FF
|
||||
codeptr=>10 = $00FF
|
||||
codeptr->12 = $0A // ASL
|
||||
codeptr=>13 = $E765 // ADC TMP
|
||||
fin
|
||||
codeptr = codeptr + 15
|
||||
A_IS_TOS = TRUE // PHA
|
||||
break
|
||||
|
Reference in New Issue
Block a user