Giter Club home page Giter Club logo

gbdk-n's People

Contributors

andreasjhkarlsson avatar flozz avatar majstar avatar ochristensen avatar wootguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gbdk-n's Issues

gotoxy

It seems like gotoxy() isn't working.

I compile this:

#include <stdio.h>
#include <gb/gb.h>
#include <gb/console.h>

// clear the screen
void cls (void) NONBANKED;

void main () {
    DISPLAY_ON;
    cls();
    gotoxy(11, 8);
    printf("O HAI!");
}

with this:

BIN=/opt/gbdk/bin
OBJ=./obj

build:
	mkdir -p $(OBJ)
	$(BIN)/gbdk-n-compile.sh demo.c -o $(OBJ)/demo.rel
	$(BIN)/gbdk-n-link.sh $(OBJ)/demo.rel -o $(OBJ)/demo.ihx
	$(BIN)/gbdk-n-make-rom.sh $(OBJ)/demo.ihx demo.gb

clean:
	rm -rf $(OBJ)
	rm -f demo.gb

and I get this:

Screenshot from 2020-03-13 22-41-33

Am I doing it wrong?

Info:

I'm running in this docker environment.

Debian GNU/Linux 10 (buster)
SDCC : 3.8.0 #10562 (Linux)

Minors fixes

I've packaged gbdk-n for nix ( see NixOS/nixpkgs#61709 ) , but i'd like few minors improvements : add a license file at project root, and please make a release, that would be easier to distribute.

Interrupt handler hangs

When I try to handle interrupts using the add_JOY, add_VBL etc. functions, the emulator (BGB) hangs after the handler is called for the first time. The code I used for test:

#include <gb/gb.h>
#include <gb/rand.h>

UINT8 tiles[64], i, jp;

void joypad_irq() {
    jp = joypad();
    set_bkg_tiles(0, 0, 1, 1, &jp);
}

void main() {
    disable_interrupts();
    DISPLAY_OFF;
    for(i=0; i<64; i++)
        tiles[i] = _rand();
    set_bkg_data(0, 128, tiles);
    SHOW_BKG;
    DISPLAY_ON;
    
    /* this hangs */
    add_JOY(joypad_irq);
    enable_interrupts();
    set_interrupts(JOY_IFLAG);
    while(1) { }
    
    /* this works */
    //enable_interrupts();
    //while(1) { joypad_irq(); }
}

Compiling on Windows 10

Just to mention the errors message I get. Nevertheless, I can compile the examples and run on bgb.

Compiling: digits.c
libc\digits.c:1: warning 115: unknown or unsupported #pragma directive 'bank=BASE'
Compiling: gprint.c
Compiling: gprintf.c
Compiling: gprintln.c
Compiling: gprintn.c
libc\gprintn.c:11: warning 94: comparison is always false due to limited range of data type
libc\gprintn.c:11: warning 126: unreachable code
libc\gprintn.c:12: warning 126: unreachable code
libc\gprintn.c:12: warning 126: unreachable code
libc\gprintn.c:13: warning 126: unreachable code
libc\gprintn.c:13: warning 126: unreachable code
Assembling: arand.s
Assembling: cgb.s
Assembling: cpy_data.s
Assembling: crt0.s
Assembling: delay.s
Assembling: drawing.s
Assembling: font.s
Assembling: f_ibm_sh.s
Assembling: f_italic.s
Assembling: f_min.s
Assembling: f_spect.s
Assembling: get_bk_t.s
Assembling: get_data.s
Assembling: get_prop.s
Assembling: get_spr.s
Assembling: get_wi_t.s
Assembling: get_xy_t.s
Assembling: global.s
Assembling: hiramcpy.s
Assembling: ibmfixed.s
Assembling: init_tt.s
Assembling: input.s
Assembling: mv_bkg.s
Assembling: mv_spr.s
Assembling: mv_win.s
Assembling: pad.s
Assembling: rand.s
Assembling: sample.s
Assembling: scroll_b.s
Assembling: scroll_s.s
Assembling: scroll_w.s
Assembling: serial.s
Assembling: set_bk_t.s
Assembling: set_data.s
Assembling: set_prop.s
Assembling: set_spr.s
Assembling: set_wi_t.s
Assembling: set_xy_t.s
Assembling: sfr.s
Assembling: sgb.s
        1 fichier(s) copié(s).
