; ====================================================================
; Parameters
; --------------------------------------------------------------------
-; Registers : [w] z Pointer to the Partitionentry
-; [r] zl Number of Diskentry to Read
-; [w] _tmp0 scratch
-; [w] _tmp1 "
+; Registers : [w] z Pointer to the Partitionentry
+; [r] zl Number of Diskentry to Read
+; [w] r0 scratch
+; [w] r1 "
; --------------------------------------------------------------------
; Description:
; ====================================================================
ldi zh,PARTENTRY_SIZE
mul zh,zl
ldiw z,hostparttbl
- add zl,_tmp0
- adc zh,_tmp1
+ add zl,r0
+ adc zh,r1
ret
; ====================================================================
andi temp,dskType_MASK
; Isn't it a Disk ?
- cpi temp,dskType_None
+ cpi temp,dskType_None
brne PC+2
rjmp dsk_read_err
; It must be a FAT16-Imagefile or CP/M Partition.
- rcall dsk_setdrvparam ;todo: do this only if needed (disk change)
+ rcall dsk_setdrvparam ;TODO: do this only if needed (disk change)
andi temp,WRTMSK
sts wrtype,temp ;save write type
; disks are the same
lds temp,unatrk
lds temp2,unatrk+1
- lds temp3,seektrk
- lds temp4,seektrk+1
- cp temp,temp3 ;seektrk = unatrk?
- cpc temp2,temp4
+ lds _tmp0,seektrk
+ lds _tmp1,seektrk+1
+ cp temp,_tmp0 ;seektrk = unatrk?
+ cpc temp2,_tmp1
brne dsk_alloc ;skip if not
; tracks are the same
lds temp,hdrsize ;add image header size
add xl,temp ;
adc xh,_0 ;
- lds temp3,seektrk ;
- lds temp4,seektrk+1 ;
- lds temp,cpmspt ;
- mul temp3,temp ;
+ lds temp,seektrk ;
+ lds temp2,seektrk+1 ;
+ lds temp3,cpmspt ;
+ mul temp,temp3 ;
add xl,r0 ;
adc xh,r1 ;
- mul temp4,temp ;
+ mul temp2,temp3 ;
add xh,r0 ;yl:xh:xl := sec + trk * SectorsPerTrack
adc yl,r1 ;
-
mov temp,xl
andi temp,SECMSK ;mask buffer number
push temp ;save for later
;copy data to or from buffer
ldiw z,hostbuf
+#if 1
+ pop temp2 ;get buffer number (which part of hostbuf)
+ clr temp
+ lsr temp2 ;temp2:temp = temp2 * 128
+ ror temp
+ add zl,temp ;offset in hostbuf
+ adc zh,temp2
+#else
ldi temp,128
pop temp2 ;get buffer number (which part of hostbuf)
mul temp2,temp
add zl,r0 ;offset in hostbuf
adc zh,r1
-
+#endif
.if DISK_DEBUG > 2
movw temp,r0
printstring "; host buf adr: "
; same disk, same block?
lds _tmp0,hostlba
- lds _tmp1,hostlba+1
cp temp,_tmp0
- cpc temp2,_tmp1
+ lds _tmp0,hostlba+1
+ cpc temp2,_tmp0
breq dsk_match
dsk_nomatch: