Commit b9bae942 authored by Sergio Costas's avatar Sergio Costas

Updated codes

parent 61dfd1f4
......@@ -19,9 +19,9 @@
#include "Z80free.h"
int Z80free_codes (Z80FREE *processor,byte opcode) {
static byte tmp1;
static word tmp2;
int Z80free_codes (Z80FREE *processor,uint8_t opcode) {
static uint8_t tmp1;
static uint16_t tmp2;
switch(opcode) {
case 0: // NOP
......@@ -963,8 +963,8 @@ int Z80free_codes (Z80FREE *processor,byte opcode) {
break;
case 211: // OUT n,A
tmp1=processor->Rm.br.A;
tmp2=((word)tmp1)<<8;
Z80free_Out_Internal(processor,tmp2+((word)Z80free_read_param_8(processor)),tmp1);
tmp2=((uint16_t)tmp1)<<8;
Z80free_Out_Internal(processor,tmp2+((uint16_t)Z80free_read_param_8(processor)),tmp1);
return (11);
break;
case 212: // CALL NC,nn
......@@ -1020,8 +1020,8 @@ int Z80free_codes (Z80FREE *processor,byte opcode) {
}
break;
case 219: // IN A,n
tmp2=((word)processor->Rm.br.A)<<8;
processor->Rm.br.A=Z80free_In_Internal(processor,tmp2+((word)Z80free_read_param_8(processor)));
tmp2=((uint16_t)processor->Rm.br.A)<<8;
processor->Rm.br.A=Z80free_In_Internal(processor,tmp2+((uint16_t)Z80free_read_param_8(processor)));
return (11);
break;
case 220: // CALL CF,nn
......
......@@ -19,7 +19,7 @@
#include "Z80free.h"
int Z80free_codesCB (Z80FREE *processor,byte opcode) {
int Z80free_codesCB (Z80FREE *processor,uint8_t opcode) {
switch(opcode) {
case 0: // RLC B
......
......@@ -19,9 +19,9 @@
#include "Z80free.h"
int Z80free_codesDD (Z80FREE *processor,byte opcode) {
static byte tmp1;
static word tmp2;
int Z80free_codesDD (Z80FREE *processor,uint8_t opcode) {
static uint8_t tmp1;
static uint16_t tmp2;
switch(opcode) {
case 0: // DEFAULT
......
......@@ -19,9 +19,9 @@
#include "Z80free.h"
int Z80free_codesDDCB (Z80FREE *processor,byte d1) {
static byte tmp1;
static byte opcode;
int Z80free_codesDDCB (Z80FREE *processor,uint8_t d1) {
static uint8_t tmp1;
static uint8_t opcode;
opcode=Z80free_Rd_Internal(processor,processor->PC++);
switch(opcode) {
......
......@@ -19,10 +19,10 @@
#include "Z80free.h"
int Z80free_codesED (Z80FREE *processor,byte opcode) {
static byte tmp1;
static byte tmp2;
static word tmp3;
int Z80free_codesED (Z80FREE *processor,uint8_t opcode) {
static uint8_t tmp1;
static uint8_t tmp2;
static uint16_t tmp3;
switch(opcode) {
case 0: // NOP
......@@ -636,10 +636,10 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
processor->Rm.wr.HL++;
processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1);
Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0));
tmp3=((((word) processor->Rm.br.C)+1)&0xFF)+(word) tmp1;
tmp3=((((uint16_t) processor->Rm.br.C)+1)&0xFF)+(uint16_t) tmp1;
Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B]));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((uint8_t)tmp3)&0x07)^processor->Rm.br.B]));
Z80free_valFlag(processor,F_Z, (processor->Rm.br.B == 0));
return (12);
break;
......@@ -650,10 +650,10 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
Z80free_Out_Internal(processor,processor->Rm.wr.BC,tmp1);
processor->Rm.wr.HL++;
Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0));
tmp3=(word) processor->Rm.br.L+(word)tmp1;
tmp3=(uint16_t) processor->Rm.br.L+(uint16_t)tmp1;
Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B]));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((uint8_t)tmp3)&0x07)^processor->Rm.br.B]));
return (12);
break;
case 164: // NOP
......@@ -704,10 +704,10 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1);
processor->Rm.wr.HL--;
Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0));
tmp3=((((word) processor->Rm.br.C)-1)&0xFF)+(word) tmp1;
tmp3=((((uint16_t) processor->Rm.br.C)-1)&0xFF)+(uint16_t) tmp1;
Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B]));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((uint8_t)tmp3)&0x07)^processor->Rm.br.B]));
return (12);
break;
case 171: // OUTD
......@@ -716,10 +716,10 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
Z80free_Out_Internal(processor,processor->Rm.wr.BC,tmp1);
processor->Rm.wr.HL--;
Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0));
tmp3=(word) processor->Rm.br.L+(word)tmp1;
tmp3=(uint16_t) processor->Rm.br.L+(uint16_t)tmp1;
Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B]));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((uint8_t)tmp3)&0x07)^processor->Rm.br.B]));
return (12);
break;
case 172: // NOP
......@@ -781,10 +781,10 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
return (17);
} else {
Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0));
tmp3=((((word) processor->Rm.br.C)+1)&0xFF)+(word) tmp1;
tmp3=((((uint16_t) processor->Rm.br.C)+1)&0xFF)+(uint16_t) tmp1;
Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B]));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((uint8_t)tmp3)&0x07)^processor->Rm.br.B]));
return (12);
}
break;
......@@ -798,10 +798,10 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
return (17);
} else {
Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0));
tmp3=(word) processor->Rm.br.L+(word)tmp1;
tmp3=(uint16_t) processor->Rm.br.L+(uint16_t)tmp1;
Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B]));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((uint8_t)tmp3)&0x07)^processor->Rm.br.B]));
return (12);
}
break;
......@@ -864,10 +864,10 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
return (17);
} else {
Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0));
tmp3=((((word) processor->Rm.br.C)-1)&0xFF)+(word) tmp1;
tmp3=((((uint16_t) processor->Rm.br.C)-1)&0xFF)+(uint16_t) tmp1;
Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B]));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((uint8_t)tmp3)&0x07)^processor->Rm.br.B]));
return (12);
}
break;
......@@ -881,10 +881,10 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
return (17);
} else {
Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0));
tmp3=(word) processor->Rm.br.L+(word)tmp1;
tmp3=(uint16_t) processor->Rm.br.L+(uint16_t)tmp1;
Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B]));
Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((uint8_t)tmp3)&0x07)^processor->Rm.br.B]));
return (12);
}
break;
......
......@@ -19,9 +19,9 @@
#include "Z80free.h"
int Z80free_codesFD (Z80FREE *processor,byte opcode) {
static byte tmp1;
static word tmp2;
int Z80free_codesFD (Z80FREE *processor,uint8_t opcode) {
static uint8_t tmp1;
static uint16_t tmp2;
switch(opcode) {
case 0: // DEFAULT
......
......@@ -19,9 +19,9 @@
#include "Z80free.h"
int Z80free_codesFDCB (Z80FREE *processor,byte d1) {
static byte tmp1;
static byte opcode;
int Z80free_codesFDCB (Z80FREE *processor,uint8_t d1) {
static uint8_t tmp1;
static uint8_t opcode;
opcode=Z80free_Rd_Internal(processor,processor->PC++);
switch(opcode) {
......
......@@ -26,7 +26,7 @@ Z80FREE emulator,emulator2;
unsigned char memory[65536];
FILE *infile;
char test_name[20];
byte ports[256];
uint8_t ports[256];
uint16_t portdirs[256];
int portpos=0,elements=0;
......@@ -163,7 +163,7 @@ int read_memory(char mode) {
printf("Error in memory, address %X. Expected value: %X, current value: %X\n",position,value,memory[position]);
}
} else {
memory[position]=(byte)value;
memory[position]=(uint8_t)value;
}
position++;
}
......@@ -185,7 +185,7 @@ int read_inports() {
}
retval=fscanf(infile,"%x",&value);
portdirs[elements]=(uint16_t)addr;
ports[elements]=(byte)value;
ports[elements]=(uint8_t)value;
elements++;
}
return 0;
......@@ -218,19 +218,19 @@ int read_test() {
return 0;
}
byte Z80free_Rd (uint16_t Addr) {
uint8_t Z80free_Rd (uint16_t Addr) {
return ((byte)memory[Addr]);
return ((uint8_t)memory[Addr]);
}
void Z80free_Wr (uint16_t Addr, byte Value) {
void Z80free_Wr (uint16_t Addr, uint8_t Value) {
memory[Addr]=(unsigned char) Value;
}
byte Z80free_In (uint16_t Port) {
uint8_t Z80free_In (uint16_t Port) {
byte value;
uint8_t value;
if (portpos>=elements) {
printf("IN beyond values\n");
......@@ -244,7 +244,7 @@ byte Z80free_In (uint16_t Port) {
return (value);
}
void Z80free_Out (uint16_t Port, byte Value) {
void Z80free_Out (uint16_t Port, uint8_t Value) {
}
......
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