Adding: obj\arand.rel
Adding: obj\cgb.rel
Adding: obj\cpy_data.rel
Adding: obj\crt0.rel
Adding: obj\delay.rel
Adding: obj\digits.rel
Adding: obj\drawing.rel
Adding: obj\font.rel
Adding: obj\f_ibm_sh.rel
Adding: obj\f_italic.rel
Adding: obj\f_min.rel
Adding: obj\f_spect.rel
ERROR: Couldn't create temporary file 'lib\gb.__L'
Adding: obj\get_bk_t.rel
Adding: obj\get_data.rel
Adding: obj\get_prop.rel
Adding: obj\get_spr.rel
Adding: obj\get_wi_t.rel
Adding: obj\get_xy_t.rel
Adding: obj\global.rel
Adding: obj\gprint.rel
Adding: obj\gprintf.rel
Adding: obj\gprintln.rel
Adding: obj\gprintn.rel
Adding: obj\hiramcpy.rel
Adding: obj\ibmfixed.rel
Adding: obj\init_tt.rel
Adding: obj\input.rel
Adding: obj\mv_bkg.rel
Adding: obj\mv_spr.rel
Adding: obj\mv_win.rel
Adding: obj\pad.rel
ERROR: Couldn't create temporary file 'lib\gb.__I'
Adding: obj\rand.rel
Adding: obj\sample.rel
Adding: obj\scroll_b.rel
Adding: obj\scroll_s.rel
Adding: obj\scroll_w.rel
Adding: obj\serial.rel
Adding: obj\set_bk_t.rel
Adding: obj\set_data.rel
Adding: obj\set_prop.rel
Adding: obj\set_spr.rel
Adding: obj\set_wi_t.rel
Adding: obj\set_xy_t.rel
Adding: obj\sfr.rel
Adding: obj\sgb.rel

Build succeeded!

Then, compiling Space example:

?ASlink-Warning-Undefined Global '.jpad' referenced by module 'Space'

But, as I said, the .gb is done and working.

More examples

More examples are needed as part of documented the available functions and showcase how to do stuff and how to build them. New and current examples needs to be checked for correctness as well as old gbdk used 8 bit-ints (not standard compliant).

Banked code support

So I've been playing around with this for a bit and banked code seems to be a major problem with gbdk-n currently. And it's not necessarily that the gbdk-n code is bad but there's definitely issues compiling code that results in multi bank roms.

After a bunch of digging I think I've pinned this to the SDCC linker not allowing for an extended address space > 64kb.

Before I go and file a bug over there, do you have any examples of working multi bank code (specifically generating a rom > 64kb)?

Replace old crt0 with default

The gbz80 runtime (crt0) included in sdcc is currently disabled and replaced with the old runtime shipped with the original gbdk. This is probably bad.

Most (all) modules depend heavily on the old runtime so the appropriate functionality needs to be broken out into modules.

Playing sound/music

Hello,

Is it possible to play background music and sound effect sfx with this SDK ?

Better documentation

This library is very helpful when starting out with gameboy development, but the lack of documentation makes it a pain to use efficiently, e.g. the entire section about gb/console.h is just blah.

Unify runtime & stdlib with SDCC

There are currently overlaps & incompatibilities between the runtime (crt) and standard libraries (stdlib) included in gbdk-n and the ones included in SDCC.

Currently, the included crt in SDCC is disabled in favor of the gbdk-n. This is because gbdk-n breaks with SDCC runtime. This is done by passing --no-std-crt0 to sdcc.

For the standard library, both the gbdk-n library and sdcc library are used because there are functions in both libraries that are needed for successful builds. The problem is when the libraries overlap, resulting in failing builds (multiple symbols defined when linking). An example is the rand() function that is defined in both gbdk-n and sdcc.

Gameboy Color Support

Lddc supports setting the -Wl-yp0x143=0x80 flag to set things as Gameboy Color compatible. Is there an equivalent way for doing this with gbdk-n / sdcc?

Is this working?

Hi, I stumbled onto your project while looking for an updated GBDK using the latest SDCC.

I've built with SDCC HEAD (3.5.4 #9304 as of Aug 24 2015) and cannot get a binary created with makebin, getting error: size of the buffer is too small.

My program, test.c, looks like:

#include <gb/gb.h>
#include <gb/console.h>
#include <stdio.h>

void main()
{
    printf(" \nTest\n");
}

And I execute the following:

$ ./gbdk-n-compile.sh test.c
+ sdcc -mgbz80 --no-std-crt0 -I /gbdk-n/bin/../include -I /gbdk-n/bin/../include/asm -c test.c

$ ./gbdk-n-link.sh test.c
+ sdcc -mgbz80 --no-std-crt0 -I /gbdk-n/bin/../include -I /gbdk-n/bin/../include/asm -L /gbdk-n/bin/../lib /gbdk-n/bin/../lib/crt0.rel -l gb.lib -o a.ihx test.c

$ makebin -Z a.ihx test.gb
error: size of the buffer is too small.

Is this correct or have I done something wrong?

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.