diff --git a/demos/lines.asm b/demos/lines.asm index c41cb0e..2f7e5e9 100644 --- a/demos/lines.asm +++ b/demos/lines.asm @@ -16,10 +16,10 @@ loop: set d 0 cmp b d ; draws black if its even - jnzb draw_black + jnz draw_black ; and white if its odd set b 15 - jmpb next + jmp next draw_black: set b 0 @@ -32,8 +32,8 @@ next: set b 0 ; checks if rendered every pixel cmp c b - jnzb end - jmpb loop + jnz end + jmp loop end: - jmpb end + jmp end diff --git a/source/display.d b/source/display.d index 69fdf1c..58ce654 100644 --- a/source/display.d +++ b/source/display.d @@ -178,20 +178,23 @@ class Display { break; } case 0x10: { - ubyte[256 * 3] paletteData = computer.ram[0x00FE05 .. 0x10105]; + uint paletteAddr = 0x00FE05; + uint pixelAddr = 0x000405; + uint pixelEnd = pixelAddr + (320 * 200); SDL_SetRenderDrawColor( - renderer, paletteData[0], paletteData[1], paletteData[2], 255 + renderer, computer.ram[paletteAddr], computer.ram[paletteAddr + 1], + computer.ram[paletteAddr + 2], 255 ); SDL_RenderClear(renderer); - for (uint i = 0x000405; i < 0x00FE05; ++ i) { - uint offset = i - 0x000405; + for (uint i = pixelAddr; i < pixelEnd; ++ i) { + uint offset = i - pixelAddr; ubyte colour = computer.ram[i]; pixels[offset] = ColourToInt( - paletteData[colour * 3], - paletteData[(colour * 3) + 1], - paletteData[(colour * 3) + 2] + computer.ram[paletteAddr + (colour * 3)], + computer.ram[paletteAddr + (colour * 3) + 1], + computer.ram[paletteAddr + (colour * 3) + 2] ); } break;