aboutsummaryrefslogtreecommitdiff
path: root/src/col80_modified/cruft/col80_init.s
blob: 89ccf75756a3db99bc9da0ed15cc21443b320d06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
; ----------------------------------------------------------------------------
; Initialization callback. The OS will call this on coldstart (or would do,
; if the driver were in ROM), and also on warmstart (because we stole the
; DOSINI vector).
; This routine is also the first thing that gets called by the mainline
; init code. Its job is to install COL80 in the handler table at HATABS.
; Actually the handler is first installed as X:, then the main init code
; fixes this up to E: unless the user is holding down SELECT. This allows
; the user to toggle between the 40-column ROM E: and COL80 without doing
; a full reboot. No idea if this was a documented feature or something the
; author used for development/debugging.

col80_init:
        ldy     #$00

next_hatab_slot:
        lda     HATABS,y
        beq     register_x_handler
        iny
        iny
        iny
        cpy     #$20
        bcc     next_hatab_slot
        jmp     return_success

register_x_handler:
        lda     #$58
        sta     HATABS,y
        lda     #<col80_vector_tab
        iny
        sta     HATABS,y
        lda     #>col80_vector_tab
        iny
        sta     HATABS,y
        jmp     return_success