home *** CD-ROM | disk | FTP | other *** search
- ; RS232 TEST - Version 2.0 (First Beta Release)
- ;
- ; RS232TST looks at the SIO status register (RR0). The entire status byte
- ; is placed in register 8. The value of the individual bits in the status
- ; register re placed in ZCPR3 user registers 0 through 7 respectively.
- ;
- ; The program aborts with an error code 6 if the Z3 wheel byte is not set,
- ; and aborts with an error message if no Z3 message buffer exists.
- ;
- ; Lindsay Haisley
- ; Znode 77
- ; (512) 259-1261
-
- cr equ 0dh
- lf equ 0ah
-
- ext putreg, z3init, getwhl, eprint, getmsg
- .request syslib, z3lib
-
- begin: jp start
- defb 'Z3ENV'
- defb 1
- env: defw 00 ; ENV buffer
- defb 'PORT'
- port: defb 06h ; Modem or RS232 control port number
- defb 'RESET'
- resflg: defb 0ffh ; SIO Interrup/Status reset flag
- defb 'WHEEL'
- whlflg: defb 0ffh ; Wheel protect flag
-
-
- start: ld hl,(env) ; Get env address
- call z3init ; Initialize z3lib
- ld a,(whlflg) ; Are we checking for wheels?
- or a
- jr z,nocheck ; If not, bypass
- call getwhl
- or a
- jp z,notwheel ; If user not wheel, dissapear
- nocheck: call getmsg ; Check for msg buffer
- or a
- jp z,msgerr ; No message buffer, so error
- ld a,0ffh
- ld hl,82h ; Point to tbuff
- ld a,(hl) ; Check for document request
- cp '/' ; ZCPR document request
- jp z,tell
-
- ; Here the work is done
- ld a,(port) ; get the port number
- ld (iport1),a ; Stick it in the code
- ld (iport2),a
- ld a,(resflg) ; Are we to do a reset?
- or a
- jr z,notreset ; If not, skip it
- ld a,10h ; Reset status/interruts
- iport1 equ $+1
- out (0),a ; Replacd by correct port
- iport2 equ $+1
- notreset: in a,(0) ; Get status
- ld c,a ; Save
-
- bit 0,c ; Bit 0, Rcv. character avail
- ld b,0
- call set
-
- bit 1,c ; Bit 1, Interrupt pending
- ld b,1
- call set
-
- bit 2,c ; Bit 2, Xmit buffer empty
- ld b,2
- call set
-
- bit 3,c ; Bit 3, Data carrier detect
- ld b,3
- call set
-
- bit 4,c ; Bit 4, ~SYNC status
- ld b,4
- call set
-
- bit 5,c ; Bit 5, Clear to send
- ld b,5
- call set
-
- bit 6,c ; Bit 6, Xmit Underrun
- ld b,6
- call set
-
- bit 7,c ; Bit 7, Break/Abort
- ld b,7
- call set
-
- ld b,8
- ld a,c
- call putreg ; Put entire control byte in reg 6
- ret
-
- set: push bc
- ld a,0
- jr z,notset
- inc a
- notset: call putreg
- pop bc
- ret
-
- notwheel: call getmsg
- or a
- ret z ; No message buffer, so just quit
- ld de,03
- add hl,de ; Point to command status
- ld (hl),6 ; Enable error handling
- ret ; Return to CCP, RS232TST is invisible
-
-
-
- msgerr: call eprint
- defz 'No Z3 Message Buffer present.......',cr,lf
- ret
-
- ; Set up document display with type and load address figures
- ;
- tell: call eprint
- ; #text
- defb ' RS232TST - Test RS232 status. Version 2.0',cr,lf
- defb ' Reg 0 = Receive Character Available',cr,lf
- defb ' Reg 1 = Interrupt Pending',cr,lf
- defb ' Reg 2 = Transmit Buffer Empty status',cr,lf
- defb ' Reg 3 = Data Carrier Detect status',cr,lf
- defb ' Reg 4 = Inverted SYNC Input status',cr,lf
- defb ' Reg 5 = Clear To Send status',cr,lf
- defb ' Reg 6 = (Unused in asynch. communication)',cr,lf
- defb ' Reg 7 = Break/Abort',cr,lf
- defb ' Reg 8 = Complete SIO Status Register Byte',cr,lf
- defz ' Note: RS232TST is '
-
- ld a,(whlflg)
- or a ; Check to see if wheel protected
- jr nz,skipnot ; If protected, skip 'NOT'
-
- call eprint
- defz 'NOT '
-
- skipnot: call eprint
- defz 'wheel protected.'
-
- ld a,(resflg)
- or a
- ret z
- call eprint
- defz 0dh,0ah,' Interrupt/Status reset enabled'
-
- ret
- ; #endtext