dos

COM executables with Open Watcom

▼魔方 西西 提交于 2020-08-07 09:43:04
问题 I'm trying to make a small utility for an old i286 machine running PC-DOS and the target format a plain COM executable. The compiler choice has been Open Watcom and, on the documentation it says it can link DOS .COM files but documentation is either ambiguous or doesn't work as the examples show, so I end up with either a .EXE file (with MZ header) or multiple linker/compiler errors. So, How can I make a .COM executable with Open Watcom compiler? 回答1: The system com option is probably invalid

Using GCC on Mac OS to Compile C Program for MS-DOS (DOSBox)

大城市里の小女人 提交于 2020-08-06 20:54:40
问题 I am running GCC 4.2.1 under Snow Leopard on Mac OS X. I want to use it to compile some old C/C++ DOS games I wrote 15 years ago so that I can run them under DosBox. To do this they obviously need to be compiled in DOS executable format, can anyone tell me how to do this using GCC please? Thanks! 回答1: DOSBox runs 16 bit x86 real-mode code under emulation. The regular GCC compiler on OSX 10.6 targets the OSX operating system and 32 bit x86 protected mode, so you cannot use that to build code

Using GCC on Mac OS to Compile C Program for MS-DOS (DOSBox)

风流意气都作罢 提交于 2020-08-06 20:47:29
问题 I am running GCC 4.2.1 under Snow Leopard on Mac OS X. I want to use it to compile some old C/C++ DOS games I wrote 15 years ago so that I can run them under DosBox. To do this they obviously need to be compiled in DOS executable format, can anyone tell me how to do this using GCC please? Thanks! 回答1: DOSBox runs 16 bit x86 real-mode code under emulation. The regular GCC compiler on OSX 10.6 targets the OSX operating system and 32 bit x86 protected mode, so you cannot use that to build code

Passing Unicode parameters to Windows .bat file when rerunning it

一笑奈何 提交于 2020-07-18 10:41:08
问题 My .bat file looks like this: @echo off CD /D "%~dp0" if [%2]==[] ( set user=%USERNAME% ) else ( set user=%2% ) :getFile if [%1]==[] ( set /p file=Enter file name : ) else ( set file=%~f1 echo File name: %~f1 ) :checkFile for /f "useback tokens=*" %%a in ('%file%') do set file=%%~a if not exist "%file%" ( echo Error: Could not find file: %file% echo. ) :: Check for admin permissions >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" if '%errorlevel%' == '0' (

How to set Timer

廉价感情. 提交于 2020-07-10 05:59:27
问题 Is there any way I can set timer 60 seconds with xor ah,ah Enter_Again: xor ah, ah ; I should put 60 seconds here int 16h ; The user should press S before 60 seconds mov bl,al cmp al,"S" 回答1: Your previous questions suggest you are running under DOS. There is no BIOS or DOS call that times out keyboard input. You can latch (chain) onto Interrupt 0x1c which is a user interrupt routine that gets called about 18.2 times a second. One minute is about 1092 of these interrupts. Your timer interrupt

reading from File in assembly

血红的双手。 提交于 2020-06-26 14:47:16
问题 i am trying to read a username and a password from a file in x86 assembly for the perpose of authentication obviously the file consists of two lines , the user name and the password how can i read the two lines seperately and compare them? My attempt: proc read_file mov ah,3dh lea dx,file_name int 21h mov bx, ax xor si,si repeat: mov ah, 3fh lea dx, buffer mov cx, 100 int 21h mov si, ax mov buffer[si], '$' mov ah, 09h int 21h ;print on screen cmp si, 100 je repeat jmp stop;jump to end stop:

hexadecimal value of opcodes

拈花ヽ惹草 提交于 2020-06-25 21:51:11
问题 I created a very simple assembly program that prints the letter 'a' in DOS. I opened it in a hex editor and the result was this: Assembly code: mov ah, 2 mov dx, 'a' int 21h Hex code B4 02 B2 61 CD 21 I wanted to understand how it was generated! Like, I do not know if I'm right, but I realized that: B4 = mov ah 02 = 2 B2 = mov dx 61 = 'a' CD = int 21h = 21 The 02 , 61 and 21 I understood what turned but and B4 , B2 and CD ? 回答1: Here's a nice reference: http://ref.x86asm.net/coder32.html As

hexadecimal value of opcodes

若如初见. 提交于 2020-06-25 21:50:11
问题 I created a very simple assembly program that prints the letter 'a' in DOS. I opened it in a hex editor and the result was this: Assembly code: mov ah, 2 mov dx, 'a' int 21h Hex code B4 02 B2 61 CD 21 I wanted to understand how it was generated! Like, I do not know if I'm right, but I realized that: B4 = mov ah 02 = 2 B2 = mov dx 61 = 'a' CD = int 21h = 21 The 02 , 61 and 21 I understood what turned but and B4 , B2 and CD ? 回答1: Here's a nice reference: http://ref.x86asm.net/coder32.html As

BIOS INT 13H with AH=2 can only read 72 sectors each time. Why?

 ̄綄美尐妖づ 提交于 2020-06-22 15:42:42
问题 I am using Bochs 2.4.5 to write a boot sector code. I use the INT 13H to read sectors from floppy. But I found that if the sector count to read > 72, the INT13 will fail. And the return code is AH=1. Below's the code and here is the INT13. The return code is AH=1. Why can't the INT 13H read more than 72 sectors? xorb %ah, %ah xorb %dl, %dl int $0x13 # reset the floppy movw $0x8000, %ax movw %ax,%es movw $0, %bx # ES:BX is the buffer movb $0x02, %ah movb $73, %al # how many sectors to read. 72

Can't enter a variable in DOS

a 夏天 提交于 2020-06-08 20:00:12
问题 I'm trying to run a batch file in vDOS (DOS emulator), where I want the user to input two variables. Every time I run the file, it doesn't let me enter the variables. SET /P in=Input: SET /P out=Output: What I expected to happen was that It'd let me enter the input for the variables. Instead, it executes both of the commands as they are (without letting me enter the input). 回答1: Windows cmd and MS-DOS are very different things and one of the differences is the set command. In MS-DOS the only