Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Apple » Apple II Emulation » Emulator disk swap eliminator
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Emulator disk swap eliminator [message #354695] Wed, 18 October 2017 14:33 Go to next message
anthonypaulo is currently offline  anthonypaulo
Messages: 531
Registered: September 2013
Karma: 0
Senior Member
One idea I've been toying around with is putting in emulator "hooks" (custom code) that are program specific and detects the disk that the program wants to access and swaps disk images for you automagically, eliminating all those pesky disk swaps on games like ultima v and pool of radiance.
Re: Emulator disk swap eliminator [message #354713 is a reply to message #354695] Wed, 18 October 2017 20:19 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: James Davis

On Wednesday, October 18, 2017 at 11:33:19 AM UTC-7, Anthony Ortiz wrote:
> One idea I've been toying around with is putting in emulator "hooks" (custom code) that are program specific and detects the disk that the program wants to access and swaps disk images for you automagically, eliminating all those pesky disk swaps on games like ultima v and pool of radiance.

So, you would need a list of disk-image (internal {Apple path/disk name?}) names and their corresponding pathnames on the PC (in a text-file maybe?) and a change of DOS/ProDOS to search for or find it in the list and swap disks. Or, a GOD program that is Omniscient!
Re: Emulator disk swap eliminator [message #354714 is a reply to message #354713] Wed, 18 October 2017 20:26 Go to previous messageGo to next message
anthonypaulo is currently offline  anthonypaulo
Messages: 531
Registered: September 2013
Karma: 0
Senior Member
On Wednesday, October 18, 2017 at 8:19:47 PM UTC-4, James Davis wrote:
> On Wednesday, October 18, 2017 at 11:33:19 AM UTC-7, Anthony Ortiz wrote:
>> One idea I've been toying around with is putting in emulator "hooks" (custom code) that are program specific and detects the disk that the program wants to access and swaps disk images for you automagically, eliminating all those pesky disk swaps on games like ultima v and pool of radiance.
>
> So, you would need a list of disk-image (internal {Apple path/disk name?}) names and their corresponding pathnames on the PC (in a text-file maybe?) and a change of DOS/ProDOS to search for or find it in the list and swap disks. Or, a GOD program that is Omniscient!

You can determine which program is running by combination name and signature. Once identified you check to see if a hook exists for it and if it does you install it. When the program gets to a certain instruction in memory the hook activates and determines, based on the program state, which disk it's looking for and swaps the disk accordingly. Eezy peezy.
Re: Emulator disk swap eliminator [message #354715 is a reply to message #354714] Wed, 18 October 2017 20:32 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
> You can determine which program is running by combination name and signature.

Yup! Please keep us updated of your work.

Some day I'd like to add a built-in cheat menu for AppleWin and have the game be auto-recognized.
i.e. An 16-bit id, 8-byte signature should do the trick.
Re: Emulator disk swap eliminator [message #354717 is a reply to message #354713] Wed, 18 October 2017 20:48 Go to previous messageGo to next message
Steve Nickolas is currently offline  Steve Nickolas
Messages: 2036
Registered: October 2012
Karma: 0
Senior Member
On Wed, 18 Oct 2017, James Davis wrote:

> On Wednesday, October 18, 2017 at 11:33:19 AM UTC-7, Anthony Ortiz wrote:
>> One idea I've been toying around with is putting in emulator "hooks" (custom code) that are program specific and detects the disk that the program wants to access and swaps disk images for you automagically, eliminating all those pesky disk swaps on games like ultima v and pool of radiance.
>
> So, you would need a list of disk-image (internal {Apple path/disk name?}) names and their corresponding pathnames on the PC (in a text-file maybe?) and a change of DOS/ProDOS to search for or find it in the list and swap disks. Or, a GOD program that is Omniscient!
>

I think the best, personally, way to do this involves making a hard drive
installable/ProDOS-compatible modification of a program.

-uso.
Re: Emulator disk swap eliminator [message #354720 is a reply to message #354717] Wed, 18 October 2017 20:52 Go to previous messageGo to next message
anthonypaulo is currently offline  anthonypaulo
Messages: 531
Registered: September 2013
Karma: 0
Senior Member
On Wednesday, October 18, 2017 at 8:48:14 PM UTC-4, Steve Nickolas wrote:
> On Wed, 18 Oct 2017, James Davis wrote:
>
>> On Wednesday, October 18, 2017 at 11:33:19 AM UTC-7, Anthony Ortiz wrote:
>>> One idea I've been toying around with is putting in emulator "hooks" (custom code) that are program specific and detects the disk that the program wants to access and swaps disk images for you automagically, eliminating all those pesky disk swaps on games like ultima v and pool of radiance.
>>
>> So, you would need a list of disk-image (internal {Apple path/disk name?}) names and their corresponding pathnames on the PC (in a text-file maybe?) and a change of DOS/ProDOS to search for or find it in the list and swap disks. Or, a GOD program that is Omniscient!
>>
>
> I think the best, personally, way to do this involves making a hard drive
> installable/ProDOS-compatible modification of a program.
>
> -uso.

Truer werdz hath ne'er been spoken! However, that is quite a bit of work and only a few remaining mortals are capable of doing so; therefore, a quick hook is more practical and relatively easily achieved.
Re: Emulator disk swap eliminator [message #354721 is a reply to message #354714] Wed, 18 October 2017 21:00 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: James Davis

On Wednesday, October 18, 2017 at 5:26:13 PM UTC-7, Anthony Ortiz wrote:

> You can determine which program is running by combination name and signature. Once identified you check to see if a hook exists for it and if it does you install it. When the program gets to a certain instruction in memory the hook activates and determines, based on the program state, which disk it's looking for and swaps the disk accordingly. Eezy peezy.

OK, I don't understand, it'S way over my head, so I will not make any more stupid suggestions here.
Re: Emulator disk swap eliminator [message #354722 is a reply to message #354715] Wed, 18 October 2017 21:09 Go to previous messageGo to next message
anthonypaulo is currently offline  anthonypaulo
Messages: 531
Registered: September 2013
Karma: 0
Senior Member
On Wednesday, October 18, 2017 at 8:32:53 PM UTC-4, Michael AppleWin Debugger Dev wrote:
>> You can determine which program is running by combination name and signature.
>
> Yup! Please keep us updated of your work.
>
> Some day I'd like to add a built-in cheat menu for AppleWin and have the game be auto-recognized.
> i.e. An 16-bit id, 8-byte signature should do the trick.

Michael, you've touched on something that I've been thinking about for a while, and that is a fully indexed and organized online Apple II software repository where each program has a unique id associated with it and can be served up to any emulator or Apple II. Since this is an enormous task it would have to be a community effort, similar to the Wikipedia model, where as people go about using the online repository they help add/edit its metadata and organize them so that they are more easily found by others. A plugin can be made for emulators that would then serve up programs straight from the online repo and a program can be made to access it from Apple IIs.
Re: Emulator disk swap eliminator [message #354723 is a reply to message #354721] Wed, 18 October 2017 22:10 Go to previous messageGo to next message
anthonypaulo is currently offline  anthonypaulo
Messages: 531
Registered: September 2013
Karma: 0
Senior Member
On Wednesday, October 18, 2017 at 9:00:02 PM UTC-4, James Davis wrote:
> On Wednesday, October 18, 2017 at 5:26:13 PM UTC-7, Anthony Ortiz wrote:
>
>> You can determine which program is running by combination name and signature. Once identified you check to see if a hook exists for it and if it does you install it. When the program gets to a certain instruction in memory the hook activates and determines, based on the program state, which disk it's looking for and swaps the disk accordingly. Eezy peezy.
>
> OK, I don't understand, it'S way over my head, so I will not make any more stupid suggestions here.

Hi James,

Every program has a unique signature, or sequence of bytes (ie. instructions) at a known location, that can identify it similar to the way CD's are identified via an online database. The emulator should be able to identify a program in this manner and, based on the id, determine whether the program has custom 'meta logic' that us users have created for it, and if so, loads it up where it lies dormant until it gets triggered. The custom logic determines what will trigger it, and in the scenario I envision for swapping disks auto-magically, it tells the emulator to trigger it when it is about to execute a certain location in memory. The program runs normally while the custom logic lies dormant until the emulator reaches that location in memory. The emulator now puts the program on pause and transfers control to the custom logic which will scan the program state and determine which disk it's trying to load. It then tells the emulator to swap disks and resume execution, all this done in a matter of microseconds, at which point the program continues running oblivious to what just occurred, sees the disk it needs already in the drive, and continues on its merry way, no longer necessitating to prompt us to insert disk.
Re: Emulator disk swap eliminator [message #354726 is a reply to message #354722] Thu, 19 October 2017 00:12 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
How many bytes do think are needed to uniquely identify a signature?

8, 16, 32, 64 ?

There are definitely lots of opportunities to speed up the run-time detection. Sort the database by "hash" value, such as FNV1a, and then use a binary search to find the hash generated from RAM.
https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo _hash_function


I agree about the community / crowd-sourcing the database.

The time consuming part is determing which address to start the signature bytes from.
Re: Emulator disk swap eliminator [message #354727 is a reply to message #354726] Thu, 19 October 2017 00:34 Go to previous messageGo to next message
anthonypaulo is currently offline  anthonypaulo
Messages: 531
Registered: September 2013
Karma: 0
Senior Member
On Thursday, October 19, 2017 at 12:12:09 AM UTC-4, Michael AppleWin Debugger Dev wrote:
> How many bytes do think are needed to uniquely identify a signature?
>
> 8, 16, 32, 64 ?
>
> There are definitely lots of opportunities to speed up the run-time detection. Sort the database by "hash" value, such as FNV1a, and then use a binary search to find the hash generated from RAM.
> https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo _hash_function
>
>
> I agree about the community / crowd-sourcing the database.
>
> The time consuming part is determing which address to start the signature bytes from.

The signature doesn't have to come from a single fixed address, it could (more like should) be a composite signature of bytes from multiple locations in order to increase uniqueness. I wonder, are dsk and such images writable as well? That is, some programs allow you to save progress to the same disk, so is this possible with these disk images or are they read-only? If read-only then an SHA1 checksum would be great, but those programs that modify their own disk image can present a problem for such checksums.
Re: Emulator disk swap eliminator [message #354734 is a reply to message #354723] Thu, 19 October 2017 04:51 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: James Davis

On Wednesday, October 18, 2017 at 7:10:50 PM UTC-7, Anthony Ortiz wrote:
> On Wednesday, October 18, 2017 at 9:00:02 PM UTC-4, James Davis wrote:
>> On Wednesday, October 18, 2017 at 5:26:13 PM UTC-7, Anthony Ortiz wrote:
>>
>>> You can determine which program is running by combination name and signature. Once identified you check to see if a hook exists for it and if it does you install it. When the program gets to a certain instruction in memory the hook activates and determines, based on the program state, which disk it's looking for and swaps the disk accordingly. Eezy peezy.
>>
>> OK, I don't understand, it'S way over my head, so I will not make any more stupid suggestions here.
>
> Hi James,
>
> Every program has a unique signature, or sequence of bytes (ie. instructions) at a known location, that can identify it similar to the way CD's are identified via an online database. The emulator should be able to identify a program in this manner and, based on the id, determine whether the program has custom 'meta logic' that us users have created for it, and if so, loads it up where it lies dormant until it gets triggered. The custom logic determines what will trigger it, and in the scenario I envision for swapping disks auto-magically, it tells the emulator to trigger it when it is about to execute a certain location in memory. The program runs normally while the custom logic lies dormant until the emulator reaches that location in memory. The emulator now puts the program on pause and transfers control to the custom logic which will scan the program state and determine which disk it's trying to load. It then tells the emulator to swap disks and resume execution, all this done in a matter of microseconds, at which point the program continues running oblivious to what just occurred, sees the disk it needs already in the drive, and continues on its merry way, no longer necessitating to prompt us to insert disk.

Has someone proven mathematically/scientifically that "Every program has a unique signature?" It may seem like common sense, but I would not think it so. I would think it more likely than not that, although two programs were different, they could still end up having the same "signature" as you determine it. Of course, I am thinking hypothetically, while you are speaking more specifically about certain Apple II games, I think.
Re: Emulator disk swap eliminator [message #354735 is a reply to message #354720] Thu, 19 October 2017 05:36 Go to previous messageGo to next message
Steve Nickolas is currently offline  Steve Nickolas
Messages: 2036
Registered: October 2012
Karma: 0
Senior Member
On Wed, 18 Oct 2017, Anthony Ortiz wrote:

> On Wednesday, October 18, 2017 at 8:48:14 PM UTC-4, Steve Nickolas wrote:
>> On Wed, 18 Oct 2017, James Davis wrote:
>>
>>> On Wednesday, October 18, 2017 at 11:33:19 AM UTC-7, Anthony Ortiz wrote:
>>>> One idea I've been toying around with is putting in emulator "hooks" (custom code) that are program specific and detects the disk that the program wants to access and swaps disk images for you automagically, eliminating all those pesky disk swaps on games like ultima v and pool of radiance.
>>>
>>> So, you would need a list of disk-image (internal {Apple path/disk name?}) names and their corresponding pathnames on the PC (in a text-file maybe?) and a change of DOS/ProDOS to search for or find it in the list and swap disks. Or, a GOD program that is Omniscient!
>>>
>>
>> I think the best, personally, way to do this involves making a hard drive
>> installable/ProDOS-compatible modification of a program.
>>
>> -uso.
>
> Truer werdz hath ne'er been spoken! However, that is quite a bit of work
> and only a few remaining mortals are capable of doing so; therefore, a
> quick hook is more practical and relatively easily achieved.

I'm not so sure about that (being one of said "remaining mortals" of which
you speak, albeit, the least experienced and least competent of such
people in practice). I think the only real difference between the two
approaches is that my method would require more points be patched, where
yours would also require specific parts of code be located and patched
accordingly, just, perhaps, fewer.

-uso.
Re: Emulator disk swap eliminator [message #354736 is a reply to message #354734] Thu, 19 October 2017 07:17 Go to previous messageGo to next message
anthonypaulo is currently offline  anthonypaulo
Messages: 531
Registered: September 2013
Karma: 0
Senior Member
Hey James,

The reason every program has to have a unique signature is that if you consider the entirety of the program to be its signature then it must be unique, otherwise the programs would be identical in which case they are the same program. That is, two programs that have the same exact sequence of instructions must be identical and therefore simply copies of each other, which means it's the same program. Now to your point, of course capturing a subset of the program to use as a signature does not guarantee its uniqueness but a composite signature, in combination with possibly the name and a checksum, can make it sufficiently unique enough for our purposes.
Re: Emulator disk swap eliminator [message #354737 is a reply to message #354735] Thu, 19 October 2017 07:24 Go to previous messageGo to next message
anthonypaulo is currently offline  anthonypaulo
Messages: 531
Registered: September 2013
Karma: 0
Senior Member
I am ignorant on the methods used to port an application from floppies to a prodos hard-drive but I assumed it to be no simple feat. I believe I read somewhere that making Prince of Persia a prodos hard-drive runnable program took quite a while and pretty difficult so I extrapolated on that. If its as easy as you say then I stand corrected and of course that would be a better approach, one that I would prefer.
Re: Emulator disk swap eliminator [message #354743 is a reply to message #354737] Thu, 19 October 2017 10:29 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
> I am ignorant on the methods used to port an application from floppies to a prodos hard-drive but I assumed it to be no simple feat.

It isn't "hard per se" just _extremely_ time consuming -- as the CIV (Conflict in Vietnam) showed. qkumba makes it look easy because he has been doing it so long. :-)

- Build disk map
- Build memory map
- Trace code
- Rinse-and-Repeat

But isn't that the true sign of a master or expert -- someone who makes the difficult look easy? :-)
Re: Emulator disk swap eliminator [message #354751 is a reply to message #354737] Thu, 19 October 2017 10:33 Go to previous messageGo to next message
qkumba is currently offline  qkumba
Messages: 1584
Registered: March 2013
Karma: 0
Senior Member
The software list from MAME is an attempt to catalogue every program that can be run. The Apple list is far from complete, of course, but it might serve as a good starting point.
Re: Emulator disk swap eliminator [message #354752 is a reply to message #354727] Thu, 19 October 2017 10:49 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
True, the multiple addresses should work just as long as it doesn't include game state variables, nor self-modified code locations. :-)

Might want to sample 16 bytes every +$8 pages (skipping HGR1 and 2), at these locations:

$0800
$1000
$1800
$6000
$6800
$7000
$7800
$8000
$8800
$9000

And determine the percentage that match.

Maybe qkumba care share his POV for what addresses, and sizes, would give a good "sampling."

I imagine we could even have a script to help with the classification along these lines:

- For every game disk on asimov
- Load emulator with disk image
- Play until turn disk appears
- Take snapshot of PC, and signature, save to disk, with disk image name
- Allow user to enter filename for disk 2

> SHA1 checksum

SHA is probably overkill. An simple FNV1a hash is more then "good enough". Plus you only need to include 1 function (5 lines) vs a whole library. :-)

Your idea of using multiple locations will minimize false positives.
Re: Emulator disk swap eliminator [message #354753 is a reply to message #354734] Thu, 19 October 2017 10:50 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
> Has someone proven mathematically/scientifically that "Every program has a unique signature?" It may seem like common sense, but I would not think it so.

It is true by definition.

Let us consider a trivial program with 4 bytes -- with no variables. This means there are:

= 256^4
= 2^8^4
= 2^(8*4)
= 2^32
= 4,294,967,296 unique programs.

Now some of them will _do_ exactly the same thing as variations, but that we aren't interested in that -- only in uniquely identifying which program we are talking about.

For the typical 48K Apple 2 game (assuming no variables) this number is:

= 256^(48*1024):
= 256^49,152
= 2^8^49,152
= 2^(8*49,152)
= 2^393,216
= 6.468 * 10^118369

A number with 118,370 decimal digits -- that is how big it is.

Since that number is too impractical we "sample" just a portion of the 48K memory and generate (hopefully) an unique "fingerprint" from that. Mapping one set of numbers into a different set of numbers is called a "transform." One of the popular types of transforms is called a "hash function":

From Wikicrapedia: A hash function is any function that can be used to map data of arbitrary size to data of fixed size. The values returned by a hash function are called hash values, hash codes, digests, or simply hashes.

You are probably familiar with the crc32 hash. Given X bytes generate a 32-bit integer, aka has value, aka signature from it.

Same concept applied here except we don't want to hash the entire 48K RAM due to

- variables should be omitted
- self-modifying code

as those would generate a different hash.


> I would think it more likely than not that, although two programs were different, they could still end up having the same "signature" as you determine it.

"False Positives" due a collision hash are indeed possible, but the probability is so unlikely that for all practical purposes this is zero -- as long as the sample size(s) are large enough.
Re: Emulator disk swap eliminator [message #354754 is a reply to message #354752] Thu, 19 October 2017 11:00 Go to previous messageGo to next message
David Schmidt is currently offline  David Schmidt
Messages: 993
Registered: October 2012
Karma: 0
Senior Member
On 10/19/2017 10:49 AM, Michael AppleWin Debugger Dev wrote:
> [...]
> I imagine we could even have a script to help with the classification along these lines:
>
> - For every game disk on asimov

This is where the wheels fall of the bus for me. I think the Amiga(?)
crowd has a notion of accepting a particular game disk in pristine (even
copy-protected) state at a particular version to be the One True Copy of
that game+version, aided by a more complete image capture from a tool
such as Kryoflux. Our in-band images are quite lossy, and all
deprotection work necessarily changes the original bits on disk. So we
have a harder job to come up with a canonical "version" of a particular
title. Should it contain copy protection? Should different "versions"
put out by different crackers, tools, and techniques be new entries in
the canon? We also have different states of capture of some disks that
have different (say) high score tables, so that frustrates checksumming
as a means of difference detection. I'm not saying it's impossible -
just that it's going to Take a Village (tm) to curate the corpus, given
its current state of art.
Re: Emulator disk swap eliminator [message #354755 is a reply to message #354754] Thu, 19 October 2017 11:36 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
I agree that the OTV (One True Version) is definitely a *huge* PITA.

However, we do have two things that will move this from the unpractical to the practical pile:

* We only need to scan memory to identity a game -- how the data is stored on the disk is orthogonal to the issue
* The copy protection itself is usually tiny compared to the actual game code

There is no perfect system, but I think Anthony's idea has merit.

Let's walk through a hypothetical example of what I'll call ADI -- auto disk inserter, or Anthony's Disk Inserter :-)

* You tell the ADI front end to fire up Captain Goodnight Side 1 in an emulator
* User presses a key to skip the intro / logos
* Game says "TURN DISK OVER AND PRESS ANY KEY."
* Game sits in a loop waiting for a key press
* ADI needs to "automagically" detect that the game is stuck in a loop waiting for user input
* ADI switches disks to Side 2
* ADI presses a key
* Game continues
* User completes the game and gets a high score
* Game says "TURN DISK OVER AND PRESS ANY KEY."
* Game sits in a loop waiting for a key press
* ADI needs to "automagically" detect that the game is stuck in a loop waiting for user input
* ADI switches disks back to Side 1
* ADI presses a key

There are definitely some technical hurdles to overcome but I believe they are doable. Namely:

* ADI would need to know "how long" a game has been waiting for keyboard input
* ADI would also need access to memory to determine the game state
* ADI needs the ability to send input back into the emulator

If emulators provided "user-hooks" this is doable.

One of my dreams is to write a bot to play an Apple 2 game, using Machine "Learning", to figure out the "perfect game". There are many applications of the foundations of ADI.

Michael
Re: Emulator disk swap eliminator [message #354763 is a reply to message #354755] Thu, 19 October 2017 13:13 Go to previous messageGo to next message
David Schmidt is currently offline  David Schmidt
Messages: 993
Registered: October 2012
Karma: 0
Senior Member
On 10/19/2017 11:36 AM, Michael AppleWin Debugger Dev wrote:

> * User presses a key to skip the intro / logos

Ok, but those things can be important and on-disk state is no longer
orthogonal to our purposes. Initial cutscenes might differ, intro
screens to the same title differ when a publisher changed hands,
configuration might be significant (deciding which orientation a
joystick should use is one example). And all those cracktros. Which
one of the many games that have similar internal running states does ADI
pick?

You're advocating a dynamic analysis solution, but there's more to a
game title (on disk) than the core input loop.
Re: Emulator disk swap eliminator [message #354764 is a reply to message #354755] Thu, 19 October 2017 13:17 Go to previous messageGo to next message
anthonypaulo is currently offline  anthonypaulo
Messages: 531
Registered: September 2013
Karma: 0
Senior Member
Actually you can skip the disk prompts and key presses so that it's all seamless. For example, ultima v has a routine that scans the drives to see if a particular disk is there and if not prompts you to insert the disk. In this case the ADI would trigger right before it scans the drives, check the program state to see which disk it's looking for, load that disk into the drive, and resume the game execution. The game would scan the drive, find the disk it's looking for, and continue on its merry way without even prompting the user.

An AI bot would be so cool, I would love to have time to read about neural networks and learn how it's done. The super mario bros bot was pretty impressive!
Re: Emulator disk swap eliminator [message #354769 is a reply to message #354764] Thu, 19 October 2017 15:02 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
> The super mario bros bot was pretty impressive!

Yup! As much as I hate SMB, yes, those bots are very cool !

I love the videos that show all possible movement for Mario using red dots/lines:
https://www.youtube.com/watch?v=j7ckTMLIwpE

Especially @4:40 when the bot falls into a hole and then jumps back out!!

TASBot
https://youtu.be/eM8Z9e-WoFs?t=427

I see people are even using an Arduino for input playback on real hardware!
http://www.instructables.com/id/NESBot-Arduino-Powered-Robot -beating-Super-Mario-/


I can't find that video where a bot discovered a _new_ move -- defense against a turtle on a stairs IIRC.

What was the video you were thinking of?
I've probably seen it, but would like to bookmark it. :-)
Re: Emulator disk swap eliminator [message #354781 is a reply to message #354769] Thu, 19 October 2017 22:30 Go to previous messageGo to next message
anthonypaulo is currently offline  anthonypaulo
Messages: 531
Registered: September 2013
Karma: 0
Senior Member
On Thursday, October 19, 2017 at 3:02:16 PM UTC-4, Michael AppleWin Debugger Dev wrote:
>> The super mario bros bot was pretty impressive!
>
> Yup! As much as I hate SMB, yes, those bots are very cool !
>
> I love the videos that show all possible movement for Mario using red dots/lines:
> https://www.youtube.com/watch?v=j7ckTMLIwpE
>
> Especially @4:40 when the bot falls into a hole and then jumps back out!!
>
> TASBot
> https://youtu.be/eM8Z9e-WoFs?t=427
>
> I see people are even using an Arduino for input playback on real hardware!
> http://www.instructables.com/id/NESBot-Arduino-Powered-Robot -beating-Super-Mario-/
>
>
> I can't find that video where a bot discovered a _new_ move -- defense against a turtle on a stairs IIRC.
>
> What was the video you were thinking of?
> I've probably seen it, but would like to bookmark it. :-)

These are the two I saw :

https://www.youtube.com/watch?v=05rEefXlmhI
https://www.youtube.com/watch?v=iakFfOmanJU

So awesome! :D
Re: Emulator disk swap eliminator [message #354785 is a reply to message #354764] Fri, 20 October 2017 02:39 Go to previous messageGo to next message
Michael J. Mahon is currently offline  Michael J. Mahon
Messages: 1767
Registered: October 2012
Karma: 0
Senior Member
Anthony Ortiz <anthonypaulo@gmail.com> wrote:
> Actually you can skip the disk prompts and key presses so that it's all
> seamless. For example, ultima v has a routine that scans the drives to
> see if a particular disk is there and if not prompts you to insert the
> disk. In this case the ADI would trigger right before it scans the
> drives, check the program state to see which disk it's looking for, load
> that disk into the drive, and resume the game execution. The game would
> scan the drive, find the disk it's looking for, and continue on its merry
> way without even prompting the user.
>
> An AI bot would be so cool, I would love to have time to read about
> neural networks and learn how it's done. The super mario bros bot was pretty impressive!
>

Don't forget that user keyboard input is a source of entropy (randomness)
for games. Who knows how many use these indefinite delays to control
gameplay?

--
-michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com
Re: Emulator disk swap eliminator [message #354951 is a reply to message #354785] Fri, 20 October 2017 13:02 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
> Don't forget that user keyboard input is a source of entropy (randomness) for games.

In theory *great* programmers do that but as we know in practice programmers are not always great. :-/
Namely,

1. Poor programmers assume the memory they are using has been initialized. :-(

i.e.
// https://github.com/AppleWin/AppleWin/issues/206
// Work-around for a cold-booting bug in "Pooyan" which expects RNDL and RNDH to be non-zero.
clock = getRandomTime();
memmain[ 0x4E ] = 0x20 | (clock >> 0) & 0xFF;
memmain[ 0x4F ] = 0x20 | (clock >> 8) & 0xFF;

// https://github.com/AppleWin/AppleWin/issues/222
// MIP_PAGE_ADDRESS_LOW breaks a few badly written programs!
// "Beautiful Boot by Mini Appler" reads past $61FF into $6200
// - "BeachParty-PoacherWars-DaytonDinger-BombsAway.dsk"
// - "Dung Beetles, Ms. PacMan, Pooyan, Star Cruiser, Star Thief, Invas. Force.dsk"
memmain[ 0x620B ] = 0x0;

Tracking _these_ down when we decided to implement different memory initialization access patterns in AppleWin was "fun".


2. I haven't seen any Apple 2 games use the keyboard to maximize the avalanche effect.
https://en.wikipedia.org/wiki/Avalanche_effect

As far I know most games just update the random seed every (game) frame.



> Who knows how many use these indefinite delays to control gameplay?

Depends on the platform.

/Oblg.

Robot Finishes Super Mario Bros. 3 In Two Seconds
https://kotaku.com/robot-finishes-super-mario-bros-3-in-two- seconds-1783418959

The ridiculously rapid run is the result of a newfound glitch discovered by TAS speddrunner ais523, which basically involves pressing buttons at an extremely fast rate—some 6,000 times a second.
Re: Emulator disk swap eliminator [message #379890 is a reply to message #354695] Sun, 20 January 2019 01:30 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: brokemmogamer

On Wednesday, October 18, 2017 at 11:33:19 AM UTC-7, Anthony Ortiz wrote:
> One idea I've been toying around with is putting in emulator "hooks" (custom code) that are program specific and detects the disk that the program wants to access and swaps disk images for you automagically, eliminating all those pesky disk swaps on games like ultima v and pool of radiance.

Did you ever attempt this? I was trying to find this exact thing.
Re: Emulator disk swap eliminator [message #379904 is a reply to message #379890] Mon, 21 January 2019 02:15 Go to previous messageGo to next message
sicklittlemonkey is currently offline  sicklittlemonkey
Messages: 570
Registered: October 2012
Karma: 0
Senior Member
On Sunday, 20 January 2019 19:30:24 UTC+13, brokem...@gmail.com wrote:
> On Wednesday, October 18, 2017 at 11:33:19 AM UTC-7, Anthony Ortiz wrote:
>> One idea I've been toying around with is putting in emulator "hooks" (custom code) that are program specific and detects the disk that the program wants to access and swaps disk images for you automagically, eliminating all those pesky disk swaps on games like ultima v and pool of radiance.
>
> Did you ever attempt this? I was trying to find this exact thing.

Less work (for you) to request a ProDOS version from qkumba.

Cheers,
Nick.
Re: Emulator disk swap eliminator [message #379908 is a reply to message #379904] Mon, 21 January 2019 07:41 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Brian Patrie

On 21/01/2019 01.15, Nick Westgate wrote:
> On Sunday, 20 January 2019 19:30:24 UTC+13, brokem...@gmail.com wrote:
>> On Wednesday, October 18, 2017 at 11:33:19 AM UTC-7, Anthony Ortiz wrote:
>>> One idea I've been toying around with is putting in emulator "hooks" (custom code) that are program specific and detects the disk that the program wants to access and swaps disk images for you automagically, eliminating all those pesky disk swaps on games like ultima v and pool of radiance.
>>
>> Did you ever attempt this? I was trying to find this exact thing.
>
> Less work (for you) to request a ProDOS version from qkumba.

Plus his ports work on real hardware. :)
Re: Emulator disk swap eliminator [message #379932 is a reply to message #379908] Tue, 22 January 2019 00:39 Go to previous messageGo to next message
qkumba is currently offline  qkumba
Messages: 1584
Registered: March 2013
Karma: 0
Senior Member
Yes, I accept requests. :-)
An Ultima 5 ProDOS version exists!
Re: Emulator disk swap eliminator [message #379936 is a reply to message #379932] Tue, 22 January 2019 02:58 Go to previous messageGo to next message
sicklittlemonkey is currently offline  sicklittlemonkey
Messages: 570
Registered: October 2012
Karma: 0
Senior Member
On Tuesday, 22 January 2019 18:39:08 UTC+13, Peter Ferrie wrote:
> Yes, I accept requests. :-)
> An Ultima 5 ProDOS version exists!

Yes, I meant to check the thread for Ultima V.

Pool Of Radiance would be good.
Might & Magic was a good game too. ; - )

Cheers,
Nick.
Re: Emulator disk swap eliminator [message #379993 is a reply to message #379932] Wed, 23 January 2019 03:55 Go to previous messageGo to next message
Steve Nickolas is currently offline  Steve Nickolas
Messages: 2036
Registered: October 2012
Karma: 0
Senior Member
I defy anyone to port "Apple Presents the //e: An Introduction", because I
think it's 64K...

Although there is a version that runs off a ProDOS block device, it
doesn't actually use the ProDOS filesystem and won't work if you just copy
the files. ;p

The exact version that I ripped off a disk I used to have is
http://3.buric.co/Apple%20Presents%20the%20IIe%20An%20Introd uction.dsk.gz
(the platinum //e edition). Prolly the more ideal one since my "metal" is
either a Platinum, or a Mac with an emulator card ;p

-uso.
Re: Emulator disk swap eliminator [message #379997 is a reply to message #354715] Wed, 23 January 2019 10:29 Go to previous messageGo to next message
zellyn is currently offline  zellyn
Messages: 173
Registered: April 2013
Karma: 0
Senior Member
On Wednesday, October 18, 2017 at 8:32:53 PM UTC-4, Michael AppleWin Debugger Dev wrote:
> Some day I'd like to add a built-in cheat menu for AppleWin and have the game be auto-recognized.
> i.e. An 16-bit id, 8-byte signature should do the trick.

That's an interesting idea. A Game-Genie-like ability, eh?

It would be kinda fun to get a bunch of emulator writers together, and create a very simple API for something like Lua or Wren scripting. So you can set breakpoints, load disks, etc. in a cross-emulator standard manner.
Re: Emulator disk swap eliminator [message #379998 is a reply to message #354722] Wed, 23 January 2019 10:33 Go to previous messageGo to next message
zellyn is currently offline  zellyn
Messages: 173
Registered: April 2013
Karma: 0
Senior Member
On Wednesday, October 18, 2017 at 9:09:40 PM UTC-4, Anthony Ortiz wrote:
> Michael, you've touched on something that I've been thinking about for a while, and that is a fully indexed and organized online Apple II software repository where each program has a unique id associated with it and can be served up to any emulator or Apple II.

I have ideas/aspirations about this too. It would be easy to key by md5 or sha-sum. I want to create a complete database of *all* Apple II software, links to disk images, version information, etc. <sigh> if only I had the time…

The Paleotronic folks already have a pretty good start on being able to serve up a huge list of disk images, fyi.

Zellyn
Re: Emulator disk swap eliminator [message #379999 is a reply to message #354754] Wed, 23 January 2019 10:35 Go to previous messageGo to next message
zellyn is currently offline  zellyn
Messages: 173
Registered: April 2013
Karma: 0
Senior Member
On Thursday, October 19, 2017 at 11:00:51 AM UTC-4, schmidtd wrote:
> This is where the wheels fall of the bus for me. I think the Amiga(?)
> crowd has a notion of accepting a particular game disk in pristine (even
> copy-protected) state at a particular version to be the One True Copy of
> that game+version, aided by a more complete image capture from a tool
> such as Kryoflux.

It's not actually that much data to just include md5sums for every reasonable variation, including .woz images, etc. A little bit of metadata on each variation would let you understand why there are multiple entries.
Re: Emulator disk swap eliminator [message #380008 is a reply to message #379993] Wed, 23 January 2019 13:18 Go to previous messageGo to next message
qkumba is currently offline  qkumba
Messages: 1584
Registered: March 2013
Karma: 0
Senior Member
> I defy anyone to port "Apple Presents the //e: An Introduction", because I
> think it's 64K...

I can do that. ProRWTS2 to the rescue.
Re: Emulator disk swap eliminator [message #380055 is a reply to message #379998] Thu, 24 January 2019 12:49 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
Hey Zellyn

Good to hear there are other emulators thinking about this.

> A Game-Genie-like ability, eh?

Yep! 8-bit consoles have the advantage that the entire game fits on one ROM with filename "rips" having a somewhat standardized name. Since titles on the Apple 2 can span multiple disks, .DSK filenames can wildly vary, not to mention it may be cracked to run from a file such qkumba's amazing ProDOS ports, etc. we need to scan memory instead to identify what the current game is.

Another snafu is that while the //e has VSYNC detection, most (older) games don't use it, and there is no "fixed" location such a VSYNC Interrupt we can
rely on. We would an attribute for each game to tell the emulator/cheat engine where the next frame is so that it can constantly "poke" values into memory at a fixed rate if it needs to. (i.e. Set number of men left to a constant value for infinite lives, etc.)

nextframe=$6000


> It would be kinda fun to get a bunch of emulator writers together, and create a very simple API for something like Lua or Wren scripting.
> So you can set breakpoints, load disks, etc. in a cross-emulator standard manner.

Getting other emulator writers together to form a couple of cross-emulator standards would be fantastic! I see that you are thinking about this from the big picture as well. That's great to hear!

My dream goal would be to have AppleWin running a game, such as Lode Runner, in one window with a second program (written in C++ or Javascript) that does ML (Machine Learning) on how to play and beat the game.

I can see a few different projects here:

1. Cheat File Format
2. Scripting Language
3. Plugin Support for external control (WebSocket?)
4. Universal ID for images

To be continued ...

Michael
Re: Emulator disk swap eliminator [message #380056 is a reply to message #380055] Thu, 24 January 2019 13:01 Go to previous messageGo to next message
zellyn is currently offline  zellyn
Messages: 173
Registered: April 2013
Karma: 0
Senior Member
On Thursday, January 24, 2019 at 12:49:03 PM UTC-5, Michael AppleWin Debugger Dev wrote:
> 3. Plugin Support for external control (WebSocket?)

I can't find it / remember enough to Google it, but there was a KansasFest presentation a while back about standardizing on an API to externally control emulators. Anyone have a link?

Zellyn
Re: Emulator disk swap eliminator [message #380057 is a reply to message #379997] Thu, 24 January 2019 13:32 Go to previous messageGo to previous message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
> something like Lua or Wren scripting

I haven't heard of Wren before. In case anyone is curious:

http://wren.io/

"Wren is small. The VM implementation is under 4,000 semicolons.
You can skim the whole thing in an afternoon.
It’s small, but not dense. It is readable and lovingly-commented."

"Wren is a scripting language. Wren is intended for embedding in applications.
It has no dependencies, a small standard library, and an easy-to-use C API.
It compiles cleanly as C99, C++98 or anything later.


Wow! My first choice would have been Javascript, followed by Lua, but after seeing the above that Wren is so tiny that definitely looks REALLY interesting!

Michael
Pages (2): [1  2    »]  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Apple II emulators update announcements
Next Topic: Code is Hanging IIGS Emulators (But Not Real IIGS)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Mon Mar 18 22:07:50 EDT 2024

Total time taken to generate the page: 0.05426 seconds