JoeStrout / minimicro-sysdisk

Contents of the /sys disk for the Mini Micro virtual computer
20 stars 10 forks source link

Changing display mode before backing display up? #4

Closed sebnozzi closed 1 year ago

sebnozzi commented 2 years ago

The order of events here got me confused. Either I don't understand it correctly or it might be a yet undetected bug:

https://github.com/JoeStrout/minimicro-sysdisk/blob/747bfee66d331a7a468671912562a7a4fbed047e/sys/startup.ms#L250

_viewImage = function(pic)
        // ...
    prevMode = display(0).mode
        // Setting display-mode of 0 to pixel ...?
    display(0).mode = displayMode.pixel
        // Before saving the previous display?
    prevDisp = display(0)
    g = new PixelDisplay
    g.install 0

Isn't the code above setting the display-mode before even saving it?

I would have thought the order of events needs to be:

_viewImage = function(pic)
        // ...
    prevMode = display(0).mode
    prevDisp = display(0)
        // Maybe this line is redundant thanks to ...
    display(0).mode = displayMode.pixel
        // ... the following 2 lines?
    g = new PixelDisplay
    g.install 0

Also, would setting the mode to pixel not be redundant since we are installing a PixelDisplay at slot 0 anyway?

JoeStrout commented 2 years ago

You're right, the code was changed when Display.install was added, but not quite correctly. Good catch!

JoeStrout commented 1 year ago

Fixed for Mini Micro 1.2.