Am I wrong or.... not ???

From: ruud_at_baltissen.org
Date: Mon, 13 Jul 2026 22:20:13 +0200
Message-ID: <eb325fc4ba1d79e81d0bbfed5705ef64_at_baltissen.org>
Hallo allemaal,


I ran into something that puzzles me. AFAIK everything should be OK 
because nobody complained but I cannot find out where I'm wrong then. 
Please have a look at the disassembly of 'Open a logical file' that 
starts at $F34A. The interesting part starts at

A_F359:					;				[F359]
	ldx	IndFileTable		; get the open file count	[98]
	cpx	#10			; < maximum + 1 ?
	bcc	A_F362			; if less than maximum + 1 go open file

	jmp	TooManyFilesErr		; else do 'too many files error' and
					; return			[F6FB]
A_F362:					;				[F362]
	inc	IndFileTable		; increment the open file count

	lda	LogicalFileNum		; get the logical file
	sta	LogicalFileTbl,X	; save it to the logical file table
					;				[0259]

The table for logical files starts at $0259 and has 10 bytes, so 
$0259..$0262. The variable IndFileTable is found at $98 and is cleared 
during a reset or during the routine "Close all files".
When a file is opened, IndFileTable is incremented at $F362 and only at 
that place. But first is checked how many files are open starting from 
$F359. If this number is ten, no more files can be opened and an error 
is generated. If it is nine, it is incremented to ten at $F362. But when 
the logical file number is stored, it is stored at $0259 + 10 = $0263. 
$0263 is the table of the device numbers of these logical files. Weird 
enough, that is no problem because when storing the logical file number, 
X is never zero. If it was at $F359, it is incremented af $F362.

But the same X is used to store the device number in the table mentioned 
above at $F374 and this table is located at $0263..$026C. So when X = 
ten, the data is stored at $026D, which is the start of the table for 
storing the second address, located at $026D..$0276. Again same story 
here, the moment X is ten, at $f36F the second address is stored at 
$0277.

And this should be a problem because this address is used, see this 
code:

GetCharKeybBuf:				;				[E5B4]
	ldy	KeyboardBuf		; get the current character from buffer
	ldx	#$00			; clear the index
A_E5B9:					;				[E5B9]
	lda	KeyboardBuf+1,X		; get next character from the buffer
					;				[0278]
	sta	KeyboardBuf,X		; save it as current character in buffer
					;				[0277]

Am I wrong ???



Something else: I used the Dutch version of Databecker's 'C64 intern' to 
check the addresses. I also have the German version but I would like to 
have an English version of the ROM listing. Any pointers, please? TIA!


-- 

Kind regards / Met vriendelijke groet, Ruud Baltissen

www.Baltissen.org
Received on 2026-07-13 22:00:39

Archive generated by hypermail 2.4.0.