AgonConsole8 / agon-vdp

Official Firmware for the Agon Console8: ESP32 VDP
MIT License
38 stars 13 forks source link

"Print Buffer Escaped" Command #217

Closed jblang closed 1 month ago

jblang commented 2 months ago

It would be useful for certain use cases to have the ability to print all the characters in a buffer as literal characters without the need to escape each control character. @stevesims suggested in discord to make the VDU system command &9B which is $80 + ESC ($1B).

Unfortunately this is my first time looking in the VDP codebase and I have gotten a bit bogged down understanding how to use the buffers. Here is what I have so far...

In agon.h:

#define VDP_BUFFER_PRINT        0x9B    // Print a buffer of characters literally with no command interpretation

In vdu_sys.h:

        case VDP_BUFFER_PRINT: {        // VDU 23, 0, &9B
            auto bufferId = readWord_t();
            auto bufferIter = buffers.find(bufferId);
            if (bufferIter == buffers.end()) {
                debug_log("vdp_bufferPrint: buffer %d not found\n\r", bufferId);
                return;
            }
                        // i can't figure out how to extract the string from the buffer
            context->plotString(stringFromBuffer);
        }
stevesims commented 1 month ago

this was released in VDP 2.9.0