vm: treat floats as 64 bits doubles. 0.0 printed as "0".

This commit is contained in:
Irmen de Jong
2023-11-20 23:19:08 +01:00
parent ab4bcdf12d
commit af5ca2d0b8
14 changed files with 139 additions and 98 deletions
+4 -4
View File
@@ -48,10 +48,10 @@ class TestMemory: FunSpec({
test("32 bits float access") {
val mem = Memory()
mem.getFloat(1000) shouldNotBe 0.0
mem.setFloat(1000, 0.0f)
mem.getFloat(1000) shouldBe 0.0f
mem.setFloat(1000, -9.876543f)
mem.getFloat(1000) shouldBe -9.876543f
mem.setFloat(1000, 0.0)
mem.getFloat(1000) shouldBe 0.0
mem.setFloat(1000, -9.876543)
mem.getFloat(1000) shouldBe -9.876543
}
test("setstring and getstring") {
+1 -1
View File
@@ -128,6 +128,6 @@ class TestVm: FunSpec( {
c64machine.getFloatAsmBytes(Math.PI) shouldBe "\$82, \$49, \$0f, \$da, \$a2"
val vm = VirtualMachineDefinition()
vm.getFloatAsmBytes(Math.PI) shouldBe "\$40, \$49, \$0f, \$db"
vm.getFloatAsmBytes(Math.PI) shouldBe "\$40, \$09, \$21, \$fb, \$54, \$44, \$2d, \$18"
}
})