new vm: next steps
This commit is contained in:
parent
3e0899359b
commit
02c86567ee
2 changed files with 10 additions and 3 deletions
|
|
@ -79,7 +79,9 @@ template decodeBx(k: expr) {.immediate, dirty.} =
|
||||||
let rbx = instr.regBx - wordExcess
|
let rbx = instr.regBx - wordExcess
|
||||||
ensureKind(k)
|
ensureKind(k)
|
||||||
|
|
||||||
proc compile(c: PCtx, s: PSym): int = vmgen.genProc(c, s)
|
proc compile(c: PCtx, s: PSym): int =
|
||||||
|
result = vmgen.genProc(c, s)
|
||||||
|
c.echoCode
|
||||||
|
|
||||||
proc myreset(n: PNode) =
|
proc myreset(n: PNode) =
|
||||||
when defined(system.reset):
|
when defined(system.reset):
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,17 @@ proc codeListing(c: PCtx, result: var string) =
|
||||||
result.addf("\t$#\tr$#, r$#, r$#", ($opc).substr(3), x.regA,
|
result.addf("\t$#\tr$#, r$#, r$#", ($opc).substr(3), x.regA,
|
||||||
x.regB, x.regC)
|
x.regB, x.regC)
|
||||||
else:
|
else:
|
||||||
result.addf("\t$#\tr$#, r$#", ($opc).substr(3), x.regA, x.regBx)
|
result.addf("\t$#\tr$#, r$#", ($opc).substr(3), x.regA, x.regBx-wordExcess)
|
||||||
result.add(" #")
|
result.add("\t#")
|
||||||
result.add(toFileLine(c.debug[i]))
|
result.add(toFileLine(c.debug[i]))
|
||||||
result.add("\n")
|
result.add("\n")
|
||||||
inc i
|
inc i
|
||||||
|
|
||||||
|
proc echoCode*(c: PCtx) =
|
||||||
|
var buf = ""
|
||||||
|
codeListing(c, buf)
|
||||||
|
echo buf
|
||||||
|
|
||||||
proc gABC(ctx: PCtx; n: PNode; opc: TOpcode; a, b, c: TRegister = 0) =
|
proc gABC(ctx: PCtx; n: PNode; opc: TOpcode; a, b, c: TRegister = 0) =
|
||||||
assert opc.ord < 255
|
assert opc.ord < 255
|
||||||
let ins = (opc.uint32 or (a.uint32 shl 8'u32) or
|
let ins = (opc.uint32 or (a.uint32 shl 8'u32) or
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue