home *** CD-ROM | disk | FTP | other *** search
-
- ; ANYCODKP.ASM - A modified version of ANYCODE. The
- ; original version was too long to fit in
- ; the space remaining in the MORPAT area
- ; of the modified WORDSTAR supplied with
- ; the Kaypro. This version is 16 bytes
- ; shorter, but is identical in operation.
- ; Replaced code is commented out, and
- ; substituted code is in capitals.
- ;
- ; O. V. Gray - 6 Feb 85
- ;
- ; ANYCODE.ASM - A program to allow printer codes to be
- ; transmitted to EPSON or other dot matrix
- ; printer from within WordStar text.
- ;
- ; Author: D. M. Hurst
- ; Date: March 3, 1984
- ;
- ; ORG 02BBh ;WS 2.26/3.0 (02DEh) WS 3.3 (02BBh)
- ;
- ORG 02D7H ;TO FIT IN SPACE REMAINING IN
- ;MORPAT AREA OF WORDSTAR SUPPLIED
- ;WITH KAYPRO
-
- mysub: cpi '`' ;is it a code character?
- ;you may sub " ` " if you use the
- ;" ` " often in your text
- ; jnz ncheck ;no, so next check
- DW 0920H ;JR NZ,NCHECK - Z80 RELATIVE JUMP
- STORE: ;ADD NEW LABEL
- sta lead ;yes, so store temporarily
- mvi a,1 ;get a 1 in accumulator
- sta fl ;set fl flag
- ret ;get another character
- ;without printing
- ncheck: cpi '~' ;is it other code character?
- ; jnz hcheck ;no, so check if part of
- ;code sequence
- DW 0720H ;JR NZ,HCHECK
- ;
- ; sta lead ;yes so store temporarily
- ; mvi a,1 ;get a 1 in accumulator
- ; sta fl ;set fl flag
- ;
- CALL STORE ;REPLACES PREVIOUS 3 LINES
- ;
- mvi a,1bh ;~ means escape required so
- ; jmp pout ;send it.
- DW 4F18H ;JR POUT
- hcheck: mov b,a ;set input char aside
- lda lead ;get contents of lead
- cpi '`' ;are we in a code seq?
- mov a,b ;char back in accumulator
- ; jz flchk ;yes, so check if flag set
- DW 0B28H ;JR Z,FLCHK
- mov b,a ;no, so char back to b
- lda lead ;check lead again
- cpi '~' ;are we in a code seq?
- mov a,b ;char back in accumulator
- ; jz flchk ;yes, so check if flag set
- DW 0228H ;JR Z,FLCHK
- ; jmp pout ;no, so print char normally
- DW 3B18H ;JR POUT
- flchk: mov b,a ;set char aside again
- lda fl ;get fl flag
- cpi 00h ;1 if set set
- mov a,b ;char back in accumulator
- ; jz addsnd ;not set, so last char in seq
- DW 1A28H ;JR Z,ADDSND
- mov b,a ;yes, so set char aside again
- mvi a,00h ;no, so place 00h in accumulator
- sta fl ;and lower the flag
- mov a,b ;char back in accumulator
- cpi 39h ;is code char a letter?
- jm nolet1 ;no, so never mind
- sui 07h ;yes, so make it a number
- nolet1: sui 30h ;now down it form ASCII
- rlc ;first char in code so
- rlc ;move 4 low bits to high
- rlc
- rlc
- ani 0f0h ;0 4 lower bits
- sta first ;store it
- ret ;go get second char code
- addsnd: mov b,a ;set 2nd code char aside
- mvi a,00 ;0 the accumulator
- lxi h,lead ;get lead addr pointer in hl
- mov m,a ;0 out the lead
- inx h ;up the hl
- mov m,a ;also 0 the flag
- mov a,b ;get char back
- cpi 39h ;was 2nd code char a letter?
- jm nolet2 ;so so skip it
- sui 07h ;yes so make it a number
- nolet2: sui 30h ;now down either from ASCII
- lxi h,first ;point to first code char addr
- mov b,m ;move actual char to b
- add b ;add a to b (result in a)
- pout: mvi c,5 ;print full code char
- mov e,a
- call 5
- ret ;back for next real char
- ;
- lead ds 1 ;space for lead code
- fl ds 1 ;flag space
- first ds 1 ;store first code while
- ;waiting for 2nd to pro-
- ;cess.
- end