home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FreeWare Collection 2
/
FreeSoftwareCollection2pd199x-jp.img
/
ms_dos
/
ish
/
ish200s
/
ish200s.lzh
/
ENCODE.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-03-27
|
4KB
|
237 lines
;
; ish file converter for MS-DOS Ver 2.00 (90/3/27)
;
;
; Copyright (c) 1986, 1987, 1989, 1990 by M. ishizuka
; All rights reserved.
;
;-----------------------------------------------;
; ;
; encode_7bit_old ;
; ;
; INPUT : si (source pointer) ;
; di (destination pointer) ;
; OUTPUT: si (next source pointer) ;
; di (next destination pointer) ;
; ERROR : NON ;
; BREAK : flags, al, bx, cx, dl ;
; ;
;-----------------------------------------------;
encode_7bit_old:
mov cx, 80d - 1
jmp encode_7bit_1
;-----------------------------------------------;
; ;
; encode_7bit ;
; ;
; INPUT : si (source pointer) ;
; di (destination pointer) ;
; OUTPUT: si (next source pointer) ;
; di (next destination pointer) ;
; ERROR : NON ;
; BREAK : flags, al, bx, cx, dl ;
; ;
;-----------------------------------------------;
encode_7bit: mov cx, 79d - 1 ; encode 7bit
encode_7bit_1: xor dl, dl
mov bx, offset encode_table_jis8
ext_dl_6_5:
ext dl, 6
xlat
stosb
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
mov dx, 5b00h ; 5bh = 91d
mov bx, offset encode_table_jis7
ext_dl_5_3:
ext dl, 5
xlat
stosb
mov cx, 3
encode_13bit_1:
ext_dl_5_1:
ext dl, 5
xlat
stosb
loop encode_13bit_1
mov cx, 74d/2
encode_13bit_2:
ext_dl_12_1:
ext dl, 12
div dh
xlat
stosb
mov al, ah
xlat
stosb
loop encode_13bit_2
inc si
ret
;-----------------------------------------------;
; ;
; encode_14bit ;
; ;
; INPUT : si (source pointer) ;
; di (destination pointer) ;
; OUTPUT: si (next source pointer) ;
; di (next destination pointer) ;
; ERROR : NON ;
; BREAK : flags, ax, bx, cx, dx ;
; ;
;-----------------------------------------------;
encode_14bit: lodsb
mov bx, offset encode_table_jis7
xlat
stosb
mov cx, 123d * 256d + 75d ; ch := 123d , cl := 75d
mov dx, 182d * 256d ; dh := 182d , dl := 0
encode_14bit_1:
ext_dl_13_1:
ext dl, 13
cmp ax, 91d * 123d
jc encode_14bit_6
sub ax, 91d * 123d
div dh
mov bx, offset encode_table_nonkana
xlat
stosb
dec cl
mov al, ah
encode_14bit_2: mov bx, offset encode_table_nonkana2
xlat
stosb
encode_14bit_3: dec cl
jns encode_14bit_1
mov bx, offset encode_table_jis7
inc cl
jz encode_14bit_4
inc cl
jz encode_14bit_5
ret
encode_14bit_4:
ext_dl_12_2:
ext dl, 12
mov dh, 91d
div dh
xlat
stosb
mov al, ah
xlat
stosb
ret
encode_14bit_5:
ext_dl_5_2:
ext dl, 5
xlat
stosb
ret
encode_14bit_6: div ch
mov bx, offset encode_table_jis7
xlat
stosb
dec cl
mov al, ah
xlat
stosb
cmp al, 80h
jb encode_14bit_3
dec cl
ext_dl_6_2:
ext dl, 6
jmp encode_14bit_2
;-----------------------------------------------;
; ;
; encode_15bit ;
; ;
; INPUT : si (source pointer) ;
; di (destination pointer) ;
; OUTPUT: si (next source pointer) ;
; di (next destination pointer) ;
; ERROR : NON ;
; BREAK : flags, ax, bx, cx, dx ;
; ;
;-----------------------------------------------;
encode_15bit: mov dx, 0b600h ; 0b6h = 182d
ext_dl_6_3:
ext dl, 6
mov bx, offset encode_table_jis8
xlat
stosb
mov cx, 76d/2
encode_15bit_1:
ext_dl_14_1:
ext dl, 14
div dh
xor ch, 0ffh
mov bx, offset encode_table_sjis
js encode_15bit_2
mov bx, offset encode_table_sjis2
encode_15bit_2: xlat
stosb
and al, 0e0h
jns encode_15bit_3
add al, 60h
add al, al
encode_15bit_3: and ch, al
mov al, ah
xor ch, 0ffh
mov bx, offset encode_table_sjis
js encode_15bit_4
mov bx, offset encode_table_sjis2
encode_15bit_4: xlat
stosb
and al, 0e0h
jns encode_15bit_5
add al, 60h
add al, al
encode_15bit_5: and ch, al
dec cl
jnz encode_15bit_1
ext_dl_6_4:
ext dl, 6
xor ch, 0ffh
mov bx, offset encode_table_sjis
js encode_15bit_6
mov bx, offset encode_table_sjis2
encode_15bit_6: xlat
stosb
and al, 0e0h
jns encode_15bit_7
add al, 60h
add al, al
and ch, al
jns encode_15bit_7
add byte ptr [di-1], 40h
encode_15bit_7: inc si
ret