;Test, if it has a valid MBR
lds temp,hostbuf+510 ;MBR signature (0xAA55) at and of sector?
- lds temp2,hostbuf+510+1
- ldi temp4,0xAA
cpi temp,0x55
- cpc temp2,temp4
+ lds temp,hostbuf+510+1
+ ldi temp2,0xAA
+ cpc temp,temp2
breq mgr_search
;No MBR, no partition table ...
; Search for valid Partitions and ImageFiles
mgr_search:
ldiw z,hostbuf+510-64 ;Point to first byte of partition table
- ldi temp4,4 ;Partition table has 4 entries.
mgr_ploop:
mgr_nextp:
adiw z,16
- dec temp4
+ cpi zl,low(hostbuf+510) ;End of partition table reached?
brne mgr_ploop
#if FAT16_SUPPORT
; Test for FAT16 Partition
ldiw z,hostbuf+510-64 ;Point to first byte of partition table
- ldi temp4,4
mgr_ploop2:
; Get Partitiontype
mgr_nextp2:
adiw zl,16
- dec temp4
+ cpi zl,low(hostbuf+510)
brne mgr_ploop2
#endif
ldi xh,'A'
pprl:
- ldd temp ,z+1 ;Get partition start
- ldd temp2,z+2
- ldd temp3,z+3
- ldd temp4,z+4
-
printnewline
- cp temp,_0 ;If zero ...
- cpc temp2,_0
- cpc temp3,_0
- cpc temp4,_0
+ ldd temp ,z+1 ;Get partition start
+ ldd temp2,z+2
+ or temp,temp2
+ ldd temp2,z+3
+ or temp,temp2
+ ldd temp2,z+4
+ or temp,temp2 ;If zero ...
breq mgr_prnop ;... no partition table at 0
; Partitiontype examining
ldd temp ,z+5 ;Get partition size
ldd temp2,z+6
- ldi temp3,0
- ldi temp4,0
-
- lsr temp4
- ror temp3
- ror temp2
+ push r15
+ push r14
+ clr r14
+ clr r15
+ lsr temp2
ror temp
lcall print_ultoa
+ pop r14
+ pop r15
printstring "KB."
mgr_goto_next_part: