cpu8051.h \
memory.c \
memory.h \
+ psw.c psw.h \
common.h \
reg8051.h
return value;
}
-void
-psw_write_cy(int cy)
-{
- u_int8_t psw = memory_read8(INT_MEM_ID, _PSW_);
-
- if (cy)
- psw |= 0x80; /* Set */
- else
- psw &= ~0x80; /* Clear */
-
- memory_write8(INT_MEM_ID, _PSW_, psw); /* Save updated value */
-}
-
-void
-psw_set_cy(void)
-{
- u_int8_t psw = memory_read8(INT_MEM_ID, _PSW_);
-
- psw |= 0x80;
-
- memory_write8(INT_MEM_ID, _PSW_, psw); /* Save updated value */
-}
-
-void
-psw_clr_cy(void)
-{
- u_int8_t psw = memory_read8(INT_MEM_ID, _PSW_);
-
- psw &= ~0x80;
-
- memory_write8(INT_MEM_ID, _PSW_, psw); /* Save updated value */
-}
-
-/* Returns 0 or 1 */
-int
-psw_read_cy(void)
-{
- return memory_read8(INT_MEM_ID, _PSW_) >> 7;
-}
-
/* Dump memory */
void
DumpMem(char *Address, char *Asize, int memory_id)
uint16_t
stack_pop16(void);
-void
-psw_set_cy(void);
-
-void
-psw_clr_cy(void);
-
-void
-psw_write_cy(int cy);
-
-int
-psw_read_cy(void);
-
void
DumpMem(char *Address, char *Asize, int memory_id);
print INST_IMP "#include \"reg8051.h\"\n";
print INST_IMP "#include \"cpu8051.h\"\n";
print INST_IMP "#include \"memory.h\"\n";
+print INST_IMP "#include \"psw.h\"\n";
print INST_IMP "#include \"instructions_8051.h\"\n\n\n";
# Header for disasm.h
--- /dev/null
+/*
+ * psw.c
+ *
+ * Copyright (C) 2013 Hugo Villeneuve <hugo@hugovil.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include "reg8051.h"
+#include "memory.h"
+
+void
+psw_write_cy(int cy)
+{
+ u_int8_t psw = memory_read8(INT_MEM_ID, _PSW_);
+
+ if (cy)
+ psw |= 0x80; /* Set */
+ else
+ psw &= ~0x80; /* Clear */
+
+ memory_write8(INT_MEM_ID, _PSW_, psw); /* Save updated value */
+}
+
+void
+psw_set_cy(void)
+{
+ u_int8_t psw = memory_read8(INT_MEM_ID, _PSW_);
+
+ psw |= 0x80;
+
+ memory_write8(INT_MEM_ID, _PSW_, psw); /* Save updated value */
+}
+
+void
+psw_clr_cy(void)
+{
+ u_int8_t psw = memory_read8(INT_MEM_ID, _PSW_);
+
+ psw &= ~0x80;
+
+ memory_write8(INT_MEM_ID, _PSW_, psw); /* Save updated value */
+}
+
+/* Returns 0 or 1 */
+int
+psw_read_cy(void)
+{
+ return memory_read8(INT_MEM_ID, _PSW_) >> 7;
+}
--- /dev/null
+/*
+ * psw.h
+ *
+ * Copyright (C) 2013 Hugo Villeneuve <hugo@hugovil.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PSW_H
+#define PSW_H 1
+
+#include <sys/types.h>
+
+void
+psw_set_cy(void);
+
+void
+psw_clr_cy(void);
+
+void
+psw_write_cy(int cy);
+
+int
+psw_read_cy(void);
+
+#endif /* PSW_H */