Category : Utilities for DOS and Windows Machines
Archive   : ISH.ZIP
Filename : ISH110A.ASM

 
Output of file : ISH110A.ASM contained in archive : ISH.ZIP
;
; ish file converter for MS-DOS Ver 1.10a (86/12/19)
;
; Copyright (c) 1986 by M. ishizuka
; All rights reserved.
;
;
; Usage: A>ish [{/r|/a|/s [{8|7|s}]|/o}] [/m [path]] [/c [path]]
; [/9 [path]] [/? [path]] [/* [path]] [/l] [{/n|/e}]
;
; Caution: /l is a dummy switch for compatibility
; of old versions.
;
;
default_mode equ 'r'
default_bit_length equ '8'
;
;
;
ext macro para1,para2 ; ext dl, for V30
ifidn ,

if para2 le 15d
db 0fh,3bh,0c2h
db para2
exitm
endif
endif
if2
%out *** error in ext ***
endif
nop
nop
nop
nop
endm

ins macro para1,para2 ; ins dl, for V30
ifidn ,

if para2 le 15d
db 0fh,39h,0c2h
db para2
exitm
endif
endif
if2
%out *** error in ins ***
endif
nop
nop
nop
nop
endm
;
;
cseg segment word
assume cs:cseg,ds:cseg,es:cseg,ss:cseg

org 100h
start: mov ah,9h
mov dx,offset msg_start
int 21h
cmp sp,offset end_of_stack
jnb skip_0_0
error_10: mov al,10d
jmp error
;
skip_0_0: mov sp,offset end_of_stack
mov cx,33d
mov ax,1
rcr ax,cl
jc skip_0_1 ; if 80186 or 80286 then skip_0_1
push cs
db 0fh,11h,0c0h
cmp sp,offset end_of_stack
jz skip_0_1 ; if 8086 then skip_0_1
jmp skip_0_2 ; if V30 then skip_0_2
;
skip_0_1: mov ax,offset emulate_ext_dl_5
mov address_emu_ext_dl_5,ax
mov ax,offset emulate_ext_dl_6
mov address_emu_ext_dl_6,ax
mov ax,offset emulate_ext_dl_12
mov address_emu_ext_dl_12,ax
mov ax,offset emulate_ext_dl_14
mov address_emu_ext_dl_14,ax
mov ax,offset emulate_ins_dl_5
mov address_emu_ins_dl_5,ax
mov ax,offset emulate_ins_dl_6
mov address_emu_ins_dl_6,ax
mov ax,offset emulate_ins_dl_12
mov address_emu_ins_dl_12,ax
mov ax,offset emulate_ins_dl_14
mov address_emu_ins_dl_14,ax
mov ax,16ffh ; call [xxxx]
mov word ptr ext_dl_5_1,ax
mov word ptr ext_dl_6_1,ax
mov word ptr ext_dl_6_2,ax
mov word ptr ext_dl_6_3,ax
mov word ptr ext_dl_12_1,ax
mov word ptr ext_dl_14_1,ax
mov word ptr ins_dl_5_1,ax
mov word ptr ins_dl_6_1,ax
mov word ptr ins_dl_6_2,ax
mov word ptr ins_dl_5_2,ax
mov word ptr ins_dl_6_4,ax
mov word ptr ins_dl_6_5,ax
mov word ptr ins_dl_12_1,ax
mov word ptr ins_dl_14_1,ax
mov ax,offset address_emu_ext_dl_5
mov word ptr ext_dl_5_1[2],ax
mov ax,offset address_emu_ext_dl_6
mov word ptr ext_dl_6_1[2],ax
mov word ptr ext_dl_6_2[2],ax
mov word ptr ext_dl_6_3[2],ax
mov ax,offset address_emu_ext_dl_12
mov word ptr ext_dl_12_1[2],ax
mov ax,offset address_emu_ext_dl_14
mov word ptr ext_dl_14_1[2],ax
mov ax,offset address_emu_ins_dl_5
mov word ptr ins_dl_5_1[2],ax
mov word ptr ins_dl_5_2[2],ax
mov ax,offset address_emu_ins_dl_6
mov word ptr ins_dl_6_1[2],ax
mov word ptr ins_dl_6_2[2],ax
mov word ptr ins_dl_6_4[2],ax
mov word ptr ins_dl_6_5[2],ax
mov ax,offset address_emu_ins_dl_12
mov word ptr ins_dl_12_1[2],ax
mov ax,offset address_emu_ins_dl_14
mov word ptr ins_dl_14_1[2],ax

skip_0_2: mov sp,offset end_of_stack
mov ax,3700h
int 21h
cld
mov si,81h
call skip_space
push si
parse_file_name:
mov bx,si
skip_file_name: lodsb
cmp al,0dh
jz skip_1_4
cmp al,dl
jz skip_1_4
cmp al,9h
jz skip_1_4
cmp al,20h
jz skip_1_4
cmp al,'/'
jz parse_file_name
cmp al,'\'
jz parse_file_name
cmp al,':'
jz parse_file_name
cmp al,81h
jc skip_file_name
cmp al,0a0h
jb skip_1_1
cmp al,0e0h
jb skip_file_name
cmp al,0fdh
jb skip_1_3
jmp short skip_file_name

skip_1_1: cmp al,81h
jnz skip_1_3
cmp byte ptr [si],40h
jz skip_1_4
skip_1_3: lodsb
jmp short skip_file_name

skip_1_4: push bx
dec si
mov di,si
skip_76: call skip_space
cmp al,dl
jnz skip_48_1
lodsb
call skip_space
lodsb
cmp al,'A'
jb skip_1_5
cmp al,'Z'+1
jnb skip_1_5
add al,20h
skip_1_5: cmp al,'r'
jz skip_1_6
cmp al,'a'
jz skip_1_6
cmp al,'s'
jz skip_1_6_1
cmp al,'o'
jz skip_1_6
xor bl,bl
cmp al,'m'
jz skip_74
inc bl
cmp al,'c'
jz skip_74
inc bl
cmp al,'9'
jz skip_74
inc bl
cmp al,'?'
jz skip_74
inc bl
cmp al,'*'
jz skip_74
cmp al,'l'
jz skip_76 ; /l is a dummy switch.
cmp al,'e'
jz skip_56
cmp al,'n'
jz skip_56
;
error_1: mov al,1
jmp error
;
skip_48_1: jmp skip_48
;
skip_56: xchg al,n_flag
skip_49: or al,al
jnz error_1
jmp short skip_76
;
skip_1_6_1: call skip_space
cmp al,dl
jz skip_1_6_2
cmp al,0dh
jz skip_1_6_2
lodsb
or al,20h
cmp al,'s'
jz skip_1_6
cmp al,'7'
jc error_1
cmp al,'9'
jnc error_1
jmp short skip_1_6
;
skip_1_6_2: mov al,default_bit_length
skip_1_6: xchg al,mode
jmp short skip_49
;
skip_74: mov al,129
mul bl
add ax,offset msdos_path
xchg ax,bx
mov al,0ffh
xchg [bx],al
or al,al
jnz error_1
call skip_space
push di
inc bx
mov di,bx
copy_path: lodsb
cmp al,0dh
jz skip_50
cmp al,dl
jz skip_50
cmp al,9
jz skip_50
cmp al,20h
jz skip_50
cmp al,81h
jc skip_51
cmp al,0a0h
jc skip_52
cmp al,0e0h
jc skip_51
cmp al,0fdh
jc skip_53
skip_51: stosb
jmp short copy_path

skip_52: cmp al,81h
jnz skip_53
cmp byte ptr [si],40h
jz skip_50
skip_53: stosb
movsb
mov byte ptr [di],'\'
jmp short copy_path
;
skip_50: dec si
inc di
inc di
get_tail: dec di
mov al,[di]
or al,al
jz get_tail
cmp al,'\'
jz skip_55
cmp al,'/'
jz skip_55
cmp al,':'
jz skip_55_1
cmp word ptr [di-1],0ff00h
jz skip_91_1
jmp short skip_90_1
;
skip_55_1: mov byte ptr [di+1],'$'
skip_55_2: cmp word ptr [di-3],0ff00h
jnz error_15
push dx
mov dl,[di-1]
or dl,20h
sub dl,60h
jz error_15
push si
push di
mov ah,36h
int 21h
pop di
pop si
pop dx
inc ax
jz error_15
skip_55_3: inc di
cmp byte ptr [di],'$'
jnz skip_55_3
mov byte ptr [di],0
jmp short skip_91_1
;
skip_55: mov ax,[di-2]
cmp ax,0ff00h
jz skip_91_1
mov byte ptr [di+1],'$'
dec di
cmp ah,':'
jz skip_55_2
skip_90_1: inc di
mov word ptr [di],0
push di
push si
push dx
mov dx,bx
mov ax,3d00h
int 21h
pop dx
pop si
pop di
mov byte ptr [di],'$'
jnc error_15
cmp ax,5
jnz error_15
mov byte ptr [di],'\'
skip_91_1: pop di
jmp skip_76
;
error_15: mov ah,9
mov dx,offset msg_error_15_1
int 21h
mov ah,9
mov dx,bx
int 21h
mov al,15d
jmp error
;
error_1_1: jmp error_1
;
skip_48: sub al,0dh
jz skip_1_7
;
error_2: mov al,2
jmp error
;
skip_1_7: pop bx
pop dx
push bx
push dx
cmp dx,di
jz error_2
stosb
mov al,mode
or al,al
jnz skip_57
mov al,default_mode
mov mode,al
skip_57: cmp al,'a'
jz skip_58
cmp al,'r'
jz skip_58
mov bx,offset msdos_path
mov cx,5
check_os_1: cmp byte ptr [bx],0
jz skip_60
cmp byte ptr os,0
jnz error_1_1
mov os,cl
skip_60: add bx,129d
loop check_os_1
cmp byte ptr os,0
mov al,'\'
jz skip_59_0
jmp short skip_59
;
skip_58: cmp byte ptr n_flag,0
jnz error_1_1
mov al,msdos_path
or al,cpm_path
or al,os9_path
or al,other_os_path
or al,all_os_path
jnz skip_59
mov al,'\'
mov all_os_path,al
skip_59_0: mov msdos_path,al
skip_59: mov ah,9h
mov dx,offset msg_start2
int 21h
mov al,mode
mov dx,offset msg_restore
cmp al,'r'
jz skip_1_8
mov dx,offset msg_all
cmp al,'a'
jz skip_1_8
mov dx,offset msg_store_8
cmp al,'8'
jz skip_1_8
mov dx,offset msg_store_7
cmp al,'7'
jz skip_1_8
mov dx,offset msg_store_s
cmp al,'s'
jz skip_1_8
mov dx,offset msg_old_style
skip_1_8: mov ah,9h
int 21h
mov dx,offset m_
cmp byte ptr msdos_path,0
jz skip_62
mov ah,9
int 21h
skip_62: mov dx,offset c_
cmp byte ptr cpm_path,0
jz skip_63
mov ah,9
int 21h
skip_63: mov dx,offset os9_
cmp byte ptr os9_path,0
jz skip_63_1
mov ah,9
int 21h
skip_63_1: mov dx,offset question_
cmp byte ptr other_os_path,0
jz skip_64
mov ah,9
int 21h
skip_64: mov dx,offset aster_
cmp byte ptr all_os_path,0
jz skip_65
mov ah,9
int 21h
skip_65: mov dx,offset msg_
mov ah,9
int 21h
pop dx
mov ax,3d00h
int 21h ; open input_file
jnc skip_4
;
cmp al,2
jnz error_4
error_3: mov al,3
jmp error
;
error_4: mov al,4
jmp error

skip_4: mov read_handler,ax
mov bx,ax
mov ax,4202h
xor cx,cx
xor dx,dx
push bx
push cx
int 21h ; get input_file size
jc error_5
pop cx
pop bx
mov word ptr work_table[2],ax
mov word ptr work_table[4],dx
cmp ax,2
jnc skip_4_1
or dx,dx
jnz skip_4_1

error_6: mov al,6
jmp error

skip_4_1: mov ax,4200h
xor dx,dx
int 21h ; move file pointer (rewind)
jc error_5
cmp mode,'r'
jz make_hsi_0
cmp mode,'a'
jnz make_ish
make_hsi_0: jmp make_hsi

make_ish: mov di,offset write_buffer
mov si,offset msg_esc
mov cx,5d
cmp byte ptr n_flag,'e'
jz skip_61
mov si,offset msg_non_esc
dec cx
skip_61: rep movsb
pop si
push si
skip_5_1: lodsb
or al,al
jz skip_5_2
stosb
jmp short skip_5_1

error_5: mov al,5
jmp error
;
skip_5_2: mov al,os
mov si,offset msg_all_os
mov cx,12d
dec al
jz skip_67
dec al
jz skip_68
mov si,offset msg_os9
mov cx,9d
dec al
jz skip_67
mov si,offset msg_cpm
mov cx,24d
dec al
jz skip_67
mov si,offset msg_ms_dos
mov cx,11d
skip_67: rep movsb
skip_68: mov si,offset msg_use_ish
mov cx,11d
rep movsb
pop si
push di
push si
mov di,offset work_table
mov ax,0 ; SEQ#(al) : 0
; TYPE(ah) : 0
; error_line_detect : ccitt_crc
; correct method : ÀÃ_sum & ÅÅÒ_sum
; total_error_detect : ccitt_crc
stosw
add di,4
cmp mode,'7'
jz skip_89
cmp mode,'s'
jz skip_89_1
; JIS8
mov ax,69d ; number of character / line
stosw ; (include SEQ# and CRC)
mov ax,68d ; number of line / block
stosw ; (include check sum)
mov ax,808h ; source file (al) : 8-bits
stosw ; ish file (ah) : 8-bits
mov si,offset parameter_jis8
jmp short skip_90
;
skip_89: ; JIS7
mov ax,63d ; number of character / line
stosw ; (include SEQ# and CRC)
mov ax,62d ; number of line / block
stosw ; (include check sum)
mov ax,0d10h ; source file (al) : 16-bits
stosw ; ish file (ah) : 13-bits
mov si,offset parameter_jis7
jmp short skip_90
;
skip_89_1: ; shift JIS
mov ax,73d ; number of character / line
stosw ; (include SEQ# and CRC)
mov ax,72d ; number of line / block
stosw ; (include check sum)
mov ax,0f10h ; source file (al) : 16-bits
stosw ; ish file (ah) : 15-bits
mov si,offset parameter_sjis

skip_90: push di
mov di,offset para_81_80
mov cx,24d
rep movsw
pop di
pop si
push si
push di
mov ax,2900h
mov di,offset work_fcb
int 21h ; parse file name
or al,al
jz skip_6

error_7: mov al,7
jmp error

error_5_1: jmp error_5

skip_6: mov si,di
pop di
mov cx,11d
inc si
rep movsb
mov al,os
mov ah,0ffh ; all OSs
dec al
jz skip_70
dec ah ; other OSs
dec al
jz skip_70
mov ah,20h ; OS-9
dec al
jz skip_70
mov ah,10h ; CP/M
dec al
jz skip_70
xor ah,ah ; MS-DOS
skip_70: xor al,al ; genre(¼Þ¬ÝÙ) : 0 (not defined)
; (1-255:for automatic genre selection)
stosw ; machine (ah)
mov ax,100h
cmp mode,'o'
jz skip_6_1
inc al ; auxiliary type (al) : 1
; ( 0 : old version )
skip_6_1: stosw ; time stamp is available (ah) : 1
; ( 0 : unavailable )
mov ax,5700h
mov bx,read_handler
int 21h
jb error_5_1
mov ax,cx ; time
stosw
mov ax,dx ; date
stosw
mov cx,para_18_15 ; clear reserved area
xor ax,ax
rep stosw
mov si,offset work_fcb+9d
mov di,offset arc_data
mov cx,3
repz cmpsb
pop si
pop di
push si

mov si,offset msg_ms_dos2
mov cx,6d
jnz skip_5_3
rep movsb
skip_5_3: mov si,offset msg_ms_dos3
mov cx,offset end_msg_ms_dos3 - offset msg_ms_dos3
cmp byte ptr n_flag,'e'
jz skip_69
mov si,offset msg_non_esc2
mov cx,7d
skip_69: rep movsb

pop si
push di
push si
skip_6_2: lodsb
or al,al
jz skip_7
cmp al,'.'
jnz skip_6_2
lodsb
cmp al,'.'
jz skip_6_2
skip_6_3: dec si
skip_7: dec si
mov di,si
mov si,offset ish_data
mov cx,5
rep movsb
mov di,offset work_fcb_2
mov dx,di
mov al,os
mov si,offset all_os_path + 1
dec al
jz skip_86
mov si,offset other_os_path + 1
dec al
jz skip_86
mov si,offset os9_path + 1
dec al
jz skip_86
mov si,offset cpm_path + 1
dec al
jz skip_86
mov si,offset msdos_path +1
skip_86: lodsb
or al,al
jz skip_87
stosb
jmp short skip_86
;
skip_87: pop si
skip_88: lodsb
stosb
or al,al
jnz skip_88
push dx
mov ax,3d00h
int 21h ; output_file already exist ?
jb skip_8

error_8: mov al,8
jmp error

skip_8: cmp ax,2
jnz error_8
mov ax,3c00h
pop dx
xor cx,cx
int 21h ; create output_file
jc error_8
mov write_handler,ax
pop cx
sub cx,offset write_buffer
call write
mov si,offset work_table
mov dx,offset ccitt_crc
mov cx,para_65_59_65
push si
lodsw
not ax
xchg ah,al
mov bx,ax
crc_1_1: lodsb
push cx
mov cx,8h
crc_1_2: shl al,1
rcl bx,1
jnb skip_9
xor bx,dx
skip_9: loop crc_1_2
pop cx
loop crc_1_1
mov cx,10h
crc_1_3: shl bx,1
jnb skip_10
xor bx,dx
skip_10: loop crc_1_3
not bx
xchg bh,bl
mov [si],bx
pop si
mov di,offset write_buffer
mov bx,offset encode_table
push di
call word ptr encode_sub1
mov ax,offset cr_lf
stosw
pop si
mov cx,para_81_80_81
rep movsw
mov cx,para_81$3_80$3_81$3
call write
;
ish_main:
mov dx,offset read_buffer
mov cx,para_66$66_60$60
mov bx,read_handler
mov ah,3fh
int 21h
jnc skip_11

jmp error_5

skip_13_2: mov cx,para_66$66@1_60$60@1
mov di,si
mov al,bl
stosb
jmp short skip_13_3

skip_11: mov cx,ax
xchg read_length,ax
mov si,offset read_buffer
mov dx,offset ccitt_crc
mov bx,para_66$66_60$60_read_buffer
mov bx,[bx]
cmp ax,para_66$66?1_60$60?1
jz skip_13_2
inc ax
jnz skip_12
lodsw
not ax
mov bx,ax
sub cx,2
skip_12: xchg bh,bl
jcxz skip_13_1
crc_2_1: lodsb
push cx
mov cx,8
crc_2_2: shl al,1
rcl bx,1
jnc skip_13
xor bx,dx
skip_13: loop crc_2_2
pop cx
loop crc_2_1
skip_13_1: mov cx,para_66$66_60$60_read_buffer
sub cx,si
mov ax,bx
jz skip_15
push cx
mov cx,10h
crc_2_3: shl ax,1
jnc skip_14
xor ax,dx
skip_14: loop crc_2_3
pop cx
not ax
skip_15: mov di,si
xchg ah,al
stosw
skip_13_3: xor ax,ax
rep stosb
mov si,offset read_buffer
mov di,offset work_table
mov al,1
make_table: stosb
inc al
push ax
mov cx,para_66_60
rep movsb
add di,2
pop ax
cmp al,byte ptr para_67_61
jb make_table
mov si,offset work_table + 1
mov cx,para_66_60
stosb
make_sum1_1: push cx
lodsb
push si
dec si
mov cx,para_65_59
make_sum1_2: add si,para_69_63
add al,[si]
loop make_sum1_2
neg al
stosb
pop si
pop cx
loop make_sum1_1

mov cx,para_67_61
add di,2
mov al,byte ptr para_68_62
stosb
mov si,offset work_table
xor bx,bx
make_sum2_1: push si
push bx
push cx
xor al,al
mov cx,para_67_61
make_sum2_2: add al,[bx+si]
add si,para_69_63
inc bx
cmp bx,para_67_61
jb skip_16
xor bx,bx
skip_16: loop make_sum2_2
neg al
stosb
pop cx
pop bx
pop si
inc bx
loop make_sum2_1

mov si,offset work_table
mov dx,offset ccitt_crc
mov cx,para_68_62
crc_3_1: push cx
cmp cx,1
mov cx,para_65_59
jnz skip_17
cmp mode,'o'
jz skip_16_1
inc byte ptr [si]
jmp short skip_17

skip_16_1: inc cx
skip_17: lodsw
not ax
xchg ah,al
mov bx,ax
crc_3_2: push cx

lodsb
mov cx,8
crc_3_3: shl al,1
rcl bx,1
jnc skip_18
xor bx,dx
skip_18: loop crc_3_3
pop cx
loop crc_3_2
mov cx,10h
crc_3_4: shl bx,1
jnc skip_19
xor bx,dx
skip_19: loop crc_3_4
not bx
xchg bh,bl
mov [si],bx
lodsw
pop cx
loop crc_3_1

mov si,offset work_table
mov di,offset write_buffer
mov cx,para_68_62
mov bx,offset encode_table
convert_7to8_1: push cx
cmp cx,1
jnz convert_7to8_2
cmp mode,'o'
jnz convert_7to8_2
call encode_7bit_old
jmp short convert_7to8_3
;
convert_7to8_2: call word ptr encode_sub2
convert_7to8_3: pop cx
mov ax,offset cr_lf
stosw
loop convert_7to8_1

mov ax,read_length
cmp ax,para_66$66?1_60$60?1
jnc skip_21
add ax,2
skip_21: add ax,para_65_59
mov bl,byte ptr para_66_60
div bl
mov bl,byte ptr para_81_80
mul bl
mov di,offset write_buffer
add di,ax
mov si,para_81$66_80$60_write_buffer
mov cx,para_81$2_80$2
cmp mode,'o'
jnz skip_21_1
inc cx
skip_21_1: add ax,cx
rep movsb
mov cx,ax
call write
mov ax,read_length
cmp ax,para_66$66?1_60$60?1
jb skip_22
jmp ish_main
;
skip_22: mov bx,write_handler
mov ah,3eh
int 21h
jc error_9
mov bx,read_handler
mov ah,3eh
int 21h
jnc skip_22_1
jmp error_5

skip_22_1: mov dx,offset msg_normal_end
mov ah,9
int 21h
end_hsi: mov ax,4c00h
int 21h
;
; ***** end of make_ish *****
;

write: mov dx,offset write_buffer
mov bx,write_handler
mov ah,40h
push cx
int 21h
jnc skip_23

error_9: mov al,9
jmp error

skip_23: pop cx
cmp ax,cx
jnz error_9
ret

skip_this_file: mov dx,offset msg_skip
mov ah,9h
int 21h
jmp short make_hsi_1

make_hsi: mov word ptr work_work2,0ffffh
make_hsi_1: mov sp,offset end_of_stack
mov word ptr end_length,0
mov byte ptr flag,0ffh
search_seq0_1: mov byte ptr type_flag,0
call get_frame
jc end_hsi
mov si,offset work_work
mov di,offset work_work2
mov cx,63d
repz cmpsb
jz search_seq0_1
skip_29_2_0: mov cx,63d
mov si,offset work_work
mov di,offset work_work2
rep movsb
skip_29_2: mov si,offset work_work + 12d
mov di,offset work_fcb
push di
mov cx,4
rep movsw
mov al,'.'
stosb
mov cx,3
rep movsb
xor al,al
stosb
mov flag2,al
add si,3
mov di,offset flag3
mov cx,5
rep movsb
mov ax,line_number_low
mov dx,line_number_high
call disp_number
pop si
call disp_file_name
mov dl,'('
mov ah,2
int 21h
mov al,work_work + 25d
mov old_style,al
mov al,work_work + 24d
mov dl,'m'
cmp al,10h
jc skip_71
mov dl,'c'
cmp al,20h
jc skip_71
mov dl,'9'
cmp al,30h
jc skip_71
mov dl,'?'
cmp al,0ffh
jc skip_71
mov dl,'*'
skip_71: mov ah,2
int 21h
mov dl,')'
mov ah,2
int 21h
mov dx,offset msg_colon
mov ah,9
int 21h
mov si,offset work_work
lodsw
or ax,ax
jnz error_12_1
mov ax,[si+8]
push si
mov si,offset parameter_jis8
mov cl,'8'
cmp ax,808h
jz check_header
mov si,offset parameter_sjis
mov cl,'s'
cmp ax,0f10h
jz check_header
mov si,offset parameter_jis7
mov cl,'7'
cmp ax,0d10h
error_12_1: jnz error_12
check_header: mov type_flag,cl
mov di,offset para_81_80
mov cx,24d
rep movsw
pop si
lodsw
add ax,para_67_61
mov length_low,ax
lodsw
jnc skip_29_1
inc ax
skip_29_1: mov length_high,ax
lodsw
cmp ax,para_69_63
jnz error_12
lodsw
cmp ax,para_68_62
jnz error_12
skip_29_5: mov al,work_work + 24d
mov bx,offset msdos_path
cmp al,10h
jc skip_72
mov bx,offset cpm_path
cmp al,20h
jc skip_72
mov bx,offset os9_path
cmp al,30h
jc skip_72
mov bx,offset other_os_path
cmp al,0ffh
jc skip_72
mov bx,offset all_os_path
skip_72: cmp byte ptr [bx],0
jz skip_73
mov si,bx
inc si
mov dx,offset work_fcb_2
mov di,dx
fname_copy: lodsb
or al,al
jz skip_66
stosb
jmp short fname_copy

error_12: mov al,12d
call error
jmp skip_this_file
;
skip_73: mov dx,offset msg_other_os
mov ah,9
int 21h
jmp skip_this_file
;
skip_66: mov si,offset work_fcb
mov cx,13d
rep movsb
mov ax,3d00h
int 21h
jb skip_30
mov bx,ax
mov ah,3eh
int 21h
cmp mode,'a'
jnz skip_29_3

skip_29_8: cmp flag2,0
jnz skip_29_6
mov si,offset temp_file
mov di,offset work_fcb
mov cx,12d/2
mov flag2,cl
rep movsw
skip_29_5_1: jmp short skip_29_5

skip_29_6: mov si,offset work_fcb + 11
mov di,si
std
mov cx,3
skip_29_4: lodsb
inc al
cmp al,'9'+1
jnz skip_29_7
mov al,'0'
skip_29_7: stosb
loopz skip_29_4
cld
jnz skip_29_5_1
jmp short error_11
;
skip_29_3: mov dx,offset msg_file_already_exist
mov ah,9h
int 21h
jmp skip_this_file
;
skip_30: cmp ax,2
jnz error_8or11
skip_30_1: mov ax,3c00h
mov dx,offset work_fcb_2
xor cx,cx
int 21h
jnc skip_30_2

error_8or11: cmp al,5
jnz error_8_1
cmp mode,'a'
jz skip_29_8
error_11: mov al,11
call error
jmp skip_this_file

error_8_1: jmp error_8

skip_47: mov al,0ffh
jmp short skip_46
;
skip_30_2: mov write_handler,ax
;
cmp flag2,0
jz search_seq_0_0
mov ah,9
mov dx,offset msg_gt
int 21h
mov si,offset work_fcb
call disp_file_name
mov dx,offset msg_colon
mov ah,9
int 21h
;
search_seq_0_0: mov byte ptr seq_old,0
mov byte ptr error_count,0
search_seq_0: mov ax,line_number_low
mov line_save_low,ax
mov ax,line_number_high
mov line_save_high,ax
call get_frame
jc skip_47
mov si,offset work_work
lodsb
skip_46: cmp al,seq_old
jnz skip_46_2
or al,al
jnz search_seq_0
push si
push di
mov si,offset work_work
mov di,offset work_work2
mov cx,63d
repz cmpsb
pop di
pop si
jz search_seq_0
skip_46_2: cmp al,byte ptr para_69_63
jnz search_seq_3
mov cx,para_66_60
mov ah,0 - (offset sum_1_to_67)
cmp byte ptr type_flag,'8'
jz skip_46_1
mov ah,0 - (offset sum_1_to_71)
cmp byte ptr type_flag,'s'
jz skip_46_1
mov ah,0 - (offset sum_1_to_61)
skip_46_1: lodsb
sub ah,al
loop skip_46_1
mov [si],ah
mov al,byte ptr para_68_62
search_seq_3: call seq_new
cmp al,seq_old
jnz skip_84
jmp skip_35

skip_84: mov ah,error_count
mov bl,ah
add bl,bl
add bl,bl
add bl,ah
xor bh,bh
add bx,offset error_seq
inc ah
mov error_count,ah
cmp ah,3
mov ah,seq_old
mov byte ptr [bx],ah
pushf
push ax
mov ax,line_save_low
inc ax
cmp ax,10000d
jnz skip_82
inc line_save_high
xor ax,ax
skip_82: mov line_save_low,ax
mov word ptr [bx+1],ax
mov ax,line_save_high
mov word ptr [bx+3],ax
pop ax
popf
jb search_seq_3
;
error_14: push ax
mov al,14d
call error
mov ah,9
mov dx,offset msg_err_dsp
int 21h
mov cx,3
mov bx,offset error_seq
disp_err: mov ax,[bx+1]
mov dx,[bx+3]
call disp_number
mov ah,9
mov dx,offset msg_br3
push cx
push bx
int 21h
pop bx
push bx
mov al,[bx]
cmp byte ptr type_flag,'7'
jz skip_81_2
mov bx,offset encode_table
cmp al,byte ptr para_68_62
jnz skip_81
add al,old_style
skip_81: xlat
skip_81_1: mov dl,al
mov ah,2
int 21h
mov dx,offset msg_br4
mov ah,9
int 21h
pop bx
pop cx
add bx,5
loop disp_err
mov ah,9
mov dx,offset msg_crlf
int 21h
pop ax
skip_44_2: or al,al
jnz skip_34_1
mov sp,offset end_of_stack
mov word ptr end_length,0
mov byte ptr flag,0ffh
jmp skip_29_2_0
;
skip_81_2: add al,21h
cmp al,'#'
jc skip_81_1
inc al
cmp al,'.'
jc skip_81_1
inc al
cmp al,60h
jc skip_81_1
inc al
jmp short skip_81_1
;
skip_34_1: jmp make_hsi
;
skip_45:
;
skip_35: mov cx,para_69_63
mov si,offset work_work
mov di,offset work_table
cmp al,byte ptr para_68_62
jnz skip_35_2
inc si
skip_35_2: dec ax
mul cl
add di,ax
rep movsb
jmp search_seq_0
;
skip_39_2: jmp skip_39
;
chk_table: mov al,error_count
push ax
add al,30h
cmp al,30h
jnz skip_35_1
mov al,'o'
skip_35_1: mov dl,al
mov ah,2
int 21h
pop ax
or al,al
jz skip_39_2
dec al
jz skip_38_1
mov al,error_seq[5]
cmp al,byte ptr para_68_62
skip_38_1: jz skip_38
mov si,offset work_table
mov dl,al
dec al
mov dh,byte ptr para_69_63
mul dh
add ax,si
mov word ptr line2,ax
mov al,error_seq
push ax
sub dl,al
dec al
mul dh
add si,ax
mov word ptr line1,si
pop ax
mov [si],al
xor dh,dh
mov cx,para_67_61
xor bx,bx
chk_table_0: push cx
push si
xor al,al
mov cx,para_68_62
chk_table_1: add al,[si+bx]
add si,para_69_63
cmp si,para_69$68_63$62_work_table
jb skip_36
sub si,para_69$68_63$62
dec bx
skip_36: inc bx
cmp bx,para_67_61
jb skip_37
xor bx,bx
skip_37: loop chk_table_1
add bx,dx
cmp bx,para_67_61
jb chk_table_2_1
sub bx,para_67_61
chk_table_2_1: sub [bx][8000h],al
line2 equ $-2
xor al,al
mov cx,para_67_61
mov si,offset work_table
chk_table_2: add al,[si+bx]
add si,para_69_63
loop chk_table_2
sub [bx][8000h],al
line1 equ $-2
pop si
pop cx
loop chk_table_0
skip_39_1: jmp short skip_39
;
skip_38: mov si,offset work_table +1
mov al,error_seq
dec al
mov ah,byte ptr para_69_63
mul ah
mov word ptr line3,ax
mov cx,para_66_60
chk_table_3: push cx
xor bx,bx
mov cx,para_67_61
xor al,al
chk_table_4: add al,[si+bx]
add bx,para_69_63
loop chk_table_4
sub [si][8000h],al
line3 equ $-2
inc si
pop cx
loop chk_table_3
;
skip_39: mov cx,para_66_60
mov si,offset work_table + 1
mov di,offset write_buffer
chk_table_5: push cx
mov cx,para_33_30
rep movsw
add si,3
pop cx
loop chk_table_5
mov si,offset write_buffer
mov cx,end_length
or cx,cx
jnz skip_40
mov cx,para_66$66_60$60
skip_40: mov bx,crc
mov dx,offset ccitt_crc
mov si,offset write_buffer
mov al,flag
or al,al
jz crc_5_1
sub flag,al
lodsw
not ax
xchg ah,al
mov bx,ax
sub cx,2
crc_5_1: lodsb
push cx
mov cx,8
crc_5_2: shl al,1
rcl bx,1
jnc skip_41
xor bx,dx
skip_41: loop crc_5_2
pop cx
loop crc_5_1
mov cx,para_66$66@2_60$60@2
cmp word ptr end_length,0
jz skip_43
mov cx,10h
crc_5_3: shl bx,1
jnc skip_42
xor bx,dx
skip_42: loop crc_5_3
mov cx,end_length
cmp bx,offset ccitt_crc_check
jz skip_43

mov al,13d
call error
jmp make_hsi

skip_43_3: mov ax,4201h
xor cx,cx
xor dx,dx
mov bx,write_handler
push bx
int 21h
jc skip_43_4
sub ax,1
sbb dx,0
mov cx,dx
mov dx,ax
mov ax,4200h
pop bx
int 21h
mov cx,0
jnc short skip_43_5
skip_43_4: jmp error_9

skip_43: mov crc,bx
sub cx,2
jz skip_43_1
jc skip_43_3
skip_43_5: call write
skip_43_1: cmp word ptr end_length,0
jz skip_44
mov bx,write_handler
mov si,offset flag3
lodsb
test al,1
jz skip_30_3
lodsw
mov cx,ax
lodsw
mov dx,ax
mov ax,5701h
push bx
int 21h
pop bx
jb error_11_1
skip_30_3: mov ah,3eh
int 21h
jb error_9_1
mov dx,offset msg_ok_of_hsi
mov ah,9h
int 21h
;
skip_44: mov byte ptr error_count,0
ret

error_9_1: jmp error_9

error_11_1: jmp error_11

seq_new: push ax
mov al,seq_old
inc al
cmp al,byte ptr para_67_61
jb skip_33
cmp al,byte ptr para_69_63
jb skip_34_2
push ax
mov ax,length_low
cmp ax,para_66_60
pop ax
jnb skip_43_2
cmp length_high,1d
jnb skip_43_2
push ax
mov ax,para_66$66?65_60$60?59
add ax,length_low
mov end_length,ax
pop ax
skip_43_2: call chk_table
cmp word ptr end_length,0
jz skip_44_1
pop ax
pop bx
jmp skip_44_2
;
skip_34_2: jmp short skip_34
;
skip_44_1: mov al,1
;
skip_33: push ax
mov ax,length_low
sub ax,para_66_60
mov length_low,ax
sbb length_high,0d
pop ax
jnc skip_34
push ax
mov ah,byte ptr para_66_60
mul ah
add ax,length_low
sub ax,para_65_59
mov end_length,ax
pop ax
push bx
push cx
push di
mov bl,al
mov ah,byte ptr para_69_63
dec al
mul ah
mov di,ax
add di,offset work_table
seq_new_1: mov al,bl
stosb
xor ax,ax
mov cx,para_34_31
rep stosw
inc bl
cmp bl,byte ptr para_67_61
jb seq_new_1
mov al,bl
pop di
pop cx
pop bx
skip_34: mov seq_old,al
pop ax
ret

get_char: push si
mov si,save_si
get_char_1: cmp si,end_of_read_buffer
jb skip_26
push ax
push bx
push cx
push dx
mov ah,3fh
mov dx,offset read_buffer
mov cx,1000h
mov bx,read_handler
int 21h
mov si,offset read_buffer
jnc skip_25

jmp error_5

skip_25: add ax,si
mov end_of_read_buffer,ax
cmp ax,si
pop dx
pop cx
pop bx
pop ax
jnz skip_26
stc
pop si
ret
;
skip_26: lodsb
cmp al,0ah
jnz skip_79
inc line_number_low
cmp line_number_low,10000d
jnz skip_79
mov line_number_low,0
inc line_number_high
skip_79: mov save_si,si
pop si
cmp al,0ah
jz skip_79_1
cmp al,0dh
skip_79_1: clc
ret

crc_check: mov si,offset work_work
mov dx,offset ccitt_crc
lodsw
; cmp al,byte ptr para_68_62
; mov cx,para_67_61
cmp al,bl
jnz skip_27
inc cx
skip_27: not ax
xchg ah,al
mov bx,ax
crc_4_1: push cx
lodsb
mov cx,8
crc_4_2: shl al,1
rcl bx,1
jnc skip_28
xor bx,dx
skip_28: loop crc_4_2
pop cx
loop crc_4_1
mov cx,10h
crc_4_3: shl bx,1
jnc skip_29
xor bx,dx
skip_29: loop crc_4_3
cmp bx,offset ccitt_crc_check
ret
;
disp_number: push bx
push cx
push ax
push dx
mov dl,'['
mov ah,2
int 21h
mov dh,'0'
mov cx,2
disp_number_1: pop ax
push cx
mov cx,4
next_digit: mov dl,'0'
compare_num: cmp ax,1000d
jc disp_number_2
sub ax,1000d
inc dl
jmp short compare_num
;
disp_number_2: cmp dl,30h
jnz skip_77
cmp dh,30h
jz skip_85
skip_77: push ax
push cx
push dx
mov ah,2
int 21h
pop dx
pop cx
pop ax
skip_85: or dh,dl
add ax,ax
mov bx,ax
add ax,ax
add ax,ax
add ax,bx
loop next_digit
pop cx
loop disp_number_1
skip_78: mov dx,offset msg_br2
mov ah,9
int 21h
pop cx
pop bx
ret
;
error: cmp al,15d+1
jb skip_24
xor al,al
skip_24: push ax
mov bx,offset msg_table
cbw
add ax,ax
add bx,ax
mov dx,[bx]
mov ah,9
int 21h
pop ax
cmp al,15d
jz skip_54
cmp al,13d
jnb skip_31
cmp al,11d
jnb skip_31_1
skip_54: mov ah,9
mov dx,offset msg_abend
int 21h
mov ax,4cffh
int 21h
;
skip_31: mov ah,3eh
mov bx,write_handler
int 21h
error_9_2: mov al,9d
jb error
mov ah,41h
mov dx,offset work_fcb_2
int 21h
jb error_9_2
mov dx,offset msg_file_delete
mov ah,9h
int 21h
skip_31_1: ret
;
encode_7bit_old:
mov cx,80d
jmp short encode_7bit_1
;
encode_7bit: mov cx,79d ; encode 7bit
encode_7bit_1: xor dl,dl
mov bx,offset encode_table
encode_7bit_2:
ext_dl_6_1:
ext dl,6
xlat
stosb
loop encode_7bit_2
or dl,dl
jz encode_7bit_3
inc si
encode_7bit_3: ret
;
encode_13bit: ; encode 13bit
xor dl,dl
mov cx,4
encode_13bit_1:
ext_dl_5_1:
ext dl,5
call encode_65bit
loop encode_13bit_1
mov bl,91d
mov cx,74d/2
encode_13bit_2:
ext_dl_12_1:
ext dl,12
div bl
call encode_65bit
mov al,ah
call encode_65bit
loop encode_13bit_2
inc si
ret
;
encode_65bit: add al,21h ; encode 6.5bit
cmp al,'#'
jc encode_65bit_1
inc al
cmp al,'.'
jc encode_65bit_1
inc al
cmp al,60h
jc encode_65bit_1
inc al
encode_65bit_1: stosb
ret
;
encode_15bit: ; encode 15bit
xor dl,dl
ext_dl_6_2:
ext dl,6
mov bx,offset encode_table
xlat
stosb
mov bl,182d
mov cx,76d/2
encode_15bit_1:
ext_dl_14_1:
ext dl,14
div bl
call encode_75bit
mov al,ah
call encode_75bit
loop encode_15bit_1
ext_dl_6_3:
ext dl,6
call encode_75bit
cmp kanji_flag,0
jz encode_15bit_2
add byte ptr [di-1],40h
mov kanji_flag,0
encode_15bit_2: inc si
ret
;
encode_75bit: add al,40h ; encode 7.5bit
cmp al,60h
jc skip_94
inc al
cmp al,7fh
jc skip_94
inc al
cmp al,0a0h
jc skip_91
inc al
cmp al,0e0h
jc skip_94
skip_91: cmp kanji_flag,0
jnz skip_94
cmp al,89h
jc skip_93
cmp al,98h
jz skip_92
cmp al,0eah
jc skip_94
sub al,0eah-98h+9-10d
skip_92: sub al,98h-80h-9
skip_93: sub al,80h-27h
skip_94: stosb
cmp kanji_flag,0
jz skip_95
mov kanji_flag,0
ret
;
skip_95: cmp al,80h
jc skip_97
cmp al,0a0h
jc skip_96
cmp al,0e0h
jc skip_97
skip_96: mov kanji_flag,al
skip_97: ret
;
decode_15bit_1_1:
jmp decode_15bit_1
;
get_frame: mov di,offset work_work
call get_char
jc get_frame_2
jz get_frame
mov bx,offset decode_table
xor dl,dl
cmp al,'#'
jz decode_7bit_1
cmp al,'!'
jz decode_13bit_1
cmp byte ptr type_flag,'s'
jz decode_15bit_1_1
cmp al,'!'+80h
jz decode_13bit_1
cmp byte ptr type_flag,0
jz get_frame
cmp byte ptr type_flag,'7'
jz decode_13bit_1
decode_7bit_1: xlat ; JIS8 format
cmp al,68d + 2
jnc get_frame
ins_dl_6_1:
ins dl,6
mov cx,78d
cmp al,68d
jnz decode_7bit_2
inc cx
decode_7bit_2: call get_char
jc get_frame_2
jz get_frame
xlat
cmp al,80h
jz decode_7bit_2
ins_dl_6_2:
ins dl,6
loop decode_7bit_2
mov bl,68d
mov cx,67d
get_frame_1: call crc_check
jnz get_frame
get_frame_2: ret
;
decode_13bit_1: call decode_65bit ; JIS7 format
jz get_frame
cmp al,62d + 2
jnc get_frame
ins_dl_5_1:
ins dl,5
mov cx,3
decode_13bit_2: call get_char
jc get_frame_2
jz get_frame
call decode_65bit
jz decode_13bit_2
cmp al,40h
jnc decode_13bit_2
ins_dl_5_2:
ins dl,5
loop decode_13bit_2
mov dh,91d
mov cx,74d/2
decode_13bit_5: call get_char
jc get_frame_2
jz get_frame__1
call decode_65bit
jz decode_13bit_5
mul dh
mov bx,ax
decode_13bit_6: call get_char
jc get_frame_2
jz get_frame__1
call decode_65bit
jz decode_13bit_6
cbw
add ax,bx
cmp ax,2000h
jnc get_frame__1
ins_dl_12_1:
ins dl,12
loop decode_13bit_5
mov bl,62d
mov cx,61d
jmp short get_frame_1
;
get_frame__1: jmp get_frame
;
get_frame_1_1: jmp short get_frame_1
;
get_frame_2_1: jmp short get_frame_2
;
decode_15bit_1: mov kanji_flag,0 ; shift JIS format
xlat
cmp al,72d + 2
jnc get_frame__1
ins_dl_6_4:
ins dl,6
mov dh,182d
mov cx,76d/2
decode_15bit_2: call get_char
jc get_frame_2
jz get_frame__1
call decode_75bit
jz decode_15bit_2
mul dh
mov bx,ax
decode_15bit_3: call get_char
jc get_frame_2_1
jz get_frame__1
call decode_75bit
jz decode_15bit_3
xor ah,ah
add ax,bx
cmp ax,8000h
jnc get_frame__1
ins_dl_14_1:
ins dl,14
loop decode_15bit_2
decode_15bit_4: call get_char
jc get_frame_2_1
jz get_frame__1
cmp kanji_flag,0
jnz decode_15bit_6
cmp al,089h
jc decode_15bit_5
cmp al,0a0h
jc decode_15bit_4
cmp al,0c9h
jc decode_15bit_6
cmp al,0e0h
jnc decode_15bit_4
sub al,40h
decode_15bit_5:
decode_15bit_6: call decode_75bit
jz decode_15bit_4
cmp al,80h
jnc get_frame__1
ins_dl_6_5:
ins dl,6
mov bl,72d
mov cx,71d
jmp short get_frame_1_1
;
decode_65bit: and al,7fh
cmp al,7fh
jz ret_z
cmp al,60h
jz ret_z
jc decode_65bit_1
dec al
decode_65bit_1: cmp al,'.'
jz ret_z
jc decode_65bit_2
dec al
decode_65bit_2: cmp al,'#'
jz ret_z
jc decode_65bit_3
dec al
decode_65bit_3: sub al,21h
jc ret_z
cmp al,0ffh ; clear Z-flag
ret
;
ret_z: xor al,al ; set Z-flag
ret
;
decode_75bit: xor ah,ah
cmp kanji_flag,ah
jnz decode_75bit_4
cmp al,0eah
jnc ret_z
cmp al,0e0h
jnc decode_75bit_3
cmp al,0a0h
jz ret_z
jnc decode_75bit_4
cmp al,98h
jz ret_z
cmp al,88h +1
jnc decode_75bit_3
cmp al,7fh
jnc ret_z
cmp al,40h
jnc decode_75bit_4
cmp al,30h
jnz decode_75bit_1
mov al,98h-0b9h
decode_75bit_1: jc decode_75bit_2
add al,0b9h-59h
decode_75bit_2: cmp al,27h
jc ret_z
add al,59h
jmp short decode_75bit_4
;
decode_75bit_3: mov ah,al
decode_75bit_4: cmp al,0f8h + 1
jnc ret_z
cmp al,0a0h
jz ret_z
jc decode_75bit_5
dec al
decode_75bit_5: cmp al,7fh
jz ret_z
jc decode_75bit_6
dec al
decode_75bit_6: cmp al,60h
jz ret_z
jc decode_75bit_7
dec al
decode_75bit_7: sub al,40h
jc ret_z
mov kanji_flag,ah
cmp al,0ffh ; clear Z-flag
ret
;
skip_space_0: inc si
skip_space: lodsb
cmp al,20h
jz skip_space
cmp al,9h
jz skip_space
cmp al,81h
jnz ret_skip_space
cmp byte ptr [si],40h
jz skip_space_0
ret_skip_space: dec si
cmp al,0dh
ret

disp_file_name: mov cx,12d
mov ah,2
disp_file_name_1:
lodsb
mov dl,al
int 21h
loop disp_file_name_1
ret
;
emulate_ext_dl_12:
push bx
push cx
mov bx,1fffh
mov cl,13d
jmp short emulate_ext_1
;
emulate_ext_dl_14:
push bx
push cx
mov bx,7fffh
mov cl,15d
jmp short emulate_ext_1
;
emulate_ext_dl_5:
push bx
push cx
mov bx,3fh
mov cl,6d
jmp short emulate_ext_1
;
emulate_ext_dl_6:
push bx
push cx
mov bx,7fh
mov cl,7d
emulate_ext_1: push dx
push si
cmp dl,8
jc emulate_ext_2
sub dl,8
inc si
emulate_ext_2: inc dl
lodsw
mov dh,[si]
jmp short emulate_ext_4
;
emulate_ext_3: shr dh,1
rcr ax,1
emulate_ext_4: dec dl
jnz emulate_ext_3
and ax,bx
pop si
pop dx
add dl,cl
cmp dl,10h
jc emulate_ext_5
sub dl,10h
inc si
inc si
emulate_ext_5: pop cx
pop bx
ret
;
emulate_ins_dl_12:
push bx
push cx
mov bx,1fffh
mov cl,13d
jmp short emulate_ins_1
;
emulate_ins_dl_14:
push bx
push cx
mov bx,7fffh
mov cl,15d
jmp short emulate_ins_1
;
emulate_ins_dl_5:
push bx
push cx
mov bx,3fh
mov cx,6
jmp short emulate_ins_1
;
emulate_ins_dl_6:
push bx
push cx
mov bx,7fh
mov cl,7
emulate_ins_1: and ax,bx
push dx
push di
xor ch,ch
xor dh,dh
cmp dl,8
jc emulate_ins_2
sub dl,8
inc di
emulate_ins_2: inc dl
jmp short emulate_ins_4
;
emulate_ins_3: shl ax,1
rcl dh,1
shl bx,1
rcl ch,1
emulate_ins_4: dec dl
jnz emulate_ins_3
not bx
not ch
and [di],bx
or [di],ax
and [di+2],ch
or [di+2],dh
pop di
pop dx
add dl,cl
cmp dl,10h
jc emulate_ins_5
sub dl,10h
inc di
inc di
emulate_ins_5: pop cx
pop bx
ret
;
sum_1_to_61 equ 63h ; 1+2+3+¥¥¥¥¥+61 ( mod 256 )
sum_1_to_67 equ 0e6h ; 1+2+3+¥¥¥¥¥+67 ( mod 256 )
sum_1_to_71 equ 0fch ; 1+2+3+¥¥¥¥¥+71 ( mod 256 )

ish_data db '.ISH',0

arc_data db 'ARC'

temp_file db 'ish_temp.000'

msg_start db 'ish file converter for MS-DOS Ver 1.10a '
db 'Copyright (C) 1986 by M. Ishizuka'
msg_crlf db 0dh,0ah,'$'
msg_start2 db '[ $'
msg_esc db 1bh,'[32m'
msg_non_esc db '<<< '
msg_ms_dos db ' for MS-DOS'
msg_cpm db ' for CP/M and/or MSX-DOS'
msg_os9 db ' for OS-9'
msg_all_os db ' for all OSs'
msg_use_ish db ' ( use ish '
msg_ms_dos2 db '& arc '
msg_ms_dos3 db ')',1bh,'[0m',0dh,0ah
end_msg_ms_dos3 equ $
msg_non_esc2 db ') >>>',0dh,0ah
msg_colon db ' : $'
msg_normal_end db 'ish_file is created.',0dh,0ah,'$'
msg_ok_of_hsi db 0dh,0ah,' file restored successfully.',0dh,0ah,'$'
msg_file_delete db 0dh,0ah,' output file is deleted.',7,0dh,0ah,'$'
msg_abend db 0dh,0ah,0ah,'ish abnormal end.',7,'$'
msg_restore db 'restore ($'
msg_all db 'restore ($'
msg_store_8 db 'store ($'
msg_store_7 db 'store ($'
msg_store_s db 'store ($'
msg_old_style db 'store ($'
m_ db 'm,$'
c_ db 'c,$'
question_ db '?,$'
aster_ db '*,$'
os9_ db '9,$'
msg_ db 8,') ]',0dh,0ah,'$'
msg_br2 db '] $'
msg_br3 db 8,'->($'
msg_br4 db ') $'
msg_err_dsp db ' error lines => $'
msg_file_already_exist db 'file already exist ... $'
msg_gt db 8,8,'> $'

msg_error_0 db 0dh,0ah,'internal error (bug in ish)$'
msg_error_1 db 0dh,0ah,'illegal switch(es)',0ah
msg_error_2 db 0dh,0ah,'Usage:'
db 0dh,0ah,' A>ish input_file_name [{/r|/a}] [/m[pt]] '
db '[/c[pt]] [/9[pt]] [/?[pt]] [/*[pt]]'
db 0dh,0ah,' A>ish input_file_name {/s[{8|s|7}]|/o}'
db ' [{/m|/c|/9|/?|/*}[pt]] [{/n|/e}]',0ah
db 0dh,0ah,' /r : restore new file(s) '
db ' /a : restore all file(s)'
db 0dh,0ah,' /s : store a JIS8 format ish file '
db ' /s8: same as /s'
db 0dh,0ah,' /ss: store a shift JIS format ish file '
db ' /s7: store a JIS7 format ish file'
db 0dh,0ah,' /m : MS-DOS '
db ' /o : store an old format ish file'
db 0dh,0ah,' /c : CP/M and/or MSX-DOS '
db ' /? : other OSs'
db 0dh,0ah,' /9 : OS-9 '
db ' /* : all OSs'
db 0dh,0ah,' pt : path name (ex. b:\pds\tools) '
db 0dh,0ah,' /n : no escape sequence '
db ' /e : escape sequence',0ah
db 0dh,0ah,' If switches are not specified, /r, /m,'
db ' and /* will be assumed.$'
msg_error_3 db 0dh,0ah,'file not found$'
msg_error_4 db 0dh,0ah,'file open error$'
msg_error_5 db 0dh,0ah,'file read error$'
msg_error_6 db 0dh,0ah,'source file too short$'
msg_error_7 db 0dh,0ah,'filename error$'
msg_error_8 db 'file creation error$'
msg_error_9 db 0dh,0ah,'file write error$'
msg_error_10 db 0dh,0ah,'too less memories$'
msg_error_11 db 0dh,0ah,' file creation error'
db 0dh,0ah,' ( volume label, directory, '
db 'file write protected, and so on. )'
db 0dh,0ah,' $'
msg_error_12 db 0dh,0ah,' This format can not be acceptable. '
db '(use upper version) ... $'
msg_error_13 db 0dh,0ah,' crc error detect ... abort this file$'
msg_error_14 db 'x'
db 0dh,0ah,' error detect ... abort this file '
db '( more than or equal to 3 errors / block )$'
msg_error_15_1 db 0dh,0ah,"path '$"
msg_error_15 db "' not found$"

msg_table dw msg_error_0,msg_error_1,msg_error_2
dw msg_error_3,msg_error_4,msg_error_5
dw msg_error_6,msg_error_7,msg_error_8
dw msg_error_9,msg_error_10,msg_error_11
dw msg_error_12,msg_error_13,msg_error_14

dw msg_error_15

msg_other_os db 'This is for other OSs ... $'
msg_skip db 'skip this file',7,0dh,0ah,'$'

cr_lf equ 0a0dh
ccitt_crc equ 1021h
ccitt_crc_check equ 1d0fh

encode_table db 23h, 25h, 26h, 27h, 29h, 2bh, 2ch, 3fh ; 00h-
db 2fh, 32h, 34h, 35h, 36h, 37h, 38h, 39h
db 3ah, 3bh, 3ch, 3dh, 3eh, 41h, 42h, 43h ; 10f-
db 44h, 45h, 46h, 47h, 48h, 49h, 4bh, 4ch
db 4eh, 4fh, 52h, 54h, 55h, 56h, 57h, 58h ; 20h-
db 59h, 5ah, 5bh, 5ch, 5dh, 5eh, 61h, 62h
db 63h, 64h, 65h, 66h, 67h, 68h, 69h, 6ah ; 30h-
db 6bh, 6ch, 6dh, 6eh, 70h, 71h, 72h, 73h
db 74h, 75h, 76h, 78h, 79h, 7ah, 7ch,0a1h ; 40h-
db 0a2h,0a3h,0a4h,0a5h,0a6h,0a7h,0a8h,0a9h
db 0aah,0abh,0ach,0aeh,0afh,0b0h,0b1h,0b2h ; 50h-
db 0b4h,0b5h,0b6h,0b7h,0b8h,0b9h,0bah,0bbh
db 0bch,0bdh,0beh,0c0h,0c1h,0c2h,0c3h,0c4h ; 60h-
db 0c5h,0c6h,0c7h,0c8h,0c9h,0cah,0cbh,0cch
db 0ceh,0cfh,0d0h,0d1h,0d2h,0d4h,0d5h,0d6h ; 70h-
db 0d7h,0d8h,0d9h,0dah,0dbh,0dch,0ddh,0deh

decode_table db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h ; 00h-
db 80h, 80h,0ffh, 80h, 80h,0ffh, 80h, 80h
db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h ; 10h-
db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h
db 80h, 80h, 80h, 00h, 80h, 01h, 02h, 03h ; 20h-
db 80h, 04h, 80h, 05h, 06h, 80h, 80h, 08h
db 80h, 80h, 09h, 80h, 0ah, 0bh, 0ch, 0dh ; 30h-
db 0eh, 0fh, 10h, 11h, 12h, 13h, 14h, 07h
db 80h, 15h, 16h, 17h, 18h, 19h, 1ah, 1bh ; 40h-
db 1ch, 1dh, 80h, 1eh, 1fh, 80h, 20h, 21h
db 80h, 80h, 22h, 80h, 23h, 24h, 25h, 26h ; 50h-
db 27h, 28h, 29h, 2ah, 2bh, 2ch, 2dh, 80h
db 80h, 2eh, 2fh, 30h, 31h, 32h, 33h, 34h ; 60h-
db 35h, 36h, 37h, 38h, 39h, 3ah, 3bh, 80h
db 3ch, 3dh, 3eh, 3fh, 40h, 41h, 42h, 80h ; 70h-
db 43h, 44h, 45h, 80h, 46h, 80h, 80h, 80h
db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h ; 80h-
db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h
db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h ; 90h-
db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h
db 80h, 47h, 48h, 49h, 4ah, 4bh, 4ch, 4dh ;0a0h-
db 4eh, 4fh, 50h, 51h, 52h, 80h, 53h, 54h
db 55h, 56h, 57h, 80h, 58h, 59h, 5ah, 5bh ;0b0h-
db 5ch, 5dh, 5eh, 5fh, 60h, 61h, 62h, 80h
db 63h, 64h, 65h, 66h, 67h, 68h, 69h, 6ah ;0c0h-
db 6bh, 6ch, 6dh, 6eh, 6fh, 80h, 70h, 71h
db 72h, 73h, 74h, 80h, 75h, 76h, 77h, 78h ;0d0h-
db 79h, 7ah, 7bh, 7ch, 7dh, 7eh, 7fh, 80h
db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h ;0e0h-
db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h
db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h ;0f0h-
db 80h, 80h, 80h, 80h, 80h, 80h, 80h, 80h

save_si dw 0ffffh
end_of_read_buffer dw 0ffffh
read_length dw 0ffffh

mode db 0
os db 0
msdos_path db 0,128 dup(0)
cpm_path db 0,128 dup(0)
os9_path db 0,128 dup(0)
other_os_path db 0,128 dup(0)
all_os_path db 0,128 dup(0)
n_flag db 0
kanji_flag db 0
line_number_low dw 1
line_number_high dw 0

parameter_jis7 dw 80,80,63,62,61,60,59,59,31,30,15
dw 80*2,80*3,63*62,60*60
dw 60*60+2,60*60+1,60*60-1,60*60-59
dw offset read_buffer + (60*60)
dw offset write_buffer + (80*60)
dw offset work_table + (63*62)
dw offset encode_13bit
dw offset encode_13bit

parameter_jis8 dw 81,81,69,68,67,66,65,65,34,33,18
dw 81*2,81*3,69*68,66*66
dw 66*66+2,66*66+1,66*66-1,66*66-65
dw offset read_buffer + (66*66)
dw offset write_buffer + (81*66)
dw offset work_table + (69*68)
dw offset encode_7bit
dw offset encode_7bit

parameter_sjis dw 80,81,73,72,71,70,69,65,36,35,18
dw 80*2,81*3,73*72,70*70
dw 70*70+2,70*70+1,70*70-1,70*70-69
dw offset read_buffer + (70*70)
dw offset write_buffer + (80*70)
dw offset work_table + (73*72)
dw offset encode_7bit
dw offset encode_15bit

para_81_80 dw ?
para_81_80_81 dw ?
para_69_63 dw ?
para_68_62 dw ?
para_67_61 dw ?
para_66_60 dw ?
para_65_59 dw ?
para_65_59_65 dw ?
para_34_31 dw ?
para_33_30 dw ?
para_18_15 dw ?

para_81$2_80$2 dw ?
para_81$3_80$3_81$3 dw ?

para_69$68_63$62 dw ?
para_66$66_60$60 dw ?

para_66$66@2_60$60@2 dw ?
para_66$66@1_60$60@1 dw ?
para_66$66?1_60$60?1 dw ?
para_66$66?65_60$60?59 dw ?

para_66$66_60$60_read_buffer dw ?
para_81$66_80$60_write_buffer dw ?
para_69$68_63$62_work_table dw ?

encode_sub1 dw ?
encode_sub2 dw ?

line_save_low dw ?
line_save_high dw ?
flag db ?
flag2 db ?
flag3 db ?
save_time dw ?
save_date dw ?
address_emu_ext_dl_5 dw ?
address_emu_ext_dl_6 dw ?
address_emu_ext_dl_12 dw ?
address_emu_ext_dl_14 dw ?
address_emu_ins_dl_5 dw ?
address_emu_ins_dl_6 dw ?
address_emu_ins_dl_12 dw ?
address_emu_ins_dl_14 dw ?
end_length dw ?
error_count db ?
error_seq db 3d dup( 0,?,?,?,? )
seq_old db ?
length_low dw ?
length_high dw ?
work_fcb db 37d dup(?)
work_fcb_2 db 139d dup(?)
read_handler dw ?
write_handler dw ?
read_buffer db 70d*70d dup(?)
crc dw ?
work_table db 73d*72d+1 dup(?)
write_buffer db 80d*72d+1 dup(?)
work_work db 128d dup(?)
work_work2 db 63d dup(?)
old_style db ?
type_flag db ?

db 256d dup(?) ; stack area
even
end_of_stack equ $

cseg ends
end start


  3 Responses to “Category : Utilities for DOS and Windows Machines
Archive   : ISH.ZIP
Filename : ISH110A.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/