Skip to content

Commit

Permalink
add 320x240 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MESYETI committed Nov 17, 2023
1 parent 23a29f1 commit 28b86cd
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
9 changes: 8 additions & 1 deletion docs/display.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ Attribute data is stored in 0x001275 - 0x0018B5

Pixel data is stored in 0x000405 - 0x00FE05

Palette data is stored in 0x00FE05 - 0x10105
Palette data is stored in 0x00FE05 - 0x010105

### 0x11
320x240 video mode with 8bpp

Pixel data is stored in 0x000405 - 0x013005

Palette data is stored in 0x013005 - 0x013305

## Text data
Text data is stored in 2 buffers:
Expand Down
4 changes: 4 additions & 0 deletions source/devices/graphicsController.d
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ class GraphicsController : Device {
computer.display.resolution = Vec2!int(320, 200);
break;
}
case 0x11: {
computer.display.resolution = Vec2!int(320, 240);
break;
}
default: break;
}

Expand Down
32 changes: 28 additions & 4 deletions source/display.d
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,34 @@ class Display {
}
break;
}
case 0x10: {
uint paletteAddr = 0x00FE05;
uint pixelAddr = 0x000405;
uint pixelEnd = pixelAddr + (320 * 200);
case 0x10:
case 0x11: {
uint paletteAddr = 0x00FE05;
uint pixelAddr = 0x000405;
uint pixelEnd = pixelAddr + (320 * 200);
Vec2!int expectedRes;

final switch (videoMode) {
case 0x10: {
paletteAddr = 0x00FE05;
pixelAddr = 0x000405;
pixelEnd = pixelAddr + (320 * 200);
expectedRes = Vec2!int(320, 200);
break;
}
case 0x11: {
paletteAddr = 0x013005;
pixelAddr = 0x000405;
pixelEnd = pixelAddr + (320 * 240);
expectedRes = Vec2!int(320, 240);
break;
}
}

if (resolution != expectedRes) {
deathColour = SDL_Color(0, 0, 255, 255);
goto default;
}

SDL_SetRenderDrawColor(
renderer, computer.ram[paletteAddr], computer.ram[paletteAddr + 1],
Expand Down

0 comments on commit 28b86cd

Please sign in to comment.