Apple II Core

badvision
Posts: 34
Joined: Mon May 03, 2021 1:48 pm
Has thanked: 4 times
Been thanked: 15 times

Re: Apple II Core

Unread post by badvision »

Joystick is weird on the Apple // series. It is 100% analogue, and uses a timing-dependent read routine to read how long a capacitor takes to go to zero after pulsing it with a charge. (this is discussed in Jim Sather's book, among other places) -- anyway another factor in analog joystick support is that many games have some kind of manual or automatic calibration. Manual = Data east games like Bruce Lee ask you to put the joystick in different configurations and press a button. Automatic = either makes a naive assumption that < 64 = left, > 192 = right and 64-192 = center and then adjusts this based on the joystick being centered when the game starts. Meaning if joystick is not actually plugged in or enabled at the time the game starts then auto-calibration will be wrong and the game will act weirdly. I don't know of many games that auto-calibrate -- many of them just make a basic assumption about the ranges of expected values.

One way to test the joystick behavior is to run a simple program like:
10 print pdl(0),pdl(1): goto 10

This will let you see the range of values while the joystick is moved around. If all you see is 255 then that's why your character just moves right.

User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

badvision wrote: Wed Sep 13, 2023 9:42 pm

10 print pdl(0),pdl(1): goto 10

This will let you see the range of values while the joystick is moved around. If all you see is 255 then that's why your character just moves right.

This, exactly. Apple II joysticks have physical knobs to help center them, and the core seems to be sligthtly off center by default. This can cause some controllers tk not work at all as you can't hit all directions. Wonder if the core could be tweaked to compensate...

rcade
Posts: 106
Joined: Wed May 27, 2020 7:57 pm
Been thanked: 14 times

Re: Apple II Core

Unread post by rcade »

It would be nice to be able to load different ROM sets into this core. For example, original Apple II integer ROMs, clone ROMs, Apple IIc ROMs, etc.

Since it was recently modified to load video ROMs, this couldn't be that big of a stretch?

riblad_om
Posts: 57
Joined: Sun May 24, 2020 10:06 pm
Has thanked: 19 times
Been thanked: 4 times

Re: Apple II Core

Unread post by riblad_om »

Newsdee wrote: Mon Jul 17, 2023 3:58 am

If anybody wants to play Wizardry 1, then I can recommend using the latest recompiled version (Apr 9th 2023):
https://www.zimlab.com/wizardry/

I'm am attempting to play this, but I can't seem to get characters to survive a reboot. I don't know if I'm missing something because I don't really know how Wizardry or the Apple II function, or if it's a technical issue.

In both 3.0 and the 40 column version I can make a new character at the Training Grounds and add them to party at the Tavern, but they are gone after reboot. I thought maybe I needed to drop them off at the Tavern by Removing them and attempted to Recover them, but no dice.

After some attempts I read through the thread and used the dsk2nib utility to convert the dsks to nibs, but the result was that the system hung when attempting to *ROSTER at the Training Grounds after creating my character. I then rebooted and attempted to Add my character at the Tavern which once again resulted in the core hanging.

Anyone know what I need to do here?

rhester72
Top Contributor
Posts: 1134
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 173 times

Re: Apple II Core

Unread post by rhester72 »

@riblad_om Are you using the unpublished core that actually saves NIBs? The 'official' one doesn't AFAIK.

riblad_om
Posts: 57
Joined: Sun May 24, 2020 10:06 pm
Has thanked: 19 times
Been thanked: 4 times

Re: Apple II Core

Unread post by riblad_om »

rhester72 wrote: Sat Jan 13, 2024 11:48 pm

@riblad_om Are you using the unpublished core that actually saves NIBs? The 'official' one doesn't AFAIK.

I wasn't, hadn't occurred to me those improvements wouldn't be implemented to the main core yet. Grabbed what I'm assuming is the latest rbf from the previous page.

There's an improvement in that created characters are persistent between boots, but the core is still locking up when I use the *ROSTER command at the Training Grounds or when I try to Add characters at the Tavern.

User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

riblad_om wrote: Sun Jan 14, 2024 12:34 am

There's an improvement in that created characters are persistent between boots, but the core is still locking up when I use the *ROSTER command at the Training Grounds or when I try to Add characters at the Tavern.

You might need to disable the write protect option, I've experienced lock ups on other games when the core was trying to write.

