home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_200
/
223_02
/
fputs.mac
< prev
next >
Wrap
Text File
|
1989-02-23
|
2KB
|
101 lines
;
; fputs(cp,unit)
;
;
CBDOS EQU 5 ;/* bdos entry point */
CPMARG EQU 128 ;/* CP/M command line */
MAXARG EQU 32 ;/* Maximum number of input args */
STDIN EQU 0
STDOUT EQU 1
STDERR EQU 2
STDLST EQU 4
CTRLZ EQU 26 ;control z
NULL EQU 0 ;pointer to nothing
FCBSIZE EQU 36 ;size, in bytes, of an FCB
NEXTP EQU 0 ;offset to next-character pointer in I/O structure
UNUSED EQU 2 ;offset to unused-positions-count in I/O structure
BUFFER EQU 6 ;offset to disk sector buffer in I/O structure
UNGOT EQU 5 ;offset to char ungotten by ungetc()
FLAG EQU 33 ;file-type flag byte (in unused part of FCB)
FREEFLG EQU 128 ;This I/O structure is available for the taking
EOFFLG EQU 2 ;The end of this file has been hit
WRTFLG EQU 1 ;This file open for writing
BUFSIZ EQU 1024 ;how long the sector buffer is
NBUFS EQU 8 ;number of I/O buffers
TBUFF EQU 128 ;default cpm buffer
LF EQU 10
EOL EQU 13
;
; CP/M BDOS CALLS
;
CLOSE EQU 16 ;close a file
CPMSTR EQU 9 ;print '$' delimited string on console
CREATE EQU 22 ;make a file
DMA EQU 26 ;set DMA (I/O address)
DELETE EQU 19 ;delete a file
GETCH EQU 1 ;read character from console
GETSTR EQU 10 ;read string from console
LSTOUT EQU 5 ;write character to list device
OPEN EQU 15 ;open a file
PUTCH EQU 2 ;write character to console
QUERY EQU 25 ;get logged-in drive id
READ EQU 20 ;read a sector
SELECT EQU 14 ;log-in a drive
WRITE EQU 21 ;write a sector
;
; File i/o storage varibles found in ulink()
;
EXTRN ZZUNIT
EXTRN ZZIP
EXTRN ZZCHP
EXTRN ZZDP
EXTRN ZZFILE
EXTRN ZZMODE
EXTRN ZZCH
EXTRN ZZT
EXTRN ZZFN
EXTRN ZZNUBU
EXTRN ZZMXSC
;
; Characteristics variable storage found in ulink()
;
EXTRN ZZSVCH
EXTRN ZZDFLT
EXTRN ZZSTAK
EXTRN ZZMEM
;
EXTRN PUTC
;
FPUTS::
POP B
POP D ; unit
POP H ; cp
PUSH H
PUSH D
PUSH B
FPUTS1: MOV A,M ; while((c=*cp++) <> NULL) {
INX H
ORA A
JZ FPUTS3
PUSH H
MOV C,A
MVI B,0
PUSH B
PUSH D
CALL PUTC ; if(putc(c,unit)==EOF)
POP D
POP B
MOV A,H
ORA A
JZ FPUTS2
POP B
RET ; return(EOF);
FPUTS2: POP H
JMP FPUTS1 ; }
FPUTS3: LXI H,0
RET ; return(NULL);
END