Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Problem coding my own loading routine
2003-07-20 10:40
Majikeyric

Registered: Sep 2002
Posts: 83
Problem coding my own loading routine

Hi,

I'm not a loading routine programming guru, in fact in so many years that's the fist time I try myself to this...
I have read a lot of manuals and all say that if an error occurs when calling a kernal routine the carry flag is set but it doesn't seem to be really the case, here is my problem when in this little piece of code, there is an error when calling the OPEN routine, the carry is not set ?!! (e.g when opening a non existing file) and the CHKIN call just behind makes the machine crashes... :-(
How can I check if the file was successfully opened ???

lda FilenameLen
ldx #<Filename --> a non existing file
ldy #>Filename
jsr SETNAM

lda #8
ldx $ba
ldy #0
jsr SETLFS
jsr OPEN
bcs ERROR --> carry not set if an error occured ?!!
ldx #8
jsr CHKIN --> crash !!! :-(

I want my loading routine to run on all kind of drives (1541/CMD HD+FD/IDE64...).

Thank you very much !!!
 
... 20 posts hidden. Click here to view all posts....
 
2013-01-01 21:27
soci

Registered: Sep 2003
Posts: 480
Yes, I know that with careful timing it's possible to find out from the expansion port if it's "safe" to map in external ROM to $e000 using the ultimax configuration. But with the IDE64 hardware available it's only possible to replace the KERNAL with an SCPU or other hacks. Unfortunately this still stands today ;(
2013-01-02 10:58
Flavioweb

Registered: Nov 2011
Posts: 463
The original question is how to intercept errors during a file OPEN function.
OPEN don't set carry because in kernal routines are LOAD and SAVE that do this job, checking $90 and setting carry accordingly with value readed.
If we need to use OPEN, we need also to check 90 manually seting carry propely if an error (timeout or others) is detected.
Checking error channel is only to know what kind of error is, because 90 reports generic timeout, eof, or device not present flags.
This works on all devices, including IDE64.
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Mike
Peacemaker/CENSOR/Hi..
iAN CooG/HVSC
MWR/Visdom
psych
t0m3000/hf^boom!^ibx
Acidchild/Padua
E$G/HF ⭐ 7
Guests online: 128
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Booze  (9.7)
3 Stormbringer  (9.7)
4 Fungus  (9.6)
5 Grim Reaper  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.032 sec.