But for Wizardry, I suggest using the PRODOS version instead.
Just get the 800K .po image from that page and rename it to .hdv - then you can mount it as a hard disk in the core and reset.

That version works nicely without any disk swaps, I can save characters and bring up the *ROSTER without issues.

riblad_om
Posts: 57
Joined: Sun May 24, 2020 10:06 pm
Has thanked: 19 times
Been thanked: 4 times

Re: Apple II Core

Unread post by riblad_om »

Newsdee wrote: Sun Jan 14, 2024 10:08 am
riblad_om wrote: Sun Jan 14, 2024 12:34 am

There's an improvement in that created characters are persistent between boots, but the core is still locking up when I use the *ROSTER command at the Training Grounds or when I try to Add characters at the Tavern.

You might need to disable the write protect option, I've experienced lock ups on other games when the core was trying to write.

But for Wizardry, I suggest using the PRODOS version instead.
Just get the 800K .po image from that page and rename it to .hdv - then you can mount it as a hard disk in the core and reset.

That version works nicely without any disk swaps, I can save characters and bring up the *ROSTER without issues.

Thanks! That definitely seems to make the game potentially playable, although I'm attempting to work out if there is a discrepancy between when the game writes to disk and when the core writes to disk.

From what I can tell, characters normally should only be considered Out and need to be Recovered if you reboot while in the Maze? However, this happens to me when I reboot in Town. This can be prevented by going to the Edge of town and Leaving the game.

After every reboot, the Party is empty and characters need to be Added from the Tavern.

Anyone know if that's all standard Wizardry behavior?

User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

riblad_om wrote: Sun Jan 14, 2024 10:52 pm

After every reboot, the Party is empty and characters need to be Added from the Tavern.
Anyone know if that's all standard Wizardry behavior?

I'm not sure but I think it happened to me on the Apple II in general.
They are not "out", i.e. you don't have to run the recovery tool to get them.

Stinky
Posts: 85
Joined: Mon Nov 15, 2021 9:05 pm
Has thanked: 50 times
Been thanked: 9 times

Re: Apple II Core

Unread post by Stinky »

This core is really great now, since the floppy write fix it seems complete and I really rate the 4am replay images. Many thanks to all contributors!

rhester72
Top Contributor
Posts: 1134
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 173 times

Re: Apple II Core

Unread post by rhester72 »

@Stinky The floppy write change never made it into the public release, did it?

Stinky
Posts: 85
Joined: Mon Nov 15, 2021 9:05 pm
Has thanked: 50 times
Been thanked: 9 times

Re: Apple II Core

Unread post by Stinky »

rhester72 wrote: Sat Mar 23, 2024 3:44 am

@Stinky The floppy write change never made it into the public release, did it?

It did and works well enough.

virtuali
Posts: 117
Joined: Mon Feb 01, 2021 10:41 pm
Has thanked: 2 times
Been thanked: 34 times

Re: Apple II Core

Unread post by virtuali »

Hi,

anybody knows how to make dual Mocking board working in Ultima V ? I can only make it work with a single Mocking board in Slot 4, any other board, in any slots, doesn't work. I'm using core version Apple-II_20231211.rbf

thorr
Top Contributor
Posts: 1188
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 582 times
Been thanked: 266 times

Re: Apple II Core

Unread post by thorr »

virtuali wrote: Sun Apr 21, 2024 11:28 pm

Hi,

anybody knows how to make dual Mocking board working in Ultima V ? I can only make it work with a single Mocking board in Slot 4, any other board, in any slots, doesn't work. I'm using core version Apple-II_20231211.rbf

It's not available in the core (yet). I have requested it previously on this forum though. I just added a request on github. Also mouse support is missing.

User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

I've been working on improving the colors of the core;
and I'm pretty happy to how it turned out.
(the current colors were too washed out to my taste)

Looking for some volunteers to test, let me know if you have any feedback.

The attached test build adds four selectable palettes:

  • new maths-derived //e NTSC palette (1)

  • Apple IIgs colors

  • AppleWin colors

  • the original core colors (2)

(1) this is a new (2024) palette from Linards Ticmanis, who wrote an earlier palette in 2005 that the Apple2 FPGA core used as reference. Here's the recent Reddit post with more details:
https://www.reddit.com/r/apple2/s/4Td4KhChRU

(2) the original core palette is from Stephen Edwards who released the first version of the core in 2009. It is supposed to be based on the 2005 Ticmanis palette, but deviates a bit (see example arlier in this thread)

