home *** CD-ROM | disk | FTP | other *** search
- TITLE ' ';
- ;
- ; PROGRAM LOG
- ;
- ; This is LOG.ASM for any Z80 based CP/M system.
- ; It was authored by ANDY HOFFMAN and is
- ; copyright (c) 1986 by ABC Software co.
- ; Box 804
- ; New Westminster
- ; B.C. Canada
- ; V3L 4Z8
- ;
- ; this program is FREE to all who desire to use it
- ; for non monitary gains. You are free to give it
- ; away to whomever you like whenever you like and
- ; may be used by anyone provided there is no profit
- ; gains of any type at all involved.
- ;
- ; It is designed to be assembled with UVMAC
- ; although it can easily be converted to M80
- ; or any other kind of Z80 assmebler.
- ;
- ; the primary purpose of doing this program was
- ; to have a ZCPR3 style drive/user program that
- ; will log a user and a drive from a single
- ; command line, to use this program first
- ; assemble with UVMAC, and then LOG du: will
- ; log the desired drive user. it has its own
- ; error checking and will work with BYE in
- ; a RCP/M enviroment with no problem as BYE
- ; does its own drive/user checking to see
- ; that the logged drive/user is valid!!
- ;
- ORG 100H ;
- JP START ; begin
- ;
- CR EQU 13 ; carriage return
- LF EQU 10 ; linefeed
- SPACE EQU 020H ; spacebar
- BDOS EQU 5 ; bdos address
- PRNT EQU 9 ; bdos function 9
- BUFF EQU 081H ; CCP command tail buffer
- MAXDRV EQU 3 ; maximum drives
- ;
- ;
- ;
- START: LD HL,0 ; PROGRAM STARTS HERE
- ADD HL,SP ;
- LD (OLDSTK),HL ; save the old stack
- LD SP,STACK ; get the new stack
- LD HL,BUFF ; get the ccp command tail into HL
- LD A,(HL) ; get the charactor into A
- CP SPACE ; is it a space?
- JR Z,COOL ; ya branch to COOL
- ; JP ERROR1 ; remove ; if you want to display error
- LD A,0 ;
- LD (USER),A ; set up user 0
- LD (DRIVE),A ; and drive A
- JP SETDV2 ; go do it and exit
- ;
- COOL: CALL GETCHR ; get the next charactor into A
- SUB 041H ; convert it
- CP MAXDRV ; is it greater then maxdriv
- JP NC,ERROR2 ; ya say so and exit
- LD (DRIVE),A ; no store it in DRIVE
- CALL GETCHR ; get the next charactor
- CP ':' ; is that all?
- JR Z,SETDV1 ; yup set the drive and exit
- SUB 030H ; make it binary
- CP 0AH ; is it anything but a number?
- JP NC,ERROR2 ; ya so exit
- EX AF,AF' ; exchange accumilator and flag with alternate
- CALL GETCHR ; get the next charactor into A
- CP ':' ; is that all?
- CALL NZ,VALID ; nope so check if valid
- DEC HL ; put HL back to where it was
- CALL GETCHR ; so we can get the next charactor
- CP ':' ; is that all?
- JP Z,SETDV3 ; yup so branch
- SUB 030H ; make it binary
- CP 6 ; is it greater then a 5
- JP NC,ERROR2 ; yup so say so and exit
- LD B,A ; store it in B
- LD A,0AH ; we know it is > 10 so put 10 in A
- ADD A,B ; add what we saved into B
- LD (USER),A ; store the new user #
- JP SETDV2 ; set drive/user and exit
- ;
- SETDV3: EX AF,AF' ; get the old A
- LD (USER),A ; store the new user #
- JR SETDV2 ; set the drive/user and exit
- ;
- VALID: EX AF,AF' ; get the old A
- CP 2 ; is it > 2
- JP NC,ERROR2 ; yup so exit
- EX AF,AF' ; put back A
- RET
- ;
- GETCHR: INC HL ; increment HL for next charactor
- LD A,(HL) ; get the charactor
- RET ; return
- ;
- SETDV1: LD A,(04) ; get the old drive/user
- RLCA ; make the low nibble the high nibble
- RLCA
- RLCA
- RLCA
- AND 0FH ; 0 off the high nibble
- RLCA ; now switch it back
- RLCA
- RLCA
- RLCA
- EX AF,AF' ; swap accumilator
- LD A,(DRIVE) ; get the drive number
- LD C,A ; put it in C
- EX AF,AF' ; swap em back
- ADD A,C ; add the drive # to A
- LD (04),A ; put the new drive/user byte in
- JP 0 ; warm boot so CCP see's new drive
- ;
- SETDV2: LD A,(USER) ; get the new user #
- RLCA ; make it the high nibble
- RLCA
- RLCA
- RLCA
- EX AF,AF' ; exchange Acummilator
- LD A,(DRIVE) ; get the drive
- LD C,A ; store it in C
- EX AF,AF' ; exchange back
- ADD A,C ; add it to A
- LD (04),A ; store the new drive/user
- JP 0 ; warm boot so CCP see's new drive/user
- ;
- ERROR1: LD DE,ERMSG1 ; get the address of message
- CALL PRINT ; print it
- JR FINISH ; branch to finish
- ;
- ERROR2: LD DE,ERMSG2 ; get the address of message
- CALL PRINT ; print it
- JR FINISH ; branch to finish
- ;
- PRINT: LD C,PRNT ; BDOS function 9 print string till $
- CALL BDOS ;
- RET ; return
- ;
- FINISH: LD HL,(OLDSTK) ; get the old stack
- LD SP,HL ; put it in
- RET ; return to exit to CCP
- ;
- OLDSTK DW 0 ; storage for the old stack
- DRIVE: DB 0 ; storage for the new drive
- USER: DB 0 ; storage for the new user
- ERMSG1: DB CR,LF,'LOG v1.0 ABC Software co 1986'
- DB CR,LF,CR,LF,CR,LF,'Usage - LOG du:',CR,LF,CR,LF
- DB 'Where d=Desired Drive letter and u=Desired user #',CR,LF
- DB CR,LF,'for example to log drive B: and user 7 type "LOG B7:"',CR,LF
- DB '$'
- ;
- ERMSG2: DB CR,LF,'LOG v1.0 ABC Software co 1986'
- DB 7,7,7,7,7,7,7,7
- DB CR,LF,CR,LF,'DRIVE/USER ERROR!!, Type LOG by itself for more info',CR,LF
- DB '$'
- STPACE: DS 128 ; make room for
- STACK: DW 0 ; the new stack
- END