Skip to content

Commit

Permalink
add mode FF
Browse files Browse the repository at this point in the history
  • Loading branch information
MESYETI committed Nov 21, 2023
1 parent ee70038 commit b34d814
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ Usage: %s {operation} [args]
Operations:
asm {file} [-o {file}]
Compiles an assembly file to machine code
-o : Sets output binary file
Flags:
-o : Sets output binary file
-t : Show lexer output
-a : parser output
-l : Show label addresses
run {file}
Runs the given file in the emulator
Expand Down
4 changes: 4 additions & 0 deletions source/computer.d
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,10 @@ int ComputerCLI(string[] args) {
++ deviceTop;
break;
}
case "--dont": { // Don't
display.enableFF = true;
break;
}
default: {
stderr.writefln("Unknown flag '%s'", args[i]);
return 1;
Expand Down
4 changes: 4 additions & 0 deletions source/devices/graphicsController.d
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ class GraphicsController : Device {
computer.display.resolution = Vec2!int(320, 240);
break;
}
case 0xFF: {
computer.display.resolution = Vec2!int(1920, 1080);
break;
}
default: break;
}

Expand Down
24 changes: 24 additions & 0 deletions source/display.d
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Display {
SDL_Texture* texture;
uint[] pixels;
Vec2!int resolution;
bool enableFF;

this() {

Expand Down Expand Up @@ -223,6 +224,29 @@ class Display {
}
break;
}
case 0xFF: {
if (!enableFF) goto default;

uint pixelAddr = 0x000405;
uint pixelEnd = pixelAddr + (1920 * 1080 * 3);
auto expectedRes = Vec2!int(1920, 1080);

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

SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);

for (uint i = pixelAddr; i < pixelEnd; i += 3) {
uint offset = i - pixelAddr;
pixels[offset] = ColourToInt(
computer.ram[i], computer.ram[i + 1], computer.ram[i + 2]
);
}
break;
}
default: {
dead = true;
SDL_SetRenderDrawColor(
Expand Down

0 comments on commit b34d814

Please sign in to comment.