lazyboy: An EDSL for programming the Game Boy.

[ bsd3, compiler, dsl, library ] [ Propose Tags ]

An EDSL for programming the Nintendo Game Boy. https://github.com/ix/lazyboy#readme


[Skip to Readme]
Versions [faq] 0.2.0.1
Change log ChangeLog.md
Dependencies aeson (>=1.4.2.0 && <1.5), base (>=4.7 && <5), hspec (>=2.6.1 && <2.7), microstache (>=1.0.1.1 && <1.1), text (>=1.2.3.1 && <1.3), transformers (>=0.5.6.2 && <0.6) [details]
License BSD-3-Clause
Copyright 2019 Rose
Author Rose
Maintainer rose@lain.org.uk
Category DSL, Compiler
Home page https://github.com/ix/lazyboy#readme
Bug tracker https://github.com/ix/lazyboy/issues
Source repo head: git clone https://github.com/ix/lazyboy
Uploaded by rose at Wed May 15 15:58:15 UTC 2019
Distributions NixOS:0.2.0.1
Downloads 24 total (24 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-05-15 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for lazyboy-0.2.0.1

[back to package description]

LAZYBOY Build Status

Coverage Status

An embedded domain-specific language + compiler written in Haskell for producing code to run on the Nintendo Game Boy.

Also features a library for manipulating constructs such as memory and graphics.

Currently, RGBASM is the only output target, but in the future native machine code generation is planned.

Syntax example (will be updated as more complex constructs are added):

main :: IO ()
main = rom >>= T.putStrLn
    where rom = compileROM $ do
            smiley <- embedBytes image
            -- set scroll values
            write (Address scx) 0
            write (Address scy) 0
            -- set background palette
            setBackgroundPalette defaultPalette
            -- perform graphics operations
            onVblank $ do
                disableLCD
                memcpy (Name smiley) (Address $ 0x9010) $ fromIntegral $ length image
                memset (Address 0x9904) (0x992F - 0x9904) 0 -- clear the background tilemap
                write (Address background1) 1 -- write the background tile data
                setLCDControl $ defaultLCDControl { lcdDisplayEnable = True, lcdBackgroundEnable = True }
            -- halt indefinitely
            freeze

image :: [Word8]
image = [0x00,0x00,0x00,0x00,0x24,0x24,0x00,0x00,0x81,0x81,0x7e,0x7e,0x00,0x00,0x00,0x00]

See app/Main.hs for a full usage example.

Build a ROM (output will be named main.gb):

stack run > examples/main.asm
cd examples && make NAME=main

About issues

I mostly use the issue tracker on here as a place to write about planned features and compiler development, don't take the count as an indicator of active bugs, and be sure to filter to show only issues that are bugs if you are curious on the state of the project.

Contributing

Please see the Contributing page on the Wiki.

Additional information about the project can also be found on the Wiki.

Special thanks

Thanks to Francesco149 and Bonzi for kindly devoting their time and knowledge to the project. The graphics functionality in particular would not be where it is without their assistance.