summaryrefslogtreecommitdiffstats
path: root/sw/z80/kernel/boot_loader.c
blob: ddca4f99e8c6a1cd261cd938b5f9845bce8ea47b (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "boot.h"
#include "progman.h"

#define DEFAULT_EXEC_STATUS 0x4000

struct exec_status *status = EXEC_STATUS; 

void boot_init() {

    *status = DEFAULT_EXEC_STATUS;

    // TODO other stuff
}

int8_t authenticate(const char *pwd) {

    const char *c_pwd = PWD_ADDR, *c_req = pwd;
    
    for (uint8_t i = 0; i < PWD_SIZE; i++) {

        if (*c_pwd != *c_req)
            return 0;

        c_pwd++;
        c_req++;
    }

    return 1;
}

void set_pwd(const char *pwd) {

    char *c_pwd = PWD_ADDR;
    const char *c_req = pwd;

    for (uint8_t i = 0; i < PWD_SIZE; i++) {

        *c_pwd = *c_req;

        c_pwd++;
        c_req++;
    }
}