Apple IIgs palette was documented by Apple with RGB values, and the same colors were used in the Mac LC Apple //e card. They are outside of NTSC spec but they look better in some games.

Apple-II_palettes_20240514.rbf
(3.39 MiB) Downloaded 16 times
User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

Here is a comparison of the palettes:
(AppleWin not pictured)

you can see the earlier core colors are quite off (especially one of the grays), and the IIgs is much more vivid

comparison.jpg
comparison.jpg (303.92 KiB) Viewed 1265 times
thorr
Top Contributor
Posts: 1188
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 582 times
Been thanked: 266 times

Re: Apple II Core

Unread post by thorr »

Thanks! When I get a chance, I will hook this up to my Apple IIc monitor with composite and compare with my Apple IIc. I mentioned I will do this in the IIgs thread, but I haven't gotten time yet. It might be a few weeks because I have company coming soon. It will be interesting to try the different palettes to see which is the most correct. Maybe I can squeeze in some time to do this soon during an evening.

thorr
Top Contributor
Posts: 1188
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 582 times
Been thanked: 266 times

Re: Apple II Core

Unread post by thorr »

I took pictures of my Apple IIc monitor with my Apple IIc and the various MiSTer palettes and Color 1/2 modes using composite. See them here: https://imgur.com/a/W1YmEtT

Here is the better of the two Apple IIc photos rotated to match the above (these are horizontal lines that I image edited to rotate to be vertical):
Image

You can right click on any image in my link above and select "Open in new tab" and do this with the Apple IIc and another image to compare the two by switching between the tabs.

I need to take these again because I should have used Manual instead of TV mode on the camera. It's a start though. I included two different Apple IIc photos for reference.

Based on my photos, not your images above, here is the best palette choice for each color in my opinion that is closest to the Apple IIc native. This is using the Composite output.
0 - black
1 - apple2fpga
2 - apple2fpga
3 - IIgs
4 - apple2fpga
5 - AppleWin
6 - IIe
7 - IIgs
8 - apple2fpga
9 - IIgs
10- AppleWin
11- IIgs
12- IIgs
13- AppleWin
14- IIgs
15- white

Interestingly, my color photo above more closely matches Newsdee's images above than the MiSTer actually produces out the composite output. Maybe make another palette called "Composite" with this mapping.

I have to say, after looking at my comparison palette with the above, I like mine the best. Maybe just use those colors. Mine actually match the description of all the colors such as dark blue, medium blue, light blue, two grays, brown, yellow, etc.

thorr
Top Contributor
Posts: 1188
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 582 times
Been thanked: 266 times

Re: Apple II Core

Unread post by thorr »

Newsdee wrote: Tue May 14, 2024 4:33 am

I[*] new maths-derived //e NTSC palette (1)

As a follow up, my guess is the composite hardware in the IIc combined with the hardware in the IIc monitor generates the correct colors. Both may be different than standard composite, but work well together. This might explain why the math-derived ones look wrong, but I have no idea.

Also, are the HGR colors different? I might have to take photos of those too. The text at the bottom doesn't look right in the photos I took, except on the IIc itself.

User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

thorr wrote: Fri May 17, 2024 6:23 pm

As a follow up, my guess is the composite hardware in the IIc combined with the hardware in the IIc monitor generates the correct colors.

Well, yes.
Composite color is created by artifacting on your NTSC CRT from a pure black & white picture.

Can you try comparing colors between your IIc and the core running in black & white mode?
That should give a much closer result... since it's your real (analog) NTSC hardware producing colors.

(also by the way, there is no color difference in Color 1 vs. Color 2; they are different in how text is handled at the lower part of the screen
... maybe we should rename it to "Color+Text" or something like that)

thorr wrote:

Interestingly, my color photo above more closely matches Newsdee's images above than the MiSTer actually produces out the composite output.

The palettes are designed to work with modern displays using RGB,
so using them with Composite video wouldn't be accurate (it would introduce other deviations).

My image was made by putting together direct video dumps (Win + PrtScr) from MiSTer;
so your comment is encouraging... it suggests the palettes are working as expected :D

thorr wrote:

Also, are the HGR colors different?

Some posts online say they are but after watching a couple of videos on color theory, I'm convinced simple visual checks are very misleading.

In fact there is no "correct" NTSC palette so to speak. Modern displays are calibrated to produce color as per some standard (such as sRGB), but the early CRT ignored all that; they just let our wetware interpret color based on whatever frequency of light they emit. Composite color is basically white dots appearing at certain frequencies changing the wavelengths emitted.

