home *** CD-ROM | disk | FTP | other *** search
- page 95,132
- ;§∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞§
- ;§ §
- ;§ マルチカラム コンパクト プリント ユーティリティ §
- ;§ §
- ;§ Multicolumn Compact PRint utility MCPR.EXE Ver1.40 §
- ;§ ~ ~ ~~ §
- ;§ Copyright (C) by 福地 邦雄 1989-1990. All rights reserved. §
- ;§∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞§
- public codeprint
- public bitprint
- public prtinit
- public feedprint
- public dosprint
- extrn inttoascs:near
- extrn abort:near
- extrn intflg:byte
- extrn reprintflg:word
- ;
- YES equ 1
- PORT equ 0
- LAND equ 1
- STOCK136 equ 0
- STOCK80 equ 1
- A4 equ 2
- B4 equ 3
- ;
- data segment para public 'DATA'
- ;
- extrn bitimgseg:word
- extrn prtbufseg:word
- extrn marginhead:word
- extrn hdrprint:word
- extrn creturns:word
- extrn linptr:dword
- extrn clmpitch:word
- extrn rawpitch:word
- extrn pprtype:word
- extrn frmtype:word
- extrn hopper:word
- extrn lincnt:word
- extrn filline:word
- extrn errorno:word
- ;
- pgprtinit dw ?
- initsiz dw ?
- ;
- clm1data db 1ch,'(`',71h,1bh,'$B',1ch,'$',23h,76h,1bh,'(H'
- clm1dsiz equ $-clm1data
- raw2data db 1ch,'%',22h,74h
- raw2dsiz equ $-raw2data
- r2c1dsiz equ $-clm1data
- raw3data db 1ch,'%',22h,70h,1bh,'[10e'
- raw3dsiz equ $-raw3data
- clm2data db 1bh,'$B',1ch,'$',22h,74h,1bh,'(H',1bh,'Q1 |',1bh,'[;12 G'
- clm2dsiz equ $-clm2data
- r2c2data db 1bh,'$B',1ch,'$',22h,74h,1bh,'(H',1bh,'Q1 |',1bh,'[24;12 G'
- r2c2dsiz equ $-r2c2data
- ;
- hmargin dw ?
- crcount dw ?
- feedata db 1bh,'E'
- clrbuff db 18h
- ;
- leddirsq db 1bh,'Q'
- ledcood db '0;4;'
- ledhopper db '0;'
- leddir db '0!@'
- ledirsqsz equ $-leddirsq
- ;
- ledinitstr db 48 dup(?)
- ;
- srlcsfsq db 1bh,'Q10 [',1bh,'Q2'
- srlhopper db '0 [',1bh,'Q0 ['
- srlcsfsqsz equ $-srlcsfsq
- ;
- printmsg db 'print error',0dh,0ah
- prtmsgsiz equ $-printmsg
- ;
- rdfontj db 32 dup(0)
- chcnt db 16
- bytcnt db 2
- side dw 0
- prtfont db 32 dup(0)
- ;
- makeankbit dw ankimgcnvt
- ankscale dw 0810h
- ;
- data ends
- ;
- code segment para public 'CODE'
- assume cs:code,ds:data
- ;
- lcount equ word ptr [bp+00h]
- ;
- aryptr equ [bp+02h]
- aryoff equ word ptr [bp+02h]
- saveds equ [bp+04h]
- ;
- chrptr equ [bp+06h]
- chroff equ word ptr [bp+06h]
- chrseg equ [bp+08h]
- ;
- prtptr equ [bp+0ah]
- prtoff equ word ptr [bp+0ah]
- prtseg equ [bp+0ch]
- ;
- bitptr equ [bp+0eh]
- bitoff equ word ptr [bp+0eh]
- bitseg equ [bp+10h]
- ;
- savelines equ [bp+12h]
- ;
- codeprint proc
- ;
- push si
- push ax
- push ax
- mov bp,sp
- cdreprint:
- mov dx,offset clrbuff
- mov cx,1
- call dosprint
- jnz cdreprint
- mov dx,pgprtinit
- mov cx,initsiz
- call dosprint
- jnz cdreprint
- call headmargin
- mov ax,ds
- mov es,ax
- mov di,offset linptr
- cmp hdrprint,YES
- jne cdlinloop
- add lcount,2
- lea di,[di-8]
- cdlinloop:
- lds si,es:[di]
- mov word ptr [si],451bh
- lea cx,[si+2]
- xor dx,dx
- call dosprint
- jnz codehead
- ;
- lea di,[di+4]
- dec lcount
- jnz cdlinloop
- ;
- mov ax,es
- mov ds,ax
- pop ax
- pop si
- pop si
- ret
- ;
- codehead:
- mov ax,es
- mov ds,ax
- mov ax,[bp+2]
- mov [bp],ax
- jmp cdreprint
- ;
- codeprint endp
- ;
- bitprint proc
- ;
- push si
- push ds
- sub sp,14h
- mov bp,sp
- bitreprint:
- call bitwrkinit
- bitreprint2:
- mov dx,offset clrbuff
- mov cx,1
- call dosprint
- jnz bitreprint2
- mov dx,pgprtinit
- mov cx,initsiz
- call dosprint
- jnz bitreprint2
- call headmargin
- jnz bitreprint2
- lineloop:
- mov bitoff,0
- mov prtoff,0
- mov chroff,0
- les di,aryptr
- mov ax,es:[di+2]
- mov chrseg,ax
- charloop:
- les di,chrptr
- xor ax,ax
- mov al,es:[di]
- inc di
- mov chroff,di
- test al,al
- jz endline
- jns spctest
- cmp al,0a0h
- jb knjset
- cmp al,0e0h
- jae knjset
- spctest:
- cmp al,' '
- jne ankset
- cmp byte ptr es:[di],' '
- jne ankset
- call skipspace
- jmp short charloop
- ankset:
- call ankimgset
- jmp short charloop
- knjset:
- call knjimgset
- jmp short charloop
- endline:
- call copyimgdata
- mov word ptr es:[di],451bh
- lea di,[di+2]
- ;
- mov cx,di
- xor dx,dx
- mov ds,prtseg
- call dosprint
- jnz bithead
- ;
- add aryoff,4
- dec lcount
- jz endprint
- jmp lineloop
- endprint:
- add sp,14h
- pop ds
- pop si
- ret
- ;
- bithead:
- mov ds,saveds
- mov ax,savelines
- jmp bitreprint
- ;
- bitprint endp
- ;
- bitwrkinit proc
- ;
- mov lcount,ax
- mov savelines,ax
- mov ax,offset linptr
- cmp hdrprint,YES
- jne nohdrprt
- add lcount,2
- sub ax,8
- nohdrprt:
- mov aryoff,ax
- mov saveds,ds
- mov ax,bitimgseg
- mov bitseg,ax
- mov ax,prtbufseg
- mov prtseg,ax
- ret
- ;
- bitwrkinit endp
- ;
- skipspace proc
- ;
- mov cx,-1
- repe scasb
- dec di
- mov chroff,di
- not cx
- mov ax,9
- mul cx
- push ax
- call copyimgdata
- pop ax
- mov word ptr es:[di],5b1bh
- lea di,[di+2]
- call inttoascs
- mov byte ptr es:[di],'a'
- inc di
- mov prtoff,di
- ret
- ;
- skipspace endp
- ;
- ankimgset proc
- ;
- push ds
- xor bx,bx
- mov bl,al
- mov ax,data
- mov ds,ax
- ;
- mov ax,700h
- mov dx,ankscale
- mov di,offset rdfontj
- int 91h
- ;
- call makeankbit
- xor ax,ax
- mov cx,8
- mov si,offset prtfont
- les di,bitptr
- ankimgloop:
- movsw
- stosb
- loop ankimgloop
- stosw
- stosb
- mov bitoff,di
- pop ds
- ret
- ;
- ankimgset endp
- ;
- ankimgcnvt proc
- ;
- mov di,offset prtfont
- mov chcnt,8
- mov bl,80h
- aclabel4:
- mov si,offset rdfontj
- mov bytcnt,2
- aclabel5:
- mov cx,8
- xor ax,ax
- aclabel6:
- mov al,[si] ;get font data
- and al,bl
- jz acbitnoset
- stc
- acbitnoset:
- rcl ah,1
- inc si
- loop aclabel6
- ;
- mov [di],ah
- inc di
- dec bytcnt
- jnz aclabel5
- ;
- shr bl,1
- dec chcnt
- jnz aclabel4
- ;
- ret
- ;
- ankimgcnvt endp
- ;
- betaimgcnvt proc
- ;
- mov di,offset prtfont
- mov chcnt,8
- mov bl,80h
- bclabel4:
- mov si,offset rdfontj
- mov bytcnt,2
- bclabel5:
- mov cx,4
- xor ax,ax
- bclabel6:
- shl ah,1
- shl ah,1
- mov al,[si] ;get font data
- and al,bl
- jz bcbitnoset
- or ah,3
- bcbitnoset:
- inc si
- loop bclabel6
- ;
- mov [di],ah
- inc di
- dec bytcnt
- jnz bclabel5
- ;
- shr bl,1
- dec chcnt
- jnz bclabel4
- ;
- ret
- ;
- betaimgcnvt endp
- ;
- knjimgset proc
- ;
- push ds
- xor bx,bx
- mov bl,es:[di]
- inc di
- mov chroff,di
- ;
- cmp al,0e0h
- jb sjblock1
- sub al,40h
- sjblock1:
- sub al,81h
- shl al,1
- add al,21h
- ;
- test bl,bl
- jns nohighbit
- dec bl
- nohighbit:
- cmp bl,9eh
- jb lowside
- inc al
- sub bx,5eh
- lowside:
- sub bx,1fh
- ;
- mov bh,al
- xchg bh,bl
- mov ax,data
- mov ds,ax
- ;
- mov ax,700h
- mov dx,1010h
- mov di,offset rdfontj
- int 91h
- ;
- call knjimgcnvt
- xor ax,ax
- mov cx,16
- mov si,offset prtfont
- les di,bitptr
- ;
- stosw
- stosb
- knjimgloop:
- movsw
- stosb
- loop knjimgloop
- stosw
- stosb
- mov bitoff,di
- pop ds
- ret
- ;
- knjimgset endp
- ;
- knjimgcnvt proc
- ;
- mov di,offset prtfont
- jclabel3:
- mov chcnt,8
- mov bl,80h
- jclabel4:
- mov si,offset rdfontj
- add si,side
- mov bytcnt,2
- jclabel5:
- mov cx,8
- xor ax,ax
- jclabel6:
- mov al,[si] ;get font data
- and al,bl
- jz jcbitnoset
- stc
- jcbitnoset:
- rcl ah,1
- lea si,[si+2]
- loop jclabel6
- ;
- mov [di],ah
- inc di
- dec bytcnt
- jnz jclabel5
- ;
- shr bl,1
- dec chcnt
- jnz jclabel4
- ;
- xor side,1
- jnz jclabel3
- ;
- ret
- ;
- knjimgcnvt endp
- ;
- copyimgdata proc
- ;
- les di,prtptr
- mov ax,bitoff
- test ax,ax
- jz noimgdata
- mov word ptr es:[di],511bh
- lea di,[di+2]
- cwd
- mov bx,3
- div bx
- call inttoascs
- mov word ptr es:[di],'W '
- lea di,[di+2]
- xor ax,ax
- mov si,ax
- mov cx,bitoff
- shr cx,1
- mov ds,bitseg
- rep movsw
- test bitoff,1
- jz evenoff
- movsb
- evenoff:
- mov bitoff,ax
- mov prtoff,di
- noimgdata:
- ret
- ;
- copyimgdata endp
- ;
- prtinit proc
- ;
- cmp clmpitch,2
- je pgw2
- ja pgw3
- ;
- cmp rawpitch,2
- jne nochange
- mov pgprtinit,offset clm1data
- mov initsiz,r2c1dsiz
- jmp short pitchend
- pgw2:
- cmp rawpitch,1
- jne w2pgh2
- mov pgprtinit,offset clm2data
- mov initsiz,clm2dsiz
- jmp short pitchend
- w2pgh2:
- mov pgprtinit,offset r2c2data
- mov initsiz,r2c2dsiz
- jmp short pitchend
- pgw3:
- cmp rawpitch,2
- jb nochange
- ja w3pgh3
- mov pgprtinit,offset raw2data
- mov initsiz,raw2dsiz
- jmp short pitchend
- w3pgh3:
- mov pgprtinit,offset raw3data
- mov initsiz,raw3dsiz
- cmp creturns,YES
- jne pitchend
- sub initsiz,5
- jmp short pitchend
- nochange:
- mov pgprtinit,offset clm1data
- mov initsiz,clm1dsiz
- pitchend:
- cmp pprtype,STOCK80
- jbe serialprt
- cld
- mov cx,ds
- mov es,cx
- mov cx,initsiz
- mov si,pgprtinit
- mov di,offset ledinitstr
- rep movsb
- ;
- mov pgprtinit,offset leddirsq
- add initsiz,ledirsqsz
- mov ax,pprtype
- add al,'0'-A4
- mov ledcood,al
- mov ax,frmtype
- add al,'0'
- mov leddir,al
- mov ax,hopper
- add al,'0'-1
- mov ledhopper,al
- jmp ppriniend
- serialprt:
- jne ppriniend
- cmp frmtype,PORT
- jne ppriniend
- mov ax,hopper
- add al,'0'-1
- mov srlhopper,al
- csfin:
- mov cx,srlcsfsqsz
- mov dx,offset srlcsfsq
- call dosprint
- jnz csfin
- ppriniend:
- mov ah,5 ;機種情報読み取り
- mov di,offset prtfont
- int 0afh
- cmp prtfont,0 ;0=16β
- jne prtiniend
- mov makeankbit,offset betaimgcnvt
- mov ankscale,0808h
- prtiniend:
- ret
- ;
- prtinit endp
- ;
- dosprint proc
- ;
- mov cs:reprintflg,0
- mov cs:intflg,0
- test cx,cx
- jz prtend
- mov ah,40h
- mov bx,4
- int 21h
- jc prterr
- sub cx,ax
- add dx,ax
- jmp short dosprint
- prtend:
- mov cs:intflg,0
- ret
- prterr:
- cmp cs:reprintflg,0
- jne prtend
- mov errorno,ax
- mov dx,offset printmsg
- mov cx,prtmsgsiz
- mov ax,seg data
- mov ds,ax
- jmp abort
- ;
- dosprint endp
- ;
- headmargin proc
- ;
- mov ax,marginhead
- mov hmargin,ax
- test ax,ax
- marginloop:
- jz nohmargin
- mov cx,2
- mov dx,offset feedata
- call dosprint
- jnz nohmargin
- dec hmargin
- jmp marginloop
- nohmargin:
- ret
- ;
- headmargin endp
- ;
- feedprint proc
- ;
- cmp creturns,YES
- je rtnprcs
- mov ah,5
- mov dl,0ch
- int 21h
- ret
- rtnprcs:
- sub ax,lincnt
- neg ax
- add ax,filline
- mov crcount,ax
- cmp crcount,0
- feedloop:
- jz feedend
- mov cx,2
- mov dx,offset feedata
- call dosprint
- jnz feedend
- dec crcount
- jmp feedloop
- feedend:
- ret
- ;
- feedprint endp
- ;
- code ends
- end