Thanks to KermPhD for the name.
I'm trying to develop an OS for the 84+ CE and am working on an installer.
So far, I understand that to deal with flash and ports, I need privileged access. To get privileged access, you need to access a port, which needs privilege itself. From what I understand, I need to enter Z80 mode, which bypasses these privileges and lets you access ports. Currently, I'm trying to bypass these privileges by setting the port to FFFFFF (which sets the last byte of privileged code to the end of theoretical memory). For some reason, it causes the system to reset, as if it wasn't running in z80 mode.
main.c
Code:
asm/main.asm
Code:
Thanks!
I'm trying to develop an OS for the 84+ CE and am working on an installer.
So far, I understand that to deal with flash and ports, I need privileged access. To get privileged access, you need to access a port, which needs privilege itself. From what I understand, I need to enter Z80 mode, which bypasses these privileges and lets you access ports. Currently, I'm trying to bypass these privileges by setting the port to FFFFFF (which sets the last byte of privileged code to the end of theoretical memory). For some reason, it causes the system to reset, as if it wasn't running in z80 mode.
main.c
Code:
/* Keep these headers */
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>
/* Put function prototypes here */
void printText(const char *text, uint8_t x, uint8_t y);
void printTextSmall(const char *text, uint8_t xpos, uint8_t ypos);
typedef void (*syscall)(void);
void main(void) {
doPrivilege();
while (!os_GetCSC());
}
asm/main.asm
Code:
.def _doPrivilege
_doPrivilege:
assume adl = 1
ld a, $D1
ld mb, a
call.is bypass and $FFFF
ret
bypass:
assume adl = 0
ld a, $FF
out0 ($1D), a
out0 ($1E), a
out0 ($1F), a
ret.l
Thanks!