Giter Site home page Giter Site logo

Comments (5)

dciabrin avatar dciabrin commented on May 28, 2024 2

Oh I never tried that, let me keep that open as a future feature.
I never tried it, but I think ideally from C, you should run something like:

    __asm__ __volatile__ ("jsr 0xc00468" : : :
                          "d0","d1","d2","d3","d4","d5","d6","d7",
                          "a0","a1","a2","a3","a4","a5","a6");

I'm not sure of the calling convention so here the example request gcc to save all registers.
I'll add a dedicated header with the appropriate macros to call all the BIOS functions.

from ngdevkit.

totologic avatar totologic commented on May 28, 2024

No problem, I am going to try today.

from ngdevkit.

totologic avatar totologic commented on May 28, 2024

Excellent ! It works. Quickly, I retrieved with success the user name of the memcard.

`
#define BIOS_CARD_COMMAND ((volatile u8*)0x10FDC4)
#define BIOS_CARD_ANSWER ((volatile u8*)0x10FDC6)
#define BIOS_CARD_START ((volatile u32*)0x10FDC8)

char data[8];
char msg[4];

*BIOS_CARD_START = (u32)data;
*BIOS_CARD_COMMAND = 7;
asm volatile ("jsr 0xc00468" : : :
"d0","d1","d2","d3","d4","d5","d6","d7",
"a0","a1","a2","a3","a4","a5","a6");

display(1, 2, data); // display user name data string on fx layer
snprintf(msg, 4, "%2d", *BIOS_CARD_ANSWER);
display(1, 3, msg);// display error code
`

from ngdevkit.

dciabrin avatar dciabrin commented on May 28, 2024

Great!

For what it's worth, latest ngdevkit master provides additional headers/helpers that allow you to access the data in the BIOS's memory as if they were regular C variables:

#include <ngdevkit/bios-ram.h>

[...]

bios_card_start = (u32)data;
bios_card_command = 7;

Maybe that can be of interest for you.

from ngdevkit.

totologic avatar totologic commented on May 28, 2024

Also I am able to load/save data.

After experimenting, I want to raise 2 issues:

  1. the NGH number must be considered in hex literally. For exxample, Puzzle Bobble NGH is 83, so a call for it would be:

*BIOS_CARD_FCB = 0x83;

  1. The BIOS_CARD_SUB must be read as 16 bits with data search command (1). But writing only 8 bits with load data command (2). It seems to work both with save data command (3)

from ngdevkit.

Related Issues (20)

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.