Introduction:
Tasm 1.0, is product of borland in 1988.
When we "tasm.exe rev_big5.asm",
it error "Undefined symbol"
and error "Illegal instruction".
According to https://leisurebamboo.wordpress.com/2022/12/01/tasm1
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:2FD1 BB3D2D MOV BX,2D3D
cs:2FD4 8BFE MOV DI,SI
cs:2FD6 8B36C21F MOV SI,[1FC2]
cs:2FDA AC LODSB
cs:2FDB D7 XLAT
cs:2FDC A803 TEST AL,03
cs:2FDE 7413 JZ 2FF3
cs:2FE0 A801 TEST AL,01
cs:2FE2 74F6 JZ 2FDA
note1: [1FC2] is buff,
note2: ds:[2D3D~2E3C] 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 37BDh~383Ch )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
000037BD: 80 02
000037BE: 80 02
000037BF: 80 02
00003839: 80 02
...
0000383A: 80 02
0000383B: 80 02
0000383C: 80 02'
Obviosly we change the file content from 37BDth byte
to 383Cth byte, just 0x80 bytes.
--------- 5.after word --------------------------
If you had tasm 1.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...
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.