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
/
A
/
CCP105P.ARC
/
SCANCZII.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-10-17
|
4KB
|
138 lines
;
; S C A N C Z I I . A S M
;
; This RSX scans the console stream for particular patterns, if one
; of the patterns are found, the SCB error flag is set.
;
; This, being for CZII.COM, looks for "error" and "failure", setting the
; error flag if found.
;
; The purpose of this RSX is to make "MAKE" work more fully under CP/M plus.
;
; CCP105.ASM with makecolon turned "on" allows the "-i" function in "make"
; to be functional (stopping the make sequence upon a stepwise error) for
; those programs (typically compilers, linkers,assemblers) which set the SCB
; error code upon errors. Since most (of my) programs don't even know about
; that error flag, something needs to be done: this RSX. This RSX is to be
; attached to the appropriate compilers (etc), and the patterns set
; appropriately. The patterns needed are those put out by the compiler (etc)
; when it detects an error. My C-compiler, for instance, puts out
; an "errors" count with compile-time errors, and "failure" with command-line
; errors. Thus, I would look for those two words in the output stream.
; I had used the "BDOSRSX" RSX to determine that my compiler uses bdos call
; 02 (console output) to stream its error message(s).
;
; The particular version of CP/M "Make" being referred to is my port
; of the "Aussie Make" -- which I posted to Usenet's net.micro.cpm .
;
; (C) Copyright 1986 by Michael D. Kersenbrock Aloha, Oregon
;
serial: db 0,0,0,0,0,0
start: jmp scan
next: jmp $-$
prev: dw 0
remove: db 0ffh ; remove with next load
nonbank: db 0 ; both banked and non-banked are OK
thename:
db 'SCANCZII' ; Scan console output RSX for czii
loader: db 0 ; load for banked & non-banked systems
db 0,0 ; system use junque
scan: ; note: no BDOS call has input in 'a'
mov a,c ; get bdos call number
cpi 2 ; console output stream?
jnz next ; no, so quickly bypass this RSX
; yep, so ....
push psw ; save all at entry
push h
push b
push d
;
; The general scheme is to maintain a window into the stream
; equal to the maximum width of the longest search string. When
; a character is sent to the console, it is added to the "window",
; and then that window is compared with all the strings. If
; a match is made (at any time), then the SCB error flag is set.
; The specific error flag set is:
; FF12 == MAKE ERROR
;
; Note that comparisons (etc) are sort of done tail-end first
; (the "current" character that just came in is the "tail-end"
; of something).
; Insert new character into window
lxi h,window+winsize-2 ; source pointer to end-1 of window
lxi d,window+winsize-1 ; destination pointer to end of window
lxi b,winsize-1 ; want to move all but last character
db 0edh,0b8h ; Z80 LDDR reverse block move
pop d ; get new character
push d
mov a,e
sta window ; insert the new character into window
lxi d,str1 ; point to first string
call compare ; compare string to window contents
cz seterror ; set SCB error if error found
lxi d,str2 ; point to second string
call compare ; compare strin to window contents
cz seterror ; set SCB error if error found
exit:
pop d ; return all registers back
pop b
pop h
pop psw
jmp next ; and let it continue with its business
window:
db ' ' ; length >= longest of below strings
winsize equ 7 ; the above length
; NOTE: the strings should be
; spelt backwards.
str1: db 'rorre',0 ; first string to look for
str2: db 'eruliaf',0 ; second string to look for
; Compare strings at window and at (DE). Return
; with ZERO FLAG RESET FOR NOMATCH and SET for MATCH.
; Note that the comparison strings terminate with a null.
compare:
lxi h,window ; *HL -> window, *DE -> compareString
cmploop:
ldax d ; get fixed-string character
ora a ; end of string?
rz ; yep, so return with MATCH indicated
cmp m ; strings matching?
rnz ; nope, so quit now & tell the caller
inx h ; point to next char in each string
inx d
jmp cmploop ; and compare next character
seterror:
mvi c,6ch ; BDOS function for set-return code
lxi d,0ff12h ; load MAKE ERROR CODE
jmp next ; go set code, then return to whomever
; called seterror
c