]> cloudbase.mooo.com Git - avrcpm.git/commitdiff
* avr/dsk_fat16.asm
authorFrank Zoll <fzoll@web.de>
Fri, 1 Oct 2010 20:06:38 +0000 (20:06 +0000)
committerFrank Zoll <fzoll@web.de>
Fri, 1 Oct 2010 20:06:38 +0000 (20:06 +0000)
  Disk image file working R/O.

git-svn-id: svn://cu.loc/avr-cpm/trunk@111 57430480-672e-4586-8877-bcf8adbbf3b7

avrcpm/avr/8080int-jmp.asm
avrcpm/avr/config.inc
avrcpm/avr/dsk_fat16.asm
avrcpm/avr/dsk_mgr.asm

index c7909961d0cabaa5113ed59b79903a8a2d84f7fd..26811b5b494edeea72a4ea7757572890c10755d9 100644 (file)
@@ -699,7 +699,7 @@ do_op_in:   ; in a,(opl)
 .endif
 
        mov temp2,opl
-       rcall portRead
+       lcall portRead
        mov opl,temp
 
 .if PORT_DEBUG
index 2562ebb5807292f91f5dea41eb2185ebf621941f..358e2273dc1e426d91167ea23750ad4f1f706533 100644 (file)
@@ -62,7 +62,9 @@
 
 .equ BOOT_DEBUG  = 0
 .equ MMC_DEBUG   = 0           /* Increase for more debugging */
-.equ FAT16_DEBUG = 2
+.equ FAT16_DEBUG = 1
+.equ FAT16_RWDEBUG = 0
+.equ FAT16_DBG_FAT = 1
 .equ INS_DEBUG   = 0
 .equ MEMTEST     = 1
 .equ BOOTWAIT    = 1
index fd52479a60522bc6359f97777572e943dc33b9d4..a0c648d2b4045612226fb1dd518e876468b9650b 100644 (file)
@@ -552,6 +552,7 @@ fat_look_store:
 ;      st      y+,temp
 
 ;   Convert Filesize to ammount of sectors
+;   (calc with 512byte/sector)
        ldd     xl,z+0x1D
        ldd     xh,z+0x1E
        ldd     zl,z+0x1F
@@ -574,7 +575,6 @@ fat_look_store:
        sts     ndisks,temp
        
 
-.if FAT16_DEBUG > 1
 ; Test finding of the first sector
        ldd     xl,z+0x1A
        ldd     xh,z+0x1B
@@ -582,6 +582,7 @@ fat_look_store:
 
        rcall   fat_gethostsec
 
+.if FAT16_DEBUG > 1
        printstring "Begin of Image at: ",0
        mov             temp ,yl
        mov             temp2,yh
@@ -651,6 +652,7 @@ fat_clusttosec:
        sbc             xh,_0
 
        lds             temp,fat_clustersize
+       lsr             temp
 
 fat_c2s_loop:
        tst             temp
@@ -685,8 +687,22 @@ fat_find_phsy_clust:
 
 ;      Get First FAT- Cluster Number of Diskimage
        
-       ldd             xl,z+1
-       ldd             xh,z+2
+       ldd             yl,z+1
+       ldd             yh,z+2
+
+.if FAT16_DBG_FAT > 0
+       printstring "Search log. Cluster ",0
+       mov temp,xl
+       mov temp2,xh
+       rcall printhexw
+       printnewline
+               
+       printstring "Search phys. Cluster ",0
+       mov temp ,yl
+       mov temp2,yh
+       rcall printhexw
+       printnewline
+.endif
 
 fat_next_phsy_clust:   
        cp              xl,_0
@@ -715,7 +731,7 @@ fat_next_phsy_clust:
        lds xh,fat_ptr2fat+1
        lds yl,fat_ptr2fat+2
        lds yh,fat_ptr2fat+3
-;   Add Sector offset
+;   Add Cluster offset within sector
        add     xl,temp
        adc     xh,_0
        adc yl,_0
@@ -736,6 +752,14 @@ fat_next_phsy_clust:
        
 ; Found the physical cluster
 fat_found_phsy_clust:  
+.if FAT16_DBG_FAT > 0
+       printstring "Found phys. Cluster at:",0
+       mov temp,yl
+       mov temp2,yh
+       rcall printhexw
+       printnewline
+.endif 
+
        ret
 
 ; ====================================================================
@@ -757,12 +781,6 @@ fat_found_phsy_clust:
 fat_hostparam:
        lds             xl,hostdsk
 
-.if HOSTRW_DEBUG
-       mov     temp,xl
-       subi    temp,-('A')
-       rcall   uartputc
-       printstring ": "
-.endif
 
        rcall dsk_getpartentry  ; get partition entry
 
@@ -771,11 +789,6 @@ fat_hostlend:
        lds             temp2,hostlba+1
        lds             temp3,hostlba+2
 
-.if HOSTRW_DEBUG
-       printstring "lba: "
-       clr             temp4
-       rcall   print_ultoa
-.endif
 
        ldd             xl,z+5                  ; get size of disk in sectors
        ldd             xh,z+6
@@ -786,23 +799,6 @@ fat_hostlend:
        cpc             temp3,yl
        brcs    fat_hp1
        
-.if HOSTRW_DEBUG
-       printstring ", max: "
-       push    temp4
-       push    temp3
-       push    temp2
-       push    temp
-       movw    temp,x
-       mov             temp3,yl
-       clr             temp4
-       rcall   print_ultoa
-       pop             temp
-       pop             temp2
-       pop             temp3
-       pop             temp4
-       printstring " "
-.endif
-       
        clr             temp
        ret
 
@@ -816,6 +812,7 @@ fat_hp1:
        mov     yh,_0
 ; Divide logical Sectornumber by size of Cluster in sectors
        lds             zl,     fat_clustersize
+       lsr     zl
 fat_search_clst_lp:
        tst             zl
        breq    fat_found_clst
@@ -834,6 +831,7 @@ fat_found_clst:
 ; ################# Get Subsector within the logical Cluster for later use
        mov             yl,xl
        lds             zl,     fat_clustersize
+       lsr             zl
 fat_search_clst_lp2:
        tst             zl
        breq    fat_found_subsec
@@ -884,6 +882,17 @@ fat_wrong_cache_clst:
        mov     xl,yl
        mov             xh,yh
        rcall   fat_gethostsec
+; Found the physical sector
+.if FAT16_DBG_FAT > 0
+       printstring "Found phys. Sector at:",0
+       mov temp,yl
+       mov temp2,yh
+       rcall printhexw
+       mov temp,xl
+       mov temp2,xh
+       rcall printhexw
+       printnewline
+.endif 
 
 ;   Save the found Sector for later use into cache
        sts             fat_clust_ptr  ,xl
@@ -899,20 +908,16 @@ fat_add_offset:
        adc             yl,_0
        adc             yh,_0
 
-.if HOSTRW_DEBUG
-       printstring ", abs:"
-       push    temp4
-       push    temp3
-       push    temp2
-       push    temp
-       movw    temp,x
-       movw    temp3,y
-       rcall   print_ultoa
-       pop             temp
-       pop             temp2
-       pop             temp3
-       pop             temp4
-       printstring " "
+; Found the physical sector
+.if FAT16_DBG_FAT > 0
+       printstring "Sector with Offset at:",0
+       mov temp,yl
+       mov temp2,yh
+       rcall printhexw
+       mov temp,xl
+       mov temp2,xh
+       rcall printhexw
+       printnewline
 .endif
 
        ori             temp,255
@@ -933,7 +938,7 @@ fat_hpex:
 ; ====================================================================
 
 fat_writehost:
-.if HOSTRW_DEBUG
+.if FAT16_RWDEBUG > 1
        printnewline
        printstring "host write "
 .endif
@@ -955,6 +960,13 @@ fat_writehost:
        brne    fat_rdwr_err
        rjmp    fat_rdwr_ok
 
+fat_rdwr_ok:
+       sts             erflag,_0
+       ret
+
+fat_rdwr_err:
+       sts             erflag,_255
+       ret
 ; ====================================================================
 ; Function: Does a Disk read operation
 ; ====================================================================
@@ -969,7 +981,7 @@ fat_writehost:
 ; ====================================================================
 
 fat_readhost:
-.if HOSTRW_DEBUG
+.if FAT16_RWDEBUG > 1
        printnewline
        printstring "host read  "
 .endif
@@ -978,6 +990,7 @@ fat_readhost:
        breq    fat_rdwr_err
        
        
+.if FAT16_RWDEBUG > 0
        printstring "Read Image Sector:"
        push    temp4
        push    temp3
@@ -990,7 +1003,8 @@ fat_readhost:
        pop             temp2
        pop             temp3
        pop             temp4
-       printstring " "
+       printnewline
+.endif
        
        call    mmcReadSect
        tst             temp
@@ -1006,12 +1020,5 @@ fat_readhost:
        tst             temp
        brne    fat_rdwr_err
 
-fat_rdwr_ok:
-       sts             erflag,_0
-       ret
-
-fat_rdwr_err:
-       sts             erflag,_255
-       ret
 #endif
 
index 16977f57cf1f3c95ac0b6742ac1086aacb78284b..8086d2f910fa7d4fc760935df8c76bc90a2d1558 100644 (file)
@@ -65,7 +65,7 @@ mgr_picl:
        brne    mgr_picl\r
 \r
 ; Start mmc Card interaction\r
-       rcall   mmcInit\r
+       lcall   mmcInit\r
        andi    temp,MMCST_NOINIT & MMCST_NODISK\r
        brne    mgr_pierr\r
        \r