GithubHelp home page GithubHelp logo

msinger / binutils-sm83 Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 36.36 MB

Binutils port for the Sharp SM83 (Game Boy CPU)

License: GNU General Public License v2.0

Makefile 16.83% Shell 0.53% M4 0.41% C 43.20% DIGITAL Command Language 0.04% sed 0.01% Perl 0.06% C++ 3.77% Lex 0.23% Yacc 0.26% Emacs Lisp 0.01% Assembly 14.42% DTrace 6.69% CWeb 0.02% Rust 0.01% D 11.02% Mathematica 0.01% Roff 0.79% R 0.32% Scheme 1.42%
gameboy assembler linker game-boy binutils sm83 assembly-sm83 dmg-001 dmg-cpu nintendo

binutils-sm83's Introduction

Binutils for GameBoy
====================


Build binutils like this:

  ./configure --target=sm83-gb-coff
  make all
  # as root:
  make install


Example file:

  ; Handler for RST28 instruction (max. 8 bytes)
  .section .rst28
    ret

  ; Handler for interrupt 4 (joypad) (max. 8 bytes)
  .section .irq4
    reti

  ; Entry point (max. 4 bytes)
  .section .entry
    nop
    jp start

  ; GameBoy Header
  .section .hdrlogo
    .db 0xCE, 0xED, 0x66, 0x66, 0xCC, 0x0D, 0x00, 0x0B, 0x03, 0x73, 0x00, 0x83, 0x00, 0x0C, 0x00, 0x0D
    .db 0x00, 0x08, 0x11, 0x1F, 0x88, 0x89, 0x00, 0x0E, 0xDC, 0xCC, 0x6E, 0xE6, 0xDD, 0xDD, 0xD9, 0x99
    .db 0xBB, 0xBB, 0x67, 0x63, 0x6E, 0x0E, 0xEC, 0xCC, 0xDD, 0xDC, 0x99, 0x9F, 0xBB, 0xB9, 0x33, 0x3E
  .section .hdrname
    .db "hram-rw"
  .section .hdrgc
    .db "TEST"
  .section .hdrcgb
    .db 0x00
  .section .hdrmc
    .db "ZZ"
  .section .hdrsgb
    .db 0x00
  .section .hdrtype
    .db 0x08
  .section .hdrrom
    .db 0x00
  .section .hdrram
    .db 0x02
  .section .hdrdest
    .db 0x01
  .section .hdrver
    .db 0x00

  ; Code for Bank 0 (starts at 0x150)
  .section .bank0
  start:
  .global start
    di

    call foo  ; call routine in bank 1

    ; Copy routine for initializing HRAM
    ld c, _ehdata
    ld hl, __load_stop_hdata - 1
  loop:
    ld a, _hdata - 1
    dec c
    cp c
    jp z, loop2  ; jumps to address 0xff80
    ld a, (hld)
    ld (c), a
    jr loop

  ; Code loaded into HRAM (starts at 0xff80)
  .section .hdata
  loop2:
    jr loop2

  ; Code for Bank 1 (starts at 0x4000)
  .section bank1
  foo:
    rst 0x28  ; call reset 0x28 handler
    ret


Build example with:

  sm83-gb-coff-as -o example.o example.s
  sm83-gb-coff-ld -o example.gb example.o

Then use rgbfix from the Rednex Game Boy Development System (rgbds):
  rgbfix -fhg example.gb

binutils-sm83's People

Contributors

msinger avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.