annotate 3rdparty/subrtns/hires.asm @ 1799:78b6ac6bba2c

makefile fixed for CO51
author boisy
date Mon, 11 Apr 2005 23:33:58 +0000
parents 900ceed1880a
children b8c7b7fbf3c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1178
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
1 ********************************************************************
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
2 * HiRes - HiRes Joystick Subroutine Module
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
3 *
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
4 * $Id$
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
5 *
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
6 * Ed. Comments Who YY/MM/DD
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
7 * ------------------------------------------------------------------
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
8 * 1 Created for Coyota project BGP 98/??/??
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
9
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
10 nam HiRes
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
11 ttl HiRes Joystick Subroutine Module
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
13 ifp1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14 use os9defs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16
1178
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
17 edition set 1
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
18
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19 mod eom,name,Sbrtn+Objct,Reent+0,HiRes,size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21 size equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23 name fcs /HiRes/
1178
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
24 fcb edition
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
26 * Hi-Res Read Routine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
27 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28 * Taken in part from "High Hopes for the Hi-Res"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 * by William Barden, Jr., Rainbow Magazine, Feb 1990, pp. 42
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
31 * Entry:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 * X = $0000 for Right, $0001 for Left
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
33 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34 * Exit:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35 * 2,s = param count (should be 4)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 * 4,s = addr of 1st param (joystick number)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 * 6,s = size of 1st param
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 * 8,s = addr of 2nd param (joystick X)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
39 * 10,s = size of 2nd param
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
40 * 12,s = addr of 3rd param (joystick Y)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41 * 14,s = size of 3rd param
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 * 16,s = addr of 4th param (joystick button)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43 * 18,s = size of 4th param
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
45
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
46 HiRes ldd 2,s get param count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47 cmpd #4 4 params?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48 bne error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 ldd [4,s] get joystick num.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50 * fix up joystick value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
51 lslb shift left 3 times
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52 lslb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 lslb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54 pshs b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55 lda #$00 fetch X value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 bsr HiResHW
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 std [9,s] save in param addr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58 lda #$08 fetch Y value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
59 ldb ,s+ get joystick selector
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 bsr HiResHW
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 std [12,s]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62 * get button value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
63 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64 ldb #$FF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65 stb $FF02
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66 ldb $FF00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67 clr $FF02
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 tst [5,s]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70 beq BtnLft
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 andb #$05
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 bra BtnCnt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73 BtnLft andb #$0A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 lsrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 BtnCnt lsrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 bcc BtnCnt2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 orb #$01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78 BtnCnt2 std [16,s] save button
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 clrb no error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 error coma
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 ldb #E$IllArg
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 * Hi-Res Hardware read routine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 * This code is a hybrid of William Barden's Hi-Res
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 * interface code in the February 1990 Rainbow, and
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 * the code in CC3IO. It prevents infinite looping
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91 * that can happen in Barden's code. It also caps the
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 * value at 639.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94 * Entry:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 * A = value to place in $FF01 (00 for X, 08 for Y)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 * B = value to place in $FF03 (00 for Right, 08 for Left)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 * Exit:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 * D = value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101 * Delays for CoCo 3 OS-9 Level Two vs. CoCo 2 OS-9 Level One
1178
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
102 IFGT Level-1
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
103 SETTLDLY equ 94
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
104 POLLDLY equ 809
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105 HIVAL equ 640
1178
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
106 ELSE
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
107 SETTLDLY equ 94*2
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
108 POLLDLY equ 404
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109 HIVAL equ 320
1178
900ceed1880a Added standard headers
boisy
parents: 0
diff changeset
110 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
112 HiResHW pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 lda $FF01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 anda #$F7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115 ora ,s+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
116 sta $FF01 select X or Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118 pshs b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
119 lda $FF03
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
120 anda #$F7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
121 ora ,s+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
122 sta $FF03 select Right or Left
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
123
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
124 * turn off ramp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
125 lda $FF20
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126 anda #$03
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
127 ora #$FC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
128 sta $FF20 turn off ramp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
129
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130 * delay for settling
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
131 ldb #SETTLDLY delay loop
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
132 Settle decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
133 bne Settle
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
134
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
135 ldd #POLLDLY
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
136 pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 lda $FF20
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 anda #$23
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 sta $FF20 turn on ramp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 RampCnt lda $FF00 get byte at $FF00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141 bmi CompVal branch if voltage hit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
142 decb B initially $29
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143 bne RampCnt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144 dec ,s ,S initially $03
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145 bpl RampCnt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 puls a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 ldd #HIVAL-1 just assume highest
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 CompVal puls a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151 pshs b,a push hi-res count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 ldd #HIVAL
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
153 subd ,s++ subtract count from 640
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
154 bcc CompVal2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158 CompVal2 cmpd #HIVAL-1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
159 bcs HiHWRts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
160 ldd #HIVAL-1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 HiHWRts rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 eom equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 end