Make status bits bools

This commit is contained in:
DavidBuchanan314 2017-01-07 21:25:34 +00:00
parent 851ac5fe1e
commit 4d9a788f7f
2 changed files with 19 additions and 16 deletions

17
6502.h
View File

@ -1,4 +1,5 @@
#include <stdint.h>
#include <stdbool.h>
#define CPU_FREQ 4000000
#define STEP_DURATION 10000000 // 10ms
@ -20,14 +21,14 @@ void * read_addr;
void * write_addr;
struct StatusBits{
unsigned char carry:1; // bit 0
unsigned char zero:1;
unsigned char interrupt:1;
unsigned char decimal:1;
unsigned char brk:1; // "break" is a reserved word :(
unsigned char unused:1;
unsigned char overflow:1;
unsigned char sign:1; // bit 7
bool carry:1; // bit 0
bool zero:1;
bool interrupt:1;
bool decimal:1;
bool brk:1; // "break" is a reserved word :(
bool unused:1;
bool overflow:1;
bool sign:1; // bit 7
};
union StatusReg { // this means we can access the status register as a byte, or as individual bits.

18
6850.h
View File

@ -1,15 +1,17 @@
#include <stdbool.h>
#define CTRL_ADDR 0xA000
#define DATA_ADDR 0xA001
struct UartStatusBits{
unsigned char RDRF:1; // bit 0
unsigned char TDRE:1;
unsigned char DCD:1;
unsigned char CTS:1;
unsigned char FE:1;
unsigned char OVRN:1;
unsigned char PE:1;
unsigned char IRQ:1; // bit 7
bool RDRF:1; // bit 0
bool TDRE:1;
bool DCD:1;
bool CTS:1;
bool FE:1;
bool OVRN:1;
bool PE:1;
bool IRQ:1; // bit 7
};
union UartStatusReg {