Skip to content

Commit

Permalink
some more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
MESYETI committed Nov 9, 2023
1 parent 609edb4 commit 5aebdf1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions source/computer.d
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ class Computer {
int ComputerCLI(string[] args) {
auto display = new Display();
display.Init();
writeln("Initialised display");

auto computer = new Computer();
display.computer = computer;
Expand Down
14 changes: 13 additions & 1 deletion source/devices/graphicsController.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module yeti16.devices.graphicsController;

import std.stdio;
import core.stdc.stdlib;
import bindbc.sdl;
import yeti16.fonts;
import yeti16.types;
Expand Down Expand Up @@ -73,7 +74,9 @@ class GraphicsController : Device {
break;
}
case 'M': {
switch (computer.ram[0x000404]) {
ubyte mode = computer.ram[0x000404];

switch (mode) {
case 0x00: {
computer.display.resolution = Vec2!int(80 * 8, 40 * 8);
break;
Expand Down Expand Up @@ -104,6 +107,15 @@ class GraphicsController : Device {
SDL_TEXTUREACCESS_STREAMING, computer.display.resolution.x,
computer.display.resolution.y
);

if (computer.display.texture is null) {
stderr.writefln(
"Failed to create texture: %s", computer.display.GetError()
);
exit(1);
}

writefln("Initialised graphics mode 0x%.2X", mode);
break;
}
default: break;
Expand Down

0 comments on commit 5aebdf1

Please sign in to comment.