flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Windows > unsupported 16-bit application | 
| Author | 
 | 
| l_inc 10 Feb 2016, 23:41 deama
 The ideas are pretty much what the message says: you cannot run 16-bit applications in 64-bit Windows. It doesn't support those. But you can run them in an emulator such as DOSBox. _________________ Faith is a superposition of knowledge and fallacy | |||
|  10 Feb 2016, 23:41 | 
 | 
| revolution 11 Feb 2016, 01:42 Yes. The 64-bit "long" mode in the CPU does not have to capability to run 16-bit code. It is not just Windows that has this problem, but all OSes that use 64-bit mode on x86 CPUs.
 If you run Windows in 32-bit mode then you can still use 16-bit code with v8086 mode, which is supported natively by the CPU. | |||
|  11 Feb 2016, 01:42 | 
 | 
| l_inc 11 Feb 2016, 12:57 revolution
 Quote: The 64-bit "long" mode in the CPU does not have to capability to run 16-bit code. It is not just Windows that has this problem, but all OSes that use 64-bit mode on x86 CPUs. This is not quite true. While the long mode (IA-32e in the Intel's terminology) does not support virtual 8086 it still can run in the compatibility submode, which in turn supports 16-bit segments where 16-bit code can run natively. In this case it's really about 64-bit Windows not supporting 16-bit segments. Ntvdm was indeed virtual 8086 and that's why it doesn't exist in 64-bit Windows, but (undocumented) support for 16-bit segments was terminated for non-technical reasons. _________________ Faith is a superposition of knowledge and fallacy | |||
|  11 Feb 2016, 12:57 | 
 | 
| revolution 11 Feb 2016, 15:25 Unless I misunderstand something, the availability of 16-bit segments is quite different from the availability of v8086 mode. v8086 mode is more than just having 16-bit segments enabled. Using v8086 mode to run 16-bit DOS *.com and *.exe files is quite important if one doesn't want to, or can't, emulate.
 Anyhow, thanks for the comment. Perhaps someone out there is writing a 64-bit OS and wants such a thing. | |||
|  11 Feb 2016, 15:25 | 
 | 
| l_inc 11 Feb 2016, 15:36 revolution
 Quote: the availability of 16-bit segments is quite different from the availability of v8086 mode. v8086 mode is more than just having 16-bit segments enabled You are totally right. I just wanted to point out that it's a bit too broad-brushy to say that 16-bit code in long mode is not natively supported by the CPU. _________________ Faith is a superposition of knowledge and fallacy | |||
|  11 Feb 2016, 15:36 | 
 | 
| deama 12 Feb 2016, 19:17 So, how do I make that run in 64-bit? | |||
|  12 Feb 2016, 19:17 | 
 | 
| AsmGuru62 13 Feb 2016, 14:52 Your 64 bit OS runs DOSBox.
 Inside DOSBox you run your 16-bit application. You have to download DOSBox - it is very simple emulator. | |||
|  13 Feb 2016, 14:52 | 
 | 
| deama 13 Feb 2016, 17:00 But how do I change the code to make it run on a 64-bit OS? | |||
|  13 Feb 2016, 17:00 | 
 | 
| AsmGuru62 13 Feb 2016, 18:03 Oh, I see... you need to re-write your 16-bit application to be a 32-bit or 64-bit Windows application.
 I suppose, it is not an easy task, especially, if you have a large 16-bit legacy program. | |||
|  13 Feb 2016, 18:03 | 
 | 
| l_inc 13 Feb 2016, 19:46 AsmGuru62
 The correct answer is actually DOSBox. But I already gave it, so it's a bit demotivating to comment any more. _________________ Faith is a superposition of knowledge and fallacy | |||
|  13 Feb 2016, 19:46 | 
 | 
| deama 14 Feb 2016, 23:05 I don't wanna run it in DOSBox, I wanna run it on my 64-bit machine.
 I see, guess I'll try some other stuff out. Any idea how I can just write the simplest "hello world" message output on a cmd? | |||
|  14 Feb 2016, 23:05 | 
 | 
| Trinitek 15 Feb 2016, 09:20 Interestingly, there doesn't seem to be any console examples packaged with FASM.    You can link msvcrt.dll and invoke printf. | |||
|  15 Feb 2016, 09:20 | 
 | 
| Tomasz Grysztar 15 Feb 2016, 09:41 Trinitek wrote: Interestingly, there doesn't seem to be any console examples packaged with FASM. | |||
|  15 Feb 2016, 09:41 | 
 | 
| deama 15 Feb 2016, 20:27 Right... 
 How would you load that? Is it ".include 'something.dll' " or? | |||
|  15 Feb 2016, 20:27 | 
 | 
| Trinitek 15 Feb 2016, 22:31 This is how it's done.     Code: format PE64 console entry start include 'include/win64a.inc' section '.text' code readable executable start: invoke printf, message invoke ExitProcess, 0 section '.data' data readable message db "Hello world!", 0 section '.idata' import data readable writeable library kernel32, 'KERNEL32.DLL',\ msvcrt, 'MSVCRT.DLL' include 'include/api/kernel32.inc' import msvcrt,\ printf, 'printf' Quote: EXAMPLES\WIN64\DLL contains a console example for 64-bit Windows. | |||
|  15 Feb 2016, 22:31 | 
 | 
| Mikl___ 16 Feb 2016, 03:20 Trinitek wrote: Interestingly, there doesn't seem to be any console examples packaged with FASM. Examples for Win64 Iczelion tutorial contains console examples for 64-bit Windows | |||
|  16 Feb 2016, 03:20 | 
 | 
| deama 16 Feb 2016, 21:27 It keeps giving me a "File not found" error on those "include" statements, in the above code and in Iczelion's examples...
 EDIT: ah, wait, fixed it; apparentely removing the "include/" works. | |||
|  16 Feb 2016, 21:27 | 
 | 
| Trinitek 16 Feb 2016, 21:32 My PATH is a little screwy, so I had to drag the include folder into my working directory. | |||
|  16 Feb 2016, 21:32 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.