+-Discord Shoutbox


Alternatively, join us on Discord directly.
You can help CodeWalrus stay online by donating here.

Ivoah's GBA programming thread [GBA]

Started by Ivoah, October 30, 2015, 02:57:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alexgt

  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

DJ Omnimaga

OOh that looks cool. :D Do you think the text speed can be improved?
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite

Ivoah

Quote from: DJ Omnimaga on November 02, 2015, 04:08:40 AM
OOh that looks cool. :D Do you think the text speed can be improved?

I'm sure it could be improved, but I probably won't bother. Here's the rom for anyone that's interested: https://sr.ht/qrIf.gba
  • Calculators owned: TI-86 (now broken), TI SR-56, TI-Nspire CX CAS, TI-84+ SE, TI-84+ SE, TI-85, TI-73 Explorer VS, ViewScreen, TI-84+ CSE, TI-83+ SE

DJ Omnimaga

As long as games that you make don't have text this slow I am fine :P (sprite-based games I mean. Imagine if the score took longer to display than the map XD)
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite

Streetwalrus

I suppose this text library uses software rendering which should explain why it's so slow.

DJ Omnimaga

YEah that could be it. That reminds me, have you gotten any luck displaying sprites, ivoah? Also does the GBA have scrolling routines?
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite

Ivoah

November 03, 2015, 04:29:49 AM #21 Last Edit: November 03, 2015, 04:31:32 AM by Ivoah
Quote from: Streetwalrus on November 02, 2015, 09:07:55 AM
I suppose this text library uses software rendering which should explain why it's so slow.

I've changed some code up a bit and now it runs much better:


I replaced
int mvaddch(int y, int x, const char ch)
{
    if (x >= COLS || x < 0 || y >= LINES || y < 0) return ERR;
    iprintf("\033[%d;%dH%c", y, x, ch);
    return OK;
}

int my_mvaddstr(int y, int x, char *str)
{
    for ( ; x < 0; ++x, ++str)
        if (*str == '\0')  return ERR;
    for ( ; *str != '\0'; ++str, ++x)
        if (mvaddch(y, x, *str) == ERR)  return ERR;
    return OK;
}


with
int my_mvaddstr(int y, int x, char *str)
{
    for ( ; x < 0; ++x, ++str)
        if (*str == '\0')  return ERR;

    if (x >= COLS || x < 0 || y >= LINES || y < 0) return ERR;
    iprintf("\033[%d;%dH%.*s", y, x, COLS - x, str);

    return OK;
}


Quote from: DJ Omnimaga on November 03, 2015, 04:27:44 AM
YEah that could be it. That reminds me, have you gotten any luck displaying sprites, ivoah? Also does the GBA have scrolling routines?

I haven't gotten around to doing anything beyond messing with the text output yet.
  • Calculators owned: TI-86 (now broken), TI SR-56, TI-Nspire CX CAS, TI-84+ SE, TI-84+ SE, TI-85, TI-73 Explorer VS, ViewScreen, TI-84+ CSE, TI-83+ SE

DJ Omnimaga

I see. By the way nice speed improvement. Does the text engine support background color for individual characters and foreground?
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite

Streetwalrus

I don't think it needs any kind of scrolling routines, the hardware is designed to draw sprites at any place on the screen. If I recall correctly it supports a couple background and map layers, and standalone sprites. So whatever you do it's going to be fast.

DJ Omnimaga

Yeah I was wondering because I wasn't sure if redrawing a tilemap every frame caused massive slowdowns.
  • Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite

Powered by EzPortal