mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-11 12:29:46 +00:00
6502: Correctly assign true view pointies; fixes #28
This commit is contained in:
parent
b2dd4eadd4
commit
709d3d0fcd
2
src/main/scala/millfork/env/Constant.scala
vendored
2
src/main/scala/millfork/env/Constant.scala
vendored
@ -66,7 +66,7 @@ sealed trait Constant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def subbyte(index: Int): Constant = {
|
def subbyte(index: Int): Constant = {
|
||||||
if (requiredSize <= index) Constant.Zero
|
if (requiredSize > 0 && requiredSize <= index) Constant.Zero
|
||||||
else index match {
|
else index match {
|
||||||
case 0 => if (isProvablyDivisibleBy256) Constant.Zero else loByte
|
case 0 => if (isProvablyDivisibleBy256) Constant.Zero else loByte
|
||||||
case 1 => hiByte
|
case 1 => hiByte
|
||||||
|
@ -176,4 +176,30 @@ class StructSuite extends FunSuite with Matchers {
|
|||||||
m.readWord(0xc002) should equal(code.count(_ == '↑') + 8)
|
m.readWord(0xc002) should equal(code.count(_ == '↑') + 8)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
test("Boolean fields") {
|
||||||
|
val code =
|
||||||
|
"""
|
||||||
|
|struct Sprite {
|
||||||
|
| byte size,
|
||||||
|
| byte size2,
|
||||||
|
| byte size3,
|
||||||
|
| byte size4,
|
||||||
|
| bool x1,
|
||||||
|
| bool x,
|
||||||
|
| bool y,
|
||||||
|
| bool z
|
||||||
|
|}
|
||||||
|
|
|
||||||
|
|array(Sprite) sprites [20] @ $c000
|
||||||
|
|
|
||||||
|
|void main() {
|
||||||
|
| sprites[0].x = true
|
||||||
|
|}
|
||||||
|
|""".stripMargin
|
||||||
|
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086, Cpu.Motorola6809)(code){ m =>
|
||||||
|
m.readByte(0xc005) should equal(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user