1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-08-09 16:25:01 +00:00
Files
PLASMA/src/libsrc/apple/jit16.pla
2018-05-16 21:31:37 +01:00

63 lines
1.3 KiB
Plaintext

//
// PLASMA JIT bytecode compiler
//
include "inc/cmdsys.plh"
//
// Indirect interpreter DEFinition entrypoint
//
struc t_defentry
byte interpjsr
word interpaddr
word bytecodeaddr
byte callcount
byte bytecodesize
end
//
// JIT compiler constants
//
const jitcomp = $03E2
const jitcodeptr = $03E4
const codemax = $BEE0
const estkh8 = $C000
const estkh = $00C0
const estkl8 = $D000
const estkl = $00D0
const ifpl8 = $E000
const ifph8 = $E100
const jmptmp = $00E6
const tmpl8 = $E700
const tmph8 = $E800
//
// Bytecode interpreter entrypoints
//
const indirectentry = $03DC
const directentry = $03D0
//
// Copy bytecode DEF to main memory
//
def defcpy(dst, defptr)#0
*$003C = defptr=>bytecodeaddr
*$003E = *$003C + defptr->bytecodesize
*$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
//
if *jitcomp
return 0
fin
*jitcomp = @compiler
cmdsys.jitcount = 44
cmdsys.jitsize = 96
puts("16-bit VM/JITC enabled\n")
return modkeep
done