summaryrefslogtreecommitdiff
path: root/z180/console.180
diff options
context:
space:
mode:
Diffstat (limited to 'z180/console.180')
-rw-r--r--z180/console.180137
1 files changed, 137 insertions, 0 deletions
diff --git a/z180/console.180 b/z180/console.180
new file mode 100644
index 0000000..1241d5a
--- /dev/null
+++ b/z180/console.180
@@ -0,0 +1,137 @@
+ ;page 255
+ .z80
+
+
+; iobyte:
+; 0 = console on AVR-System
+; 1 = console on SIO/ASCI
+
+
+ extrn iobyte
+ extrn ff.init,ff.i.st,ff.in
+ extrn ff.o.st,ff.out
+ if CPU_Z180
+ extrn as0init,as0ista,as0inp,as0osta,as0out
+ extrn as1init,as1ista,as1inp,as1osta,as1out
+ else
+ extrn ser.init,ser.ist,ser.in,ser.ost,ser.out
+ endif
+
+ public charini
+ public ?const,?conin
+ public ?conos,?cono
+
+ include config.inc
+ if CPU_Z180
+ include z180reg.inc
+ endif
+
+ cseg
+
+ if CPU_Z180
+charini:
+ call ff.init
+ call as0init
+ jp as1init
+
+?const:
+ ld a,(iobyte)
+ and 03h
+ jp z,ff.i.st
+ dec a
+ jp z,as0ista
+ dec a
+ jp z,as1ista
+ jr nullstatus
+
+?conin:
+ ld a,(iobyte)
+ and 03h
+ jp z,ff.in
+ dec a
+ jp z,as0inp
+ dec a
+ jp z,as1inp
+ jr nullinput
+
+?conos:
+ ld a,(iobyte)
+ and 03h
+ jp z,ff.o.st
+ dec a
+ jp z,as0osta
+ dec a
+ jp z,as1osta
+ jr rettrue
+
+?cono:
+ ld a,(iobyte)
+ and 03h
+ jp z,ff.out
+ dec a
+ jp z,as0out
+ dec a
+ jp z,as1out
+ jr nulloutput
+
+ else
+
+charini:
+ call ff.init
+ ld c,0
+ call ser.init
+ ld c,1
+ jp ser.init
+
+?const:
+ ld a,(iobyte)
+ and 03h
+ jp z,ff.i.st
+ dec a
+ ld b,a
+ jp ser.ist
+
+?conin:
+ ld a,(iobyte)
+ and 03h
+ jp z,ff.in
+ dec a
+ ld b,a
+ jp ser.in
+
+?conos:
+ ld a,(iobyte)
+ and 03h
+ jp z,ff.o.st
+ dec a
+ ld b,a
+ jp ser.ost
+
+?cono:
+ ld a,(iobyte)
+ and 03h
+ jp z,ff.out
+ dec a
+ ld b,a
+ jp ser.out
+ endif
+
+
+nullinput:
+ ld a,1Ah
+ ret
+
+nulloutput:
+ ld a,c
+ ret
+
+rettrue:
+ or 0FFh
+ ret
+
+nullstatus:
+ xor a
+ ret
+
+ end
+