As a result, perceptions varies greatly per person and the monitors involved. I could calibrate colors by eye to make my LCD modern display exact to my PVM (by my own eyes), but to you it may look completely different. Worse, even for the same person, changing the "knobs" on a display (i.e. brightness, contrast, chroma, etc) can change the result. I like to push high chroma on my PVM for some games, and reduce it for others...

In particular that means that tweaks of one knob affects all colors at once (as it would on a real display) rather than being a per-color adjustment.

What prompted me to improve the Apple II colors for the core was a Reddit post by somebody (Linards) who spent a lot of time going over the maths of how NTSC and color perception works; and came up with a palette that gets as close to the Apple IIgs RGB colors as NTSC can..

That is just one possible palette...but it was determined by finding how to "adjust the knobs" to get those colors, and he provided enough documentation (source code, references, posts) for somebody to go through it and try to challenge / improve the method.

I like that approach a lot; in fact, ideally I'd like to have the core let users adjust the knobs by themselves, but the maths are a bit complex and I'm not sure it would work well in FPGA synthesis (I'm happy to be proven wrong - just not versed enough in HDL and the specific maths to do it right, at least right now).

Note that Linards also compared to a real Apple IIe and found the colors to match; we ought to verify of course :)

Reddit posts:

User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

One more small request, could you take screenshots of Karateka in your display?
I want to see how the floor appears in composite color (some people say it should be gray - although its not something we can do with the core at the moment)

Edit: here is a website showing you how C64 (VIC/VIC II) NTSC colors change when you adjust the "knobs": https://www.colodore.com/
Ideally we need something like that for the Apple II specific colors (it will be slightly different colors due to hardware differences)
A writeup of the method behind that website is here: https://www.pepto.de/projects/colorvic/

thorr
Top Contributor
Posts: 1188
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 582 times
Been thanked: 266 times

Re: Apple II Core

Unread post by thorr »

Thanks for working on this and for your reply. I will work on this when I have more time. I have company coming and will be quite busy for a few weeks preparing and visiting.

Having an adjustable palette like the knob would be very cool. In the meantime I still like my actual colors better that are accurate with all the descriptions like light blue and yellow (instead of pinkish purple and light green). I totally understand how things look different to different people but it is hard to dispute actual photographs that have the expected colors vs different ones and getting the actual color values from them. Can you make a new palette option that matches my IIc picture for RGB on the MiSTer? You can call it "IIc NTSC Photo" or "From Photo" or "Actual" or something like that since that is it's source and possibly put "Math" on the other one.

Also, it would be cool if you could make a "Composite Out" palette option for use with the composite output and get the color that RGB would produce so I could use it with my IIc monitor. That is what my list above was intended for.

And I adjusted my knobs a long while back to get the colors right. I look at it as color calibrating just like I do with my other CRT's. I think they look pretty good this way.

Thanks again!

User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

Here is a side-by-side comparison of your picture and an HDMI video capture.
It's fairly close - I can probably get it better by tinkering a bit more with capture settings and filters.

The only color that does not seem to match at all is Light Blue (COLOR 7); but the rest look very close to me.

Top
MiSTer FPGA Apple II core, screenshot of HDMI video capture

Botton
Apple IIc capture

Settings used

Code: Select all

MiSTer core settings
------------------------
Display: Color
Palette: //e
Pizel Clock: Normal
Aspect Ratio: Original
Scale: Normal

MiSTer Video Processing Options
(Preset: Sony Trinitron + tweaks)
------------------------
Horz filter: GS_Sharpness_050.txt
Vert filter: SLA_Dk_040_Br_080.txt
Scan filter: Same as Vert
Gamma Correction: CRT Simulation.txt
Shadow Mask - 1x :  Sony Trinitron (1968).txt
Attachments
comparison.jpg
comparison.jpg (539.4 KiB) Viewed 530 times
User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

thorr wrote: Sat May 18, 2024 1:08 pm

Thanks for working on this and for your reply. I will work on this when I have more time. I have company coming and will be quite busy for a few weeks preparing and visiting.

No rush. I appreciate the feedback!

Attached is a custom build with your choice of colors, give it a try. I called it the "handpicked" palette.
I personally don't like how the apple2fpga Brown comes out (looks too olive to me) but it may be different on your display.

Try also adjusting Gamma values; I think they work for CRT out (the rest is only for HDMI)

