-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Review LOADB+SAVEB error handling #363
Comments
LOADB has two modes of failure.
|
I'm pretty sure this works like it should. marker foo
: setlfs ( file# sa -- )
$b9 c! $b8 c! ;
: setnam ( nameaddr namelen -- )
$b7 c! $bb ! ;
\ Open a logical file
\ ioresult is 0 on success, kernal
\ error # on failure.
( nameaddr namelen file# sa --
ioresult )
: open
setlfs setnam [ w stx,
$ffc0 jsr, \ OPEN
+branch bcs, \ carry set = error
0 lda,# \ A is only valid on error
:+
w ldx,
lsb sta,x
0 lda,# msb sta,x
] ;
\ Close a logical file
code close ( file# -- )
txa, pha,
lsb lda,x \ x = file#
$ffc3 jsr, \ CLOSE
pla, tax, inx,
;code
: errchk sr c@ 1 and if
ar c@ else
0 then ioabort ;
: load ( sa dst -- ioresult )
xr ! ar c! $ffd5 sys errchk ;
: save ( start end zeropage -- ioresult
)
dup ar c! swap xr ! !
$ffd8 sys errchk ;
( filenameptr filenamelen dst -- endadd
)
: loadb
1 0 setlfs -rot setnam 0
swap load drop $ae @ ;
: saveb ( start end nameaddr namelen --
)
1 1 setlfs setnam $c1 save drop ; |
Some thoughts about existing code:
EDIT: changed my mind on most of these points. |
i discovered now, thanks to $9d, CHKIN to device 0 (keyboard) actually is an error. CLRCHN should be used instead. see ea486d8 |
ioresult could be a variable that is simply overwritten with the next file, stack, or even a FIFO buffer |
yes, that could work too, with the advantage that it's not a breaking change. |
it's also a bit of open question if LOADB/SAVEB should be interactive or not. |
...I think I change my mind! I now think it's fine if LOADB/SAVEB keep their current signatures, and are "interactive" Two problems to fix:
|
ST is supposed to set a timeout show serial bus timeout with Bit 2. I am unaware of the conditions, but it's something to look into. |
Load/Save uses fast loaders, so that's not going anywhere. so merely opening channel 15 first, then you can readst, and see if the device is present first. abort or close and then load/save. |
Oh! I forgot about fastloaders. But don’t they also follow the regular
pattern with returning status by carry flag + accumulator?
In that case, LOAD failure could be detected and handled before trying to
read error channel.
…On Tue, 31 Aug 2021 at 08:50, Whammo ***@***.***> wrote:
Load/Save uses fast loaders, so that's not going anywhere. so merely
opening channel 15 first, then you can readst, and see if the device is
present first. abort or close and then load/save.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#363 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAY34O3BERHMYYSR2323DP3T7R3SLANCNFSM5DBESVRA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
The point is, LOAD blocks on a device not present error, right? So you can't check, the carry, it hangs. |
Anyway, _errorchread definitely hangs if DEVICE not present. : ecr $1551 sys ; ( Version 3 address of _errorchread ) Try it with different device numbers. |
I find that LOAD does in fact return an error in A:
|
I was meaning LOADB and SAVEB hangs, no way to check status. |
Oh yes! I’d like to see that fixed
…On Tue, 31 Aug 2021 at 23:46, Whammo ***@***.***> wrote:
I was meaning LOADB and SAVEB hangs, no way to check status.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#363 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAY34O3DYYREC3GSGXMNBHTT7VESFANCNFSM5DBESVRA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
It was complicated to fix I follow your suggestion to let v check for a good device number: 9a4e8ce |
Created follow-up issue for the loadb/saveb hangs. |
Do LOADB+SAVEB have appropriate error handling? If not, fix it.
see discussion in #357
The text was updated successfully, but these errors were encountered: