1 year ago
#34431

Codor
Assembly language initialization of floating-point unit
Just out of curiosity I'm fiddling around with some demoscene 256 byte intros. I came around one production which ran fine under MS-DOS 6.22 but crashes under FreeDOS 1.3 - "sometimes". It turned out that it ran fine when executed after some other small intro but crashed when it was the first application started after booting. Both used FPU code for generation of cosine tables.
Lengthy disassembly and investigation turned out that the "good" intro was using the FINIT instruction as documented here
https://c9x.me/x86/html/file_module_x86_id_97.html
which was missing in the "bad" intro. Including the FINIT instruction and reassembly with TASM 2.0 resolved the issue (which somehow made me proud of accepting to start the rather extensive journey).
Now my question is - was it expected that under DOS every application did a proper initialization of the FPU with the instructions mentioned above? If so, why did I not encounter problems on MS-DOS but only on FreeDOS? Is this some unspecified behaviour and I have just been lucky in the past or is something documented about this regarding MS-DOS and FreeDOS?
assembly
dos
x86-16
tasm
x87
0 Answers
Your Answer