Attachments
Apple-II_thorr_20240517.rbf
(3.41 MiB) Downloaded 12 times
thorr
Top Contributor
Posts: 1188
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 582 times
Been thanked: 266 times

Re: Apple II Core

Unread post by thorr »

Thanks! Is the new version for RGB using my photo, or for composite using my list? If it is for RGB I would compare my TV with component to the IIc since the composite might muck up the color, but also will check the IIc monitor for curiosity's sake. The gamma adjustment will be interesting too.

The third color and brown are quite different IMO also.

thorr
Top Contributor
Posts: 1188
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 582 times
Been thanked: 266 times

Re: Apple II Core

Unread post by thorr »

Well, I have the answer, it is from my list for the composite output. The colors look much better on my monitor now! I would call this "Composite Out" once we get it dialed in perfectly since it is only for use with composite output. Here is a photo from my phone which is not as good as my previous pictures but will have to do for now since I don't have time to deal with my better camera. Thanks!

Image

thorr
Top Contributor
Posts: 1188
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 582 times
Been thanked: 266 times

Re: Apple II Core

Unread post by thorr »

Dang it I just ordered a used Canon EF 100mm f/2.8 Macro lens because I want better close up photos like my phone can do. I will take my photos with that after it arrives and after my company leaves. This will help with my future photos for akeley too.

User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

thorr wrote: Sat May 18, 2024 2:31 pm

I would call this "Composite Out" once we get it dialed in perfectly since it is only for use with composite output.

Just curious, is there a specific reason why you are using colors from the core in composite mode?
Could you try it with the Black & White mode?

The intended use with Composite video is to set the core in Black & White mode then let the display create the colors by NTSC artifacts.
It should look like the picture below (photo by eobet from the MiSTer FPGA discord)

(unless perhaps you have a PAL display - then maybe it doesn't work the same way)

The image is using diagnostic program "Apple_IIe_Diagnostic_v2.1_19xx_-.dsk" - you can find it by googling the disk image name

Attachments
apple_2_composite.jpg
apple_2_composite.jpg (1.8 MiB) Viewed 298 times
thorr
Top Contributor
Posts: 1188
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 582 times
Been thanked: 266 times

Re: Apple II Core

Unread post by thorr »

Newsdee wrote: Sun May 19, 2024 12:51 am
thorr wrote: Sat May 18, 2024 2:31 pm

I would call this "Composite Out" once we get it dialed in perfectly since it is only for use with composite output.

Just curious, is there a specific reason why you are using colors from the core in composite mode?
Could you try it with the Black & White mode?

The intended use with Composite video is to set the core in Black & White mode then let the display create the colors by NTSC artifacts.
It should look like the picture below (photo by eobet from the MiSTer FPGA discord)

(unless perhaps you have a PAL display - then maybe it doesn't work the same way)

The image is using diagnostic program "Apple_IIe_Diagnostic_v2.1_19xx_-.dsk" - you can find it by googling the disk image name

I have an actual Apple IIc NTSC composite monitor. When I set the core to B&W mode, it shows everything in black and white. Currently, when I launch the MiSTer, the main menu is in black and white, and once I launch the core and put it in Color mode, it is in color. Is there an INI file I need to set? Currently vga_mode=svideo

The reason I am using the IIc monitor is because I have a real IIc and a MiSTer, so we can try to get the two outputs to match exactly with the same monitor.

User avatar
Newsdee
Top Contributor
Posts: 841
Joined: Mon May 25, 2020 1:07 am
Has thanked: 100 times
Been thanked: 214 times

Re: Apple II Core

Unread post by Newsdee »

thorr wrote: Sun May 19, 2024 1:05 am

I have an actual Apple IIc NTSC composite monitor. When I set the core to B&W mode, it shows everything in black and white.

Is this your monitor by any chance? https://oldcrap.org/2019/05/14/apple-iic-monitor/
Also does your IIc have some kind of dongle to connect to the video-port, allowing to plug a "regular" composite jack to it?

Either way, it's clear your monitor does not do artifact color ... so we have to generate the color in the core.

The reason I am using the IIc monitor is because I have a real IIc and a MiSTer, so we can try to get the two outputs to match exactly with the same monitor.

Yes that's a great test to make. I suspect the extra color circuitry is in the dongle used with the IIc.
We have room for a "//c PAL" palette; I've used your values for now until we determine a better one.

Post Reply