Updated api.h which was causing kernel events to be screwy.
This commit is contained in:
parent
1a2fc959c6
commit
496ef13a94
7 changed files with 240 additions and 223 deletions
3
README
3
README
|
@ -68,6 +68,9 @@ proper size for your intended use and have 256 or fewer colors. The result of
|
||||||
the conversion will be a "clut" file with the color lookup table in it as well
|
the conversion will be a "clut" file with the color lookup table in it as well
|
||||||
as an "indexed" file of the pixels in your image mapped to the color table.
|
as an "indexed" file of the pixels in your image mapped to the color table.
|
||||||
|
|
||||||
|
The image converter can also take a bitmap and slice it into 8x8, 16x16, 24x24,
|
||||||
|
or 32x32 chunks for use as sprite data.
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
========
|
========
|
||||||
|
|
|
@ -129,95 +129,93 @@ void getInput(void) {
|
||||||
static byte twoJoy = 0;
|
static byte twoJoy = 0;
|
||||||
static byte keyJoy = 0;
|
static byte keyJoy = 0;
|
||||||
|
|
||||||
kernelCall(NextEvent);
|
do {
|
||||||
|
kernelCall(NextEvent);
|
||||||
|
|
||||||
// Read real joysticks.
|
if (kernelEventData.type != 0) {
|
||||||
if (kernelEvent(JOYSTICK)) {
|
textPrintInt(kernelEventData.type);
|
||||||
oneJoy = kernelEventData.joystick.joy0;
|
textPrint(" ");
|
||||||
twoJoy = kernelEventData.joystick.joy1;
|
textPrintInt(kernelEvent(key.PRESSED));
|
||||||
anyJoy = oneJoy | twoJoy | keyJoy;
|
textPrint(" ");
|
||||||
}
|
textPrintInt(kernelEvent(key.RELEASED));
|
||||||
|
textPrint("\n");
|
||||||
// Use keyboard as virtual joystick.
|
|
||||||
// ***TODO*** This doesn't work worth a crap.
|
|
||||||
if (kernelEvent(key.PRESSED)) {
|
|
||||||
switch (kernelEventData.key.ascii) {
|
|
||||||
case 'w':
|
|
||||||
case 'W':
|
|
||||||
keyJoy |= JOY_UP;
|
|
||||||
break;
|
|
||||||
case 'a':
|
|
||||||
case 'A':
|
|
||||||
keyJoy |= JOY_LEFT;
|
|
||||||
break;
|
|
||||||
case 's':
|
|
||||||
case 'S':
|
|
||||||
keyJoy |= JOY_DOWN;
|
|
||||||
break;
|
|
||||||
case 'd':
|
|
||||||
case 'D':
|
|
||||||
keyJoy |= JOY_RIGHT;
|
|
||||||
break;
|
|
||||||
case 'j':
|
|
||||||
case 'J':
|
|
||||||
keyJoy |= JOY_BUTTON_1;
|
|
||||||
break;
|
|
||||||
case 'k':
|
|
||||||
case 'K':
|
|
||||||
keyJoy |= JOY_BUTTON_2;
|
|
||||||
break;
|
|
||||||
case 'l':
|
|
||||||
case 'L':
|
|
||||||
keyJoy |= JOY_BUTTON_3;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
anyJoy = oneJoy | twoJoy | keyJoy;
|
|
||||||
}
|
|
||||||
if (kernelEvent(key.RELEASED)) {
|
|
||||||
switch (kernelEventData.key.ascii) {
|
|
||||||
case 'w':
|
|
||||||
case 'W':
|
|
||||||
keyJoy &= JOY_UP;
|
|
||||||
break;
|
|
||||||
case 'a':
|
|
||||||
case 'A':
|
|
||||||
keyJoy &= JOY_LEFT;
|
|
||||||
break;
|
|
||||||
case 's':
|
|
||||||
case 'S':
|
|
||||||
keyJoy &= JOY_DOWN;
|
|
||||||
break;
|
|
||||||
case 'd':
|
|
||||||
case 'D':
|
|
||||||
keyJoy &= JOY_RIGHT;
|
|
||||||
break;
|
|
||||||
case 'j':
|
|
||||||
case 'J':
|
|
||||||
keyJoy &= JOY_BUTTON_1;
|
|
||||||
break;
|
|
||||||
case 'k':
|
|
||||||
case 'K':
|
|
||||||
keyJoy &= JOY_BUTTON_2;
|
|
||||||
break;
|
|
||||||
case 'l':
|
|
||||||
case 'L':
|
|
||||||
keyJoy &= JOY_BUTTON_3;
|
|
||||||
break;
|
|
||||||
anyJoy = oneJoy | twoJoy | keyJoy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
// Read real joysticks.
|
||||||
textGotoXY(0, 0);
|
if (kernelEventData.type == kernelEvent(GAME)) {
|
||||||
textPrintInt(oneJoy);
|
oneJoy = kernelEventData.game.game0;
|
||||||
textPrint(" ");
|
twoJoy = kernelEventData.game.game1;
|
||||||
textPrintInt(twoJoy);
|
}
|
||||||
textPrint(" ");
|
|
||||||
textPrintInt(keyJoy);
|
// Use keyboard as virtual joystick.
|
||||||
textPrint(" ");
|
if (kernelEventData.type == kernelEvent(key.PRESSED)) {
|
||||||
textPrintInt(anyJoy);
|
switch (kernelEventData.key.ascii) {
|
||||||
textPrint(" ");
|
case 'w':
|
||||||
*/
|
case 'W':
|
||||||
|
keyJoy |= JOY_UP;
|
||||||
|
break;
|
||||||
|
case 'a':
|
||||||
|
case 'A':
|
||||||
|
keyJoy |= JOY_LEFT;
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
case 'S':
|
||||||
|
keyJoy |= JOY_DOWN;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
case 'D':
|
||||||
|
keyJoy |= JOY_RIGHT;
|
||||||
|
break;
|
||||||
|
case 'j':
|
||||||
|
case 'J':
|
||||||
|
keyJoy |= JOY_BUTTON_1;
|
||||||
|
break;
|
||||||
|
case 'k':
|
||||||
|
case 'K':
|
||||||
|
keyJoy |= JOY_BUTTON_2;
|
||||||
|
break;
|
||||||
|
case 'l':
|
||||||
|
case 'L':
|
||||||
|
keyJoy |= JOY_BUTTON_3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (kernelEventData.type == kernelEvent(key.RELEASED)) {
|
||||||
|
switch (kernelEventData.key.ascii) {
|
||||||
|
case 'w':
|
||||||
|
case 'W':
|
||||||
|
keyJoy &= ~JOY_UP;
|
||||||
|
break;
|
||||||
|
case 'a':
|
||||||
|
case 'A':
|
||||||
|
keyJoy &= ~JOY_LEFT;
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
case 'S':
|
||||||
|
keyJoy &= ~JOY_DOWN;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
case 'D':
|
||||||
|
keyJoy &= ~JOY_RIGHT;
|
||||||
|
break;
|
||||||
|
case 'j':
|
||||||
|
case 'J':
|
||||||
|
keyJoy &= ~JOY_BUTTON_1;
|
||||||
|
break;
|
||||||
|
case 'k':
|
||||||
|
case 'K':
|
||||||
|
keyJoy &= ~JOY_BUTTON_2;
|
||||||
|
break;
|
||||||
|
case 'l':
|
||||||
|
case 'L':
|
||||||
|
keyJoy &= ~JOY_BUTTON_3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (kernelGetPending() > 0);
|
||||||
|
|
||||||
|
// Merge inputs. Yes, this allows dumb things like LEFT and RIGHT at the same time.
|
||||||
|
anyJoy = oneJoy | twoJoy | keyJoy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,35 +60,34 @@ int main(void) {
|
||||||
|
|
||||||
tileSetScroll(0, 0, xs, 0, ys);
|
tileSetScroll(0, 0, xs, 0, ys);
|
||||||
|
|
||||||
while(true) {
|
while (true) {
|
||||||
|
kernelEventData.type = 0;
|
||||||
kernelCall(NextEvent);
|
kernelCall(NextEvent);
|
||||||
if (kernelGetPending() > 0) {
|
if (kernelEventData.type == kernelEvent(key.RELEASED)) {
|
||||||
if (kernelEvent(key.PRESSED)) {
|
switch (kernelEventData.key.ascii) {
|
||||||
switch (kernelEventData.key.ascii) {
|
case 'w':
|
||||||
case 'w':
|
case 'W':
|
||||||
case 'W':
|
ys--;
|
||||||
ys--;
|
break;
|
||||||
break;
|
case 'a':
|
||||||
case 'a':
|
case 'A':
|
||||||
case 'A':
|
xs--;
|
||||||
xs--;
|
break;
|
||||||
break;
|
case 's':
|
||||||
case 's':
|
case 'S':
|
||||||
case 'S':
|
ys++;
|
||||||
ys++;
|
break;
|
||||||
break;
|
case 'd':
|
||||||
case 'd':
|
case 'D':
|
||||||
case 'D':
|
xs++;
|
||||||
xs++;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
tileSetScroll(0, 0, xs, 0, ys);
|
|
||||||
textGotoXY(0, 0);
|
|
||||||
textPrintInt(xs);
|
|
||||||
textPrint(", ");
|
|
||||||
textPrintInt(ys);
|
|
||||||
textPrint(" ");
|
|
||||||
}
|
}
|
||||||
|
tileSetScroll(0, 0, xs, 0, ys);
|
||||||
|
textGotoXY(0, 0);
|
||||||
|
textPrintInt(xs);
|
||||||
|
textPrint(", ");
|
||||||
|
textPrintInt(ys);
|
||||||
|
textPrint(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
200
f256lib/api.h
200
f256lib/api.h
|
@ -1,33 +1,28 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the TinyCore MicroKernel for the Foenix F256,
|
* This file is part of the TinyCore 6502 MicroKernel, Copyright 2022 Jessie
|
||||||
* Copyright 2022,2023 Jessie Oberreuter <Gadget@HackwrenchLabs.com>. As with
|
* Oberreuter <joberreu@moselle.com>. As with the Linux Kernel Exception to
|
||||||
* the Linux Kernel Exception to the GPL3, programs built to run on the
|
* the GPL3, programs built to run on the MicroKernel are expected to
|
||||||
* MicroKernel are expected to include this file. Doing so does not affect
|
* include this file. Doing so does not effect their license status.
|
||||||
* their license status.
|
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
* Kernel Calls Populate the kernel.arg.* variables appropriately, and then
|
||||||
|
* JSR to one of the velctors below:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
#ifndef kernel_api_h
|
||||||
* Kernel calls populate the kernel.arg.* variables appropriately, and then
|
#define kernel_api_h
|
||||||
* JSR to one of the velctors below:
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef kernel_h
|
|
||||||
#define kernel_h
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
struct call { // Mount at $ff00
|
struct call { // Mount at $ff00
|
||||||
|
|
||||||
long NextEvent; // Copy the next event into user-space.
|
long NextEvent; // Copy the next event into user-space.
|
||||||
long ReadData; // Copy primary bulk event data into user-space
|
long ReadData; // Copy primary bulk event data into user-space
|
||||||
long ReadExt; // Copy secondary bolk event data into user-space
|
long ReadExt; // Copy secondary bolk event data into user-space
|
||||||
long Yield; // Give unused time to the kernel.
|
long Yield; // Give unused time to the kernel.
|
||||||
long Putch; // deprecated
|
long Putch; // deprecated
|
||||||
long Basic; // deprecated
|
long RunBlock; //
|
||||||
long dummy1; // reserved
|
long RunNamed; //
|
||||||
long dummy2; // reserved
|
long reserved;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
long List; // Returns a bit-set of available block-accessible devices.
|
long List; // Returns a bit-set of available block-accessible devices.
|
||||||
|
@ -57,43 +52,55 @@ struct call { // Mount at $ff00
|
||||||
long Close; // Close an open file.
|
long Close; // Close an open file.
|
||||||
long Rename; // Rename a closed file.
|
long Rename; // Rename a closed file.
|
||||||
long Delete; // Delete a closed file.
|
long Delete; // Delete a closed file.
|
||||||
|
long Seek; // Set the next read/write position within an open file.
|
||||||
} File;
|
} File;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
long Open; // Open a directory for reading.
|
long Open; // Open a directory for reading.
|
||||||
long Read; // Read a directory entry; may also return VOLUME and FREE events.
|
long Read; // Read a directory entry; may also return VOLUME and FREE events.
|
||||||
long Close; // Close a directory once finished reading.
|
long Close; // Close a directory once finished reading.
|
||||||
|
long MkDir; // Create a new directory.
|
||||||
|
long RmDir; // Deletes an existing directory.
|
||||||
} Directory;
|
} Directory;
|
||||||
|
|
||||||
long gate;
|
long gate;
|
||||||
|
|
||||||
struct {
|
|
||||||
long GetSize; // Returns rows/cols in kernel args.
|
|
||||||
long DrawRow; // Draw text/color buffers left-to-right
|
|
||||||
long DrawColumn; // Draw text/color buffers top-to-bottom
|
|
||||||
} Display;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
long GetIP; // Get the local IP address.
|
long GetIP; // Get the local IP address.
|
||||||
long SetIP; // Set the local IP address.
|
long SetIP; // Set the local IP address.
|
||||||
long GetDNS; // Get the configured DNS IP address.
|
long GetDNS; // Get the configured DNS IP address.
|
||||||
long SetDNS; // Set the configured DNS IP address.
|
long SetDNS; // Set the configured DNS IP address.
|
||||||
long GetTime; //
|
long SendICMP; // Send an ICMP packet (typically a ping).
|
||||||
long SetTime; //
|
long Match; // Determine if the current event matches a specific socket.
|
||||||
long GetSysInfo; //
|
|
||||||
long SetBPS; // Set the serial BPS (should match the SLIP router's speed).
|
struct {
|
||||||
} Config;
|
long Init; // Initialize a 32 byte UDP socket structure.
|
||||||
|
long Send; // Send data via the supplied UDP socket structure.
|
||||||
|
long Recv; // Copy the UDP payload from the event to the user's address space.
|
||||||
|
} UDP;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
long Open; // Initialize a 256 byte TCP structure for a specified destination.
|
||||||
|
long Accept; // Initialize a 256 byte TCP structure from a received SYN packet.
|
||||||
|
long Reject; // Reply to a received TCP packet with a REJECT message.
|
||||||
|
long Send; // Accept some new data and send an ACK along with any unACK'd data.
|
||||||
|
long Recv; // Copy any new TCP bytes into the user's buf and update the socket state.
|
||||||
|
} TCP;
|
||||||
|
};
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
long InitUDP; //
|
long Reset; // Re-init the display.
|
||||||
long SendUDP; //
|
long GetSize; // Returns rows/cols in kernel args.
|
||||||
long RecvUDP; //
|
long DrawRow; // Draw text/color buffers left-to-right
|
||||||
long InitTCP; //
|
long DrawColumn; // Draw text/color buffers top-to-bottom
|
||||||
long SendTCP; //
|
} Display;
|
||||||
long RecvTCP; //
|
|
||||||
long SendICMP; //
|
struct {
|
||||||
long RecvICMP; //
|
long GetTime; // Get the date+time in BCD: YY,YY,MM,DD,HH,MM,SS,cS
|
||||||
} Net;
|
long SetTime; //
|
||||||
|
long GetSysInfo; //
|
||||||
|
long SetBPS; //
|
||||||
|
} Config;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Kernel Call Arguments; mount at $f0
|
// Kernel Call Arguments; mount at $f0
|
||||||
|
@ -105,11 +112,11 @@ struct events_t {
|
||||||
|
|
||||||
struct common_t {
|
struct common_t {
|
||||||
char dummy[8-sizeof(struct events_t)];
|
char dummy[8-sizeof(struct events_t)];
|
||||||
void * ext;
|
const void * ext;
|
||||||
uint8_t extlen;
|
uint8_t extlen;
|
||||||
void * buf;
|
const void * buf;
|
||||||
uint8_t buflen;
|
uint8_t buflen;
|
||||||
void * internal;
|
void * internal;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fs_mkfs_t {
|
struct fs_mkfs_t {
|
||||||
|
@ -169,6 +176,12 @@ struct fs_delete_t {
|
||||||
// fname_len = args.buflen
|
// fname_len = args.buflen
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct fs_seek_t {
|
||||||
|
uint8_t streak;
|
||||||
|
uint8_t cookie;
|
||||||
|
uint32_t position;
|
||||||
|
};
|
||||||
|
|
||||||
struct file_t {
|
struct file_t {
|
||||||
union {
|
union {
|
||||||
struct fs_open_t open;
|
struct fs_open_t open;
|
||||||
|
@ -177,6 +190,7 @@ struct file_t {
|
||||||
struct fs_close_t close;
|
struct fs_close_t close;
|
||||||
struct fs_rename_t rename;
|
struct fs_rename_t rename;
|
||||||
struct fs_delete_t delete;
|
struct fs_delete_t delete;
|
||||||
|
struct fs_seek_t seek;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -201,6 +215,8 @@ struct dir_t {
|
||||||
struct dir_open_t open;
|
struct dir_open_t open;
|
||||||
struct dir_read_t read;
|
struct dir_read_t read;
|
||||||
struct dir_close_t close;
|
struct dir_close_t close;
|
||||||
|
struct dir_open_t mkdir;
|
||||||
|
struct dir_open_t rmdir;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -236,58 +252,68 @@ struct call_args {
|
||||||
struct events {
|
struct events {
|
||||||
uint16_t reserved;
|
uint16_t reserved;
|
||||||
uint16_t deprecated;
|
uint16_t deprecated;
|
||||||
uint16_t JOYSTICK; // joystick events
|
uint16_t GAME; // joystick events
|
||||||
uint16_t DEVICE; // deprecated
|
uint16_t DEVICE; // deprecated
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t PRESSED;
|
uint16_t PRESSED;
|
||||||
uint8_t RELEASED;
|
uint16_t RELEASED;
|
||||||
} key;
|
} key;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t DELTA;
|
uint16_t DELTA;
|
||||||
uint8_t CLICKS;
|
uint16_t CLICKS;
|
||||||
} mouse;
|
} mouse;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t NAME;
|
uint16_t NAME;
|
||||||
uint8_t SIZE;
|
uint16_t SIZE;
|
||||||
uint8_t DATA;
|
uint16_t DATA;
|
||||||
uint8_t WROTE;
|
uint16_t WROTE;
|
||||||
uint8_t FORMATTED;
|
uint16_t FORMATTED;
|
||||||
uint8_t ERROR;
|
uint16_t ERROR;
|
||||||
} block;
|
} block;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t SIZE;
|
uint16_t SIZE;
|
||||||
uint8_t CREATED;
|
uint16_t CREATED;
|
||||||
uint8_t CHECKED;
|
uint16_t CHECKED;
|
||||||
uint8_t DATA;
|
uint16_t DATA;
|
||||||
uint8_t WROTE;
|
uint16_t WROTE;
|
||||||
uint8_t ERROR;
|
uint16_t ERROR;
|
||||||
} fs;
|
} fs;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t NOT_FOUND;
|
uint16_t NOT_FOUND;
|
||||||
uint8_t OPENED;
|
uint16_t OPENED;
|
||||||
uint8_t DATA;
|
uint16_t DATA;
|
||||||
uint8_t WROTE;
|
uint16_t WROTE;
|
||||||
uint8_t EOF;
|
uint16_t EOF;
|
||||||
uint8_t CLOSED;
|
uint16_t CLOSED;
|
||||||
uint8_t RENAMED;
|
uint16_t RENAMED;
|
||||||
uint8_t DELETED;
|
uint16_t DELETED;
|
||||||
uint8_t ERROR;
|
uint16_t ERROR;
|
||||||
|
uint16_t SEEK;
|
||||||
} file;
|
} file;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t OPENED;
|
uint16_t OPENED;
|
||||||
uint8_t VOLUME;
|
uint16_t VOLUME;
|
||||||
uint8_t FILE;
|
uint16_t FILE;
|
||||||
uint8_t FREE;
|
uint16_t FREE;
|
||||||
uint8_t EOF;
|
uint16_t EOF;
|
||||||
uint8_t CLOSED;
|
uint16_t CLOSED;
|
||||||
uint8_t ERROR;
|
uint16_t ERROR;
|
||||||
} directory;
|
} directory;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
uint16_t TCP;
|
||||||
|
uint16_t UDP;
|
||||||
|
} net;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
uint16_t TICK;
|
||||||
|
} clock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -318,9 +344,9 @@ struct event_mouse_t {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct event_joystick_t {
|
struct event_game_t {
|
||||||
uint8_t joy0;
|
uint8_t game0;
|
||||||
uint8_t joy1;
|
uint8_t game1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct event_fs_data_t {
|
struct event_fs_data_t {
|
||||||
|
@ -375,11 +401,11 @@ struct event_t {
|
||||||
uint8_t buf; // kernel's buf page ID
|
uint8_t buf; // kernel's buf page ID
|
||||||
uint8_t ext; // kernel's ext page ID
|
uint8_t ext; // kernel's ext page ID
|
||||||
union {
|
union {
|
||||||
struct event_key_t key;
|
struct event_key_t key;
|
||||||
struct event_mouse_t mouse;
|
struct event_mouse_t mouse;
|
||||||
struct event_joystick_t joystick;
|
struct event_game_t game;
|
||||||
struct event_file_t file;
|
struct event_file_t file;
|
||||||
struct event_dir_t directory;
|
struct event_dir_t directory;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,9 +36,8 @@ static byte _BITMAP_CLUT[3];
|
||||||
static byte _color;
|
static byte _color;
|
||||||
static byte _active; // Current drawing page.
|
static byte _active; // Current drawing page.
|
||||||
|
|
||||||
#define bitmapPutPixelIOSet(x, y) FAR_POKE((_BITMAP_BASE[_active] + mathUnsignedAddition(mathUnsignedMultiply(y, _MAX_X), (int32_t)x)), _color)
|
|
||||||
|
|
||||||
//static void bitmapPutPixelIOSet(uint16_t x, uint16_t y);
|
#define bitmapPutPixelIOSet(x, y) FAR_POKE((_BITMAP_BASE[_active] + mathUnsignedAddition(mathUnsignedMultiply(y, _MAX_X), (int32_t)x)), _color)
|
||||||
|
|
||||||
|
|
||||||
void bitmapClear(void) {
|
void bitmapClear(void) {
|
||||||
|
@ -144,21 +143,6 @@ void bitmapPutPixel(uint16_t x, uint16_t y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// This does the actual pixel setting but depends on the I/O being umapped.
|
|
||||||
static void bitmapPutPixelIOSet(uint16_t x, uint16_t y) {
|
|
||||||
uint32_t pixelRAM;
|
|
||||||
byte block;
|
|
||||||
|
|
||||||
pixelRAM = _BITMAP_BASE[_active] + mathUnsignedAddition(mathUnsignedMultiply(y, _MAX_X), (int32_t)x);
|
|
||||||
block = pixelRAM / EIGHTK;
|
|
||||||
pixelRAM &= 0x1FFF; // Find offset into this block.
|
|
||||||
POKE(SWAP_SLOT, block);
|
|
||||||
POKE(SWAP_ADDR + pixelRAM, _color);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void bitmapReset(void) {
|
void bitmapReset(void) {
|
||||||
uint32_t realSize;
|
uint32_t realSize;
|
||||||
uint32_t pageBlocks;
|
uint32_t pageBlocks;
|
||||||
|
@ -250,13 +234,13 @@ void bitmapSetColor(byte c) {
|
||||||
void bitmapSetVisible(byte p, bool v) {
|
void bitmapSetVisible(byte p, bool v) {
|
||||||
switch (p) {
|
switch (p) {
|
||||||
case 0:
|
case 0:
|
||||||
POKE(VKY_BM0_CTRL, v ? 1 | _BITMAP_CLUT[p] : 0); // Enable bitmap 0, GLUT 0.
|
POKE(VKY_BM0_CTRL, v ? 1 | _BITMAP_CLUT[p] : 0); // Enable bitmap 0.
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
POKE(VKY_BM1_CTRL, v ? 1 | _BITMAP_CLUT[p] : 0); // Enable bitmap 0, GLUT 0.
|
POKE(VKY_BM1_CTRL, v ? 1 | _BITMAP_CLUT[p] : 0); // Enable bitmap 1.
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
POKE(VKY_BM2_CTRL, v ? 1 | _BITMAP_CLUT[p] : 0); // Enable bitmap 0, GLUT 0.
|
POKE(VKY_BM2_CTRL, v ? 1 | _BITMAP_CLUT[p] : 0); // Enable bitmap 2.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,10 +58,9 @@ typedef unsigned char bool;
|
||||||
|
|
||||||
// Our stuff.
|
// Our stuff.
|
||||||
#define SWAP_SLOT MMU_MEM_BANK_5
|
#define SWAP_SLOT MMU_MEM_BANK_5
|
||||||
#define SWAP_ADDR ((uint16_t)(SWAP_SLOT - MMU_MEM_BANK_0) * (uint16_t)0x2000)
|
|
||||||
|
|
||||||
// This is an attempt to allow us to free up slot 5 and use slot 6 for paging
|
// This is an attempt to allow us to free up slot 5 and use slot 6 for paging
|
||||||
// RAM in and out. Currently, it does not work.
|
// RAM in and out. ***TODO*** Currently, it does not work.
|
||||||
#if SWAP_SLOT == MMU_MEM_BANK_6
|
#if SWAP_SLOT == MMU_MEM_BANK_6
|
||||||
|
|
||||||
#define SWAP_IO_SETUP() \
|
#define SWAP_IO_SETUP() \
|
||||||
|
@ -78,6 +77,11 @@ typedef unsigned char bool;
|
||||||
asm("cli"); \
|
asm("cli"); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#elif SWAP_SLOT == MMU_MEM_BANK_7
|
||||||
|
|
||||||
|
#define SWAP_IO_SETUP() asm("sei");
|
||||||
|
#define SWAP_IO_SHUTDOWN() asm("cli");
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define SWAP_IO_SETUP()
|
#define SWAP_IO_SETUP()
|
||||||
|
@ -85,6 +89,8 @@ typedef unsigned char bool;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SWAP_ADDR ((uint16_t)(SWAP_SLOT - MMU_MEM_BANK_0) * (uint16_t)0x2000)
|
||||||
|
|
||||||
|
|
||||||
// Things not in the Merlin defs.
|
// Things not in the Merlin defs.
|
||||||
#define TEXT_MATRIX 0xc000 // I/O Page 2
|
#define TEXT_MATRIX 0xc000 // I/O Page 2
|
||||||
|
|
|
@ -192,7 +192,6 @@ void textPrintUInt(uint32_t value){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Reset display to text, "standard" colors.
|
|
||||||
void textReset(void) {
|
void textReset(void) {
|
||||||
byte x;
|
byte x;
|
||||||
byte y;
|
byte y;
|
||||||
|
@ -239,6 +238,8 @@ void textSetCursor(byte c) {
|
||||||
|
|
||||||
|
|
||||||
void textSetDouble(bool x, bool y) {
|
void textSetDouble(bool x, bool y) {
|
||||||
|
//***TODO*** Adding this function seems to have screwed up scrolling.
|
||||||
|
|
||||||
POKE(VKY_MSTR_CTRL_1, (PEEK(VKY_MSTR_CTRL_1) & 0xf9) | (x << 1) | (y << 2));
|
POKE(VKY_MSTR_CTRL_1, (PEEK(VKY_MSTR_CTRL_1) & 0xf9) | (x << 1) | (y << 2));
|
||||||
|
|
||||||
_MAX_COL = x ? 40 : 80;
|
_MAX_COL = x ? 40 : 80;
|
||||||
|
|
Loading…
Add table
Reference in a new issue