In brief: much better audio for "xapple2" Linux Apple II emulator, at http://www.mrob.com/xapple2 I have recently begun preparing for my "1000-to-1 party" celebrating the fact that computers are now 1000 times faster (1 GHz) than when I started programming the Apple ][ (1 MHz) back in 1980. (See http://www.mrob.com/1000to1.html ) Since I'm a Linux user, and all my software was written on an Apple ][+, I chose the "xapple2" emulator. I couldn't get the "PC speaker" sound to work -- so I added support for /dev/audio (sound card). The result is perfect sound reproduction (as I have verified with my real Apple //c). It also has a very nice side-effect that if you are running the emulator at full speed (via the F9 key), it will slow down to genuine 1-MHz Apple ][ speed as soon as it plays sound, then speed up again only after sound has stopped for at least 1/2 second. Thus, there is no need to waste processor bandwidth in the speed delay loop just to get the sound to be right. The changes involved modifying the core CPU opcode routines (the x86 assembler code in cpu.S) to count clock cycles, and a small callback routine for the $C030 memory access vector that does the actual writing to /dev/audio. I haven't seen much discussion of the xapple2 emulator recently, and the maintainer's email address isn't working, so I'm posting this message to let people know about it. The changed source files are applied to the 0.7.4 release (the latest I could find) and available at http://www.mrob.com/xapple2/ - Robert Munafo Apple ][ programmer since 1980 Sent via Deja.com http://www.deja.com/ Before you buy. , Holger Picker wrote: > Illegal opcodes not fully emulated yet are about to be implemented > in the next beta. Are they the same as on a MOS 6510 (CBM 64)? They are very clearly documented in the file "Extra Instructions Of The 65XX Series CPU" by Adam Vardy, which you can find by using a search engine and searching for "65xx extra vardy". If you want to see it in source code, look at my version of the xapple2 emulator (file cpu.S) which you can get here: http://www.mrob.com/xapple2/cpu.S > No proper sound. Only crappy direct PC-Speaker [...] I am in > strong need of information on how to program a soundblaster > compatible sound card using double buffering under protected > mode environment. I can't help with the specifics of writing to a SoundBlaster in Windows, but the basic algorithm for doing sound is simple -- count the 6502 CPU cycles (see above file to see one way of doing this) and use an algorithm like that in this file: http://www.mrob.com/xapple2/misc.c to generate a bytestream to write to the audio output. > And I need information about the internal organisation of the > AppleIIc. I have a //c, let me know what you want me to investigate. Jon Bettencourt wrote: > As for the RGB values of the standard high-resolution graphics > colors, there are none Not true! The precise colors can be determined by looking at the NTSC standard together with the schematics of the original Apple ][ video hardware. You also have to know about gamma correction and color spaces. I'm going to post this in another message since it is of such general significance and goes beyond just emulators. - Robert Sent via Deja.com http://www.deja.com/ Before you buy. I am giving a table of all the lores and hires colors with their values in RGB. First, though there is a bit to explain... The Apple ][ hardware generates a NTSC composite (luma plus chroma) signal complete with a color burst on the "back porch" of each scanline. The dots for all display modes (text, lores and hires) come from a master 14.31818-MHz clock, which is divided by 4 to produce the color burst. Dots for 40-col text and hires graphics come out at 7.15909 MHz. Dots for 80-col text, lores graphics, and double hires graphics come out at 14.31818 MHz. Although NTSC defines the scanline as 227.5 cycles per scanline (so the phase alternates on alternate scanlines, producing a dithering effect), the Apple rounds it up to 228. (This is why solid bright colors on a monochrome monitor appear as vertical stripes rather than the "tiny checkerboard" pattern you see when watching a TV program on the same monochrome monitor.) To understand the NTSC standard fully, there are four coordinate systems you have to deal with: - chroma phase, chroma amplitude and luma - YIQ - Y B-Y R-Y - RGB The "color burst" signal I just described, plus the positions of some of the coordinate axes of the other systems, are all defined by relative phase angles with respect to each other. I'll skip all the details, but you are invited to read any of the URLs I'm listing at the end if you want to know more (some are dead but cached on Google). The important things to know for our purposes are: 1. On the Apple ][, all pixels and the color burst are in phase with the master clock. However, they come out as square waves, and the effect of the TV's circuitry (or a composite monitor) is to turn the square wave into the closest matching sine wave. 2. Because all the pixels generated are in phase with the color burst signal, the phase of the sine wave is always 0, 45, 90, 135, 180, 225, 270, or 315. The color burst itself is phase 180. For example, "green" HCOLOR=1 and "light green" COLOR=12 are 50% duty cycle square waves centered at phase 225. 3. The 4 hires colors are all 50% square waves, which gives a chroma amplitude higher than anything in a real TV broadcast. This is why they look so garish. Contrary to what was recently said in the article "Jon Relay's Apple II Info Archives" in the Aug 2000 GS WorldView, these four colors are *not* the same as the NTSC "+I, +Q, -I and -Q" colors. They are actually 12 degrees lower in phase -- probably not enough to notice, since your tint control is probably a bit off anyway (-: 4. The lores colors are derived a similar way, although two of them (the two grays) are square waves of twice the chroma frequency, and these are "averaged out" to a flat 50% gray by the TV. All of the lores colors are binary combinations of the four PRIMARY lores colors, which are the four that appear "dark gray" on a monochrome monitor: duty cycle phase Red COLOR=1 45 to 135 90 Dark-blue COLOR=2 315 to 45 0 Dark-green COLOR=4 225 to 315 270 Brown COLOR=8 135 to 225 180 If we combine COLOR 4 and COLOR 8, we get COLOR 12: 4 plus 8 = 12. This color is "on" from 135 to 315, which makes a 50% square wave centered on 225. Thus, it appears the same as the HCOLOR=1 described above. Here is the table. It was used by taking the chroma/luma values and transforming to R-Y and B-Y, then transforming to YUV and finally to RGB. The last step requires a gamma correction for display on an RGB monitor, I used Y to the power of -0.4. For reference, the NTSC "color bars" test pattern colors and the YIQ axis colors are also given.
                 --chroma--
 Color name      phase ampl luma   -R- -G- -B-
 black    COLOR=0    0   0    0      0   0   0
 gray     COLOR=5    0   0   50    156 156 156
 grey     COLOR=10   0   0   50    156 156 156
 white    COLOR=15   0   0  100    255 255 255
 dk blue  COLOR=2    0  60   25     96  78 189
 lt blue  COLOR=7    0  60   75    208 195 255
 purple   COLOR=3   45 100   50    255  68 253
 purple   HCOLOR=2  45 100   50    255  68 253
 red      COLOR=1   90  60   25    227  30  96
 pink     COLOR=11  90  60   75    255 160 208
 orange   COLOR=9  135 100   50    255 106  60
 orange   HCOLOR=5 135 100   50    255 106  60
 brown    COLOR=8  180  60   25     96 114   3
 yellow   COLOR=13 180  60   75    208 221 141
 lt green COLOR=12 225 100   50     20 245  60
 green    HCOLOR=1 225 100   50     20 245  60
 dk green COLOR=4  270  60   25      0 163  96
 aqua     COLOR=14 270  60   75    114 255 208
 med blue COLOR=6  315 100   50     20 207 253
 blue     HCOLOR=6 315 100   50     20 207 253
 NTSC Hsync          0   0  -40      0   0   0
 NTSC black          0   0    7.5   41  41  41
 NTSC Gray75         0   0   77    212 212 212
 YIQ +Q             33 100   50    255  81 255
 NTSC magenta       61  82   36    255  40 181
 NTSC red          104  88   28    255  28  76
 YIQ +I            123 100   50    255  89  82
 NTSC yellow       167  62   69    221 198 121
 Color burst       180  40   0       0   4   0
 YIQ -Q            213 100   50     51 232  41
 NTSC green        241  82   48     12 234  97
 NTSC cyan         284  88   56     10 245 198
 YIQ -I            303 100   50      0 224 231
 NTSC blue         347  62   15     38  65 155
See also http://www.ee.washington.edu/conselec/CE/kuhn/ntsc/95x4.htm http://www.landfield.com/faqs/apple2/faq/part16/ http://www.grin.net/~cturley/gsezine/GS.WorldView/v2000/Aug/Articles/A2.InfoArchives.Aug.2000.txt http://www-viz.tamu.edu/faculty/parke/ends489f00/notes/sec1_4.html http://www.neutralzone.org/home/faqsys/docs/codet http://www.belle-nuit.com/archives/videoglossary.html http://www.itc-usa.com/noframe/radapclr.htm - Robert Munafo Apple ][ programmer since 1980! Sent via Deja.com http://www.deja.com/ Before you buy.