Commit MetaInfo

Revision8abec6ba06777d994f2466ecb1e4e09226ec5fb9 (tree)
Time2019-02-09 15:26:06
Authoringlorion <homemicro@ingl...>
Commiteringlorion

Log Message

implemented bit instruction in emulator

Change Summary

Incremental Difference

diff -r 1700c7f6497e -r 8abec6ba0677 emulator/hm1000.c
--- a/emulator/hm1000.c Fri Feb 08 22:07:10 2019 -0800
+++ b/emulator/hm1000.c Fri Feb 08 22:26:06 2019 -0800
@@ -542,6 +542,13 @@
542542 if ((s->p & FLAG_Z) != 0) s->pc += off;
543543 }
544544
545+OP(bit) {
546+ uint8_t val = load_u8(s, modes_a[op & 0x1f](s));
547+ s->p &= ~(FLAG_N | FLAG_V | FLAG_Z);
548+ s->p |= val & (FLAG_N | FLAG_V);
549+ if ((s->a & val) == 0) s->p |= FLAG_Z;
550+}
551+
545552 OP(bmi) {
546553 int8_t off = (int8_t) load_u8(s, mode_imm(s));
547554 if ((s->p & FLAG_N) != 0) s->pc += off;
@@ -771,12 +778,6 @@
771778 OP(tya) { s->a = set_nz(s, s->y); }
772779 #undef OP
773780
774-#define OP(NAME) static void op_ ## NAME (hm1k_state *s, uint8_t op) { \
775- op_ni(s, op); \
776-}
777-OP(bit)
778-#undef OP
779-
780781 #define OP(CODE, NAME, MODE, CYCLES) op_ ## NAME,
781782 static const hm1k_op ops[256] = {
782783 #include "ops.inc"
Show on old repository browser