Hello, Guest the thread was viewed881 times and contains 5 replies

last post from Freddy at the

40/80 col switching with pokes

  • Hi everyone,

    Been lurking the forum only for a short while, so not sure if this is the right place to ask.

    I've been fooling around with Basic 10 as a way to start familiarizing myself with C65 in Xemu and one thing I'm stuck with right now is getting my program to switch to 40 columns or 80 columns with one or more poke commands.

    So I did print peek(dec("D031")), which seemed the right (and only?) address that concerns this. Was getting 224 for 80 column and 96 for 40 column, after switching the modes manually with F1 in the emu.

    Now doing a poke dec("D031"),96 will switch the screen to 40 columns, but if I was in 80 columns from boot, the line width remains 80 or something. So every print command or the list command on a larger program will throw in an empty line every row if the contents are within 40 columns.

    And doing a poke dec("D031"),224 will switch to 80 columns, if I was in 40 columns from pressing F1 earlier, but the line width will then remain 40, which makes every rows being printed or listed alternating between the left half and the right half of the screen.

    F1 switches the modes correctly, including limiting the maximum line width that basic is displaying its stuff in. So I either keep missing the register in the documentation that makes this works correctly, or I'm not understanding $D031 correctly, or it's a bug of sorts. But I'm not putting my money on bug. It's probably my limited knowledge :thumbup:

    Thanks in advance if anyone can push me in the right direction. Cheers!

  • There's a second register that tells the VIC4 how many bytes are in a line.

    ;number of bytes per text screen line lo

    .CHARSTEP_LO = $d058

    ;number of bytes per text screen line hi

    .CHARSTEP_HI = $d059

    So POKE $d058,80 should do the trick.

    BTW, you can use $ directly for hex numbers, as in POKE $d031,224

    This worked for me (entered manually):

    POKE $d031,0

    POKE $d058,40

  • Thanks man!

    Hmm but the poking hex ie $d031,0 directly doesn't work for me. Maybe that is Basic 65? I have yet to check that out. Working my way up!

    I bet also, if I enable the VIC4 registers, your suggestion with D058 will work..But for VIC-III nothing much is happening.

    I think will have to dig around in the VIC-III listings and find something similar, if I want to stay pure C65 for the fun of it. Or I'll give up and jump ship to the mega65 mode later.

    Anyway, you do got me thinking in the right direction maybe. Scouting the C65 updated speficiations @ git now to see if there is something similar to CHARSTEP for VIC-III..
    A quick ctrl+f didn't produce any results but maybe its named slightly different...