; Various functions: init, (RAM) disk, mmc, timer
-; This file needs to get split up.
;
; Copyright (C) 2010 Sprite_tm
; Copyright (C) 2010 Leo C.
ramtestw:
mov temp,xh
eor temp,xl
- mem_write
- adiw xl,1
+ rcall dram_write_pp
brcc ramtestw
printstring "wait..."
ldiw x,0
ramfillw:
ldi temp,MEMFILL_VAL
- mem_write
- adiw xl,1
+ rcall dram_write_pp
brcc ramfillw
.endif
boot_again:
printnewline
- printstring "Initing mmc...",0
+ printstring "Initing mmc..."
printnewline
- call mgr_init_partitions
+ lcall mgr_init_partitions
cbr temp,0x80
brne boot_ipl2
boot_ipl2:
- call mgr_prnt_parttbl
+ lcall mgr_prnt_parttbl
printnewline
printstring "Partinit done."
+
+ ldi temp,0
+ rcall dsk_img_type ;parameter for boot disk image.
+
+ lcall dsk_inval_hostbuf ;init (de)blocking buffer
+
+; Read first sector of first CP/M partition (ipl)
+
+; Disk 0
+ sts seekdsk,_0
+; Track 0
+ sts seektrk,_0
+ sts seektrk+1,_0
+; Sector 0
+ sts seeksec,_0
+
+; Destination
+ ldiw x,IPLADDR
+ stsw dmaadr,x
+
+ lcall dsk_read
-; Read first sector of first CP/M partition
-
- lds xl,hostparttbl+1
- lds xh,hostparttbl+2
- lds yl,hostparttbl+3
- lds yh,hostparttbl+4
- rcall mmcReadSect
-
- rcall dsk_cboot ;init (de)blocking buffer
-
-;First sector of disk or first CP/M partition is in hostbuf.
-
-;Save to Z80 RAM (only 128 bytes because that's retro)
- ldiw z,hostbuf
- ldiw x,IPLADDR
-iplwriteloop:
- ld temp,z+
- mem_write
- adiw xl,1
- cpi zl,low(hostbuf+128)
- brne iplwriteloop
- cpi zh,high(hostbuf+128)
- brne iplwriteloop
- jmp z80_init
+; lift off
+ ljmp z80_init