That's not actually using an SDcard as far as the emulator is concerned, it's using the SDcard as a hostfs with the root set to the card. It's still just "Files on the host system."
Using the -sdcard switch says "Use this mounted file as a literal fat32 SDcard" and that lets the emulator uses the actual fat32 code in the kernal. It uses the code in the kernal ROM at that point, instead of being emulated by the ... emulator.
I know, right? WUT?
Long story short, the system behaves differently when on -sdcard and when on hostfs.
Switching to R43 frustration
Re: Switching to R43 frustration
Milk my duds! (From the movie "Wreck it Ralph.")
I'm going through the keyboard scan code, and I see there is a "I2C" WRITE that sets the Caplock led.
Have we always been able to write through "I2C" as well as read? Does this mean we can set the mouse mode so the scroll wheel works?
There doesn't appear to be anything in the mouse driver that supports changing the mode, but that doesn't mean it can't be added.
... The mouse we ship with the keyboard DOES have a scroll wheel, right?
I'm going through the keyboard scan code, and I see there is a "I2C" WRITE that sets the Caplock led.
Have we always been able to write through "I2C" as well as read? Does this mean we can set the mouse mode so the scroll wheel works?
There doesn't appear to be anything in the mouse driver that supports changing the mode, but that doesn't mean it can't be added.
... The mouse we ship with the keyboard DOES have a scroll wheel, right?
Re: Switching to R43 frustration
The ROM contains a full implementation of a FAT32 driver (i.e., taking a plain seekable bitstream and making "FAT32" happen on it). Using the SD card image directly is such a seekable bitstream, so the CPU/ROM can operate on it as intended.
The host's hard drive cannot be used like this, so for hostfs, the best we can do is detect when the 6502 is about to run a disk access i/o routine, break out, have the emulator itself fulfill it natively with standard file access functions, skip the 6502 ahead and resume as though it completed the operation itself.
The trade-off is, the emulator needs to simulate those Kernal functions itself, outside of the ROM. While the goal is to match the ROM's behavior as closely as possible, there will be times when it doesn't (and sometimes can't). Hostfs would be fine for the most common operations a game would need like loading and saving, and the SD card image is when you need true 1:1 emulation of the SD card, like using an OS.
The host's hard drive cannot be used like this, so for hostfs, the best we can do is detect when the 6502 is about to run a disk access i/o routine, break out, have the emulator itself fulfill it natively with standard file access functions, skip the 6502 ahead and resume as though it completed the operation itself.
The trade-off is, the emulator needs to simulate those Kernal functions itself, outside of the ROM. While the goal is to match the ROM's behavior as closely as possible, there will be times when it doesn't (and sometimes can't). Hostfs would be fine for the most common operations a game would need like loading and saving, and the SD card image is when you need true 1:1 emulation of the SD card, like using an OS.
Re: Switching to R43 frustration
Yes, the i2c interface had always been both read and write, and I imagine scroll wheel support could be added as long as the smc isn't filtering the messages out or something.
- ahenry3068
- Posts: 1147
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Switching to R43 frustration
I guess I haven't done anything advanced enough to break it yet. Using -fsroot with the sdcard
has so far worked ok for me.
has so far worked ok for me.
-
- Posts: 503
- Joined: Sat Jul 11, 2020 3:30 pm
Re: Switching to R43 frustration
Can I just use the actual SD card plugged into my laptop rather than an image?
- ahenry3068
- Posts: 1147
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Switching to R43 frustration
I use it that way on Linux. I'm sure it can work under windows too. According to other
people here on some functions it won't work correctly. But if your just using Load and Save it should work fine.
people here on some functions it won't work correctly. But if your just using Load and Save it should work fine.
Re: Switching to R43 frustration
Ed, if you want it to be an actual fat32 image usable with -sdcard, then no. But if all you want is to connect to the SDcard instead of a subdirectory on your hard drive, then sure: Just use -fsroot your_sdcard just as you would any sub directory in your computer.
Long answer, the "secret sauce" is in what DragWx said:
"(i.e., taking a plain seekable bitstream and making "FAT32" happen on it). Using the SD card image directly is such a seekable bitstream, so the CPU/ROM can operate on it as intended."
So what you need to do to make an sdcard.img work like that is to mount it using your computer's mount system, then pass the mounted file itself (NOT the mount point..) to the emulator in the -sdcard param
The mount point, which is also sees the contents of the file, is just part of your host filesystem, and can only be used as a root for the -fsroot param.
Look at the link posted by DragWx a few posts ago. That explains how to set up the sdcard image to work that way.
Long answer, the "secret sauce" is in what DragWx said:
"(i.e., taking a plain seekable bitstream and making "FAT32" happen on it). Using the SD card image directly is such a seekable bitstream, so the CPU/ROM can operate on it as intended."
So what you need to do to make an sdcard.img work like that is to mount it using your computer's mount system, then pass the mounted file itself (NOT the mount point..) to the emulator in the -sdcard param
The mount point, which is also sees the contents of the file, is just part of your host filesystem, and can only be used as a root for the -fsroot param.
Look at the link posted by DragWx a few posts ago. That explains how to set up the sdcard image to work that way.
Re: Switching to R43 frustration
Easy way to tell the difference:
In the BASIC screen on startup, type:
DOS"$
In an emulated environment (not using the -sdcard switch.) the first line will show the root directory, or "/" HOST
In an sdcard environment (and assumedly, real hardware.) it will show the volume label, or "X16 DISK" FAT32
This doesn't affect much in the way of normal operation, but some commands like copy (DOS"C:dest_file=source_file) won't work on the host fs.
In the BASIC screen on startup, type:
DOS"$
In an emulated environment (not using the -sdcard switch.) the first line will show the root directory, or "/" HOST
In an sdcard environment (and assumedly, real hardware.) it will show the volume label, or "X16 DISK" FAT32
This doesn't affect much in the way of normal operation, but some commands like copy (DOS"C:dest_file=source_file) won't work on the host fs.