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
/
ENTERPRS
/
CPM
/
UTILS
/
S
/
SGTOOL10.ARC
/
VDCASM.C
< prev
next >
Wrap
Text File
|
1993-07-19
|
1KB
|
55 lines
/*
SG C Tools 1.0
(C) 1993 Steve Goldsmith
All Rights Reserved
VDCASM.C is in-line Z80 Assembler code to speed up invdc() and outvdc().
I encountered a compiler lock up tring to optimize (-O) VDC.C with this code.
I used C -O -C VDC.C to compile. Works fine without -O, go figure? Just
replace the code in VDC.C with the code below. If you can figure out why this
is bombing the optimizer let me know! Even without -O the Assembler code is
faster than inp() and outp()!
Compiled with HI-TECH C 3.09 (CP/M-80).
*/
uchar invdc(uchar RegNum)
{
/* in-line assembler to set vdc reg to read and wait for status bit 7 */
#asm
ld a,(ix+6)
ld bc,0d600h
out (c),a
1:
in a,(c)
bit 7,a
jr z,1b
#endasm
return(inp(vdcDataReg)); /* read register */
}
void outvdc(uchar RegNum, uchar RegVal)
{
/* in-line assembler to set vdc reg to write, wait for status bit 7 and */
/* write new value to reg */
#asm
ld a,(ix+6)
ld bc,0d600h
out (c),a
1:
in a,(c)
bit 7,a
jr z,1b
ld a,(ix+8)
inc bc
out (c),a
#endasm
}