aboutsummaryrefslogtreecommitdiff
path: root/autorun.s
blob: c7bbac041ad2441b72d7ba1c5e76dcd2ca5cbeb2 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
 .include "atari.inc"
 .include "xex.inc"

 .bss
 .org $80

old_sdlstl: .res 1
old_sdlsth: .res 1
old_color2: .res 1
old_color1: .res 1

 .code

loadaddr = $3000

 xex_org loadaddr
screendata:
 .incbin "about.dat"

 .if ((* - screendata) <> 960)
   .error .sprintf("%c*** about.dat is %d bytes (should be 960)", 10, * - screendata)
 .endif

dlist:
 .byte DL_BLK8, DL_BLK8, DL_BLK8
 .byte DL_CHR40x8x1 | DL_LMS
 .word screendata
 .repeat 23
  .byte DL_CHR40x8x1
 .endrep
 .byte DL_JVB
 .word dlist

main:
 ; fix things so the Reset key doesn't do a coldstart, see
 ; BOOT? and COLDST in Mapping.
 lda #0
 sta COLDST
 lda #1
 sta BOOTQ

 lda SDLSTL
 sta old_sdlstl
 lda SDLSTH
 sta old_sdlsth
 lda COLOR1
 sta old_color1
 lda COLOR2
 sta old_color2

 lda #$90
 sta COLOR2
 lda #$0e
 sta COLOR1
 lda #<dlist
 sta SDLSTL
 lda #>dlist
 sta SDLSTH

loop:
 ldx CH
 cpx #$ff
 beq loop

 lda #$ff
 sta CH

 lda old_sdlstl
 sta SDLSTL
 lda old_sdlsth
 sta SDLSTH
 lda old_color1
 sta COLOR1
 lda old_color2
 sta COLOR2

 cpx #KEY_1
 bne not_1
 ldy #0
 beq setup_iocb

not_1:
 cpx #KEY_2
 bne not_2
 ldy #1
 bne setup_iocb

not_2:
 ; 3, or actually any other key
 rts

setup_iocb:
 ldx #$10
 lda #$28 ; MyDOS XIO 40
 sta ICCOM,x
 lda fntab_l,y
 sta ICBAL,x
 lda fntab_h,y
 sta ICBAH,x
 lda fnlentab,y
 sta ICBLL,x
 lda #0
 sta ICBLH,x
 jsr CIOV

 ; CIOV should never return on success, so if we get here, give up.
 lda #0
 sta COLOR2
hang: jmp hang
 rts

dla_filename: .byte "D:DLA.XEX"
dla_fn_len = * - dla_filename
csv_filename: .byte "D:DLA2CSV.XEX"
csv_fn_len = * - csv_filename

fntab_l:  .byte <dla_filename, <csv_filename
fntab_h:  .byte >dla_filename, >csv_filename
fnlentab: .byte dla_fn_len, csv_fn_len

xex_run main