mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-12-23 01:29:47 +00:00
simplify iterators
This commit is contained in:
parent
6d5da43684
commit
00575f46f7
@ -15,7 +15,6 @@
|
||||
|
||||
## TODO
|
||||
|
||||
- assembly doc w/ define support
|
||||
- label region as assembly doc
|
||||
- add mapping support
|
||||
- postfix operations to accumulator values
|
||||
- loops
|
@ -24,13 +24,11 @@ package object dsl {
|
||||
}
|
||||
|
||||
def enum[A](implicit ctx: AsmDocumentContext, ev: EnumAsm[A]): Unit = {
|
||||
val (_, xs) =
|
||||
val xs =
|
||||
ev.all
|
||||
.map(ev.label)
|
||||
.foldLeft(0 -> List.empty[(String, Int)]) {
|
||||
case ((next, acc), s) =>
|
||||
(next + 1) -> (acc :+ (s -> next))
|
||||
}
|
||||
.toList
|
||||
.zip(List.iterate(0, ev.all.size)(_ + 1))
|
||||
|
||||
val grp =
|
||||
DefinitionGroup(
|
||||
@ -47,13 +45,11 @@ package object dsl {
|
||||
}
|
||||
|
||||
def bitField[A](implicit ctx: AsmDocumentContext, ev: BitField[A]): Unit = {
|
||||
val (_, xs) =
|
||||
val xs =
|
||||
ev.all
|
||||
.map(ev.label)
|
||||
.foldLeft(1 -> List.empty[(String, Int)]) {
|
||||
case ((next, acc), s) =>
|
||||
(next << 1) -> (acc :+ (s -> next))
|
||||
}
|
||||
.toList
|
||||
.zip(List.iterate(1, ev.all.size)(_ << 1))
|
||||
|
||||
val grp =
|
||||
DefinitionGroup(
|
||||
|
Loading…
Reference in New Issue
Block a user