2163
|
1 NAM mach_coco
|
|
2 TTL CoCo machine routines
|
|
3
|
|
4 PSECT mach_coco,0,0,0,0,mach_init
|
|
5
|
|
6 VSECT
|
|
7 ENDSECT
|
|
8
|
|
9 PIA0Base equ $FF00
|
|
10 PIA1Base equ $FF20
|
|
11
|
|
12 mach_init:
|
|
13 * CoCo 1/2 Initialization Code
|
|
14 ldx #PIA1Base PIA1
|
|
15 clr -3,x clear PIA0 Control Register A
|
|
16 clr -1,x clear PIA0 Control Register B
|
|
17 clr -4,x set PIA0 side A to input
|
|
18 ldd #$FF34
|
|
19 sta -2,x set PIA0 side B to output
|
|
20 stb -3,x enable PIA0 peripheral reg, disable PIA0
|
|
21 stb -1,x MPU interrupts, set CA2, CA1 to outputs
|
|
22 clr 1,x $FF20 = DDR, motoroff
|
|
23 clr 3,x $FF22 = DDR, sound disabled
|
|
24 deca A = $FE after deca
|
|
25 sta ,x bits 1-7 are outputs, bit 0 is input on PIA1 side A
|
|
26 lda #$F8
|
|
27 sta 2,x bits 0-2 are inputs, bits 3-7 are outputs on B side
|
|
28 stb 1,x enable peripheral registers, disable PIA1 MPU
|
|
29 stb 3,x interrupts and set CA2, CB2 as outputs
|
|
30 clr 2,x set 6847 mode to alphanumeric
|
|
31 ldb #$02
|
|
32 stb ,x make RS-232 output marking
|
|
33 clrb
|
|
34 tfr b,dp B = 0
|
|
35 ldb #$04
|
|
36 clr -2,x
|
|
37 bitb 2,x
|
|
38
|
|
39 lda #$37
|
|
40 sta PIA1Base+3
|
|
41
|
|
42 lda PIA0Base+3
|
|
43 ora #$01
|
|
44 sta PIA0Base+3
|
|
45
|
|
46 lda PIA1Base+2
|
|
47 anda #$07
|
|
48 sta PIA1Base+2
|
|
49
|
|
50 * 64K DRAM (M0=0, M1=1)
|
|
51 sta $FFDA RESET M0
|
|
52 sta $FFDD SET M1
|
|
53
|
|
54 rts
|
|
55
|
|
56 endsect
|