sam-astro / Astro8-Computer

Custom 16-bit homebrew CPU, emulator, renderer, PCB, and language

Repository from Github https://github.comsam-astro/Astro8-ComputerRepository from Github https://github.comsam-astro/Astro8-Computer

Last pixel is black

maramowicz opened this issue · comments

Describe the bug
Its not possible to set or see (idk for now) last pixel on emulator on Linux (maybe on windows too but I dont has windows so idk) from version 0.2.0 upwards (0.1.1 works)

To Reproduce
Steps to reproduce the behavior:

  1. Open rainbow_gradient.armstrong
  2. See error (last pixel is black)

Expected behavior
Whole screen is "rainbow"

Additional context
Screenshot of bug
image

I think I finded a problem:
For example ADD if result equals/is higher than 65534 subtracting 65534:
562: if (bus >= 65534)
But if code want draw pixels, its checking up to 65534:
688: if (pixelRamIndex >= 65535) { pixelRamIndex = 61439;
That means is not possible to set int higher than 65533, so its not possible to set 65534 address.

Edit: I'm changed all 65534 to 65535 and everything works correctly so why they are changed? 2^16 = 65536 and if we must include 0 then range is from 0 to 65535.
Maybe I'm wrong, but doesn't this need to be corrected to if (bus >= 65536)?
I think:
65534 is in range
65535 in in range too
65536 is out of range

Thanks I'll fix this, I accidentally thought 65525 was exclusive haha

Fixed in the dev branch