home *** CD-ROM | disk | FTP | other *** search
- ;
- ; S C A N L N . A S M
- ;
- ; This RSX scans the console stream for a particular pattern, if
- ; this pattern is not found, the SCB error flag is set.
- ;
- ; This, being for LN.COM, looks for the pattern "1.07<cr><cr><lf>Base:".
- ; if it is found before/when "Base:" is found, then NO error messages
- ; were found. This is looking for error messages between the ...1.07 signon
- ; message, and the statistics line. Obviously, this is depending upon the
- ; version number of the linker.
- ;
- ; 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 'SCANLN ' ; Scan console output RSX for ln
-
- loader: db 0 ; load for banked & non-banked systems
-
- db 0,0 ; system use junque
-
- okflag db 0 ; flag == 0 if the str1 string hasn't
- ; been found yet
-
-
- 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
- jnz scan2 ; go look for error if OK not found
- mvi a,1 ; get a non-zero
- sta okflag ; indicate the "goodstring" is found
- scan2:
- lda okflag ; already found the "goodstring"?
- ora a
- jnz exit ; yep, so skip further comparisons
- 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 12 ; the above length
-
- ; NOTE: the strings should be
- ; spelt backwards.
- str1: db ':esaB',0ah,0dh,0dh,'70.1',0 ; first string to look for
-
- str2: db ':esaB',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
-
- iness
-
-
- window:
- db ' ' ; length >= longest of below strings
-
- winsize equ 12 ; the above length
-
-