mirror of
https://github.com/irmen/prog8.git
synced 2025-01-10 20:30:23 +00:00
vm: fix storezm/storezx instructions
This commit is contained in:
parent
e09f054058
commit
e659b91c4d
@ -163,11 +163,11 @@ internal class AssignmentGen(private val codeGen: CodeGen, private val expressio
|
|||||||
if(zero) {
|
if(zero) {
|
||||||
if(fixedIndex!=null) {
|
if(fixedIndex!=null) {
|
||||||
variableAddr += fixedIndex*itemsize
|
variableAddr += fixedIndex*itemsize
|
||||||
code += VmCodeInstruction(Opcode.STOREZM, VmDataType.FLOAT, value=variableAddr)
|
code += VmCodeInstruction(Opcode.STOREZM, vmDt, value=variableAddr)
|
||||||
} else {
|
} else {
|
||||||
val indexReg = codeGen.vmRegisters.nextFree()
|
val indexReg = codeGen.vmRegisters.nextFree()
|
||||||
code += loadIndexReg(array, itemsize, indexReg)
|
code += loadIndexReg(array, itemsize, indexReg)
|
||||||
code += VmCodeInstruction(Opcode.STOREZX, VmDataType.FLOAT, reg1=indexReg, value=variableAddr)
|
code += VmCodeInstruction(Opcode.STOREZX, vmDt, reg1=indexReg, value=variableAddr)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(vmDt== VmDataType.FLOAT) {
|
if(vmDt== VmDataType.FLOAT) {
|
||||||
|
@ -3,6 +3,7 @@ TODO
|
|||||||
|
|
||||||
For next release
|
For next release
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
|
- vm: fix primes.p8 calculating wrong primes
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
%import textio
|
%import textio
|
||||||
%import math
|
%zeropage basicsafe
|
||||||
%import string
|
|
||||||
%import floats
|
|
||||||
%zeropage dontuse
|
|
||||||
|
|
||||||
|
|
||||||
; NOTE: meant to test to virtual machine output target (use -target vitual)
|
; NOTE: meant to test to virtual machine output target (use -target vitual)
|
||||||
@ -34,22 +31,17 @@ main {
|
|||||||
sub start() {
|
sub start() {
|
||||||
; mcCarthy()
|
; mcCarthy()
|
||||||
|
|
||||||
|
ubyte[256] sieve
|
||||||
ubyte @shared bb = %10110001
|
ubyte xx
|
||||||
byte @shared sb = -99
|
for xx in 0 to 255 {
|
||||||
bb *= 2
|
sieve[xx] = false
|
||||||
bb /= 2
|
}
|
||||||
bb *= 8
|
for xx in 0 to 255 {
|
||||||
bb /= 8
|
txt.print_ub(sieve[xx])
|
||||||
txt.print_ub(bb) ; 17
|
txt.spc()
|
||||||
|
}
|
||||||
txt.nl()
|
txt.nl()
|
||||||
|
|
||||||
sb *= 2
|
|
||||||
sb /= 2
|
|
||||||
sb *= 8
|
|
||||||
sb /= 8
|
|
||||||
txt.print_b(sb) ; -3
|
|
||||||
txt.nl()
|
|
||||||
|
|
||||||
; ; a "pixelshader":
|
; ; a "pixelshader":
|
||||||
; sys.gfx_enable(0) ; enable lo res screen
|
; sys.gfx_enable(0) ; enable lo res screen
|
||||||
|
@ -630,10 +630,11 @@ class VirtualMachine(val memory: Memory, program: List<Instruction>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun InsINCM(i: Instruction) {
|
private fun InsINCM(i: Instruction) {
|
||||||
|
val address = i.value!!
|
||||||
when(i.type!!) {
|
when(i.type!!) {
|
||||||
VmDataType.BYTE -> memory.setUB(i.value!!, (memory.getUB(i.value)+1u).toUByte())
|
VmDataType.BYTE -> memory.setUB(address, (memory.getUB(address)+1u).toUByte())
|
||||||
VmDataType.WORD -> memory.setUW(i.value!!, (memory.getUW(i.value)+1u).toUShort())
|
VmDataType.WORD -> memory.setUW(address, (memory.getUW(address)+1u).toUShort())
|
||||||
VmDataType.FLOAT -> memory.setFloat(i.value!!, memory.getFloat(i.value)+1f)
|
VmDataType.FLOAT -> memory.setFloat(address, memory.getFloat(address)+1f)
|
||||||
}
|
}
|
||||||
pc++
|
pc++
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user