summaryrefslogtreecommitdiffstats
path: root/sw/z80/drivers/pio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sw/z80/drivers/pio.c')
-rw-r--r--sw/z80/drivers/pio.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sw/z80/drivers/pio.c b/sw/z80/drivers/pio.c
index 18697d8..272e191 100644
--- a/sw/z80/drivers/pio.c
+++ b/sw/z80/drivers/pio.c
@@ -1,6 +1,7 @@
#include "pio.h"
-#if 0 /* old inline asm implementation */
+#ifdef PIO_ASM_INTERFACE
+/* old inline asm implementation */
inline void _pio_write(uint8_t reg, uint8_t data)
{
__asm
@@ -17,7 +18,6 @@ inline void _pio_write(uint8_t reg, uint8_t data)
__endasm;
}
-// incomplete
inline uint8_t _pio_read(uint8_t reg) __naked
{
__asm
@@ -31,7 +31,8 @@ inline uint8_t _pio_read(uint8_t reg) __naked
ret
__endasm;
}
-#endif
+
+#else
inline void _pio_write(uint8_t reg, uint8_t data)
{
@@ -43,6 +44,8 @@ inline uint8_t _pio_read(uint8_t reg)
return *((uint8_t *) (ADDR_DEV_PIO + reg));
}
+#endif
+
void pio_set_mode(int port, int mode, uint8_t io)
{
// 0x0F is a control sequence to set mode
@@ -58,7 +61,7 @@ void pio_set_mode(int port, int mode, uint8_t io)
void pio_set_interrupts(int port, int control)
{
// 0x07 is a control sequence to set interrupts
- _pio_write((PIO_REG_CTRL + port), (control | 0x07));
+ _pio_write((PIO_REG_CTRL + port), (control<<4 | 0x07));
}
void pio_set_interrupts_mask(int port, int control, uint8_t mask)