Changeset 32
- Timestamp:
- 08/02/09 04:39:28 (3 years ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
page00/boot.asm (modified) (3 diffs)
-
page00/jumptable.asm (modified) (1 diff)
-
page02/02base.asm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/page00/boot.asm
r31 r32 474 474 cp skGraphvar 475 475 jr z,StartBootLoader 476 $$: ld hl,0 477 ld (appBackUpScreen+50),hl 478 ld (appBackUpScreen+52),hl 479 set indicRun,(iy+indicFlags) 476 $$: set indicRun,(iy+indicFlags) 480 477 ld hl,1 481 478 ld (curRow),hl … … 502 499 ld (curRow),hl 503 500 call DispHexA 504 cp 36h505 jr z,waitOnByte506 501 cp 37h 507 502 jr nz,notKey … … 513 508 call z,PowerOff 514 509 jr $B 515 waitOnByte:516 di517 res curAble,(iy+curFlags)518 ld hl,(curRow)519 push hl520 ld hl,handler521 call APP_PUSH_ERRORH522 ld hl,2523 ld (curRow),hl524 ld a,6525 call PutC526 B_CALL Rec1stByteNC527 call DispHexA528 B_CALL RecAByteIO529 call DispHexA530 B_CALL RecAByteIO531 call DispHexA532 B_CALL RecAByteIO533 call DispHexA534 call APP_POP_ERRORH535 handler:536 pop hl537 ld (curRow),hl538 res indicOnly,(iy+indicFlags)539 set curAble,(iy+curFlags)540 jr $B541 510 sTest: 542 511 DB "This is a test!",0 543 512 544 513 StartBootLoader: 514 ;TODO: this whole thing eventually needs to run from sector 70h or wherever I back myself up to 545 515 res indicOnly,(iy+indicFlags) 546 516 res curAble,(iy+curFlags) -
trunk/page00/jumptable.asm
r17 r32 61 61 DB 7Ch 62 62 _HandleUSBACablePluggedIn: 63 call Page0Call 63 64 DW HandleUSBACablePluggedIn 64 65 DB 02h 65 66 _HandleUSBACableUnplugged: 67 call Page0Call 66 68 DW HandleUSBACableUnplugged 67 69 DB 02h 68 70 _HandleUSBBCablePluggedIn: 71 call Page0Call 69 72 DW HandleUSBBCablePluggedIn 70 73 DB 02h 71 74 _HandleUSBBCableUnplugged: 75 call Page0Call 72 76 DW HandleUSBBCableUnplugged 73 77 DB 02h 74 78 _HandleUSBInterruptInitialize: 79 call Page0Call 75 80 DW HandleUSBInterruptInitialize 76 81 DB 02h 77 82 _HandleDefaultUSBInterrupt: 83 call Page0Call 78 84 DW HandleDefaultUSBInterrupt 79 85 DB 02h 80 86 _ReadUSBInterruptData: 87 call Page0Call 81 88 DW ReadUSBInterruptData 82 89 DB 02h -
trunk/page02/02base.asm
r9 r32 2 2 SEGMENT PAGE02 3 3 4 include "includes\os2.inc" 5 4 6 PUBLIC HandleUSBInterruptInitialize,HandleDefaultUSBInterrupt,ReadUSBInterruptData 5 7 PUBLIC HandleUSBACablePluggedIn,HandleUSBACableUnplugged,HandleUSBBCablePluggedIn,HandleUSBBCableUnplugged 8 EXTERN PutC 6 9 7 10 ;TODO: deal with all these USB events, somehow 8 11 HandleUSBACablePluggedIn: 9 12 HandleUSBACableUnplugged: 13 ret 14 10 15 HandleUSBBCablePluggedIn: 16 set useUSB,(iy+linkFlags) 17 ld a,2 18 ld (9C28h),a 19 ld a,80h 20 out (57h),a 21 xor a 22 out (4Ch),a 23 ld a,1 24 out (5Bh),a 25 xor a 26 in a,(4Ch) 27 ld a,2 28 out (54h),a 29 ld a,20h 30 out (4Ah),a 31 xor a 32 out (4Bh),a 33 in a,(3Ah) 34 bit 3,a 35 jr z,$F 36 ld a,20h 37 out (4Bh),a 38 $$: xor a 39 out (54h),a 40 ld b,1 41 call WaitTimerBms 42 in a,(3Ah) 43 bit 3,a 44 jr z,$F 45 ld a,44h 46 out (54h),a 47 $$: ld a,0C4h 48 out (54h),a 49 ld a,8 50 out (4Ch),a 51 ld de,0FFFFh 52 $$: call DecreaseCounter 53 jr z,killUSBscfRet 54 in a,(4Ch) 55 cp 1Ah 56 jr z,$F 57 cp 5Ah 58 jr z,$B 59 $$: ld a,0FFh 60 out (87h),a 61 xor a 62 out (92h),a 63 in a,(87h) 64 ld a,0Eh 65 out (89h),a 66 xor a 67 ld (9C26h),a 68 ld (9C27h),a 69 ld a,5 70 out (8Bh),a 71 ld a,5 72 ld (9C28h),a 73 in a,(8Fh) 74 bit 2,a 75 jr z,$F 76 in a,(81h) 77 or 2 78 out (81h),a 79 call WaitTimer20ms 80 jr continue 81 $$: in a,(81h) 82 or 1 83 out (81h),a 84 continue: 85 in a,(54h) 86 or 1 87 out (54h),a 88 ret 89 11 90 HandleUSBBCableUnplugged: 91 ret 92 12 93 HandleUSBInterruptInitialize: 94 in a,(4Dh) 95 bit 5,a 96 jr nz,handleFinalPeriphInit 97 ld a,20h 98 out (57h),a 99 in a,(4Ch) 100 cp 5Ah 101 ret z 102 cp 1Ah 103 ret z 104 ld a,4 105 ld (9C28h),a 106 xor a 107 out (4Ch),a 108 ld a,1 109 out (5Bh),a 110 xor a 111 in a,(4Ch) 112 ld a,2 113 out (54h),a 114 ld a,20h 115 out (4Ah),a 116 ;TODO: finish this...it's 7AM and I've been at this all night... 117 ret 118 handleFinalPeriphInit: 119 set 5,(iy+1Bh) 120 ld a,2 121 ld (9C28h),a 122 ld a,80h 123 out (57h),a 124 xor a 125 out (4Ch),a 126 ld a,1 127 out (5Bh),a 128 ld a,2 129 out (54h),a 130 ld a,20h 131 out (4Ah),a 132 call ScrewWithUSBPorts 133 ld a,8 134 out (4Ch),a 135 ld de,0FFFFh 136 $$: call DecreaseCounter 137 jr z,die 138 in a,(4Ch) 139 cp 1Ah 140 jr z,$F 141 cp 5Ah 142 jr nz,$B 143 $$: ld a,0FFh 144 out (87h),a 145 xor a 146 out (92h),a 147 ld a,0Eh 148 out (89h),a 149 xor a 150 ld (9C26h),a 151 ld (9C27h),a 152 ld a,5 153 out (8Bh),a 154 ;TODO: finish this...it's 7:30AM and I've been at this all night... 155 ret 156 die: 157 ScrewWithUSBPorts: 158 ret 159 13 160 HandleDefaultUSBInterrupt: 161 di 162 bit 3,(iy+41h) 163 ret nz 164 in a,(8Fh) 165 bit 7,a 166 jr nz,killUSBInterruptsError 167 xor a 168 out (5Bh),a 169 ld a,20h 170 out (57h),a 171 ld a,(9C28h) 172 cp 4 173 jr nz,setUSBErrorStateAndStuff 174 ld a,1 175 ld (9C28h),a 176 ld b,50 177 call WaitTimerBms 178 ld a,1 179 out (5Bh),a 180 res 0,(iy+41h) 181 ret 182 183 killUSBInterruptsError: 184 ld a,6 185 ld (9C28h),a 186 xor a 187 out (5Bh),a 188 jr setUSBErrorStateAndStuff 189 14 190 ReadUSBInterruptData: 15 191 ret 16 192 193 DecreaseCounter: 194 dec de 195 ld a,d 196 or e 197 ret 198 199 WaitTimer20ms: 200 ld b,2 201 WaitTimerBms: 202 push hl 203 ld a,42h 204 out (36h),a 205 xor a 206 out (37h),a 207 ld a,b 208 out (38h),a 209 ld hl,0 210 $$: inc hl 211 in a,(4) 212 bit 7,a 213 jr z,$B 214 pop hl 215 ret 216 217 killUSBscfRet: 218 xor a 219 out (5Bh),a 220 setUSBErrorStateAndStuff: 221 in a,(4Dh) 222 bit 5,a 223 jr nz,$F 224 xor a 225 out (4Ch),a 226 res 6,(iy+41h) 227 jr continueFail 228 $$: ld b,8 229 in a,(4Dh) 230 bit 6,a 231 jr nz,$F 232 ld b,0 233 $$: ld a,b 234 out (4Ch),a 235 continueFail: 236 ld a,2 237 out (54h),a 238 in a,(39h) 239 and 0F8h 240 out (39h),a 241 ld a,6 242 ld (9C28h),a 243 in a,(4Dh) 244 bit 5,a 245 jr nz,fail2 246 ld de,0FFFFh 247 $$: call DecreaseCounter 248 jr z,failUSBGood 249 in a,(4Dh) 250 bit 7,a 251 jr z,$B 252 in a,(4Dh) 253 bit 0,a 254 jr z,$B 255 ld a,22h 256 out (57h),a 257 scf 258 ret 259 fail2: in a,(4Dh) 260 bit 6,a 261 jr nz,$F 262 xor a 263 out (4Ch),a 264 ld a,50h 265 jr fail3 266 $$: ld a,93h 267 fail3: out (57h),a 268 scf 269 ret 270 failUSBGood: 271 scf 272 ei 273 ld a,1 274 out (5Bh),a 275 res 0,(iy+41h) 276 ret 277
