]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avr/init.asm
* New config option: SRAM_FILL
[avrcpm.git] / avr / init.asm
index 469001a38545c815d391b812918d0ecb07ee425e..e2d48f4455b84ddf3340d766f66c9766506d2d13 100644 (file)
@@ -1,7 +1,7 @@
 ;    Hardware initialisation, disk, mmc, timer, DRAM test
 ;
 ;    Copyright (C) 2010 Sprite_tm
-;    Copyright (C) 2010 Leo C.
+;    Copyright (C) 2010-2013 Leo C.
 ;
 ;    This file is part of avrcpm.
 ;
@@ -79,11 +79,21 @@ cp_l:       lpm     xh,z+
 
        ldiw    z,SRAM_START
        ldi     temp2,high(ramtop)
-clr_l:
+clr_loop:
        st      z+,_0
        cpi     zl,low(ramtop)
        cpc     zh,temp2
-       brne    clr_l
+       brne    clr_loop
+
+; - Fill unused RAM (stack)
+
+       ldi     temp2,high(RAMEND+1)
+       ldi     temp,SRAMFILL_VAL
+fill_loop:
+       st      z+,temp
+       cpi     zl,low(RAMEND+1)
+       cpc     zh,temp2
+       brne    fill_loop
 
 ; Init clock/timer system
 
@@ -119,7 +129,7 @@ clr_l:
 
        sei
 
-#if I2C
+#if I2C_SUPPORT
        rcall   i2c_init                        ; Init I2C master
        rcall   rtc_get
 #endif
@@ -220,8 +230,8 @@ ramtestend:
 
 .if MEMFILL
        ldiw    x,0
+       ldi     temp,MEMFILL_VAL
 ramfillw:
-       ldi temp,MEMFILL_VAL
        rcall   dram_write_pp
        brcc ramfillw
 .endif
@@ -253,7 +263,9 @@ boot_ipl2:
        printnewline
        printstring "Partinit done."
        
-       lcall   dsk_inval_hostbuf       ;init (de)blocking buffer
+; Init (de)blocking buffer
+
+       lcall   dsk_inval_hostbuf
 
 ; Read first sector of first CP/M partition (ipl)
 
@@ -269,7 +281,8 @@ boot_ipl2:
        ldiw    x,IPLADDR
        stsw    dmaadr,x
        
-       lcall   dsk_read
+       ldi     temp,1<<READ_FUNC
+       lcall   dskDoIt
 
 ;      lift off
        ljmp z80_init