DosBox runs games such as Wolfenstein 3D and Doom pretty well. In DosBox configuration file, the CPU type is set to auto (which it is said is the fastest option.) Cycles, which is the number of instructions DosBox attempts to emulate each millisecond, is also set to auto. I tried using CTRL + F12 to increase this value while running DosBox but there isn't much difference when it comes to my QBasic program. Note that I am calling PSET in a double FOR loop to draw a square on the screen. Maybe this is a slow approach? I tried using FreeBasic and it runs the same code just fine. The only thing that has worked in QBasic is the approach that uses page-flipping.
This code runs fine:
DATA 00,00,00,00,00,00,00,00,00,00,12,12,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,15,15,00,00,00
DATA 00,00,00,00,00,00,00,00,00,15,15,15,15,00,00
DATA 00,00,00,00,00,00,00,00,00,15,15,00,15,00,00
DATA 00,00,00,00,00,00,00,00,15,15,15,15,15,14,00
DATA 00,00,00,00,15,15,15,15,15,15,15,15,15,14,14
DATA 15,00,15,15,15,15,00,15,15,15,15,15,00,00,00
DATA 00,15,15,15,15,00,15,15,15,15,15,00,00,00,00
DATA 15,00,15,15,00,15,15,15,15,15,15,00,00,00,00
DATA 00,15,15,15,15,00,00,15,15,15,15,00,00,00,00
DATA 15,00,15,15,15,15,15,15,15,15,00,00,00,00,00
DATA 00,00,00,00,00,00,15,15,15,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,14,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,14,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,14,14,14,00,00,00,00,00,00
SCREEN 7, 0, 1, 0
CLS
FOR y = 0 TO 14
FOR x = 0 TO 14
READ DotColor
PSET (x, y), DotColor
NEXT
NEXT
DIM imgDuck(15, 15)
GET (0, 0)-(15, 15), imgDuck
CLS
done = 0
speed = 2
x = 0
y = 0
KeyRight$ = CHR$(0) + CHR$(77)
KeyLeft$ = CHR$(0) + CHR$(75)
keyDown$ = CHR$(0) + CHR$(80)
keyUp$ = CHR$(0) + CHR$(72)
WHILE done = 0
CLS
PUT (x, y), imgDuck
PCOPY 1, 0
k$ = UCASE$(INKEY$)
SELECT CASE k$
CASE KeyRight$
x = x + speed
CASE KeyLeft$
x = x - speed
CASE keyUp$
y = y - speed
CASE keyDown$
y = y + speed
CASE "Q"
done = 1
END SELECT
WEND
But the code that only makes PSET calls does not?
The PSET-only approach looks like this:
duck:
DATA 00,00,00,00,00,00,00,00,00,00,12,12,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00,15,15,00,00,00
DATA 00,00,00,00,00,00,00,00,00,15,15,15,15,00,00
DATA 00,00,00,00,00,00,00,00,00,15,15,00,15,00,00
DATA 00,00,00,00,00,00,00,00,15,15,15,15,15,14,00
DATA 00,00,00,00,15,15,15,15,15,15,15,15,15,14,14
DATA 15,00,15,15,15,15,00,15,15,15,15,15,00,00,00
DATA 00,15,15,15,15,00,15,15,15,15,15,00,00,00,00
DATA 15,00,15,15,00,15,15,15,15,15,15,00,00,00,00
DATA 00,15,15,15,15,00,00,15,15,15,15,00,00,00,00
DATA 15,00,15,15,15,15,15,15,15,15,00,00,00,00,00
DATA 00,00,00,00,00,00,15,15,15,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,14,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,14,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,14,14,14,00,00,00,00,00,00
SCREEN 7
done = 0
speed = 2
x = 0
y = 0
KeyRight$ = CHR$(0) + CHR$(77)
KeyLeft$ = CHR$(0) + CHR$(75)
keyDown$ = CHR$(0) + CHR$(80)
keyUp$ = CHR$(0) + CHR$(72)
WHILE done = 0
CLS
FOR i = 0 TO 14
FOR j = 0 TO 14
READ DotColor
PSET (x + j, y + i), DotColor
NEXT
NEXT
RESTORE duck
k$ = UCASE$(INKEY$)
SELECT CASE k$
CASE KeyRight$
x = x + speed
CASE KeyLeft$
x = x - speed
CASE keyUp$
y = y - speed
CASE keyDown$
y = y + speed
CASE "Q"
done = 1
END SELECT
WEND
Correction: FreeBASIC runs it the same just a little bit better performance-wise. I guess the problem is PSET?