Abusing the Emulator for Fun and Profit

All aspects of programming on the Commander X16.
Post Reply
rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

Abusing the Emulator for Fun and Profit

Post by rje »


Just this afternoon, I realized that when I pass “-bas my-file” to the emulator, it is TYPED IN, so to speak.

If I didn’t care about compatibility with the X16, then I could front-load my program with a pile of initializations in “immediate mode” without incurring the penalty of storing lines of BASIC DATA statements.

Useless in the light of wanting to support the X16 as a physical chunk of hardware, so mostly an amusing observation.  Unless I use that in the place of loading data files into the RAM banks perhaps... but I don’t see the benefit there, so.

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

Abusing the Emulator for Fun and Profit

Post by SlithyMatt »


Good observation. This could be used to do script-generated configuration, though only with the emulator. But, that may be useful in determining a fixed configuration to use for production.

Another good use case I can see is programmatically initializing VRAM and/or banked RAM, then NEW-ing it out to load in the program code, which could be in BASIC or machine language. This would really only be useful when the initialization has a randomized element to it, otherwise you could just load pre-initialized binaries. This use case would extend to production, where the initialization program blows itself away with the actual application code once it's done. Developing this construct would be very easy by just loading ASCII BASIC files from the host until the init/launch code is finalized. Cuts down on a lot of the process.

geek504
Posts: 95
Joined: Wed Aug 26, 2020 4:52 pm

Abusing the Emulator for Fun and Profit

Post by geek504 »


I came here expecting to see some sort of smashing the stack for fun and profit... the classic buffer-overflow treatsie!

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

Abusing the Emulator for Fun and Profit

Post by rje »



12 hours ago, geek504 said:




I came here expecting to see some sort of smashing the stack for fun and profit... the classic buffer-overflow treatsie!



That sounds like fun.

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

Abusing the Emulator for Fun and Profit

Post by rje »


I just realized that this is more powerful and useful than I thought:

THE FUZZY PROBLEM

One of the games I'm writing uses data ... this data is already established, so its nature and content are understood.  All I have to do is get it on the SD card in a way that the X16 likes.

I expect to have around 125 subdirectories, each with 16 files give or take.  Each file is smaller than 8K in size.

 

THE IMMEDIATE MODE SOLUTION

"Immediate" mode can be used to create one subdirectory and its 16 files in one shot.

Or maybe more... since this is immediate mode, I can make it a "stream" of small programs, each of which creates a file.

Or, even better, one program that creates a file, and immediate data that loads in the data to write AND run that program, then load in another set of data, run the program, and repeat 2000 times.

 

Post Reply