IO Module
This module is handles the i/o ports. Since port 1C is shared by the indicator and LCD control lines, we implement a "bit set" feature via software.
Download:
; /////////////////////////////////////////////////////////////
; // I/O Port Controller
; // (c) 1999 Geoff Knagge, Andrew Carr, Mark Lynn
; // last modified : 22/10/1999
; //
; /////////////////////////////////////////////////////////////
DoorPort = 30 ; port 1A
LockPort = 31 ; port 1B
; Port 1C is accessed by the routines below...
WinPort = 40 ; port 2A
LcdPort = 41 ; port 2B
KeyPort = 42 ; port 2C
io_init:
push af
mvi A,90H
out 33 ; init IO port 1
call io_2bWrite ; init IO port 2
pop af
ret
io_2bWrite:
push af
mvi a,98
out 43
pop af
ret
io_2bRead:
push af
mvi a,9A
out 43
pop af
ret
io_1cID : .byte 0
io_1cLCD: .byte 0
io_WtLCD: ; write control signals to bits 0-2 of 1C
; writes bits 0-2 of A, and masks the others
push af
push hl
ani 7 ; mask bits 3-7
lxi hl, io_1cLCD
mov m,a
lxi hl, io_1cID
ora m ; add in bit 7
out 32
pop hl
pop af
ret
io_WtID: ; write ID signal to bit 7 of 1C
; writes bits 7 of A, and masks the others
push af
push hl
ani 80 ; mask bits 3-7
lxi hl, io_1cID
mov m,a
lxi hl, io_1cLCD
ora m ; add in bit 7
out 32
pop hl
pop af
ret
|