2163
|
1 NAM mach_coco
|
|
2 TTL CoCo machine routines
|
|
3
|
2191
|
4 PSECT mach_coco3,0,0,0,0,mach_init
|
2163
|
5
|
|
6 VSECT
|
|
7 ENDSECT
|
|
8
|
|
9 PIA0Base equ $FF00
|
|
10 PIA1Base equ $FF20
|
|
11 DAT.Regs equ $FFA0
|
|
12
|
|
13 mach_init:
|
|
14 * CoCo 3 Initialization Code
|
|
15 clr $FFD9 go into fast mode
|
|
16
|
|
17 * Setup MMU
|
|
18 ldx #DAT.Regs
|
|
19 leay MMUTbl,pcr
|
|
20 ldb #16
|
|
21 MMULoop lda ,y+
|
|
22 sta ,x+
|
|
23 decb
|
|
24 bne MMULoop
|
|
25
|
|
26 * Setup video
|
|
27 leau CC3Regs,pcr point to video setup data
|
|
28 ldx #$FF90
|
|
29 Loop1 ldd ,u++ get the bytes
|
|
30 std ,x++ save in the hardware
|
|
31 cmpx #$FFA0
|
|
32 bcs Loop1
|
|
33
|
|
34 * Set palettes up
|
|
35 leau PalTbl,pcr
|
|
36 ldy #$FFB0 palette register
|
|
37 ldb #16
|
|
38 lbsr CopyRtn
|
|
39
|
|
40 * Initialize PIAs
|
|
41 ldx #PIA1Base RG - Initialize the PIA 1
|
|
42 ldd #$FF34
|
|
43 clr 1,x cassette motor off, 0,x is DDR
|
|
44 clr 3,x 2,x is DDR
|
|
45 deca A = $FE
|
|
46 sta ,x cassette bit 0 input, all others output
|
|
47 lda #$F8 bits 7-3 output, bits 2-0 input
|
|
48 sta 2,x set DDR
|
|
49 stb 1,x 0,x not DDR
|
|
50 stb 3,x 2,x not DDR
|
|
51 clr 2,x
|
|
52 lda #$02 RS-232 bit hi
|
|
53 sta ,x set it
|
|
54
|
|
55 lda #$FF all outputs
|
|
56 ldx #PIA0Base
|
|
57 clr 1,x 0,x is DDR
|
|
58 clr 3,x 2,x is DDR
|
|
59 clr ,x all inputs
|
|
60 sta 2,x all outputs
|
|
61 stb 1,x 0,x is not DDR
|
|
62 stb 3,x 2,x is not DDR
|
|
63 clr 2,x
|
|
64
|
|
65 rts
|
|
66
|
|
67 CopyRtn clra
|
|
68 tfr d,x
|
|
69 Copy1 ldb ,u+
|
|
70 stb ,y+
|
|
71 leax -1,x
|
|
72 bne Copy1
|
|
73 rts
|
|
74
|
|
75 * MMU
|
|
76 MMUTbl
|
|
77 fcb $38,$39,$3A,$3B,$3C,$3D,$3E,$3F
|
|
78 fcb $38,$39,$3A,$3B,$3C,$3D,$3E,$3F
|
|
79
|
|
80 * GIME register default values
|
|
81 CC3Regs fcb $EC CC2, MMU, IRQ, Vector page, SCS
|
|
82 fcb $00 map type 0
|
|
83 fcb $00 no FIRQ
|
|
84 fcb $00 no IRQ
|
|
85 fdb $0900 timer
|
|
86 fcb $00 unused
|
|
87 fcb $00 unused
|
|
88 fcb $00
|
|
89 fcb $00
|
|
90 fcb $00
|
|
91 fcb $00
|
|
92 fdb $0FE0
|
|
93 fcb $00
|
|
94 fcb $00
|
|
95
|
|
96 * Palette register default colors
|
|
97 PalTbl
|
|
98 fcb $12 green
|
|
99 fcb $36
|
|
100 fcb $09 blue
|
|
101 fcb $24 red
|
|
102 fcb $3F white
|
|
103 fcb $1B cyan
|
|
104 fcb $2D magenta
|
|
105 fcb $26
|
|
106 fcb $00 black
|
|
107 fcb $12 green
|
|
108 fcb $00 black
|
|
109 fcb $3F white
|
|
110 fcb $00 black
|
|
111 fcb $12 green
|
|
112 fcb $00 black
|
|
113 fcb $26
|
|
114
|
|
115
|
|
116 endsect
|