Hallo Besucher, der Thread wurde 1k mal aufgerufen und enthält 4 Antworten

letzter Beitrag von LGB-Z am

Super extended attribute mode in BASIC10

  • Hi all!


    For those of you who are struggling to access the VIC-IV's extended features, here's a little bit of sample code that shows how to access "super extended attribute mode" in BASIC10. Nothing fancy of course, just the absolute basics: Showing some text, flipping characters and using the fabled raster rewrite buffer.



    Here it is: https://files.mega65.org?id=46…59-487d-9baf-fd4b73cb4ae1


    Some remarks:


    Lines 140 / 630-690

    When using super extended character mode, you really want a custom error handler, because if something goes wrong, VIC-IV doesn't reset to a sane configuration automatically.


    Lines 170-210:

    Switching to VIC-IV mode has to be done in machine language because BASIC10 relies on the VIC-III being there. Since between the first and the last access into VIC's KEY register, VIC goes to VIC-II mode temporarily, all kinds of nasty crashes might happen if doing this from BASIC


    Line 310:

    The C65 (and C128) screen editor has the nasty habit of scrolling the screen down when logical lines are filled up. Since this causes chaos with our custom clear screen routine (see below), we have to disable screen editor line linking (one physical line=one logical line). To re-enable it later, just type POKE 248,0


    Line 320:

    This clears the screen to colour 0. Since in super extended character mode each character on the screen is made up of two bytes in screen memory (and two bytes in colour memory) we use the little trick of writing " @" via PRINT after setting the foreground colour to 0 -- thus

    a) setting both addresses in colour memory to colour 0,

    b) setting the first byte of the screen RAM two-byte pair to the space character, and

    c) setting the second byte of the screen RAM 2-byte-pair to zero

    If you can think of a faster way of clearing the screen in BASIC10, let me know... :)


    Lines 340-400:

    Write some stuff to the screen via a custom output routine that writes the single characters with the proper offsets


    Lines 420-470:

    Demonstrates some attributes


    Lines 490-540:

    Demonstrates the raster rewrite buffer


    Lines 580-610:

    Custom text output; feel free to use this in your own programs


    Overall it can be said (again) that BASIC10 is to the M65 what BASIC2 was to the C64: A really not-so-great language that doesn't the machine proper justice ;)

    But with some dedication, one can achieve nice results nevertheless! :)