Make status bits bools
This commit is contained in:
parent
851ac5fe1e
commit
4d9a788f7f
17
6502.h
17
6502.h
|
@ -1,4 +1,5 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define CPU_FREQ 4000000
|
#define CPU_FREQ 4000000
|
||||||
#define STEP_DURATION 10000000 // 10ms
|
#define STEP_DURATION 10000000 // 10ms
|
||||||
|
@ -20,14 +21,14 @@ void * read_addr;
|
||||||
void * write_addr;
|
void * write_addr;
|
||||||
|
|
||||||
struct StatusBits{
|
struct StatusBits{
|
||||||
unsigned char carry:1; // bit 0
|
bool carry:1; // bit 0
|
||||||
unsigned char zero:1;
|
bool zero:1;
|
||||||
unsigned char interrupt:1;
|
bool interrupt:1;
|
||||||
unsigned char decimal:1;
|
bool decimal:1;
|
||||||
unsigned char brk:1; // "break" is a reserved word :(
|
bool brk:1; // "break" is a reserved word :(
|
||||||
unsigned char unused:1;
|
bool unused:1;
|
||||||
unsigned char overflow:1;
|
bool overflow:1;
|
||||||
unsigned char sign:1; // bit 7
|
bool sign:1; // bit 7
|
||||||
};
|
};
|
||||||
|
|
||||||
union StatusReg { // this means we can access the status register as a byte, or as individual bits.
|
union StatusReg { // this means we can access the status register as a byte, or as individual bits.
|
||||||
|
|
18
6850.h
18
6850.h
|
@ -1,15 +1,17 @@
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define CTRL_ADDR 0xA000
|
#define CTRL_ADDR 0xA000
|
||||||
#define DATA_ADDR 0xA001
|
#define DATA_ADDR 0xA001
|
||||||
|
|
||||||
struct UartStatusBits{
|
struct UartStatusBits{
|
||||||
unsigned char RDRF:1; // bit 0
|
bool RDRF:1; // bit 0
|
||||||
unsigned char TDRE:1;
|
bool TDRE:1;
|
||||||
unsigned char DCD:1;
|
bool DCD:1;
|
||||||
unsigned char CTS:1;
|
bool CTS:1;
|
||||||
unsigned char FE:1;
|
bool FE:1;
|
||||||
unsigned char OVRN:1;
|
bool OVRN:1;
|
||||||
unsigned char PE:1;
|
bool PE:1;
|
||||||
unsigned char IRQ:1; // bit 7
|
bool IRQ:1; // bit 7
|
||||||
};
|
};
|
||||||
|
|
||||||
union UartStatusReg {
|
union UartStatusReg {
|
||||||
|
|
Loading…
Reference in New Issue