puts function

This commit is contained in:
aramya 2023-07-03 11:09:00 +01:00
parent b33635641b
commit 720f391a10
2 changed files with 20 additions and 0 deletions

View File

@ -10,9 +10,13 @@ void __eabi(void)
{
}
//void* ofw_interpret(char* cmd, int32_t* stack_args, int n_stack_args, int n_ret_args, int32_t* reta
void main(void)
{
puts("ABCD", 4);
ofw_interpret("blink-screen", 0, 0, 0, 0);
ofw_interpret("key", 0, 0, 1, (int32_t*)0x03020000);
if (ofw_test("open"))
{
asm("mr 27, 28");

16
src/lib/common.c Normal file
View File

@ -0,0 +1,16 @@
#include <ofw.h>
void puts(char* str, int len)
{
char cmd[len+8];
cmd[0] = '.'; cmd[1] = '"';
cmd[2] = ' ';
for (int i = 3; i < len+3; i++)
{
cmd[i] = str[i-3];
}
cmd[len+3] = '"'; cmd[len+4] = ' ';
cmd[len+5] = 'c'; cmd[len+6] = 'r';
cmd[len+7] = 0;
ofw_interpret(cmd, 0, 0, 0, 0);
}