Commodore 64 Self Modifying data
When I was young in the early 1980s, my father bought me and my siblings a Commodore 64 hooked up to a spare black and white TV set.
I wanted to learn how to program video games, but that was complex. My first BASIC program did Baseball stats for one of my brothers and his team. Numbers got stored in data statements, but we had no way to save them for we didn’t have a floppy drive or cassette tape drive.
I did some work for friends of my mother in cleaning houses for them. One of them had a daughter about my age that passed away, and was trying to learn on a Commodore 64, wanted me to throw out some compute Gazette magazines. So I asked if I could have them, and I would type in examples.
I saved my money from doing chores and bought the Datasette drive because the C64 could not use a normal tape recorder. I was able to save the Baseball Stats program on it.
The C64 did not have a database feature, so I’d have a subroutine that added data to the Data statements using the poke command after storing the data in an array, adding new numbers and then poking them back into data statements and save on tape. It was a self modifying BASIC program.
Actually had I had a Atari 8 bit computer with a more advanced BASIC that didn’t need peek and poke statements to do advanced things, I would not have learned binary, hexadecimal, machine language, and how memory addresses worked. On a C64 you had to use peek and poke on memory locations to do a lot of stuff.
I earned enough for a 1541 floppy drive and was able to modify the program to write to a file on the floppy drive instead of modify the data statements. A friend borrowed my C64/C128 collection and I never got it back, and I forgot how it worked. I really feel bad that I don’t have the self modifying code anymore.