aboutsummaryrefslogtreecommitdiff
path: root/arm9/source/core.h
blob: 2eccc0ade6ab0d84b4f3324e29ce5ed5b28a6bc9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef CORE_H_
    #define CORE_H_

    #include "bang.h"
    #include "dev.h"


    typedef struct {
        u8 mem[256];
        u8 p;
    } Stack;

    typedef struct {
        bool alive;             // True when program is not halted
        bool awake;             // True when program is not asleep
        u8 mem[65536];          // Program memory
        u16 ip;                 // Instruction pointer
        Stack wst, rst;         // Working and return stacks
        DeviceBus dev;          // Device bus
    } Bedrock;

    // Methods.
    void br_reset(Bedrock *br);
    void br_load(Bedrock *br, u8 program[], int size);
    void br_rouse(Bedrock *br);
    void br_run(Bedrock *br);
#endif