vc64web / virtualc64web

vc64web - Commodore C64 Emulator for iPad iPhone Android and the Web with CSDb access for thousands of demos at your fingertip.
https://vc64web.github.io/doc/about.html
GNU General Public License v3.0
43 stars 4 forks source link

DMA Visualizer #75

Open mithrendal opened 3 years ago

mithrendal commented 3 years ago

grafik

I did this c64->configure(OPT_DMA_DEBUG, true);

but the visualization is fairly static ... it does not change ... am I holding it wrong ?

grafik

oh the paparazzi took a photo of us 🙄 ... me left ... dirk on the right side... 🤓

dirkwhoffmann commented 3 years ago

The C64 has pretty stable "DMA" compared to the Amiga (VICII accesses are more or less static).

If you look at the image closely, you can see that every item casts a shadow (red arrow). The shadow is due to the fact that the DMA debugger automatically modifies the brightness of the debug color according to the bus value. As long as these shadows go away when the screen changes back to the checkerboard, everything is fine.

101246825-e6be3c80-3715-11eb-89b6-28ff7f8c3ede

Yes, paparazzi are really behind us. But are you sure that's us? We look so young on this picture... 🤔 Here is a most recent one I think: 🤓

theatre

mithrendal commented 3 years ago

grafik

and what does the shadow mean ? does it mean that it is a sprite ?

dirkwhoffmann commented 3 years ago

The shadows reflect bitmap graphics data (or data from the character Rom, depending on the display mode). Sprite data is fetched outside the visible screen area. To make it visible, you need to display the whole texture (the one with the checkerboard pattern).

mithrendal commented 3 years ago

I want to have the sprite cutout feature ... it will be very useful for identifying in game sprites by number and this is particulary very important for ActionButton autobot AI programming ...

I am doing this now ... c64->configure(OPT_CUT_LAYERS, SPR0|SPR1|SPR2|SPR3|SPR4|SPR5|SPR6|SPR7 /*c64->getConfigItem(OPT_CUT_LAYERS) */);

but no effect ...😳

the hide sprite feature works ... but I don't need it ...🙄 c64->configure(OPT_HIDE_SPRITES, true);

Oh no again ... one just can't drink a coffee without being photographed 🙄

grafik

dirkwhoffmann commented 3 years ago

I am doing this now ... c64->configure(OPT_CUT_LAYERS, SPR0|SPR1|SPR2|SPR3|SPR4|SPR5|SPR6|SPR7)

There is a global bit (0x100) for enabling and disabling sprite layer cutting. If this bit is 0, the lower eight bits (sprite bits) have no effect. Hence, what you need to do is:

c64->configure(OPT_CUT_LAYERS, 0x100|SPR0|SPR1|SPR2|SPR3|SPR4|SPR5|SPR6|SPR7)

This will cut out all 8 sprites.

mithrendal commented 3 years ago

grafik

Yes the mysterious 0x100 bit was missing ...

now I have to add the config section ... should it be a global or a game specific setting 🤔 ... I think we go with a gobal one...

dirkwhoffmann commented 3 years ago

Very cool 😎.

I think we go with a gobal one...

Agreed. Make it a global one

mithrendal commented 3 years ago

grafik

fantastic ... this is brilliant ... you see the sprites changing live while you are clicking ..

Agreed. Make it a global one

I make it not only global but I also implemented a new setting feature ... I implemented it as a 'forgettable' setting ... thus when you restart the browser now actively forgets about what the user set in the last session ... all layer cut outs will be reset to zero ...

here is the javascript code ...


$('.layer').change( function(event) {
    //recompute stencil cut out layer value
    const layers={
        sprite0: 0x01,
        sprite1: 0x02,
        sprite2: 0x04,
        sprite3: 0x08,
        sprite4: 0x10,
        sprite5: 0x20,
        sprite6: 0x40,
        sprite7: 0x80,        
    };
    const GLOBAL_SPRITE_BIT= 0x100;

    var layer_value = 0;
    for(var layer_id in layers)
    {
        if(document.getElementById(layer_id).checked)
        {
            layer_value |= layers[layer_id];
        }
    }
    if((layer_value & 0xff) != 0)
    {
        layer_value |= GLOBAL_SPRITE_BIT;
    }

    wasm_cut_layers( layer_value );
});
mithrendal commented 3 years ago

I think we close this ... if somebody votes against not implementing the DMA visualizer .... we can open this again

dirkwhoffmann commented 3 years ago

if somebody votes against not implementing the DMA visualizer

No DMA visualizer in the web edition? 😱

mithrendal commented 3 years ago

Oh in that case we add it to vc64web. 😅 we need it for vAmigaWeb anyways ... so the code could be reused...