Palette Shifting Fun

VGA Palette Shifting Demo

Messing with the Mode 13h palette. I noticed one section of it is already just a cycle through hue values, so I made it loop through those hues while drawing, and also loop the section of the palette itself. The result is magic!

Posted: 2017-01-22


Early VGA Tests

20170122_Early_VGA_Tests.png

I've decided to make a DOS game. This is one of the earliest tests, which just writes the entire palette to the corner of the screen. Currently using Mode 13h.

Using DOSBox in the short term for testing. Still need to acquire a real 486 with VGA and a SoundBlaster compatible sound card.

Posted: 2017-01-22


LilyVM - Addressing Modes

Well, I guess I settled on that last addressing mode. It's two more modes, which pretty much just copy the existing immediate-memory-location and something-from-the-stack addressing modes.

Again, my terminology might be way off, but I'm going to call it indirect-whatever mode.

Syntax in the assember for it is *address, or $stack_offset.

Here's what it's doing in code for the "fetch" part. (Excuse the crappy temporary error handling for now.)

inline LilyVM::Word LilyVM::fetchParameterByType(LilyVM::ParamType type)
{
    switch(type) {
        case PARAM_NULL:             return 0;
        case PARAM_IMMEDIATE:        return fetchInstruction();
        case PARAM_ADDRESS:          return fetchRaw(fetchInstruction());
        case PARAM_STACK:            return fetchRaw(stackPointer + fetchInstruction());
        case PARAM_INDIRECT_ADDRESS: return fetchRaw(fetchRaw(fetchInstruction()));
        case PARAM_INDIRECT_STACK:   return fetchRaw(fetchRaw(stackPointer + fetchInstruction()));

        default:
            break;
    }

    // TODO: Throw error (bad instruction).
    cout << "Bad addressing mode for read: " << type << endl;
    exit(1);

    return 0;
}

And here's a little example snippet of assembly demonstrating it.

mov 123 **someAddress
mov 123 *$somestackOffset

The ability to add in-line, immediate data was also added in the last couple of revisions. There are assembly directives to have the next few Words be some explicit values, or to fill the next 'n' Words with some specific value.

I think the incomplete VM code might almost be not-embarrassing enough to toss up GitHub soon.

Next up: Profiling and comparisons against Lua and native code. Then taking out some of the modulo crap and trying it again.

Posted: 2016-07-25


0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 [ 39 ] 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68

Previous | Next