BASIC. File I/O wrappers as GOSUB.

All aspects of programming on the Commander X16.
Post Reply
User avatar
ahenry3068
Posts: 1194
Joined: Tue Apr 04, 2023 9:57 pm

BASIC. File I/O wrappers as GOSUB.

Post by ahenry3068 »

I'm beginning the last Sub-Project of my HANGMAN game.

I really find the Commodore BASIC syntax for file open and such quite confusing
and overly complicated. So...... I'm learning it.. and at the same time
ensuring I can forget most of it by creating GOSUB wrappers.

IF I WAS A DISCIPLINED PROGRAMMER (Lol...lol).. I would be writing down
variable definitions and at least a rough flow-chart right now... (Not happening :) )

I do have a rough sketch in my mind how this is going to go.

Current variable defs in mind... :
(SUGGESTIONS)

F1$-F9$ --- Used to pass file and Directory names to GOSUB's

EM$ -- Current Error Message (This is following the COMMODORE 1541 Docs)

CE -- The current error number

PE -- The previous error number. (possibly a ERROR "STACK" if I find it necessary).

FS -- Operation SUCCESS. Set to 1 by GOSUB if the operation was successful, 0 otherwise
(yes I know the ST System Variable exists. I'm trying to Abstract it)

FC -- File Count... Used if GOSUB manipulates multiple files...

O1$-O9$ -- Hold the filenames of currently open files

TF -- TRY FORCE -- If set to 1 Try to force the desired operation through errors... The main
use I see for this is to "SCRATCH" an existing file before OPEN for Write.

EE -- END ERROR -- Kind of the opposite. Will END the program on any File I/O error if set to 1
May leave this in the code but it's really there because I know these routines are going to take "A LOT"
of testing.
User avatar
ahenry3068
Posts: 1194
Joined: Tue Apr 04, 2023 9:57 pm

Re: BASIC. File I/O wrappers as GOSUB.

Post by ahenry3068 »

I'm thinking of jumping the gun and just doing the Immediate I need for Hangman.

Get HangMan out there then maybe revisit this, for a comprehensive set of routines.

I'm kinda chomping at the bit to start writing C code.
User avatar
ahenry3068
Posts: 1194
Joined: Tue Apr 04, 2023 9:57 pm

Re: BASIC. File I/O wrappers as GOSUB.

Post by ahenry3068 »

I'm afraid this project might get pushed aside...... I've got to get back and at least finish the rudimentary game logic
for Hangman. I will at least wrap the necessary file I/O for that game here. It won't be what I originally
intended. But it will be something. As for the future.... Who Knows. (Tom Baker..... WHO KNOWS.)
Post Reply