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