Skip to content

Instantly share code, notes, and snippets.

View cbeust's full-sized avatar

Cedric Beust cbeust

View GitHub Profile
; Test access to the memory card ($D000 and above).
; This is an adaptation of Zellyn's a2audit tests made to be run headlessly: https://github.com/zellyn/a2audit
; If the tests succed, $3D contains the number of successful tests
; If a test fails, the code lands on a BRK, $3D contains the number of passed tests,
; and Y is the index of the comparison that failed (1-5)
;
; Cedric Beust, cedric@beust.com, 9/17/2020
;
D1 := $d17b
~/kotlin/kobalt $ k assemble
__ __ __ __ __
/ //_/ ____ / /_ ____ _ / / / /_
/ ,< / __ \ / __ \ / __ `/ / / / __/
/ /| | / /_/ / / /_/ // /_/ / / / / /_
/_/ |_| \____/ /_.___/ \__,_/ /_/ \__/ 1.0.93
Regular compilation time: 2459 ms
Parallel build starting
╔═════════════════════════╗
~/kotlin/kobalt $ k assemble
__ __ __ __ __
/ //_/ ____ / /_ ____ _ / / / /_
/ ,< / __ \ / __ \ / __ `/ / / / __/
/ /| | / /_/ / / /_/ // /_/ / / / / /_
/_/ |_| \____/ /_.___/ \__,_/ /_/ \__/ 1.0.93
Regular compilation time: 2459 ms
Parallel build starting
╔═════════════════════════╗
Root
A
A1
A2
A3
B
B1
B2
B21
A
A1
A2
1
11
12
@cbeust
cbeust / a.kt
Created February 7, 2017 20:19
class Tree(val payload: Int, val leaves: List<Tree>)
@cbeust
cbeust / a.kt
Created February 7, 2017 20:19
displayGraphGeneric(graph, Node::children, Node::value)
displayGraphGeneric(tree, Tree::leaves, Tree::payload)
@cbeust
cbeust / a.kt
Created February 7, 2017 20:18
fun <T, U> displayGraphGeneric(roots: List<T>,
children: (T) -> List<T>,
value: (T) -> U,
indent: String = “”) {
roots.forEach {
println(indent + value(it))
displayGraphGeneric(children(it), children, value,
indent + “ “)
}
}
@cbeust
cbeust / a.kt
Created February 7, 2017 20:18
val graph = listOf(Node(“A”, listOf(
Node(“A1”),
Node(“A2”)))
)
displayGraph(graph)
val tree = listOf(Tree(1, listOf(
Tree(11),
Tree(12)))
)
@cbeust
cbeust / a.kt
Created February 7, 2017 20:17
class Node(override val value: String,
override val children: List<Node> = emptyList()) : INode<String>
class Tree(val payload: Int, val leaves: List<Tree>) : INode<Int> {
override val children: List<Tree> = leaves
override val value: Int = payload
}