My first BASIC program in fifteen years
After fifteen-plus years, I try my hand at programming in BASIC once again. I start with a bank account balancing program.
For quite a while, I've been keeping track of some of my home accounts using the Easy Working The Planner spreadsheet app, on my C64.
It works really well, but I thought I'd try and write my own specialized app for my particular needs. So, I set off and began to write (in BASIC) a little program I've called, “Ledger 64” .
Now, it's nothing really special, but I did enjoy writing it. It's been a long time since I sat down and wrote my own C64 program from scratch. I didn't realize how much I forgot about programming in BASIC, but it didn't take all that long for it to come flooding back to me.
So, this is a pretty simple and straight forward ledger program. You enter the accounts you want to track and use transactions to move money between them. When all is said and done, it then tells you the dollar balances of each of the accounts.
The account information is stored in two SEQ (sequential) files on floppy disk. Why SEQ files, you ask? It's the only file-type with which I know how to successfully program for the C64. Besides, I think the way I've used them is quite effective.
The first SEQ file records the number of accounts and their names. The second SEQ file keeps track of the account balances.
After setting up your ledger, the program provides three basic functions: entering transactions against each account, listing account summaries, and printing out a hard copy of session transactions and account totals.
When entering transactions, they are first applied only to the values in memory and not stored to floppy until they're “committed”. This way, I have a way of backing out of any transactions applied during the session if I make a mistake.
Once I'm happy with the numbers, I can then commit them and the C64 updates the SEQ file to match. Then, if I want a record of the transactions I did during the session, I can print out a hard copy and file it away for reference later.
Apart from the ledger record keeping functions, I also added a few extras, like the ability to specify the data disk drive (8, 9, or otherwise) and wrote a few notes under a Help section.
As I use it in my day-to-day, I'm sure I'll see some improvements I can make, as well as get a few ideas for new features. But for now, I think it's pretty good for what I need it to do. Although, I'm quite sure I could do some condensing of the code. But, hey, it's my first BASIC program in fifteen years or so. Cut me some slack.
If you're curious and would like to give the program a try for yourself, feel free to download it from the public shares, here on CommodoreServer, under the Apps sub-folder.
Leave a Comment
You must be signed-in to post comments.Responses
S0RC3R0R 9/18/2012
Compile it using BLITZ and it should run even faster!
- SRCR
Pinacolada 9/18/2012
Have you considered dotBASIC? It's really nifty, and it'll give your BASIC program lots of polish.
judland 9/18/2012
Thanks, SRCR, for the suggestion. Perhaps I'll use it for future projects.
Never heard of dotBASIC, Pinecolada. Is that something that you'd have to have running on your C64 in order for a program written in dotBASIC program to work?