home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
SIMTEL
/
CPMUG
/
CPMUG051.ARK
/
VDB.ALX
< prev
next >
Wrap
Text File
|
1984-04-29
|
6KB
|
405 lines
REV EQU 11H ; 12/28/80 R. Curtiss BUFF, INIR, OTIR
;REV EQU 10H ; 12/28/80 R. Curtiss from NB-VDB
;VREV EQU 21H ; 06/10/80 R. Curtiss HOME --> CHOME
BEGIN
;
; Entry points
;
ENTRY VO
;
; TDL-XITAN VDB driver for Heath H19 emulation (partial)
;
NSTATE: DW ST1
CIMAGE: DB 00000000B
MSR: DB 0
INVERT: DB 0
;
; Local data storage (uninitialized)
;
DSEG
BUFF: DS 81 ; scroll buffer
CSEG
;
; ----------------------------------------
;
BS EQU 08H
CR EQU 0DH
LF EQU 0AH
BEL EQU 07H
ESC EQU 1BH
DEL EQU 7FH
VDBCTL EQU 9CH
VDBDAT EQU VDBCTL+1
CONTROL EQU VDBCTL+2
VDBMRF EQU 10000000B
VDBYCF EQU 11000000B
VDBXCR EQU 11100000B
VDBYCR EQU 11100001B
VDBMRR EQU 11100010B
VDBRES EQU 11100011B
VDBGMK EQU 01100000B
BELBIT EQU 00000001B
VDBAP EQU 0
VDBBE EQU 1
VDBIS EQU 2
VDBID EQU 3
VDBDC EQU 4
VDBDD EQU 5
PROCEDURE VOINIT
SETNEXT ( NSTATE = ST1 )
MVI A,00000000B
STA CIMAGE
XRA A
STA INVERT
MVI A,4
CALL PUTMODE
RET
PROCEDURE VO
PUSH B
PUSH D
PUSH H
MOV A,C
ANI 7FH
EXECUTE ( NSTATE )
( ST1 )
CPI ESC
WHEN ( ZERO )
SETNEXT ( NSTATE = ST2 )
FIN
ELSE CALL VOUT
FIN
( ST2 )
SELECT
( 'Y' )
SETNEXT ( NSTATE = ST3 )
FIN
( 'S' )
SETNEXT ( NSTATE = ST5 )
MVI A,0FFH
STA MSR
FIN
( 'R' )
SETNEXT ( NSTATE = ST5 )
XRA A
STA MSR
FIN
( OTHERWISE )
SETNEXT ( NSTATE = ST1 )
CALL VOP
FIN
FIN
FIN
( ST3 )
SETNEXT ( NSTATE = ST4 )
SUI 32
CALL PUTY
FIN
( ST4 )
SETNEXT ( NSTATE = ST1 )
SUI 32
CALL PUTX
FIN
( ST5 )
SETNEXT ( NSTATE = ST1 )
SUI '0'
ANI 7
MOV B,A
MVI A,1
INR B
LOOP
DCR B
BREAK IF ( ZERO )
RLC
FIN
MOV B,A
LDA MSR
ORA A
WHEN ( ZERO ) ; reset selected mode bit
MOV A,B
CMA
MOV B,A
CALL GETMODE
ANA B
CALL PUTMODE
FIN
ELSE
CALL GETMODE
ORA B
CALL PUTMODE
FIN
FIN
FIN
POP H
POP D
POP B
RET
PROCEDURE VOUT
SELECT
( DEL ) NOP
( CR )
XRA A
CALL PUTX
FIN
( LF )
CALL GETY
INR A
CPI 25
WHEN ( CARRY ) CALL PUTY ; y = y + 1
ELSE CALL SCROLL
FIN
( BS )
CALL GETX
ORA A
IF ( NOT ZERO )
DCR A
CALL PUTX ; x = x - 1
FIN
FIN
( BEL )
LDA CIMAGE
ORI BELBIT
OUT CONTROL ; fire bell one shot
XRI BELBIT
OUT CONTROL
FIN
( OTHERWISE )
CPI ' '
WHEN ( CARRY ) CALL WHAT ; control character display
ELSE CALL DISPLAY ; normal character display
FIN
FIN
RET
PROCEDURE VOP
SELECT
( 'E' ) CALL ERASE
( 'J' ) CALL E2EOS
( 'K' ) CALL E2EOL
( 'l' ) CALL ELINE
( 'H' ) CALL CHOME
( 'A' ) CALL UP
( 'B' ) CALL DOWN
( 'C' ) CALL RIGHT
( 'D' ) CALL LEFT
( 'p' ) CALL REVERSE
( 'q' ) CALL NORMAL
( OTHERWISE ) CALL WHAT
FIN
RET
PROCEDURE WHAT
CPI 32
WHEN ( CARRY ) ; control character
PUSH PSW
MVI A,'^'+80H
CALL DISPLAY
POP PSW
ORI 0C0H ; reverse and non control
CALL DISPLAY
FIN
ELSE
ORI 80H
CALL DISPLAY
FIN
RET
PROCEDURE DISPLAY
MOV B,A
LDA INVERT
ORA A
MOV A,B
IF ( NOT ZERO ) ; blink or invert
XRI 80H
FIN
OUT VDBDAT
MVI A,VDBXCR
OUT VDBCTL
IN VDBCTL
ORA A
IF ( ZERO ) ; line full - wrap around
MVI A,VDBYCR
OUT VDBCTL
IN VDBCTL
ORA A
IF ( ZERO ) ; screen full - scroll required
CALL SCROLL
FIN
FIN
RET
PROCEDURE ERASE
XRA A
CALL PUTX
CALL PUTY
REPEAT
CALL CLIN ; CLEAR THE LINE
CALL GETY
ORA A
UNTIL ( ZERO )
RET
PROCEDURE E2EOS
CALL GETX
PUSH PSW
CALL GETY
PUSH PSW
REPEAT
CALL CLIN
CALL GETY
ORA A
UNTIL ( ZERO )
POP PSW
CALL PUTY
POP PSW
CALL PUTX
RET
PROCEDURE UP
CALL GETY
ORA A
IF ( NOT ZERO ) ; not top of screen
DCR A
CALL PUTY ; Y = Y - 1
FIN
RET
PROCEDURE DOWN
CALL GETY
INR A
CPI 25
IF ( CARRY )
CALL PUTY ; y = y + 1
FIN
RET
PROCEDURE RIGHT
CALL GETX
INR A
CPI 80
IF ( CARRY ) ; cursor at right of screen
CALL PUTX ; X = X + 1
FIN
RET
PROCEDURE LEFT
CALL GETX
ORA A
IF ( NOT ZERO )
DCR A
CALL PUTX
FIN
RET
PROCEDURE REVERSE
MVI A,0FFH
STA INVERT
RET
PROCEDURE NORMAL
MVI A,0
STA INVERT
RET
PROCEDURE E2EOL
CALL GETX
PUSH PSW
CALL GETY
PUSH PSW
CALL CLIN
POP PSW
CALL PUTY
POP PSW
CALL PUTX
RET
PROCEDURE ELINE
CALL GETY
PUSH PSW
XRA A
CALL PUTX
CALL CLIN
POP PSW
CALL PUTY
RET
PROCEDURE CHOME
XRA A
CALL PUTX ; X = 0
CALL PUTY ; Y = 0
RET
PROCEDURE SCROLL
CALL GETMODE ; GET MODE
LXI H,BUFF
PUSH PSW
ORI 10H ; 1<VDBDC KILL CURSOR
OUT VDBCTL ; INHIBIT
PUSH H
MVI D,VDBYCF+1
MVI C,VDBDAT ; data port
XRA A
OUT VDBCTL
MOV A,D
REPEAT
OUT VDBCTL ; SET Y POS
MVI B,80
.Z80
INIR
.8080
POP H
PUSH H
MOV A,D
DCR A
OUT VDBCTL
MVI B,80
.Z80
OTIR
.8080
POP H
PUSH H
INR D
MOV A,D
CPI 0D9H ; 25!VDBYCF
UNTIL ( NO CARRY )
POP H
CALL CLIN ; CLEAR LAST LINE
MVI A,0D8H ; 24!VDBYCF
OUT VDBCTL
POP PSW
OUT VDBCTL ; ENABLE DISPLAY
RET
PROCEDURE PUTY
ANI 1FH
ORI VDBYCF
OUT VDBCTL
RET
PROCEDURE PUTX
ANI 7FH
OUT VDBCTL
RET
PROCEDURE GETY
MVI A,VDBYCR
OUT VDBCTL
IN VDBCTL
RET
PROCEDURE GETX
MVI A,VDBXCR
OUT VDBCTL
IN VDBCTL
RET
PROCEDURE PUTMODE
ANI 3FH
ORI VDBMRF
OUT VDBCTL
RET
PROCEDURE GETMODE
MVI A,VDBMRR
OUT VDBCTL
IN VDBCTL ; READ MODE
ORI VDBMRF ; SET TO WRITE MODE
RET
PROCEDURE CLIN
MVI A,VDBXCR
OUT VDBCTL
REPEAT
MVI A,' '
OUT VDBDAT
IN VDBCTL
ORA A
UNTIL ( ZERO )
RET
END
END-OF-FILE