Working on kernel calls.
This commit is contained in:
parent
8486c2e375
commit
6c21d5cac9
12 changed files with 94 additions and 30 deletions
|
@ -24,13 +24,13 @@
|
|||
|
||||
|
||||
PROJECT=cube-pre
|
||||
START=0x200
|
||||
|
||||
F256=$(pwd)/../..
|
||||
LLVM=${F256}/llvm-mos
|
||||
SETTINGS=${LLVM}/mos-platform/f256k/lib/settings.ld
|
||||
PATH=${LLVM}/bin:${PATH}
|
||||
|
||||
START=0x200
|
||||
|
||||
echo "__f256_start = ${START};" > ${SETTINGS}
|
||||
|
||||
CLANG="mos-f256k-clang -I${F256}/include -I${F256}/f256lib -O3"
|
||||
|
|
|
@ -195,6 +195,7 @@ int main(void) {
|
|||
cubeProjX[i] = TO_LONG(fix_mul(cubeProjX[i], scale)) + widthOffset;
|
||||
cubeProjY[i] = TO_LONG(fix_mul(cubeProjY[i], scale)) + heightOffset;
|
||||
}
|
||||
|
||||
l = 0;
|
||||
for (i=0; i<24; i += 2) {
|
||||
line[l][t].x1 = cubeProjX[edges[i]];
|
||||
|
@ -203,6 +204,8 @@ int main(void) {
|
|||
line[l][t].y2 = cubeProjY[edges[i + 1]];
|
||||
l++;
|
||||
}
|
||||
|
||||
kernelUpdate();
|
||||
}
|
||||
|
||||
textClear();
|
||||
|
@ -228,6 +231,8 @@ int main(void) {
|
|||
for (i=0; i<12; i++) bitmapLine(line[i][p].x1, line[i][p].y1, line[i][p].x2, line[i][p].y2);
|
||||
l++;
|
||||
p++;
|
||||
|
||||
kernelUpdate();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -23,29 +23,31 @@
|
|||
#
|
||||
|
||||
|
||||
PROJECT=cube
|
||||
START=0x200
|
||||
|
||||
|
||||
F256=$(pwd)/../..
|
||||
LLVM=${F256}/llvm-mos
|
||||
SETTINGS=${LLVM}/mos-platform/f256k/lib/settings.ld
|
||||
PATH=${LLVM}/bin:${PATH}
|
||||
|
||||
START=0x2000
|
||||
|
||||
echo "__f256_start = ${START};" > ${SETTINGS}
|
||||
|
||||
CLANG="mos-f256k-clang -I${F256}/include -I${F256}/f256lib -O3"
|
||||
|
||||
${CLANG} -c ${F256}/f256lib/f256.c
|
||||
${CLANG} -c cube.c
|
||||
${CLANG} -o cube cube.o f256.o
|
||||
${CLANG} -c ${PROJECT}.c
|
||||
${CLANG} -o ${PROJECT} ${PROJECT}.o f256.o
|
||||
|
||||
mv -f cube cube.bin
|
||||
mv -f ${PROJECT} ${PROJECT}.bin
|
||||
|
||||
${F256}/header/header \
|
||||
pgz 24 \
|
||||
cube.pgz \
|
||||
${PROJECT}.pgz \
|
||||
${START} \
|
||||
cube.bin ${START}
|
||||
${PROJECT}.bin ${START}
|
||||
|
||||
#llvm-nm cube.elf > cube.lst
|
||||
llvm-objdump -d --print-imm-hex cube.elf > cube.lst
|
||||
hexdump -C cube.pgz > cube.hex
|
||||
#llvm-nm ${PROJECT}.elf > ${PROJECT}.lst
|
||||
llvm-objdump -d --print-imm-hex ${PROJECT}.elf > ${PROJECT}.lst
|
||||
hexdump -C ${PROJECT}.pgz > ${PROJECT}.hex
|
||||
|
|
|
@ -209,6 +209,8 @@ int main(void) {
|
|||
bitmapSetColor(255);
|
||||
draw_cube(p, t);
|
||||
t += 2;
|
||||
|
||||
kernelUpdate();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -23,29 +23,30 @@
|
|||
#
|
||||
|
||||
|
||||
PROJECT=pgztest
|
||||
START=0x200
|
||||
|
||||
F256=$(pwd)/../..
|
||||
LLVM=${F256}/llvm-mos
|
||||
SETTINGS=${LLVM}/mos-platform/f256k/lib/settings.ld
|
||||
PATH=${LLVM}/bin:${PATH}
|
||||
|
||||
START=0x2000
|
||||
|
||||
echo "__f256_start = ${START};" > ${SETTINGS}
|
||||
|
||||
CLANG="mos-f256k-clang -I${F256}/include -I${F256}/f256lib -Os"
|
||||
CLANG="mos-f256k-clang -I${F256}/include -I${F256}/f256lib -O3"
|
||||
|
||||
${CLANG} -c ${F256}/f256lib/f256.c
|
||||
${CLANG} -c pgztest.c
|
||||
${CLANG} -o pgztest pgztest.o f256.o
|
||||
${CLANG} -c ${PROJECT}.c
|
||||
${CLANG} -o ${PROJECT} ${PROJECT}.o f256.o
|
||||
|
||||
mv -f pgztest pgztest.bin
|
||||
mv -f ${PROJECT} ${PROJECT}.bin
|
||||
|
||||
${F256}/header/header \
|
||||
pgz 24 \
|
||||
pgztest.pgz \
|
||||
${PROJECT}.pgz \
|
||||
${START} \
|
||||
pgztest.bin ${START}
|
||||
${PROJECT}.bin ${START}
|
||||
|
||||
#llvm-nm pgztest.elf > pgztest.lst
|
||||
llvm-objdump -d --print-imm-hex pgztest.elf > pgztest.lst
|
||||
hexdump -C pgztest.pgz > pgztest.hex
|
||||
#llvm-nm ${PROJECT}.elf > ${PROJECT}.lst
|
||||
llvm-objdump -d --print-imm-hex ${PROJECT}.elf > ${PROJECT}.lst
|
||||
hexdump -C ${PROJECT}.pgz > ${PROJECT}.hex
|
||||
|
|
|
@ -65,11 +65,16 @@ void bitmap(void) {
|
|||
y2 = randomRead() % my;
|
||||
|
||||
bitmapLine(x, y, x2, y2);
|
||||
|
||||
kernelUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void text(void) {
|
||||
byte x;
|
||||
byte y;
|
||||
|
||||
textPrint("F256 LIVES!\n");
|
||||
textSetColor(LIGHT_GREEN, BLACK);
|
||||
textPrint("Green!\n\n");
|
||||
|
@ -79,12 +84,23 @@ void text(void) {
|
|||
textPrint("\nint16_t is "); textPrintInt(sizeof(int16_t));
|
||||
textPrint("\nint32_t is "); textPrintInt(sizeof(int32_t));
|
||||
textPrint("\n");
|
||||
|
||||
textPrint("\n");
|
||||
textGetXY(&x, &y);
|
||||
|
||||
while(1) {
|
||||
kernelUpdate();
|
||||
textGotoXY(x, y);
|
||||
textPrint("Pending: ");
|
||||
textPrintInt(kernelGetPendingEvents());
|
||||
textPrint(" ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(void) {
|
||||
f256Init();
|
||||
text();
|
||||
bitmap();
|
||||
//bitmap();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,9 @@ void dma2dFill(uint32_t start, uint16_t width, uint16_t height, uint16_t stride,
|
|||
|
||||
|
||||
static void dmaWait(void) {
|
||||
|
||||
//***FIX*** This whole block seems unneeded if DMA halts the CPU while it transfers.
|
||||
|
||||
// First, wait for DMA to be complete.
|
||||
while (PEEK(DMA_STATUS) & DMA_STAT_BUSY)
|
||||
// Spin our wheels.
|
||||
|
|
|
@ -54,11 +54,12 @@ void f256Init(void) {
|
|||
// MMU_MEM_BANK_6 is always mapped to I/O.
|
||||
// MMU_MEM_BANK_7 belongs to the MicroKernel.
|
||||
|
||||
randomSeed(0); //***TODO*** Use clock or something.
|
||||
|
||||
kernelReset();
|
||||
graphicsReset();
|
||||
textReset();
|
||||
bitmapReset();
|
||||
tileReset();
|
||||
spriteReset();
|
||||
|
||||
randomSeed(0); //***TODO*** Use clock or something.
|
||||
}
|
||||
|
|
|
@ -24,6 +24,11 @@
|
|||
#include "kernel.h"
|
||||
|
||||
|
||||
// Allocate some RAM to hold event data.
|
||||
static struct event_t event;
|
||||
// Create an alias for the kernel args.
|
||||
static struct call_args *args = (struct call_args *)0x00f0;
|
||||
|
||||
char error;
|
||||
|
||||
|
||||
|
@ -40,3 +45,21 @@ kGetTimeStamp
|
|||
jsr kernel.Clock.GetTime
|
||||
rts
|
||||
*/
|
||||
|
||||
|
||||
byte kernelGetPendingEvents(void) {
|
||||
return -args->events.pending;
|
||||
}
|
||||
|
||||
|
||||
void kernelReset(void) {
|
||||
// Tell the kernel where our event buffer lives.
|
||||
args->events.event = &event;
|
||||
|
||||
kernelUpdate();
|
||||
}
|
||||
|
||||
|
||||
void kernelUpdate(void) {
|
||||
CALL(NextEvent);
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ extern "C"
|
|||
#include "f256.h"
|
||||
|
||||
|
||||
#define VECTOR(member) (size_t)(&((struct call *)0xff00)->member)
|
||||
#define EVENT(member) (size_t)(&((struct events *)0)->member)
|
||||
#define VECTOR(member) (size_t)(&((struct call *)0xff00)->member)
|
||||
#define EVENT(member) (size_t)(&((struct events *)0)->member)
|
||||
#define CALL(fn) \
|
||||
asm("jsr %[addy] \n" \
|
||||
"stz %[err] \n" \
|
||||
|
@ -45,8 +45,12 @@ extern "C"
|
|||
: "a", "x", "y", "c", "v");
|
||||
|
||||
|
||||
extern struct event_t event; // The event struct is allocated in crt0. Or is it?
|
||||
extern char error;
|
||||
extern char error;
|
||||
|
||||
|
||||
byte kernelGetPendingEvents(void);
|
||||
void kernelReset(void);
|
||||
void kernelUpdate(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -92,6 +92,12 @@ void textDefineColor(byte slot, byte fr, byte fg, byte fb, byte br, byte bg, byt
|
|||
}
|
||||
|
||||
|
||||
void textGetXY(byte *x, byte *y) {
|
||||
*x = _col;
|
||||
*y = _row;
|
||||
}
|
||||
|
||||
|
||||
// Move cursor.
|
||||
void textGotoXY(byte x, byte y) {
|
||||
_col = x;
|
||||
|
|
|
@ -61,6 +61,7 @@ extern colorT textColors[16];
|
|||
|
||||
void textClear(void);
|
||||
void textDefineColor(byte slot, byte fr, byte fg, byte fb, byte br, byte bg, byte bb);
|
||||
void textGetXY(byte *x, byte *y);
|
||||
void textGotoXY(byte x, byte y);
|
||||
void textPrint(char *message);
|
||||
void textPrintInt(int32_t value);
|
||||
|
|
Loading…
Add table
Reference in a new issue