Commit 62092dc5 authored by Sergio Costas's avatar Sergio Costas

Updated to uint8_t and uint16_t all the other files

parent cf5ac996
......@@ -15,7 +15,7 @@ all:
cd src && $(MAKE)
clean:
rm -f src/fbzx src/*.o src/*~
rm -f src/fbzx src/*.o src/*~ src/z80free/*.o
install:
rm -f $(PREFIX2)/bin/fbzx
......
FLAGS = -O2
FLAGS = -O2 -Wall
CC=g++ -c $(FLAGS)
CPP=g++ -c $(FLAGS)
......
......@@ -86,12 +86,12 @@ int save_z80(char *filename) {
}
fprintf(fichero, "%c%c%c%c%c%c", procesador.Rm.br.A, procesador.Rm.br.F,
procesador.Rm.br.C, procesador.Rm.br.B, procesador.Rm.br.L,
procesador.Rm.br.H); // AF, BC and HL
procesador.Rm.br.H); // AF, BC and HL
if (ordenador->current_mode == MODE_48K) { // 48K
fprintf(fichero, "%c%c", (byte) (procesador.PC & 0x0FF), (byte) ((procesador.PC >> 8) & 0xFF)); // PC
if (ordenador->current_mode == MODE_48K) { // 48K
fprintf(fichero, "%c%c", (uint8_t) (procesador.PC & 0x0FF), (uint8_t) ((procesador.PC >> 8) & 0xFF)); // PC
} else {
fprintf(fichero, "%c%c", 0, 0); // 128K
fprintf(fichero, "%c%c", 0, 0); // 128K
}
fprintf(fichero, "%c%c", procesador.Rm.br.P, procesador.Rm.br.S); // SP
......@@ -146,8 +146,8 @@ int save_z80(char *filename) {
// 128K
fprintf(fichero, "%c%c", 23, 0); // Z80 file v2.01
fprintf(fichero, "%c%c", (byte) (procesador.PC & 0x0FF),
(byte) ((procesador.PC >> 8) & 0x0FF)); // PC
fprintf(fichero, "%c%c", (uint8_t) (procesador.PC & 0x0FF),
(uint8_t) ((procesador.PC >> 8) & 0x0FF)); // PC
fprintf(fichero, "%c", 3); // hardware mode=3
fprintf(fichero, "%c", ordenador->mport1); // content of 0x7FFD latch
fprintf(fichero, "%c%c", 0, 0); // no If1, no emulation of any kind
......@@ -281,16 +281,16 @@ int load_z80(const char *filename) {
snap->L = tempo[4];
snap->H = tempo[5];
if (type) {
snap->PC = ((word) tempo2[2]) + 256 * ((word) tempo2[3]);
snap->PC = ((uint16_t) tempo2[2]) + 256 * ((uint16_t) tempo2[3]);
for (bucle = 0; bucle < 16; bucle++) {
snap->ay_regs[bucle] = tempo2[9 + bucle];
}
snap->ay_latch = tempo2[8];
} else {
snap->PC = ((word) tempo[6]) + 256 * ((word) tempo[7]);
snap->PC = ((uint16_t) tempo[6]) + 256 * ((uint16_t) tempo[7]);
}
snap->SP = ((word) tempo[8]) + 256 * ((word) tempo[9]);
snap->SP = ((uint16_t) tempo[8]) + 256 * ((uint16_t) tempo[9]);
snap->I = tempo[10];
snap->R = (tempo[11] & 0x7F);
......@@ -321,8 +321,8 @@ int load_z80(const char *filename) {
snap->HH = tempo[20];
snap->AA = tempo[21];
snap->FF = tempo[22];
snap->IY = ((word) tempo[23]) + 256 * ((word) tempo[24]);
snap->IX = ((word) tempo[25]) + 256 * ((word) tempo[26]);
snap->IY = ((uint16_t) tempo[23]) + 256 * ((uint16_t) tempo[24]);
snap->IX = ((uint16_t) tempo[25]) + 256 * ((uint16_t) tempo[26]);
if (tempo[27] != 0) {
snap->IFF1 = 1;
......@@ -535,8 +535,8 @@ int load_sna(const char *filename) {
snap->C = tempo[13];
snap->B = tempo[14];
snap->IY = ((word) tempo[15]) + 256 * ((word) tempo[16]);
snap->IX = ((word) tempo[17]) + 256 * ((word) tempo[18]);
snap->IY = ((uint16_t) tempo[15]) + 256 * ((uint16_t) tempo[16]);
snap->IX = ((uint16_t) tempo[17]) + 256 * ((uint16_t) tempo[18]);
if (tempo[19] & 0x01) {
snap->IFF1 = 1;
......@@ -553,7 +553,7 @@ int load_sna(const char *filename) {
snap->R = tempo[20];
snap->F = tempo[21];
snap->A = tempo[22];
snap->SP = ((word) tempo[23]) + 256 * ((word) tempo[24]);
snap->SP = ((uint16_t) tempo[23]) + 256 * ((uint16_t) tempo[24]);
snap->Imode = tempo[25];
snap->border = tempo[26];
......@@ -571,7 +571,7 @@ int load_sna(const char *filename) {
}
addr -= 16384;
addr += 27;
snap->PC = ((word) tempo[addr]) + 256 * ((word) tempo[addr + 1]);
snap->PC = ((uint16_t) tempo[addr]) + 256 * ((uint16_t) tempo[addr + 1]);
tempo[addr] = 0;
tempo[addr + 1] = 0;
snap->SP += 2;
......@@ -580,7 +580,7 @@ int load_sna(const char *filename) {
memcpy(snap->page[1], tempo + 16411, 16384);
memcpy(snap->page[2], tempo + 32795, 16384);
} else {
snap->PC = ((word) tempo2[0]) + 256 * ((word) tempo2[1]);
snap->PC = ((uint16_t) tempo2[0]) + 256 * ((uint16_t) tempo2[1]);
memcpy(snap->page[5], tempo + 27, 16384);
memcpy(snap->page[2], tempo + 16411, 16384);
v1 = tempo[2];
......
......@@ -22,12 +22,12 @@
#include "z80free/Z80free.h"
struct z80snapshot {
byte A, F, B, C, D, E, H, L, AA, FF, BB, CC, DD, EE, HH, LL, R, I, IFF1, IFF2, Imode;
uint8_t A, F, B, C, D, E, H, L, AA, FF, BB, CC, DD, EE, HH, LL, R, I, IFF1, IFF2, Imode;
bool issue_3;
word PC, IX, IY, SP;
byte type; // bit 0/1: 48K/128K/+3
byte border; // border color
byte pager; // content of pagination register in 128K mode
uint16_t PC, IX, IY, SP;
uint8_t type; // bit 0/1: 48K/128K/+3
uint8_t border; // border color
uint8_t pager; // content of pagination register in 128K mode
unsigned char page[12][16384];
unsigned int found_pages; // bit=1: page exists. bit=0: page don't exists.
unsigned char ay_regs[16];
......
......@@ -91,7 +91,7 @@ bool computer::callback_receiver(string signal_received, class Signals *object)
/* Returns the bus value when reading a port without a periferial */
byte computer::bus_empty() {
uint8_t computer::bus_empty() {
if (ordenador->current_mode != MODE_P3) {
return (screen->get_bus_value(this->cicles_counter));
} else {
......@@ -125,7 +125,7 @@ void computer::emulate(int tstados) {
// check if there's contention and waits the right number of tstates
void computer::do_contention(bool io, word addr) {
void computer::do_contention(bool io, uint16_t addr) {
if (this->memcontended_zone == 0) {
return;
}
......@@ -219,7 +219,7 @@ void extra_contention() {
procesador.subtstates = 0;
}
void Z80free_Wr(word Addr, byte Value) {
void Z80free_Wr(uint16_t Addr, uint8_t Value) {
extra_contention();
ordenador->do_contention(false, Addr);
ordenador->write_memory(Addr, Value);
......@@ -249,11 +249,11 @@ void computer::write_memory(uint16_t Addr, uint8_t Value) {
}
}
byte Z80free_Rd(word Addr) {
uint8_t Z80free_Rd(uint16_t Addr) {
extra_contention();
if ((microdrive->mdr_active) && (microdrive->mdr_paged) && (Addr < 8192)) { // Interface I
return ((byte) ordenador->shadowrom[Addr]);
return ((uint8_t) ordenador->shadowrom[Addr]);
}
if (ordenador->other_ret == 1) {
......@@ -268,22 +268,22 @@ byte Z80free_Rd(word Addr) {
uint8_t computer::read_memory(uint16_t Addr) {
switch (Addr & 0xC000) {
case 0x0000:
return ((byte) (*(ordenador->block0 + Addr)));
return ((uint8_t) (*(ordenador->block0 + Addr)));
break;
case 0x4000:
return ((byte) (*(ordenador->block1 + Addr)));
return ((uint8_t) (*(ordenador->block1 + Addr)));
break;
case 0x8000:
return ((byte) (*(ordenador->block2 + Addr)));
return ((uint8_t) (*(ordenador->block2 + Addr)));
break;
case 0xC000:
return ((byte) (*(ordenador->block3 + Addr)));
return ((uint8_t) (*(ordenador->block3 + Addr)));
break;
......@@ -294,10 +294,10 @@ uint8_t computer::read_memory(uint16_t Addr) {
}
}
void Z80free_Out(word Port, byte Value) {
void Z80free_Out(uint16_t Port, uint8_t Value) {
// Microdrive access
word maskport;
uint16_t maskport;
extra_contention();
if (ordenador->current_mode != MODE_P3) {
......@@ -361,9 +361,9 @@ void Z80free_Out(word Port, byte Value) {
}
}
byte Z80free_In(word Port) {
uint8_t Z80free_In(uint16_t Port) {
static unsigned int temporal_io;
byte pines;
uint8_t pines;
extra_contention();
if (ordenador->current_mode != MODE_P3) {
......
......@@ -120,9 +120,9 @@ public:
computer();
~computer();
bool callback_receiver(string, class Signals *);
byte bus_empty();
uint8_t bus_empty();
void emulate(int);
void do_contention(bool io, word addr);
void do_contention(bool io, uint16_t addr);
uint8_t read_memory(uint16_t Addr);
void write_memory(uint16_t Addr, uint8_t Value);
};
......
......@@ -378,9 +378,9 @@ void load_config() {
}
int main(int argc, char *argv[]) {
int bucle, tstados, argumento, length;
string gamefile;
word PC = 0;
int bucle, tstados, argumento, length;
string gamefile;
uint16_t PC = 0;
CMDLine parse(argc, argv);
......@@ -674,7 +674,7 @@ void do_fast_load() {
if ((size == 0) || (procesador.Rm.wr.DE == 0)) {
break;
}
ordenador->write_memory(procesador.Rm.wr.IX, (byte) data[counter]); // store the byte
ordenador->write_memory(procesador.Rm.wr.IX, (uint8_t) data[counter]); // store the byte
procesador.Rm.wr.IX++;
procesador.Rm.wr.DE--;
counter++;
......
......@@ -60,8 +60,8 @@ void Microdrive::emulate(int tstados) {
// still nothing to do here
}
byte Microdrive::in(word Port) {
byte retorno;
uint8_t Microdrive::in(uint16_t Port) {
uint8_t retorno;
/* allow access to the port only if motor 1 is ON and there's a file open */
......@@ -110,7 +110,7 @@ byte Microdrive::in(word Port) {
return (0xFF);
}
void Microdrive::out(word Port, byte Value) {
void Microdrive::out(uint16_t Port, uint8_t Value) {
/* allow access to the port only if motor 1 is ON and there's a file open */
if (((Port | 0xFFE7) == 0xFFE7) && (this->mdr_drive == 0x01) && (this->mdr_current_mdr[0])) {
......
......@@ -36,16 +36,16 @@ class Microdrive {
uint32_t mdr_nogap; // TSTATEs remaining for next GAP
uint8_t mdr_cartridge[137923]; // current cartridge
uint8_t mdr_drive; // current drive
byte mdr_old_STATUS; // to detect an edge in COM CLK
uint8_t mdr_old_STATUS; // to detect an edge in COM CLK
uint8_t mdr_modified; // if a sector is stored, this change to know that it must be stored in the file
byte trash;
uint8_t trash;
public:
Microdrive();
void reset();
byte in(word);
void out(word, byte);
uint8_t in(uint16_t);
void out(uint16_t, uint8_t);
void emulate(int);
int select_mdrfile(char *);
int new_mdrfile(char *);
......
......@@ -10,16 +10,16 @@ class Mouse {
int posy;
public:
byte x;
byte y;
byte button;
uint8_t x;
uint8_t y;
uint8_t button;
bool enabled;
Mouse();
void reset();
void emulate(int);
byte in(word);
uint8_t in(uint16_t);
};
extern class Mouse *mouse;
......
......@@ -329,26 +329,26 @@ void SPK_AY::reset() {
this->vol_c = 0;
}
void SPK_AY::set_latch(byte Value) {
void SPK_AY::set_latch(uint8_t Value) {
this->ay_latch = (Value & 0x0F);
}
void SPK_AY::set_value(byte Value) {
void SPK_AY::set_value(uint8_t Value) {
this->ay_registers[this->ay_latch] = (unsigned char) Value;
if (this->ay_latch == 13) {
this->ay_envel_way = 2; // start cycle
}
}
byte SPK_AY::get_value() {
uint8_t SPK_AY::get_value() {
return (this->ay_registers[this->ay_latch]);
}
byte SPK_AY::get_value(int v) {
uint8_t SPK_AY::get_value(int v) {
return (this->ay_registers[v]);
}
byte SPK_AY::get_latch() {
uint8_t SPK_AY::get_latch() {
return (this->ay_latch);
}
......
......@@ -46,11 +46,11 @@ public:
void play_sound(int);
void reset();
void set_latch(byte);
void set_value(byte);
byte get_latch();
byte get_value();
byte get_value(int);
void set_latch(uint8_t);
void set_value(uint8_t);
uint8_t get_latch();
uint8_t get_value();
uint8_t get_value(int);
};
extern class SPK_AY *spk_ay;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment