Introduction:
Tasm 2.01, is product of borland in 1990.
When we "tasm.exe rev_big5.asm",
it error "Undefined symbol"
and error "Illegal instruction".
According to https://leisurebamboo.wordpress.com/2022/12/01/tasm2
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:1D19 56 PUSH SI
cs:1D1A BB4607 MOV BX,0746
cs:1D1D 8B36843D MOV SI,[3D84]
cs:1D21 AC LODSB
cs:1D22 D7 XLAT
cs:1D23 A802 TEST AL,02
cs:1D25 75FA JNZ 1D21
note1: [3d84] is buff,
note2: ds:[0746~07c5] are 100h attrib8 of ascii,they are:
02 02 02 02-02 02 02 02 ;ascii00~07
02 02 02 02-02 01 02 02 ;ascii08~0F
02 02 02 02-02 02 02 02 ;ascii10~17
02 02 02 02-02 02 02 02 ;ascii18~1F
02 08 40 08-80h 80h 08 40 ;ascii20¡«27
08 05 dup(08) 04 08 ;ascii28~2F
0Ah dup(10h) ;'0'~'9'
08 01-08 08 08 80h ;ascii3A~3F
80h 1Ah dup(80h) ;'@','A'~'Z'
08-08 08 08 80h ;ascii5B~5F
08 1Ah dup(A0h) ;'`','a'~'z'
08-08 08 08 08 ;ascii7B~7F
80h dup(02h) ;ascii80~FF
--------- 3.solution ----------------------------
Lots of kanji_letter are great than 0x80,
so we can change their attrib8 to the same as 'A'~'Z',
this means change ascii80~FF(the bytes in file <<tasm.exe>>
corresponding part are 16C46h~16CC5h )to 80h dup(80h).
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 80h bytes.
--------- 4.backup and compare ------------------
To prove we just change 80h 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
00016C46: 80 02
00016C47: 80 02
00016C48: 80 02
00016C49: 80 02
...
00016CC3: 80 02
00016CC4: 80 02
00016CC5: 80 02'
Obviosly we change the file content from 16C46th byte
to 16CC5th byte, just 0x80 bytes.
--------- 5.after word --------------------------
If you had tasm 2.01,
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.