Hello, Guest the thread was viewed1.7k times and contains 10 replies

last post from Ultimax at the

C64 - Code ASM : Problem with pixel set.

  • Hello everybody...


    For the program there asm which I realize, I need a small code to draw pixel.
    I found on the forum a small routine which pleases me well.


    There were some errors of labels that I corrected.


    I do not performance of speed.


    I use Bank3 (no need the characters).
    Address Screen = $e000


    The routine ' clrHiResBITMAP ' does not work.
    The routine ' SetPixel ' does not work.


    My code:

  • 1.) In line 28 you set both, the background colour and the foreground colour, to 0 = black. You won't be able to see any dots this way. Try #$10 for example for white dots on a black screen.
    2.) I understand that you do not aim for speed. However, this code is painfully unnecessarily slow. My advice: throw it away. If you like I could give you a better routine.

  • Thank you M.J.
    ---
    I said it because I found full of code which looks only for performances of speed for demos with tables to avoid the greedy calculations in cycles.
    This short not very long routine is enough for my needs.


    But if you have better I am well interested sure. All that I want it is that it works.
    ---
    The routine 'ColorHires' works very well, even when I change the color code, it is the routine ' clrHiResBITMAP ' which does not work.
    If I remove the call of the routine 'ColorHires', the disappearance of the screen is not made.
    And ' SetPixel ' makes nothing.
    --
    Thank you...

  • Hoogo
    I load an image in bottom of screen and I is none problem with the kernal.
    Of quite manners, I use routines of the kernal (Load, Save, Keyboard...)
    If I deactivate it, I lose the access in these routine.


    The Kernal has a size of 8KB, so it overlays the whole bitmap. So you have to care about $01, and also about IRQs with SEI/CLI.

  • It has already been mentioned by the previous posters, I don't see any provisions here to handle the RAM/ROM banking in $E000..$FFFF. The standard configuration always writes to RAM (that's why the bitmap load works), but reads from ROM.


    At least around the LDA/ORA/STA combo to update the bitmap byte, you'll have to set $01 to all RAM, and back to RAM/ROM. An interrupt occuring during these half a dozen instructions ought not crash the C64, here the simplest solution is to again 'bracket' these instructions with SEI/CLI.


    Last, you wrote that speed isn't important to you here. I tell you, speed is *all* here that matters - otherwise it wouldn't make any sense to write this function in machine language. Alas, this code looks like it was literally translated from BASIC, with painfully slow 'multiplications' to calculate the bitmap address and which bit to set. You don't do that this way in ML, one uses tables instead!