-
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
LOADB/SAVEB hang on invalid device #499
Comments
IEC commands do not freeze on invalid device. code ds
w stx,
$00 lda,#
$90 sta, \ clear st
$ba lda,
$ffb1 jsr, \ listen
$6f lda,#
$ff93 jsr, \ second #15
$ffae jsr, \ unlisten
$90 lda, \ readst
+branch bne, \ device not present?
\ checking for the device is optional
\ but a good idea.
$ba lda,
$ffb4 jsr, \ talk #8
$6f lda,#
$ff96 jsr, \ tksa #15
here
$90 lda, \ readst
+branch bne,
$ffa5 jsr, \ acptr get byte
$ffd2 jsr, \ chrout
swap jmp, \ loop
:+
$ffab jsr, \ untalk
:+
w ldx, ;code |
Which means DOS will also freeze when device is invalid. |
It's not load or save that freezes, it's open. |
It might be simpler to vector kernal open through something like this: LDA #$00
STA $90 ; clear STATUS flags
LDA $BA ; device number
JSR $FFB1 ; call LISTEN
LDA #$6F ; secondary address 15 (command channel)
JSR $FF93 ; call SECLSN (SECOND)
JSR $FFAE ; call UNLSN
LDA $90 ; get STATUS flags
BNE .devnp ; device not present
JMP open
.devnp
... device not present handling ...
RTS
|
The original code for reading error channel is here: https://codebase64.org/doku.php?id=base:reading_the_error_channel_of_a_disk_drive " A small warning: Both the BASIC and the Assembler versions will deadlock if the device is not present. " Edit: It also presents an alternate version which avoids the deadlock. Edit 2: OK, it looks like you found the same code :-) |
OK, I think the above commit might work. The codebase64 page says: "In this version the status-byte is accessed directly which reduces the portability of the code." <-- That's not great, but OK... "This will limit you to IEC-bus devices" I am not sure what practical consequences that has. Would one ever want to LOADB/SAVEB to something else? |
You can use kernal readst, but unlike basic, it doesn't clear after reading. |
We have to reset status before IEC commands because they only change ST on failure. |
Yes, DOS, INCLUDED and OPEN, and anything with kernal open is subject to hang on device not present. |
All the info I used to master kernal IEC https://commodore.software/downloads/download/215-articles-and-guides/15601-iec-disected |
Another advantage of IEC commands is they don't consume file numbers. |
12 device dos |
The problem is a bug with the Kernal opening a file with no file name. |
One could add a 0 check to send-cmd, but maybe it is equally fine to let
user exit the bad state by pressing RESTORE?
After all, DOS with empty string is not a real use-case?
…On Wed, 28 Dec 2022 at 10:56, Whammo ***@***.***> wrote:
The problem is a bug with the Kernal opening a file with no file name.
It creates the file entries in the tables so chkin doesn't error , then
exits.
The command channel doesn't require an open or a close,
so it doesn't check if the device is there before it goes to chrin it gets
stuck waiting.
—
Reply to this email directly, view it on GitHub
<#499 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAY34O3CHTE3DBGEVCRIWBTWPQFFXANCNFSM6AAAAAATKIP26I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
DOS with an empty string prints the current device status if it's there, and hangs otherwise. |
I see, so it is a use case. |
: send-cmd ( addr len -- )
?dup if
$f $f open ioabort
clrchn $f chkin ioabort
begin chrin emit readst until
clrchn $f close cr
else drop _errorchread then ; perhaps? But yes it's doable. |
That seems like a fine solution. Added! |
I think there were some additions to V that can be rolled back now. |
* fix LOADB/SAVEB hang on device not present closes #499 * fix DOS hang on device not present
Oh really? What V additions? |
added v check for bad device# ? |
ah right! great catch. thank you! |
At some point in the future maybe, we can get durexForth off of the filesystem and onto IEC commands so file numbers used by the system would go away. |
That stuff is a bit above my head probably :-) |
Serial IEC is certainly arcane. The documentation is sparse. The IEEE parallel PET stuff is well documented, of which the serial stuff is a tiny subset, the overview makes it understandable. |
Wow! Thanks. I'll try not to f- anything up. 🥇 |
12 device parse-name foo $7000 loadb <-- hangs
12 device $7000 $7100 parse-name foo saveb <-- hangs
The text was updated successfully, but these errors were encountered: