]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avr/init.asm
* cpm/BIOS.MAC
[avrcpm.git] / avr / init.asm
index 940b135570f1780d8a93a305a1fdfa8c2189e2b8..41626dd285bf7d1c19c14de1bd85c2ef77860e15 100644 (file)
@@ -34,7 +34,8 @@ regval_tab:
 regval_tab_e:
 
 start:
-       ldi temp,low(RAMEND)    ; top of memory
+       ldi temp,low(RAMEND)    ; top of memory; vim:set ts=8 noet nowrap
+
        out SPL,temp            ; init stack pointer
        ldi temp,high(RAMEND)   ; top of memory
        out SPH,temp            ; init stack pointer
@@ -79,11 +80,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
 
@@ -162,7 +173,7 @@ ramtestwl:
        ldiw    x,0
        clr     temp3                   ;Error counter
 ramtestr:
-       mem_read
+       rcall   dram_read
 
 ;      ori     temp,0x04               ;simulate error
 ;      andi    temp,0xF7
@@ -214,14 +225,32 @@ ramtestrex:
 halted_loop:
        rjmp    halted_loop             ;keep AVR in an endless loop
 
+printxbits:
+       push    temp2
+       push    temp3
+       mov     temp2,temp
+       ldi     temp3,8
+prntxb0:
+       ldi     temp,'-'
+       lsl     temp2
+       brcc    prntxb1
+       ldi     temp,'X'
+prntxb1:
+       rcall   uartPutc
+       dec     temp3
+       brne    prntxb0
+       pop     temp3
+       pop     temp2
+       ret
+
 ramtestend:
 
 .endif
 
 .if MEMFILL
        ldiw    x,0
+       ldi     temp,MEMFILL_VAL
 ramfillw:
-       ldi temp,MEMFILL_VAL
        rcall   dram_write_pp
        brcc ramfillw
 .endif
@@ -253,53 +282,33 @@ 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)
 
+       ldiw    y,fsys_vars
+
 ;      Disk 0
-       sts     seekdsk,_0
+       std     y+o_seekdsk,_0
 ;      Track 0
-       sts     seektrk,_0
-       sts     seektrk+1,_0
+       std     y+o_seektrk,  _0
+       std     y+o_seektrk+1,_0
 ;      Sector 0
-       sts     seeksec,_0
+       std     y+o_seeksec,_0
 
 ;      Destination
        ldiw    x,IPLADDR
-       stsw    dmaadr,x
+       std     y+o_dmaadr+0,xl
+       std     y+o_dmaadr+1,xh
        
-       lcall   dsk_read
+       ldi     temp,1<<READ_FUNC
+       lcall   dskDoIt
 
 ;      lift off
        ljmp z80_init
 
 
-printspace:
-       push    temp
-       ldi     temp,' '
-       rcall   uartputc
-       pop     temp
-       ret
-
-printxbits:
-       push    temp2
-       push    temp3
-       mov     temp2,temp
-       ldi     temp3,8
-prntxb0:
-       ldi     temp,'-'
-       lsl     temp2
-       brcc    prntxb1
-       ldi     temp,'X'
-prntxb1:
-       rcall   uartPutc
-       dec     temp3
-       brne    prntxb0
-       pop     temp3
-       pop     temp2
-       ret
-
-
-
+; vim:set ts=8 noet nowrap