z80: add out16 for out's to a 16bit port, and in16 likewise
authorAlan Cox <alan@linux.intel.com>
Wed, 20 Feb 2019 22:32:09 +0000 (22:32 +0000)
committerAlan Cox <alan@linux.intel.com>
Wed, 20 Feb 2019 22:32:09 +0000 (22:32 +0000)
We need these for some of the systems that do I/O decoding on the cheap (like
the ZX spectrum). Not yet tested.

Kernel/cpu-z80/cpu.h
Kernel/lowlevel-z80-banked.s

index add210b..2935754 100644 (file)
@@ -25,6 +25,11 @@ typedef uint16_t irqflags_t;
 extern void out(uint8_t addr, uint8_t val);
 extern uint8_t in(uint8_t addr) __z88dk_fastcall;
 
+/* This is an 8bit value to 16bit port - its defined as dual uint16_t to get
+   better code out of SDCC */
+extern void out16(uint16_t addr, uint16_t val);
+extern uint8_t in16(uint16_t addr) __z88dk_fastcall;
+
 /* Z80 binaries start with a JP */
 #define EMAGIC    0xc3    /* Header of executable */
 #define EMAGIC_2  0x18   /* JR */
index bec1ae6..1bd1577 100644 (file)
@@ -48,6 +48,8 @@
        .globl ___hard_irqrestore
        .globl _in
        .globl _out
+       .globl _in16
+       .globl _out16
 
         ; imported symbols
        .globl _chksigs
@@ -676,6 +678,20 @@ _out:
        push de
        jp (hl)
 
+_out16:
+       pop hl  ; return
+       pop iy  ; bank
+       pop bc  ; port
+       pop de  ; data
+       push de
+       push bc
+       push hl
+       push iy
+       out (c),e
+       jp (hl)
+
+_in16:
+       ld b,h
 _in:
        ld c,l
        in l, (c)