mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-06-26 01:29:31 +00:00
complicated stub
This commit is contained in:
parent
913e612102
commit
627bfcbeab
|
@ -3,4 +3,7 @@ package com.htmlism.scratchpad
|
||||||
object Encoded:
|
object Encoded:
|
||||||
trait Byte[A]
|
trait Byte[A]
|
||||||
|
|
||||||
|
object Byte:
|
||||||
|
given intByte: Encoded.Byte[Int] with {}
|
||||||
|
|
||||||
trait Word[A]
|
trait Word[A]
|
||||||
|
|
|
@ -2,14 +2,14 @@ package com.htmlism.scratchpad
|
||||||
|
|
||||||
// https://mads.atari8.info/mads_eng.html#_mv
|
// https://mads.atari8.info/mads_eng.html#_mv
|
||||||
object Move:
|
object Move:
|
||||||
def const[R: Register, A: WriteLease.Byte, X: Encoded.Byte](x: X): Asm2[R, A] =
|
def const[R: Register, A: WriteLease.ByteAddress, X: Encoded.Byte](x: X): Asm2[R, A] =
|
||||||
Load
|
Load
|
||||||
.const[R, X](x)
|
.const[R, X](x)
|
||||||
.widenWith[A] andThen Store.from[R, A]
|
.widenWith[A] andThen Store.from[R, A]
|
||||||
|
|
||||||
def from[R: Register, A: ReadLease.Byte, B: WriteLease.Byte]: Asm3[R, A, B] =
|
def from[R: Register, A: ReadLease.ByteAddress, B: WriteLease.ByteAddress]: Asm3[R, A, B] =
|
||||||
Asm3Instructions(List(""))
|
Asm3Instructions(List(""))
|
||||||
|
|
||||||
object Word:
|
object Word:
|
||||||
def const[R: Register, A: WriteLease.Word, X: Encoded.Word](x: X): Asm2[R, A] =
|
def const[R: Register, A: WriteLease.WordAddress, X: Encoded.Word](x: X): Asm2[R, A] =
|
||||||
Asm2Instructions(List(""))
|
Asm2Instructions(List(""))
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.htmlism.scratchpad
|
package com.htmlism.scratchpad
|
||||||
|
|
||||||
object ReadLease:
|
trait ReadLease[A]
|
||||||
trait Byte[A]
|
|
||||||
|
|
||||||
trait Word[A]
|
object ReadLease:
|
||||||
|
trait ByteAddress[A]
|
||||||
|
|
||||||
|
trait WordAddress[A]
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.htmlism.scratchpad
|
package com.htmlism.scratchpad
|
||||||
|
|
||||||
object Store:
|
object Store:
|
||||||
def from[R: Register, A: WriteLease.Byte]: Asm2[R, A] =
|
def from[R: Register, A: WriteLease.ByteAddress]: Asm2[R, A] =
|
||||||
Byte[R, A]()
|
Byte[R, A]()
|
||||||
|
|
||||||
case class Byte[R, A]()(using R: Register[R], A: WriteLease.Byte[A]) extends Asm2[R, A]:
|
case class Byte[R, A]()(using R: Register[R], A: WriteLease.ByteAddress[A]) extends Asm2[R, A]:
|
||||||
def xs: List[String] =
|
def xs: List[String] =
|
||||||
List("ST" + R.name)
|
List("ST" + R.name)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.htmlism.scratchpad
|
package com.htmlism.scratchpad
|
||||||
|
|
||||||
object WriteLease:
|
trait WriteLease[A]
|
||||||
trait Byte[A]
|
|
||||||
|
|
||||||
trait Word[A]
|
object WriteLease:
|
||||||
|
trait ByteAddress[A]
|
||||||
|
|
||||||
|
trait WordAddress[A]
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.htmlism.scratchpad
|
||||||
|
|
||||||
|
import weaver.*
|
||||||
|
object ComplicatedResourceSuite extends FunSuite:
|
||||||
|
class Player[A <: Player[_]](address: Int):
|
||||||
|
def headAddr: Int =
|
||||||
|
address
|
||||||
|
|
||||||
|
def tailAddres: Int =
|
||||||
|
address + 1
|
||||||
|
|
||||||
|
def setHead(x: Int)(using W: WriteLease[A]): Asm1[Register.A] =
|
||||||
|
Load.Const[Register.A, Int](x)
|
||||||
|
|
||||||
|
class PlayerOne extends Player[PlayerOne](40)
|
||||||
|
|
||||||
|
class PlayerTwo extends Player[PlayerTwo](80)
|
Loading…
Reference in New Issue
Block a user