From: Leo C Date: Sun, 17 May 2015 22:01:01 +0000 (+0200) Subject: sdio errormessages X-Git-Tag: hexrel-6~1 X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp-cpm3.git/commitdiff_plain/04134640c401acf7d6ac6b3bf7d609601f0242da?ds=inline sdio errormessages --- diff --git a/cbios/sdio.180 b/cbios/sdio.180 index e6c12ea..2c4823d 100644 --- a/cbios/sdio.180 +++ b/cbios/sdio.180 @@ -226,7 +226,7 @@ rwc_doit: inc hl ld (hl),a -more$retries: +retry: ld hl,send_msg ld b,send_msg_rw_len @@ -239,9 +239,6 @@ more$retries: or a ret z ; check status and return to BDOS if no error - xor a - ld (residual),a - ; suppress error message if BDOS is returning errors to application... ld a,(@ermde) @@ -257,67 +254,96 @@ more$retries: call ?pmsg ; last function (read or write) ld a,(recv_msg_rc) + and a,07fh + jr z,fatfs_err -;TODO: rc errorcode + ld hl,drvmsg0 ; point at first driver error message + ld c,drvmsg_count + call pdecoded +fatfs_err: ld a,(recv_msg_rc) tst 080h - jr z,fs_end + jr z,prompt ; no fatfs error -fatfs_err: + ld hl,fsmsg + call ?pmsg + ld hl,fr$msg0 ; point at first FatFs message + ld c,fr$msg$count ld a,(recv_msg_rc+1) - cp 20 - jr c,fs_err1 - xor a -fs_err1 - ld hl,fr$msg0 ; point at first message - ld bc,fr$msg$size - ld e,a ; save message number - xor a - inc e -nxt_str: - dec e - jr z,fs_err_found - cpir - jr z,nxt_str - ld hl,fr$msg0 ; not found, point at first message + call pdecoded -fs_err_found: - call ?pmsg - -fs_end: +prompt: ld hl,error$msg call ?pmsg ; print ", Retry (Y/N) ? " call u$conin$echo ; get operator response - cp 'y' - jr z,more$retries ; Yes, then retry 10 more times + cp 'Y' + jr z,retry ; Yes, then retry 10 more times + hard$error: ; otherwise, - ld a,1 - ret ; return hard error to BDOS + xor a + ld (residual),a + + ld a,1 ; return hard error to BDOS + ret cancel: ; here to abort job jp ?wboot ; leap directly to warmstart vector +; Print message to error code in A +; + +pdecoded: + push bc + push de + push hl ; put pointer to first message on stack + cp c + jr c,pdc_1 + xor a +pdc_1: + ld bc,0 + ld e,a ; save message number + xor a + inc e +pdc_nxt_str: + dec e + ex (sp),hl + jr z,pdc_found + ex (sp),hl + cpir + jr z,pdc_nxt_str + ; not found (should not happen) +pdc_found: + pop hl + call ?pmsg + pop de + pop bc + ret + + +; get console input, echo it, and shift to upper case + u$conin$echo: - ; get console input, echo it, and shift to upper case + call ?const or a - jp z,u$c1 ; see if any char already struck + jr z,u$c1 ; see if any char already struck call ?conin - jp u$conin$echo ; yes, eat it and try again + jr u$conin$echo ; yes, eat it and try again u$c1: call ?conin push af ld c,a - call ?cono + cp ' '-1 + call nc,?cono pop af cp 'a' ret c - sub 'a'-'a' ; make upper case + sub 'a'-'A' ; make upper case ret @@ -353,61 +379,47 @@ recv_msg_len equ $ - recv_msg operation$name: dw read$msg read$msg: - db ', Read',0 + db ', Read, ',0 write$msg: - db ', Write',0 - - - ; table of pointers to error message strings - -fr$msg0: db ' Unknown FatFs Error,',0 -fr$msg1: db ' DISK_ERR,',0 -fr$msg2: db ' INT_ERR,',0 -fr$msg3: db ' NOT_READY,',0 -fr$msg4: db ' NO_FILE,',0 -fr$msg5: db ' NO_PATH,',0 -fr$msg6: db ' INVALID_NAME,',0 -fr$msg7: db ' DENIED,',0 -fr$msg8: db ' EXIST,',0 -fr$msg9: db ' INVALID_OBJECT,',0 -fr$msg10: db ' WRITE_PROTECTED,',0 -fr$msg11: db ' INVALID_DRIVE,',0 -fr$msg12: db ' NOT_ENABLED,',0 -fr$msg13: db ' NO_FILE_SYSTEM,',0 -fr$msg14: db ' MKFS_ABORTED,',0 -fr$msg15: db ' TIMEOUT,',0 -fr$msg16: db ' LOCKED,',0 -fr$msg17: db ' NOT_ENOUGH_CORE,',0 -fr$msg18: db ' TOO_MANY_OPEN_FILES,',0 -fr$msg19: db ' FR_INVALID_PARAMETER,',0 + db ', Write, ',0 + +drvmsg0: db 'Unknown Error, ',0 +drvmsg1: db 'Invalid Parameter(s), ',0 +drvmsg2: db 'Invalid Drive, ',0 +drvmsg3: db 'Bus Timeout, ',0 +drvmsg_size equ $ - drvmsg0 +drvmsg_count equ 3 + +fsmsg: db 'FatFs: ',0 + +; table of pointers to error message strings + +fr$msg0: db 'Unknown Error,',0 +fr$msg1: db 'DISK_ERR,',0 +fr$msg2: db 'INT_ERR,',0 +fr$msg3: db 'NOT_READY,',0 +fr$msg4: db 'NO_FILE,',0 +fr$msg5: db 'NO_PATH,',0 +fr$msg6: db 'INVALID_NAME,',0 +fr$msg7: db 'DENIED,',0 +fr$msg8: db 'EXIST,',0 +fr$msg9: db 'INVALID_OBJECT,',0 +fr$msg10: db 'WRITE_PROTECTED,',0 +fr$msg11: db 'INVALID_DRIVE,',0 +fr$msg12: db 'NOT_ENABLED,',0 +fr$msg13: db 'NO_FILE_SYSTEM,',0 +fr$msg14: db 'MKFS_ABORTED,',0 +fr$msg15: db 'TIMEOUT,',0 +fr$msg16: db 'LOCKED,',0 +fr$msg17: db 'NOT_ENOUGH_CORE,',0 +fr$msg18: db 'TOO_MANY_OPEN_FILES,',0 +fr$msg19: db 'FR_INVALID_PARAMETER,',0 +fr$msg20: db 'short read/write,',0 fr$msg$size equ $ - fr$msg0 - +fr$msg$count equ 20 error$msg: db ' Retry (Y/N) ? ',0 end - -/* File function return code (FRESULT) */ - -FR_OK = 0, /* (0) Succeeded */ -FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */ -FR_INT_ERR, /* (2) Assertion failed */ -FR_NOT_READY, /* (3) The physical drive cannot work */ -FR_NO_FILE, /* (4) Could not find the file */ -FR_NO_PATH, /* (5) Could not find the path */ -FR_INVALID_NAME, /* (6) The path name format is invalid */ -FR_DENIED, /* (7) Access denied due to prohibited access or directory full */ -FR_EXIST, /* (8) Access denied due to prohibited access */ -FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */ -FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */ -FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */ -FR_NOT_ENABLED, /* (12) The volume has no work area */ -FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */ -FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any parameter error */ -FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */ -FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */ -FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */ -FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_SHARE */ -FR_INVALID_PARAMETER /* (19) Given parameter is invalid */