From 5aebdf11dc1ae57b439ebfd30ba3ebc72ebc1369 Mon Sep 17 00:00:00 2001 From: yeti0904 Date: Thu, 9 Nov 2023 16:46:39 +0000 Subject: [PATCH] some more logging --- source/computer.d | 1 + source/devices/graphicsController.d | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/source/computer.d b/source/computer.d index ebe742f..824700f 100644 --- a/source/computer.d +++ b/source/computer.d @@ -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; diff --git a/source/devices/graphicsController.d b/source/devices/graphicsController.d index 5692b8c..d630308 100644 --- a/source/devices/graphicsController.d +++ b/source/devices/graphicsController.d @@ -1,6 +1,7 @@ module yeti16.devices.graphicsController; import std.stdio; +import core.stdc.stdlib; import bindbc.sdl; import yeti16.fonts; import yeti16.types; @@ -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; @@ -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;