[patinho] Preloaded another example program and fixed the opcode parsing of the SAI instruction that it uses.

This commit is contained in:
Felipe Corrêa da Silva Sanches 2015-12-01 12:33:34 -02:00
parent a2ac9e36c3
commit 32db54e38f
2 changed files with 63 additions and 49 deletions

View File

@ -71,7 +71,7 @@ void patinho_feio_cpu_device::device_start()
void patinho_feio_cpu_device::device_reset()
{
m_pc = 0xE00;
m_pc = 0x006;
m_acc = 0;
m_idx = READ_INDEX_REG();
m_flags = 0;
@ -226,50 +226,6 @@ void patinho_feio_cpu_device::execute_instruction()
m_indirect_addressing = true;
m_scheduled_IND_bit_reset = false; //the next instruction execution will schedule it.
return;
case 0xCB:
//Executes I/O functions
//TODO: Implement-me!
value = READ_BYTE_PATINHO(PC);
INCREMENT_PC_4K;
channel = opcode & 0x0F;
function = value & 0x0F;
switch(value & 0xF0){
case 0x10:
printf("Unimplemented FNC /%X%X instruction\n", channel, function);
break;
case 0x20:
//SAL="Salta"
// Skips a couple bytes if a condition is met
skip = false;
switch(function)
{
case 1:
if (m_peripherals[channel].io_status == DEVICE_READY)
skip = true;
break;
case 2:
if (m_peripherals[channel].device_is_ok)
skip = true;
break;
case 4:
if (m_peripherals[channel].IRQ_request == true)
skip = true;
break;
}
if (skip){
INCREMENT_PC_4K;
INCREMENT_PC_4K;
}
break;
case 0x40:
printf("Unimplemented ENTR /%X0 instruction\n", channel);
break;
case 0x80:
printf("Unimplemented SAI /%X0 instruction\n", channel);
break;
}
return;
case 0xD1:
//Bit-Shift/Bit-Rotate instructions
value = READ_BYTE_PATINHO(PC);
@ -437,6 +393,50 @@ void patinho_feio_cpu_device::execute_instruction()
if (ACC == 0)
PC = addr;
return;
case 0xC0:
//Executes I/O functions
//TODO: Implement-me!
value = READ_BYTE_PATINHO(PC);
INCREMENT_PC_4K;
channel = opcode & 0x0F;
function = value & 0x0F;
switch(value & 0xF0){
case 0x10:
printf("Unimplemented FNC /%X%X instruction\n", channel, function);
break;
case 0x20:
//SAL="Salta"
// Skips a couple bytes if a condition is met
skip = false;
switch(function)
{
case 1:
if (m_peripherals[channel].io_status == DEVICE_READY)
skip = true;
break;
case 2:
if (m_peripherals[channel].device_is_ok)
skip = true;
break;
case 4:
if (m_peripherals[channel].IRQ_request == true)
skip = true;
break;
}
if (skip){
INCREMENT_PC_4K;
INCREMENT_PC_4K;
}
break;
case 0x40:
printf("Unimplemented ENTR /%X0 instruction\n", channel);
break;
case 0x80:
printf("Unimplemented SAI /%X0 instruction\n", channel);
break;
}
return;
case 0xE0:
//SUS = "Subtrai um ou Salta": Subtract one from the data in the given address
// or, if the data is zero, then simply skip a couple bytes.

View File

@ -29,11 +29,22 @@ DRIVER_INIT_MEMBER(patinho_feio_state, patinho_feio)
}
void patinho_feio_state::machine_start(){
//copy the "absolute program example" from appendix G directly into RAM
// Copy some programs directly into RAM.
// This is a hack for setting up the computer
// while we don't support loading programs from punched tape rolls...
// while we don't support loading programs
// from punched tape rolls...
UINT8 *RAM = (UINT8 *) memshare("maincpu:internalram")->ptr();
UINT8 *program = memregion("example_program")->base();
UINT8 *program;
//"absolute program example" from page 16.7
// Prints "PATINHO FEIO" on the DECWRITER:
program = memregion("exemplo_16.7")->base();
memcpy(&RAM[0x003], program, 0x028);
//"absolute program example" from appendix G:
// Allows users to load programs from the
// console into the computer memory.
program = memregion("hexam")->base();
memcpy(&RAM[0xE00], program, 0x0D5);
}
@ -56,8 +67,11 @@ static MACHINE_CONFIG_START( patinho_feio, patinho_feio_state )
MACHINE_CONFIG_END
ROM_START( patinho )
ROM_REGION( 0x0d5, "example_program", 0 )
ROM_REGION( 0x0d5, "hexam", 0 )
ROM_LOAD( "apendice_g__hexam.bin", 0x000, 0x0d5, CRC(c6addc59) SHA1(126bc97247eac45c58708eaac216c2438e9e4af9) )
ROM_REGION( 0x0d5, "exemplo_16.7", 0 )
ROM_LOAD( "exemplo_16.7.bin", 0x000, 0x028, CRC(0a87ac8d) SHA1(7c35ac3eed9ed239f2ef56c26e6f0c59f635e1ac) )
ROM_END
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */