mirror of
https://github.com/dosbox-staging/dosbox-staging
synced 2025-12-04 16:27:29 -05:00
Page:
DOS filesystem tests
Pages
AUTOTYPE candidates
Adding utilities
Application issues
Applications
Audio configuration recommendations
Audio mixer signal flow diagram
Audio tests
Building on NixOS
CPU tests
Config file examples
Controller issues
Creative 4MB GMGSMT
DOS 32A compatibility list
DOS ROM format
DOS filesystem tests
DOS tests
DOSBox forks
Documentation (unmaintained)
Dual OPL2 and OPL3 games
Dual mouse gaming
Frequently asked questions
Game controls guide
Game issues
Games with CD DA, GUS and MIDI audio
Games with enhanced Tandy & PCjr graphics and sound
General dev notes & tips
Getting started
Gravis UltraSound enhancements
Home
Input tests
Instant launch
Intel compiler tips
Joysticks
Keymapper
Learning DOS programming
MIDI
Multiplayer & serial ports
Performance tests
Release process
Running games from batch files
Shaders
Shortcuts
Sound cards
Sound issues
Sourceport links of classic DOS first person shooters
Special keys
Tips & tricks
True 16 bit audio games
UniVBE
Video cards
Video tests — CRT shaders
Video tests — Presentation
Video tests — Video modes
Windows 1.0x
Windows 2.x
Windows 3.0
Windows 3.1x
Windows 9x
Windows
Working with disc images on Windows 3.x
No results
3
DOS filesystem tests
Daniel Bomar edited this page 2025-01-12 14:24:56 -06:00
Table of Contents
Read after delete test
Real DOS (tested with MS-DOS 6.22 in a VM) allows files to be deleted while file handles are currently open. Reading and writing to the handle after delete is technically undefined behavior in DOS but in practice, it should return the old deleted data if nothing else wrote to the disk in the same location.
In DOSBox Staging, this behavior is defined to always return the old file data. This assembly program tests this behavior.
To test
- Copy the code below to a text file. Ex:
unread.asm - Download NASM (can be built from host, doesn't have to be the DOS version): https://www.nasm.us/
nasm unread.asm -o unread.com- Copy
unread.comto a folder to be mounted with DOSBox - Create a
test.txtin that same folder with some text to read back - Run the program. On success,
test.txtwill be deleted and the text will be output to the DOS console.
org 100h
section .text
; open file
mov ah, 3dh
mov al, 0h
lea dx, [file_name]
int 21h
jc open_error_fn
mov [handle], ax
; delete file
mov ah, 41h
lea dx, [file_name]
int 21h
jc delete_error_fn
; read file
mov ah, 3fh
mov bx, [handle]
mov cx, 32
lea dx, [str]
int 21h
jc read_error_fn
; append newline and M$ termination to file contents
lea dx, [str]
mov bx, dx
add bx, ax
mov word [bx], 13
inc bx
mov word [bx], 10
inc bx
mov word [bx], '$'
; print the string we read from the file
mov ah, 09h
int 21h
end:
mov ah, 0h
int 21h
open_error_fn:
lea dx, [open_error]
jmp print_error
delete_error_fn:
lea dx, [delete_error]
jmp print_error
read_error_fn:
lea dx, [read_error]
print_error:
mov ah, 09h
int 21h
jmp end
section .data
file_name: db 'test.txt', 0
open_error: db 'Failed to open file', 13, 10, '$'
delete_error: db 'Failed to delete file', 13, 10, '$'
read_error: db 'Failed to read file', 13, 10, '$'
section .bss
handle: resb 2
str: resb 64
General
How-to's
- Adding utilities
- Applications
- Config file examples
- Dual-mouse gaming
- Getting started
- Instant launch
- Joysticks and Gamepads
- Keymapper
- Multiplayer & serial ports
- Windows
Lists
- AUTOTYPE candidates
- CDDA / GUS / MIDI games
- DOS/32A compatibility
- Dual OPL2 and OPL3 games
- Games with enhanced Tandy & PCjr graphics and sound
- Shaders
- Special keys
Audio
- Audio mixer signal flow diagram
- Audio configuration recommendations
- GUS enhancements
- MIDI
- Sound cards
- True 16-bit audio games
Video
Issues
Dev
- How to contribute
- Release process
- Audio tests
- CPU tests
- DOS tests
- Input tests
- Performance tests
- Video tests — Video modes
- Video tests — CRT shaders
- Video tests — Presentation
- Learning DOS programming
- Intel compiler tips