[cc65] How can I cause the "FILE NOT FOUND" msg to print to screen using existing kernal or basic routines for the C64?

Date view Thread view Subject view

From: Michael McIntosh (cc65_at_lifepod.com)
Date: 2003-02-11 21:00:46


I am writing a program that runs automatically upon loading by overwriting
the basic warm start vector while loading and causing it to execute code
at $02A7 when it finishes loading. That code, in turn, loads another
program and executes it.

I am using the C64 kernal LOAD routine ($FFD5) to load a file in assembly
language. If the file is not found, I wish to print out a "FILE NOT FOUND"
message and cause the code to return to the basic prompt without clearing
the screen.

I have to write this code in assembly because I only have 89 bytes to work
with ($02A7-$02FF). I could embed an ascii string in my program, but I
don't have room for it and the code required to print it. Does anyone know
how I could trigger either an existing kernal or basic routine that would
print out the standard "FILE NOT FOUND" message?

I wouldn't go through all this hassle normally, but I plan on contributing
my code for others to use. If they mess up while trying to use the code,
I'd like to give them a clue if they used an invalid filename.

Here is the relevant part of my code:

	lda	#$01		; device file #
	ldx	#$08		; device unit #
	ldy	#$ff		; no command
	jsr	setlfs		; set logical file (kernal call)
	lda	#(.strlen(PROGRAM_NAME))	; get length of filename
	ldx	#<(_filename)	; set lower address of filename
	ldy	#>(_filename)	; set upper address of filename
	jsr	setnam		; set file name	(kernal call)
	lda	#$00		; set flag for load operation
	ldx	#$ff		; alternative start address
	ldy	#$ff		; alternative start address
	jsr	load		; load program file (kernal call)
	bcc	EXEC		; branch to execution if no load error

	???     Print error message and return to basic prompt

EXEC:	jmp     PROGRAM_ADDR	; jump to program entry point

Thank you all for your time. :)

Michael McIntosh

+++ Codito, Ergo Sum +++


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-02-11 21:03:19 CET