VolksForth/sources/cpm/portz80.fth

52 lines
3.1 KiB
Forth
Raw Normal View History

\ *** Block No. 0 Hexblock 0
\ Z80-Portzugriff UH 05Nov86
Dieses File enthaelt Definitionen um die Z80-Ports ueber 16-Bit
Adressen anzusprechen.
Einige Komputer, so die der Schneider Serie dekodieren ihre
Ports etwas unkonventionell, sodass sie unbedingt ueber 16-Bit
Adressen angesprochen werden muessen.
Im allgemeinen sollte es ausreichen 8-Bit Adressen zu benutzen.
\ *** Block No. 1 Hexblock 1
\ Z80-Portaccess Extending 8080-Assembler UH 05Nov86
Assembler definitions
| : Z80-io ( base -- ) \ define special Z80-io instruction
Create c,
Does> ( reg -- ) $ED c, c@ swap 8 * + c, ;
$40 Z80-io (c)in
$41 Z80-io (c)out
Forth definitions
-->
\ *** Block No. 2 Hexblock 2
\ store and fetch values with 16-bit port-adresses UH 05Nov86
Code pc@ ( 16b -- 8b ) \ fetch 8-bit value from 16-bit port-addr
H pop IP push H B mvx L (c)in 0 H mvi
IP pop hpush jmp
end-code
Code pc! ( 8b 16b -- ) \ store 8-bit value to 16-bit port-addr
H pop D pop IP push H B mvx E (c)out
IP pop Next
end-code