aboutsummaryrefslogtreecommitdiff
path: root/src/main.effekt
blob: 59f8f12c45e7a115187d54cf22c167513f54cdee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module main // must be named same as the file!

import src/cpu
import src/renderers/js
import src/renderer
import bytearray

def main(): Unit = {
  // Using the JS backend
  region global {
    def renderer: Renderer = JSRenderer::makeRenderer
    def cpu_ = makeCPU() {renderer}
    def plsRender(rom: ByteArray): Unit = {
      cpu_.initCPU(rom)
      renderer.update(box {() => cpu_.cycleCPU()})
    }
    renderer.init(plsRender)
    ()
  }
  ()
}