2 ; Oliver Schmidt, 07.09.2009
4 ; unsigned __fastcall__ videomode (unsigned mode);
15 ; Get and save current videomode flag
19 ; If we are in 80 column mode then the 80 column firmware is
20 ; known to be active so we can just print the ctrl-char code
21 ; (even if this only means staying in the current videomode)
26 ; If we are in 40 column mode and want to set 40 column mode
27 ; then we explicitly do nothing as we neither know about the
28 ; current state of the 80 column firmware nor want to fix it
29 : cmp #$11 ; Ctrl-char code for 40 cols
32 ; If we are in 40 column mode and want to set 80 column mode
33 ; then we first presume the 80 column firmware being already
34 ; active and print the ctrl-char code (this causes a garbage
35 ; char to be printed on the screen if isn't already active)
38 ; If we successfully switched to 80 column mode then the 80
39 ; column firmware was in fact already active and we're done
43 ; The 80 column firmware isn't already active so we need to
44 ; initialize it - causing the screen to be cleared and thus
45 ; the garbage char printed above to be erased (but for some
46 ; reason the cursor horizontal position not to be zeroed)
49 ; Initializing the 80 column firmware needs the ROM switched
50 ; in, otherwise it would copy the F8 ROM to the LC (@ $CEF4)
53 ; Initialize 80 column firmware
56 ; Switch in LC bank 2 for R/O
59 ; Return ctrl-char code for setting previous
60 ; videomode using the saved videomode flag
61 done: lda #$11 ; Ctrl-char code for 40 cols
64 lda #$12 ; Ctrl-char code for 80 cols
65 : rts ; X was preserved all the way