From cc0ff74b627605620c8caa7f39cd43459d70add3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Corr=C3=AAa=20da=20Silva=20Sanches?= Date: Mon, 30 Nov 2015 16:46:44 -0200 Subject: [PATCH] [patinho] Implement SUS instruction --- src/devices/cpu/patinhofeio/patinho_feio.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/devices/cpu/patinhofeio/patinho_feio.cpp b/src/devices/cpu/patinhofeio/patinho_feio.cpp index d5ec7701648..eac67e79c9b 100644 --- a/src/devices/cpu/patinhofeio/patinho_feio.cpp +++ b/src/devices/cpu/patinhofeio/patinho_feio.cpp @@ -424,6 +424,19 @@ void patinho_feio_cpu_device::execute_instruction() if (ACC == 0) PC = addr; 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. + addr = compute_effective_address((opcode & 0x0F) << 8 | READ_BYTE_PATINHO(PC)); + INCREMENT_PC_4K; + value = READ_BYTE_PATINHO(addr); + if (value > 0){ + WRITE_BYTE_PATINHO(addr, value-1); + } else { + INCREMENT_PC_4K; + INCREMENT_PC_4K; + } + return; case 0xF0: //PUG = "Pula e guarda": Jump and store. // It stores the return address to addr and addr+1