-
Notifications
You must be signed in to change notification settings - Fork 1
/
SDOS.asm
54 lines (43 loc) · 1.55 KB
/
SDOS.asm
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
.include "SDCard_Controller_def.asm"
;******************************************************************************
; ISDOS_INIT
; Init the SDCARD
; Inputs:
; None
; Affects:
; SDCARD_PRSNT_MNT = 0 if SD card is not present or 1 is present.
;******************************************************************************
ISDOS_INIT
.as
TURN_ON_SD_LED
LDA #0
; SD Card is not present
STA SDCARD_PRSNT_MNT
; initialize the SD Card reader
LDA #SDC_TRANS_INIT_SD
STA SDC_TRANS_TYPE_REG
LDA #SDC_TRANS_START
STA SDC_TRANS_CONTROL_REG
SD_WAIT LDA SDC_TRANS_STATUS_REG
AND #SDC_TRANS_BUSY
CMP #SDC_TRANS_BUSY
BEQ SD_WAIT
; check for errors
LDA SDC_TRANS_ERROR_REG
BEQ SD_INIT_SUCCESS
LDA #'F'
STA EVID_TEXT_MEM + 100 *3
LDA #$10
STA EVID_COLOR_MEM + 100 *3
BRA SD_INIT_DONE
SD_INIT_SUCCESS
; SD Card is present
LDA #1
STA SDCARD_PRSNT_MNT
LDA #'B'
STA EVID_TEXT_MEM + 100 *3
LDA #$10
STA EVID_COLOR_MEM + 100 *3
SD_INIT_DONE
TURN_OFF_SD_LED
RTS