home *** CD-ROM | disk | FTP | other *** search
- ;-------------------------------------------------------;
- ; ;
- ; Txt2Exe V4.00 ;
- ; - Bind.asm ╫╓┐Γ└ª░≤│╠╨≥ ;
- ; ;
- ; │╠╩╜╫≈╒▀:═⌠└±╚² ▒ú┴⌠╦∙╙╨░µ╚¿! 1995.7 ;
- ; ;
- ; ╥╘╧┬┤·┬δ╓╨╙╨╣╪░µ╚¿╡─╨┼╧ó▓╗╡├╨▐╕─,╥╘╧┬┤·┬δ▓╗╡├╙├ ;
- ; ╙┌╔╠╥╡─┐╡─íú ;
- ; ;
- ;-------------------------------------------------------;
-
- code segment
- assume cs:code,ds:code,es:code
-
- msgCopyright db 'Bind V1.04 (C)Copyright by LiSan Wang. '
- db '1995.7',0dH,0aH
- db 'All rights reserved.',0dH,0aH,0aH
- db 'link cclib file to Txt2Exe. '
- db 'Use with TXT2EXE only',0dH,0aH,0aH,0
- msgHelp db 'Usage: bind cclib_file exe_file[.exe]',0
- msgOpenError db ' open error.',0
- msgReadError db ' read error.',0
- msgWriteError db ' write error.',0
- msgIsNotT2E db ' is not a TXT2EXE file.',0
- msgMemError db 'Has not enough memory.',0
- msgWarning db 'Warning: rewrite '
- msgStrend db 0
-
- fnInput db 64 dup(0) ; ╩Σ╚δ╬─╝■├√
- fnOutput db 64 dup(0) ; ╩Σ│÷╬─╝■├√
-
- handleInput dw 0 ; ╩Σ╚δ╬─╝■╛Σ▒·
- handleOutput dw 0 ; ╩Σ│÷╬─╝■╛Σ▒·
-
- fileDate dw 0 ; ╬─╝■╚╒╞┌
- fileTime dw 0 ; ╬─╝■╩▒╝Σ
-
- segPsp dw 0 ; PSP╢╬╓╡
- segBuffer dw 0 ; ─┌▓┐╗║│σ╟°╢╬╓╡
-
- attrib dw 0 ; ╬─╝■╩⌠╨╘
- position db 32 dup(0) ; ╬─╝■═╖╗║│σ╟°
-
- ;-------------------------------------------------------;
- ; ╧╘╩╛╫╙│╠╨≥ ;
- ; ╚δ┐┌: bx ╬¬┤²╧╘╩╛╨┼╧ó╡─╞½╥╞┴┐ ;
- ; ╢»╫≈: ╜½bx╓╕╧≥╡─╥╘0H╜ß╬▓╡─╫╓╖√┤«╘┌╞┴─╗╔╧╧╘╩╛│÷ ;
- ; └┤ ;
- ;-------------------------------------------------------;
-
- disp proc near
- @ds0:
- mov al,cs:[bx]
- or al,al
- jz @ds1
- mov ah,0eH
- push bx
- mov bl,7
- int 10H
- pop bx
- inc bx
- jmp short @ds0
- @ds1:
- ret
- disp endp
-
- ;-------------------------------------------------------;
- ; │÷┤φ┤ª└φ╫╙│╠╨≥ ;
- ; ╚δ┐┌: bx ╬¬│÷┤φ╨┼╧ó╡─╞½╥╞┴┐ ;
- ; ╢»╫≈: ╜½bx╓╕╧≥╡─│÷┤φ╨┼╧ó╘┌╞┴─╗╔╧╧╘╩╛│÷└┤,╣╪▒╒ ;
- ; ╬─╝■,╩═╖┼╗║│σ╟°,╚╗║≤╖╡╗╪DOS ;
- ;-------------------------------------------------------;
-
- error proc near
- call near ptr disp
- cmp word ptr cs:segBuffer,0
- jz @e0
- mov ah,49H
- mov es,cs:segBuffer
- int 21H
- @e0:
- mov ax,4cffH
- int 21H
- error endp
-
- ;-------------------------------------------------------;
- ; ╣╪▒╒╬─╝■╫╙│╠╨≥ ;
- ; ╢»╫≈: ╣╪▒╒╦∙╙╨┤≥┐¬╡─╬─╝■ ;
- ;-------------------------------------------------------;
-
- close proc near
- cmp word ptr handleInput,0
- jz @c0
- mov ah,3eH
- mov bx,handleInput
- int 21H
- @c0:
- cmp word ptr handleOutput,0
- jz @c1
- mov ah,3eH
- mov bx,handleInput
- int 21H
- @c1:
- ret
- close endp
-
- ;-------------------------------------------------------;
- ; │⌡╩╝╗»╫╙│╠╨≥╓«╥╗ ;
- ; ╢»╫≈: ╖╓╬÷├ⁿ┴ε╨╨,▓ó╔Ω╟δ╗║│σ╟° ;
- ;-------------------------------------------------------;
-
- init0 proc near
- mov ax,cs
- mov es,ax
- mov bx,offset msgCopyright
- call near ptr disp
- cmp byte ptr ds:80H,2
- jae @i2
- @i1:
- mov bx,offset msgHelp
- call near ptr error
- @i2:
- cld
- mov si,81H
- mov di,offset fnInput
- @i3:
- lodsb
- cmp al,' '
- jz @i3
- cmp al,'/'
- jz @i1
- cmp al,'?'
- jz @i1
- @i4:
- cmp al,'/'
- jz @i5
- cmp al,0dH
- jz @i1
- cmp al,' '
- jz @i7
- stosb
- lodsb
- jmp short @i4
- @i5:
- lodsb
- cmp al,0dH
- jz @i1
- cmp al,' '
- jnz @i5
- @i7:
- lodsb
- cmp al,' '
- jz @i7
- dec si
- @i8:
- mov al,0
- stosb
- mov di,offset fnOutput
- @i9:
- lodsb
- cmp al,' '
- jz @i10
- cmp al,'/'
- jz @i10
- cmp al,0dH
- jnz @i11
- @i10:
- mov al,0
- @i11:
- stosb
- or al,al
- jnz @i9
- @i12:
- mov ax,cs
- mov ds,ax
- mov si,offset fnOutput
- mov di,si
- cmp byte ptr [si],0
- jnz @i13
- jmp @i1
- @i13:
- lodsb
- or al,al
- jnz @i14
- mov al,'.'
- @i14:
- stosb
- cmp al,'.'
- jnz @i13
- cmp byte ptr [si-2],'\'
- jnz @i15
- nop
- nop
- jmp @i1
- @i15:
- mov al,'e'
- stosb
- mov al,'x'
- stosb
- mov al,'e'
- stosb
- mov al,0
- stosb
-
- mov ah,4aH
- mov bx,zseg
- sub bx,segPsp
- mov es,segPsp
- int 21H
- mov ah,48H
- mov bx,1000H
- int 21H
- jnc @i16
- mov bx,offset msgMemError
- call near ptr error
- @i16:
- mov segBuffer,ax
- ret
- init0 endp
-
- ;-------------------------------------------------------;
- ; │⌡╩╝╗»╫╙│╠╨≥╓«╢■ ;
- ; ╢»╫≈: ╢╘╩Σ╚δíó╩Σ│÷╬─╝■╜°╨╨╘ñ┤ª└φ ;
- ;-------------------------------------------------------;
-
- init1 proc near
- mov ax,3d00H
- mov dx,offset fnInput
- int 21H
- jnc @r1
- mov bx,offset fnInput
- @r0:
- call near ptr disp
- mov bx,offset msgOpenError
- call near ptr error
- @r1:
- mov handleInput,ax
- mov ax,3d00H
- mov dx,offset fnOutput
- int 21H
- jnc @r3
- @r2:
- call near ptr close
- mov bx,offset fnOutput
- jmp @r0
- @r3:
- mov handleOutput,ax
- mov bx,ax
- mov ax,5700H
- int 21H
- mov fileDate,dx
- mov fileTime,cx
- mov ah,3fH
- mov bx,handleOutput
- mov cx,20H
- mov dx,offset position
- int 21H
- jnc @r5
- call near ptr close
- mov bx,offset fnOutput
- call near ptr disp
- mov bx,offset msgReadError
- call near ptr error
- @r5:
- cmp word ptr position+10H,0100H
- jz @r7
- call near ptr close
- mov bx,offset fnOutput
- call near ptr disp
- mov bx,offset msgIsNotT2E
- call near ptr error
- @r7:
- mov ax,4300H
- mov bx,handleOutput
- mov dx,offset fnOutput
- int 21H
- mov attrib,cx
- mov ax,4301H
- mov bx,handleOutput
- mov cx,0
- mov dx,offset fnOutput
- int 21H
- mov ax,word ptr position+4
- mov bx,512
- mov cx,word ptr position+2
- cmp cx,0
- jz @r9
- dec ax
- @r9:
- mul bx
- add ax,cx
- adc dx,0
- mov word ptr position,ax
- mov word ptr position+2,dx
- mov ah,3eH
- mov bx,handleOutput
- int 21H
- mov ax,3d01H
- mov dx,offset fnOutput
- int 21H
- jnc @r11
- jmp @r2
- @r11:
- mov handleOutput,ax
- mov bx,ax
- mov ax,4200H
- mov cx,word ptr position+2
- mov dx,word ptr position
- int 21H
- ret
- init1 endp
-
- ;-------------------------------------------------------;
- ; └ª░≤╫╙│╠╨≥ ;
- ; ╢»╫≈: ╜½╕°╢¿╡─╫╓─ú╬─╝■╛¡╫¬╗╗║≤╙δEXE╬─╝■└ª░≤╘┌ ;
- ; ╥╗╞≡ ;
- ;-------------------------------------------------------;
-
- ;-------------------------------------------------------;
- ; Bind.exe╢╘╡π╒≤╫╓┐Γ╬─╝■╙╨╥╗╢¿╡─╥¬╟≤:╩╫╧╚╩╟║║╫╓▒╪╨δ ;
- ; ┤╙01╟°╡╜88╟°┴¼╨°┤µ╖┼,╡½▓╗╥╗╢¿╖╟╥¬╡╜88╟°; ╞Σ┤╬╩╟├┐╕÷║║ ;
- ; ╫╓╡─32╫╓╜┌╡π╒≤╫╓─ú╩²╛▌▒╪╨δ╥╘╚τ╧┬╨╬╩╜┤µ╖┼: ;
- ; ;
- ; ╫≤░δ▓┐╖╓ ╙╥░δ▓┐╖╓ ;
- ; ;
- ; ╡┌0╫╓╜┌ ╡┌1╫╓╜┌ ;
- ; . . ;
- ; . . ;
- ; . . ;
- ; ╡┌30╫╓╜┌ ╡┌31╫╓╜┌ ;
- ; ;
- ; ╚τ╣√╡π╒≤╫╓┐Γ╬─╝■▓╗┬·╫π╥╘╔╧┴╜╕÷╠⌡╝■,╟δ╨▐╕─▒╛╫╙│╠╨≥ ;
- ; ;
- ; ╜≡╔╜SPDOS 6.0F╓╨╡─╝≥╨▌╡π╒≤╫╓┐Γ╬─╝■╚▒╔┘11í½14╟°,▓ó ;
- ; ╟╥╞Σ├┐╕÷║║╫╓╡─32╫╓╜┌╡π╒≤╫╓─ú╩²╛▌┤µ╖┼╨╬╩╜╚τ╧┬: ;
- ; ;
- ; ╫≤░δ▓┐╖╓ ╙╥░δ▓┐╖╓ ;
- ; ;
- ; ╡┌0╫╓╜┌ ╡┌16╫╓╜┌ ;
- ; . . ;
- ; . . ;
- ; . . ;
- ; ╡┌15╫╓╜┌ ╡┌31╫╓╜┌ ;
- ; ;
- ; ╥≥╢°▓╗─▄╓▒╜╙╙╔Bind.exe┤ª└φíú╜≡╔╜SPDOS 6.0F╓╨╡─╖▒ ;
- ; ╠σ╡π╒≤╫╓┐Γ╬─╝■╚▒╔┘1í½14╟°,╥▓▓╗─▄╓▒╜╙╙╔Bind.exe┤ª└φíú ;
- ; ;
- ; ╞Σ╦ⁿ║║╫╓╧╡═│╡─16╡π╒≤╧╘╩╛╫╓┐Γ╬─╝■╛°┤≤▓┐╖╓╢╝┐╔╥╘╙├ ;
- ; Bind.exe╓▒╜╙└ª░≤╡╜╓≈│╠╨≥╔╧╚Ñíú ;
- ; ;
- ; ╓╨╣·┴·ACIOSíó╧ú═√UCDOS╡╚╧╘╩╛╫╓┐Γ╬─╝■│ñ╢╚╬¬261696 ;
- ; ╫╓╜┌╡─║║╫╓╧╡═│,╫╓┐Γ╙δTXT2EXE╝µ╚▌ ;
- ; ;
- ; SPDOS 6.0F╡─╝≥╠σ╫╓┐Γ,╟δ░┤╥╘╧┬╫ó╩═╨▐╕─▒╛╘┤│╠╨≥ ;
- ; ╒δ╢╘CXDOS╡─╨▐╕─╬┤╛¡╡≈╩╘ ;
- ;-------------------------------------------------------;
-
- bind proc near
- push ds
- mov ds,segBuffer
- mov ax,ds
- mov es,ax
- cld
- @t1:
- mov bx,cs:handleInput
- mov ah,3fH
-
- ; ╧┬├µ╥╗╠⌡╓╕┴ε┐╔╥╘╕∙╛▌▓╗═¼╡─║║╫╓╧╡═│╜°╨╨╨▐╕─
- ; ╢╘ SPDOS 6.0F ╝≥╠σ╫╓┐Γ,╕─╬¬
- ; mov cx,10*94*32
- ; ╢╘ CXDOS ╕─╬¬(CXDOS╡─╦∙╙╨╕─╢»╛∙╬┤╛¡╡≈╩╘)
- ; mov cx,10*94*32
-
- mov cx,65536-64 ; ╒Γ╠⌡╓╕┴ε┐╔╥╘╚τ╔╧╨▐╕─
-
- mov dx,32
- int 21H
-
- ; ╢╘SPDOS 6.0F ╝≥╠σ╫╓┐Γ,▒Ω║┼í░@t2í▒╡╜í░@t6í▒╓«╝Σ╡─╓╕┴ε╚Ñ╡⌠
- ; ╢╘CXDOS, ▒Ω║┼í░@t2í▒╙δí░@t3í▒╓«╝Σ╡─┴╜╠⌡╓╕┴ε╚Ñ╡⌠(╬┤╛¡╡≈╩╘)
-
- @t2:
- cmp ax,0
- jz @t20
- @t3:
- mov dx,ax
- mov si,32
- mov di,0
- @t4:
- cmp si,dx
- ja @t6
- mov cx,16
- @t5:
- lodsw
- mov es:[di],al
- mov es:[di+16],ah
- inc di
- loop @t5
- add di,16
- jmp @t4
- @t6:
- mov ah,40H
- mov bx,cs:handleOutput
- mov cx,dx
- mov dx,0
- int 21H
-
- ; ╢╘SPDOS 6.0F╝≥╠σ╫╓┐Γ,╧┬├µ╥╗╠⌡╓╕┴ε╚Ñ╡⌠
- ; ╢╘CXDOS,╧┬├µ╥╗╠⌡╓╕┴ε╚Ñ╡⌠
-
- jmp @t1
- @t20:
- pop ds
- mov ax,4301H
- mov bx,handleOutput
- mov cx,attrib
- mov dx,offset fnOutput
- int 21H
- mov ax,5701H
- mov bx,handleOutput
- mov cx,fileTime
- mov dx,fileDate
- int 21H
- call near ptr close
- ret
- bind endp
-
- ;-------------------------------------------------------;
- ; ╓≈│╠╨≥ ;
- ;-------------------------------------------------------;
-
- start:
- mov ax,ds
- mov ss,ax
- mov sp,100H ; ╔Φ╓├╢╤╒╗
- mov cs:segPsp,ax
- call near ptr init0 ; │⌡╩╝╗»
- call near ptr init1
- call near ptr bind ; ╫╓─ú╫¬╗╗╙δ└ª░≤
- mov bx,offset msgWarning ; ╧╘╩╛╨┼╧ó
- call near ptr disp
- mov bx,offset fnOutput ; ═╦│÷
- call near ptr error
-
- code ends
-
- zseg segment
- zseg ends
-
- end start