standardize

This commit is contained in:
Luxferre
2022-08-06 09:34:32 +03:00
parent db589f3904
commit 152744e84a
2 changed files with 39 additions and 21 deletions
+25 -16
View File
@@ -9,10 +9,25 @@
* @author Luxferre
*/
/* Standard includes */
/* Standard includes with size optimizations for TCC */
#ifdef __TINYC__
#include <tcclib.h>
#else
#include <stdlib.h>
#include <stdio.h>
#endif
/*
* Non-standard includes
* To save space, we emulate necessary conio functions on non-6502 systems, not vice versa
*/
#ifdef __CC65__
#include <conio.h>
#else
#endif
/* Definitions section */
@@ -51,7 +66,6 @@
/* Some necessary constants and offsets derived from the above values */
#define STACK_SIZE_WORDS (STACK_SIZE / WS) /* Main and return stack size in words */
#define MAIN_STACK_ADDR 0 /* Main stack address */
#define RETURN_STACK_ADDR STACK_SIZE /* Return stack address */
#define LIT_STACK_ADDR (RETURN_STACK_ADDR + STACK_SIZE) /* Literal stack address */
@@ -72,9 +86,9 @@
*/
struct EquiFlags {
uchar II:1; /* instruction ignore mode */
uchar CM:1; /* compilation mode */
uchar IM:1; /* interpretation mode */
unsigned int II:1; /* instruction ignore mode */
unsigned int CM:1; /* compilation mode */
unsigned int IM:1; /* interpretation mode */
};
struct CLTEntry {
@@ -103,22 +117,17 @@ struct EquiRAM {
};
/*
* Before running the main code, instantiate and initialize the machine RAM
*/
static struct EquiRAM ram = {
.gpd_start = GPD_AREA_START,
.cmd_start = CMD_BUF_START,
.cmd_size = CMD_BUF_SIZE
};
/* Before running the main code, instantiate the machine RAM */
static struct EquiRAM ram;
/* Also create an alternative view of the same RAM area for direct offset-based access */
static uchar* flatram = (uchar *)&ram;
int main(int argc, char* argv[]) {
/* */
/* initialize the RAM in the most standard way */
ram.gpd_start = GPD_AREA_START;
ram.cmd_start = CMD_BUF_START;
ram.cmd_size = CMD_BUF_SIZE;
printf("0x%X", ram.cmd_size);