Home / tasm / 3.0
Name Modified Size InfoDownloads / Week
Parent folder
readme.txt 2023-01-30 5.0 kB
fc.txt 2023-01-27 6.6 kB
Totals: 2 Items   11.6 kB 0
Introduction:
  Tasm 3.0, is product of borland in 1991.
When we "tasm.exe rev_big5.asm",
it error "Undefined symbol"
and error "Illegal instruction".

  According to https://leisurebamboo.wordpress.com/2022/12/01/tasm3
we modify the tasm.eve by commandLine "difc.exe fc.txt".
After that, "tasm.exe rev_big5.asm" runs OK,
it can read symbols with kanji now.

--------- 1.symptoms ----------------------------
  We can compile reverse.asm(attached in tasm demo
itself) by commandLine
"tasm.exe reverse.asm" and
"tlink.exe reverse.obj,reverse.exe".
But after we change some function_name or variable_name
in asm, once a letter is great than 0x80, then the symbol
can not be compiled by tasm.
  That is a bug.

--------- 2.affected part -----------------------
  In tasm.exe, when it fgetch(), it:
cs:281B 8B360E57 MOV SI,[570E]
cs:281F AC       LODSB
cs:2820 32E4     XOR AH,AH
cs:2822 8BD8     MOV BX,AX
cs:2824 D1E3     SHL BX,1
cs:2826 FFA7D607 JMP [BX+07D6]

note1: [570e] is buff,
note2: ds:[07D6~09D5] are switch_jump_table, they are:
dw 21h dup(281Fh)       ;ascii 00~20
dw 2838h,28D4h, 2838h   ;ascii 21~23
dw 3 dup(2DFAh),28D4h   ;ascii 24~27
dw 6 dup(2838h)         ;ascii 28~2d
dw 285Dh,2838h          ;ascii 2e~2f
dw 0Ah dup(28FBh)       ;'0'~'9'
dw 2838h, 282Ah         ;ascii 3a~3b
dw 3 dup(2838h)         ;ascii 3c~3e
dw 2 dup(2DFAh)         ;ascii 3f~40

dw 2A7Ch,2ADFh, 2B43h   ;"ABC"
dw 2BD0h,2C9Fh          ;"DE"
dw 4 dup(2DFAh),2CC5h   ;"FGHI",'J'
dw 2 dup(2DFAh),2CF5h   ;"KL",  'M'
dw 2 dup(2DFAh),2D2Bh   ;"NO",  'P'
dw 2 dup(2DFAh),2D8Fh   ;"QR",  'S'
dw 7 dup(2DFAh)         ;"TUVWXYZ"
dw 2838h,284Ah, 2838h   ;ascii 5b~5d
dw 2838h,2DFAh, 2838h   ;ascii 5e~60

dw 2A75h,2AD8h, 2B3Ch   ;"abc"
dw 2BC9h,2C98h          ;"de"
dw 4 dup(2DFAh),2CBEh   ;"fghi",'j'
dw 2 dup(2DFAh),2CEEh   ;"kl",  'm'
dw 2 dup(2DFAh),2D24h   ;"no",  'p'
dw 2 dup(2DFAh),2D88h   ;"qr",  's'
dw 7 dup(2DFAh)         ;"tuvwxyz"
dw 5 dup(2838h)         ;ascii 7b~7f

dw 80h dup(281Fh)       ;ascii 80~FF


  The most common address in alphabet
is 2DFAh,(dup 7 times).
  At this address,the code are:
cs:2DFA 06     PUSH ES
cs:2DFB 32E4   XOR  AH,AH
cs:2DFD 4E     DEC  SI
cs:2DFE BB2F41 MOV  BX,412F
cs:2E01 D7     XLAT
cs:2E02 16     PUSH SS
cs:2E03 07     POP  ES
cs:2E04 BF0C47 MOV  DI,470C

note3: ds:[412f~422e] are 100h attrib8 of ascii,they are:
02 02 02 02-02  02  02 02 ;ascii 00~07
02 02 02 02-02  01  02 02 ;ascii 08~0F
02 02 02 02-02  02  02 02 ;ascii 10~17
02 02 02 02-02  02  02 02 ;ascii 18~1F
02 08 40 08-80h 80h 08 40 ;ascii 20~27
08 05 dup(08) 04 08       ;ascii 28~2F
0Ah dup(10h)              ;'0'~'9'
      08 01-08 08 08 80h  ;ascii 3A~3F
80h 1Ah dup(80h)          ;'@','A'~'Z'
         08-08 08 08 80h  ;ascii 5B~5F
08  1Ah dup(A0h)          ;'`','a'~'z'
         08-08 08 08 08   ;ascii 7B~7F
    80h dup(02h)          ;ascii 80~FF

--------- 3.solution ----------------------------
  Lots of kanji_letter are great than 0x80,
so we can

  3.1.change their attrib8 to the same as 'T'~'Z',
this means change ascii80~FF(the bytes in file <<tasm.exe>>
corresponding part are 1C28Fh~1C30Eh )
from "80 dup(02h)" to "80h dup(80h)".

  3.2.change their jump_address in switch_table,
this means change ascii80~FF(the words in file <<tasm.exe>>
corresponding part are 189B6h~18AB5h )
from "80h dup(281Fh)" to "80h dup(2DFAh)".

  After changed, tasm.exe can compile symbols with kanji.
The demo asm are rev_gbk.asm and rev_big5.asm,
which willbe error in old days.
And how many code we change? just 180h bytes.

--------- 4.backup and compare ------------------
  To prove we just change 180h bytes:
before we modify the tasm.exe, we can backup it as tasm.bak.
After modified, we can "fc /b tasm.exe tasm.bak > fc.txt"
to do file-compare in binary mode. And we will get a text file,
which name is "fc.txt", and its' content are:

'Comparing files TASM.EXE and TASM.BAK
000189B6: FA 1F
000189B7: 2D 28
000189B8: FA 1F
000189B9: 2D 28
000189BA: FA 1F
000189BB: 2D 28
000189BC: FA 1F
000189BD: 2D 28
...
00018AB0: FA 1F
00018AB1: 2D 28
00018AB2: FA 1F
00018AB3: 2D 28
00018AB4: FA 1F
00018AB5: 2D 28

0001C28F: 80 02
0001C290: 80 02
0001C291: 80 02
0001C292: 80 02
...
0001C30B: 80 02
0001C30C: 80 02
0001C30D: 80 02
0001C30E: 80 02'

  Obviosly we change the file content
from 189B6th byte to 18AB5th byte, just 0x100 bytes;
from 1C28Fth byte to 1C30Eth byte, just  0x80 bytes.

--------- 5.after word --------------------------
  If you had tasm 3.0,
after you notice bugs above, you can
1)send message to borland.com...
  but borland had been chng to codeGear,
  and codeGear had been sold to embarcadero & microfocus...
2)seek the writer of that exe...
  but Anders Hejlsberg had been m$.
3)rename your tasm.exe as tasm.bak,
  and input "difc.exe fc.txt" in console.
  Of course, the name of file(fc.txt) is not import.
Source: readme.txt, updated 2023-01-30