OSDN Git Service

e920292fd244fdee76b4afa4d36364ebf4b5339a
[fast-forth/master.git] / ADDON / SD_TOOLS.asm
1 ; -*- coding: utf-8 -*-
2 ; http://patorjk.com/software/taag/#p=display&f=Banner&t=Fast Forth
3
4 ; Fast Forth For Texas Instrument MSP430FRxxxx FRAM devices
5 ; Copyright (C) <2015>  <J.M. THOORENS>
6 ;
7 ; This program is free software: you can redistribute it and/or modify
8 ; it under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
11 ;
12 ; This program is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ; GNU General Public License for more details.
16 ;
17 ; You should have received a copy of the GNU General Public License
18 ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
21
22 ; read logical sector and dump it 
23 ; ----------------------------------;
24     FORTHWORD "SECT_D"              ; sector. --            don't forget to add decimal point to your sector number (if < 65536)
25 ; ----------------------------------;
26 SECT_D
27     MOV     TOS,X                   ; X = SectorH
28     MOV     @PSP,W                  ; W = sectorL
29     CALL    #readSectorWX           ; W = SectorLO  X = SectorHI
30 DisplaySector
31     mDOCOL                          ;
32     .word   UDDOT                   ; ud --            display the double number
33     .word   lit,BUFFER,lit,200h,DUMP;    
34     .word   EXIT                    ;
35 ; ----------------------------------;
36
37 ; TIP : How to identify FAT16 or FAT32 SD_Card ?
38 ; 1 CLUSTER <==> FAT16 RootDIR
39 ; 2 CLUSTER <==> FAT32 RootDIR
40 ; ----------------------------------;
41 ; read first sector of Cluster and dump it
42 ; ----------------------------------;
43             FORTHWORD "CLUST_D"     ; cluster.  --         don't forget to add decimal point to your sector number (if < 65536)
44 ; ----------------------------------;
45     MOV     TOS,&ClusterH           ;
46     MOV     @PSP,&ClusterL          ;
47 Clust_ClustProcess
48     CALL    #ComputeClusFrstSect    ;
49     MOV     &SectorL,0(PSP)         ;
50     MOV     &SectorH,TOS            ;
51     JMP     SECT_D                  ;
52 ; ----------------------------------;
53
54 ; dump FAT1 sector of last entry
55 ; ----------------------------------;
56             FORTHWORD "FAT_D"       ;VWXY Display first FATsector
57 ; ----------------------------------;
58     SUB     #4,PSP                  ;
59     MOV     TOS,2(PSP)              ;
60     MOV     &OrgFAT1,0(PSP)         ;
61     MOV     #0,TOS                  ; FATsectorHI = 0
62     JMP     SECT_D                  ;
63 ; ----------------------------------;
64
65 ;; dump FAT1 sector of last entry
66 ;; ----------------------------------;
67 ;            FORTHWORD "FAT1_D"      ; Display FATsector
68 ;; ----------------------------------;
69 ;    MOV     &OrgFAT1,Y              ;
70 ;FAT1_D_Next                         ;
71 ;    SUB     #4,PSP                  ;
72 ;    MOV     TOS,2(PSP)              ; save TOS
73 ;    MOV     Y,0(PSP)                ;
74 ;    MOV     #0,TOS                  ; FATsectorHI = 0
75 ;    JMP     SECT_D                  ;
76 ;; ----------------------------------;
77 ;
78 ;; dump FAT1 sector of last entry
79 ;; ----------------------------------;
80 ;            FORTHWORD "FAT2_D"      ; Display FATsector
81 ;; ----------------------------------;
82 ;    MOV     &OrgFAT2,Y              ;
83 ;    JMP     FAT1_D_Next             ;
84 ;; ----------------------------------;
85
86
87
88 ; dump DIR sector of opened file or first sector of current DIR by default
89 ; ----------------------------------;
90             FORTHWORD "DIR_D"       ; Display DIR sector of CurrentHdl or CurrentDir sector by default 
91 ; ----------------------------------;
92     SUB     #4,PSP                  ;
93     MOV     TOS,2(PSP)              ;           save TOS
94     MOV     &DIRClusterL,&ClusterL  ;
95     MOV     &DIRClusterH,&ClusterH  ;
96     JMP     Clust_ClustProcess      ;
97 ; ----------------------------------;
98