diff --git a/Programs/CosmOS/Apps/Snake.asm b/Programs/CosmOS/Apps/Snake.asm index 0078ff4..e7cb6b5 100644 --- a/Programs/CosmOS/Apps/Snake.asm +++ b/Programs/CosmOS/Apps/Snake.asm @@ -591,12 +591,19 @@ drawPut: ; ---- Waiting ---- ; -; There is no clock on this machine, so time is counted in instructions. At the emulated -; rate this is about an eighth of a second, which is a speed a person can play at. Running -; the emulator faster or slower moves it, and that is the honest answer: the machine has -; no way to know how long a second is and this program is not going to pretend it does. +; There is no clock on this machine, so time is counted in cycles. At the emulated rate this +; is about an eighth of a second, which is a speed a person can play at. Running the emulator +; faster or slower moves it, and that is the honest answer: the machine has no way to know +; how long a second is and this program is not going to pretend it does. +; +; THE COUNT USED TO BE 256 AND THE COMMENT USED TO SAY INSTRUCTIONS. When a cycle stopped +; being an instruction and became a memory access, every loop in the machine got dearer and +; this one silently doubled - the game has been running at half the speed it says ever since, +; in a terminal as much as in a window. The inner loop is a DECA and a BNA, one byte and +; three, so four cycles a turn: 122 times 256 times 4 is about 125,000, which is an eighth of +; a second at a megahertz. pause: - RSTB + INIB 0d122 pauseOuter: RSTA pauseInner: diff --git a/Source/Emulator/voyager.c b/Source/Emulator/voyager.c index f8d8c01..ec55093 100644 --- a/Source/Emulator/voyager.c +++ b/Source/Emulator/voyager.c @@ -242,7 +242,13 @@ int main(int argc, char *argv[]) { } else { // Resizable, because how big somebody wants a screen is not the machine's business. // The picture is rescaled to whatever the window becomes, in whole pixels. - SetConfigFlags(FLAG_WINDOW_RESIZABLE); + // + // And presented in step with the display. Without the hint the frame limiter sleeps + // towards sixty a second on its own clock, which beats against a screen refreshing on + // its own - some frames shown twice, some skipped, and the machine handed an uneven + // number of cycles each time because it takes them from the wall clock. The target + // stays as well, for a driver that ignores the hint. + SetConfigFlags(FLAG_WINDOW_RESIZABLE | FLAG_VSYNC_HINT); InitWindow(VIDEO_MAX_WIDTH * SCREEN_SCALE, VIDEO_MAX_HEIGHT * SCREEN_SCALE, "Segan Voyager"); SetTargetFPS(60); diff --git a/Tests/expected/cosmosRun.out b/Tests/expected/cosmosRun.out index ab141cf..c5e3c7e 100644 --- a/Tests/expected/cosmosRun.out +++ b/Tests/expected/cosmosRun.out @@ -3,7 +3,7 @@ CosmOS > greet.sbx 211 hello.sbx 53 Life.sbx 1396 -Snake.sbx 2163 +Snake.sbx 2164 Keys.sbx 664 Say.sbx 156 Break.sbx 149 diff --git a/Tests/expected/cosmosSlowDisk.out b/Tests/expected/cosmosSlowDisk.out index 0abfaff..c74d37d 100644 --- a/Tests/expected/cosmosSlowDisk.out +++ b/Tests/expected/cosmosSlowDisk.out @@ -2,7 +2,7 @@ CosmOS > greet.sbx 211 hello.sbx 53 Life.sbx 1396 -Snake.sbx 2163 +Snake.sbx 2164 Keys.sbx 664 Say.sbx 156 Break.sbx 149