fl { PropForth3.4 2010.9.24 2010.10.3 fix bugs adding "file_detail" } : address ." Input Address(hex) > " 0 tmp W! begin begin key dup 30 < if d = if tmp W@ 0> if 1 else 0 then else 0 then else dup 3a 40 between if drop 0 else dup 47 60 between if drop 0 else dup 66 > if drop 0 else dup emit tmp W@ 8 = if 9 0 do drop loop 0 tmp W! ." incorect input" cr ." Input Address(hex) > " 0 else todigit tmp dup W@ 1+ swap W! 0 then then then then then until tmp W@ 1 > if tmp W@ 1- 0 do swap i 1+ 4 * lshift or loop then \ convert data dup 200 u/mod drop if drop 0 tmp W! ." incorect input" cr ." Input Address(hex) > " 0 else 1 then until cr cr Block ; : file_detail b0 + buff_ptr W! \ DIR_Name ." Name " buff_ptr W@ c + C@ dup 8 and 0= if buff_ptr W@ 8 0 do dup C@ dup 20 > if emit else drop then 1+ loop else buff_ptr W@ 8 0 do dup C@ dup 20 = if drop else dup 41 5a between if 20 + emit else emit then then 1+ loop then swap ." ." 10 and 0= if 3 0 do dup C@ dup 20 > if emit else drop then 1+ loop else 3 0 do dup C@ dup 20 = if drop else 20 + emit then 1+ loop then cr cr \ DIR_Attr ." Attribute " C@ dup 1 and 1 = if ." READ_ONLY " then dup 2 and 2 = if ." HIDDEN " then dup 4 and 4 = if ." SYSTEM " then dup 8 and 8 = if ." VOLUME_ID " then dup 10 and 10 = if ." DIRECTORY " then dup 20 and 20 = if ." ARCHIVE " then cr cr ." Type " 10 and 10 = if ." Directory" else ." File" then cr cr \ DIR_CrtTime ." Create Time " buff_ptr W@ e + W@ dup f800 and b rshift dup 0= if ." 00" drop else dup a < if ." 0" then to_decimal then ." :" dup 7e0 and 5 rshift dup 0= if ." 00" drop else dup a < if ." 0" then to_decimal then ." :" buff_ptr W@ d + C@ 63 > if 1 else 0 then swap 1f and 2 * + dup 0= if ." 00" drop else dup a < if ." 0" then to_decimal then ." ." buff_ptr W@ d + C@ dup 63 > if 64 - then to_decimal cr cr \ DIR_CtrDate ." Create date " buff_ptr W@ 10 + W@ dup fe00 and 9 rshift 7bc + to_decimal ." /" dup 1e0 and 5 rshift to_decimal ." /" 1f and dup 0= if ." 00" drop else to_decimal then cr cr \ DIR_LastAccDate ." Last Access Date " buff_ptr W@ 12 + W@ dup fe00 and 9 rshift 7bc + to_decimal ." /" dup 1e0 and 5 rshift to_decimal ." /" 1f and dup 0= if ." 00" drop else to_decimal then cr cr \ DIR_WrtTime ." Update Write time " buff_ptr W@ 16 + W@ dup f800 and b rshift dup 0= if ." 00" drop else dup a < if ." 0" then to_decimal then ." :" dup 7e0 and 5 rshift dup 0= if ." 00" drop else dup a < if ." 0" then to_decimal then ." :" 1f and 2 * dup 0= if ." 00" drop else dup a < if ." 0" then to_decimal then cr cr \ DIR_WrtDate ." Update Write date " buff_ptr W@ 18 + W@ dup fe00 and 9 rshift 7bc + to_decimal ." /" dup 1e0 and 5 rshift to_decimal ." /" 1f and dup 0= if ." 00" drop else to_decimal then cr cr \ DIR_FirstCluster ." First Cluster number " ." 0x" \ buff_ptr W@ 14 + W@ 10 lshift buff_ptr W@ 1a + W@ . cr cr \ DIR_FileSize ." File Size " buff_ptr W@ 1c + L@ conversion cr cr \ DIR_FileSize ; : search RDE_addr L@ block_read 1 tmp W! \ tmp1 \ input line number b0 begin dup C@ e5 = if 20 + dup b0 1ff + > if drop tmp W@ 200 * RDE_addr L@ + block_read tmp dup W@ 1+ swap W! b0 then 0 else dup b + C@ f <> if tmp1 W@ 1 = if dup b0 - file_detail 1 else tmp1 dup W@ 1- swap W! 20 + dup b0 1ff + > if drop tmp W@ 200 * RDE_addr L@ + block_read tmp dup W@ 1+ swap W! b0 then 0 then else 20 + dup b0 1ff + > if drop tmp W@ 200 * RDE_addr L@ + block_read tmp dup W@ 1+ swap W! b0 then 0 then then until drop ; : file_name 8 0 do dup C@ dup 20 > if emit else drop then 1+ loop ." ." 3 0 do dup C@ dup 20 > if emit else drop then 1+ loop drop ; : file RDE_addr L@ block_read 1 tmp W! \ line number 1 tmp1 W! b0 begin dup C@ e5 = if 20 + dup b0 1ff + > if drop tmp1 W@ 200 * RDE_addr L@ + block_read tmp1 dup W@ 1+ swap W! b0 then 0 else dup C@ 0= if 1 else dup b + C@ f <> if tmp dup W@ dup to_decimal ." " 1+ swap W! dup file_name cr then 20 + dup b0 1ff + > if drop tmp1 W@ 200 * RDE_addr L@ + block_read tmp1 dup W@ 1+ swap W! b0 then 0 then then until drop \ tmp1 is input line_number+1 if 1 then no file tmp W@ dup 1 > if cr ." Input file number > " 0 tmp1 W! begin dup begin key dup 30 < if d = if tmp1 W@ 0> if 1 else ." Input file number > " 0 then else 0 then else dup 39 > if drop 0 else dup emit tmp1 W@ 2 = if 3 0 do drop loop 0 tmp1 W! ." incorect input" cr ." Input file number > " 0 else todigit tmp1 dup W@ 1+ swap W! 0 then then then until tmp1 W@ 2 = if swap a * + then dup tmp1 W! > if tmp1 W@ 0= if ." zero is NG!!" cr ." Input file number > " 0 tmp1 W! 0 else drop 1 then else ." not match" cr ." Input file number > " 0 tmp1 W! 0 then until cr cr search else ." no file" cr drop then ; : menu ." j -- Display CSD" cr ." k -- Display CID" cr ." l -- Display SD-information" cr ." h -- memu list" cr ." s(Address) -- Single Block Read" cr \ ." c(sector) -- Single Block Read" cr ." m -- Master Boot Record" cr ." b -- BIOS Parameter Block" cr ." f -- File Allocation Table" cr ." r -- Root Directory Entry" cr ." u -- File Detail" cr ." q -- Quit" cr ; : viewer sd_init tmp W@ 100 = if exit then collect_info menu cr ." >" begin key dup emit cr dup 6a = if drop csd 0 cr cr else dup 6b = if drop cid 0 cr cr else dup 68 = if drop cr menu 0 cr cr else dup 73 = if drop cr address 0 cr cr else dup 6d = if drop cr MBR 0 cr cr else dup 62 = if drop cr BTB 0 cr cr else dup 66 = if drop cr FAT 0 cr cr else dup 72 = if drop cr RDE 0 cr cr else dup 75 = if drop cr file 0 cr cr else dup 6c = if drop cr info 0 cr cr else dup 71 = if drop 1 else drop 0 then then then then then then then then then then then ." >" until ;