mirror of
https://github.com/irmen/prog8.git
synced 2024-12-23 09:32:43 +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(fixedIndex!=null) {
|
||||
variableAddr += fixedIndex*itemsize
|
||||
code += VmCodeInstruction(Opcode.STOREZM, VmDataType.FLOAT, value=variableAddr)
|
||||
code += VmCodeInstruction(Opcode.STOREZM, vmDt, value=variableAddr)
|
||||
} else {
|
||||
val indexReg = codeGen.vmRegisters.nextFree()
|
||||
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 {
|
||||
if(vmDt== VmDataType.FLOAT) {
|
||||
|
@ -3,6 +3,7 @@ TODO
|
||||
|
||||
For next release
|
||||
^^^^^^^^^^^^^^^^
|
||||
- vm: fix primes.p8 calculating wrong primes
|
||||
...
|
||||
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
%import textio
|
||||
%import math
|
||||
%import string
|
||||
%import floats
|
||||
%zeropage dontuse
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
; NOTE: meant to test to virtual machine output target (use -target vitual)
|
||||
@ -34,22 +31,17 @@ main {
|
||||
sub start() {
|
||||
; mcCarthy()
|
||||
|
||||
|
||||
ubyte @shared bb = %10110001
|
||||
byte @shared sb = -99
|
||||
bb *= 2
|
||||
bb /= 2
|
||||
bb *= 8
|
||||
bb /= 8
|
||||
txt.print_ub(bb) ; 17
|
||||
ubyte[256] sieve
|
||||
ubyte xx
|
||||
for xx in 0 to 255 {
|
||||
sieve[xx] = false
|
||||
}
|
||||
for xx in 0 to 255 {
|
||||
txt.print_ub(sieve[xx])
|
||||
txt.spc()
|
||||
}
|
||||
txt.nl()
|
||||
|
||||
sb *= 2
|
||||
sb /= 2
|
||||
sb *= 8
|
||||
sb /= 8
|
||||
txt.print_b(sb) ; -3
|
||||
txt.nl()
|
||||
|
||||
; ; a "pixelshader":
|
||||
; 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) {
|
||||
val address = i.value!!
|
||||
when(i.type!!) {
|
||||
VmDataType.BYTE -> memory.setUB(i.value!!, (memory.getUB(i.value)+1u).toUByte())
|
||||
VmDataType.WORD -> memory.setUW(i.value!!, (memory.getUW(i.value)+1u).toUShort())
|
||||
VmDataType.FLOAT -> memory.setFloat(i.value!!, memory.getFloat(i.value)+1f)
|
||||
VmDataType.BYTE -> memory.setUB(address, (memory.getUB(address)+1u).toUByte())
|
||||
VmDataType.WORD -> memory.setUW(address, (memory.getUW(address)+1u).toUShort())
|
||||
VmDataType.FLOAT -> memory.setFloat(address, memory.getFloat(address)+1f)
|
||||
}
|
||||
pc++
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user