whscullin / apple2js Goto Github PK
View Code? Open in Web Editor NEWAn Apple II emulator originally written in Javascript, now being converted to TypeScript
Home Page: http://www.scullinsteel.com/apple2/
License: MIT License
An Apple II emulator originally written in Javascript, now being converted to TypeScript
Home Page: http://www.scullinsteel.com/apple2/
License: MIT License
Hello,
When I try to start the emulator on my Android hosted Chrome using the link http://www.scullinsteel.com/apple2/ I get the following issue:
At the same time, when I launch the emulator on my laptop, everything works fine:
I assume that it is possibly due to android security settings or something of this sort, but I don't have an expertise to solve the problem on my own.
It would be great to have a chance to play with the emulator on my Android phone on the go.
Please help.
Thank you.
First, I know there's all kinds of stuff about Apple II scaling, but it should be possible to get the renderer to a nice 4:3 aspect ratio. I've actually gotten it there myself with CSS, and it looks fine. I've also used CSS to upscale to a friendly 800 by 600. Could features like that be built into the emulator, so anyone who uses it can have good scaling?
Second, can we have the option to turn the pixelated image rendering on or off?
Third, I like the way the GL rendering blends the colors. It looks much better that way. But also, it adds some unnecessary things, like barrel distortion, more black border, a change of aspect ratio, chroma noise, and some kind of glitchiness down the left side of the screen. Can we have a version that keeps the color blending but gets rid of some of the other stuff?
When I do:
$ npm install
it fails with:
npm WARN tarball tarball data for apple2shader@git+ssh://[email protected]/whscullin/apple2shader.git#e87a445148bbcc7f4dbfa2609902071631f96bbc (sha512-nk+2iHnKtWHsUvRFiG77x5A5GmScQKc+MHDJOFB6GYmqTomhakyPdfw1Dkupj+iDQc6EmelUgbnF/weZoTtQ1Q==) seems to be corrupted. Trying again.
npm WARN tarball tarball data for apple2shader@git+ssh://[email protected]/whscullin/apple2shader.git#e87a445148bbcc7f4dbfa2609902071631f96bbc (sha512-nk+2iHnKtWHsUvRFiG77x5A5GmScQKc+MHDJOFB6GYmqTomhakyPdfw1Dkupj+iDQc6EmelUgbnF/weZoTtQ1Q==) seems to be corrupted. Trying again.
npm ERR! code EINTEGRITY
npm ERR! sha512-nk+2iHnKtWHsUvRFiG77x5A5GmScQKc+MHDJOFB6GYmqTomhakyPdfw1Dkupj+iDQc6EmelUgbnF/weZoTtQ1Q== integrity checksum failed when using sha512: wanted sha512-nk+2iHnKtWHsUvRFiG77x5A5GmScQKc+MHDJOFB6GYmqTomhakyPdfw1Dkupj+iDQc6EmelUgbnF/weZoTtQ1Q== but got sha512-UtWmaTPHaSa6dv0FZlpNtA9d4Od3vk6t9929e+gKNjCwSYr6sMnC29h7Qls/SJwpOqArh2o0rEb83dgcfbPepg==. (151960 bytes)
Logs show:
43 http fetch GET 304 https://codeload.github.com/whscullin/apple2shader/tar.gz/e87a445148bbcc7f4dbfa2609902071631f96bbc 400ms (from cache)
44 warn tarball tarball data for apple2shader@git+ssh://[email protected]/whscullin/apple2shader.git#e87a445148bbcc7f4dbfa2609902071631f96bbc (sha512-nk+2iHnKtWHsUvRFiG77x5A5GmScQKc+MHDJOFB6GYmqTomhakyPdfw1Dkupj+iDQc6EmelUgbnF/weZoTtQ1Q==) seems to be corrupted. Trying again.
45 timing reify:rollback:createSparse Completed in 39ms
46 timing reify:rollback:retireShallow Completed in 0ms
47 timing command:install Completed in 11799ms
48 verbose stack Error: sha512-nk+2iHnKtWHsUvRFiG77x5A5GmScQKc+MHDJOFB6GYmqTomhakyPdfw1Dkupj+iDQc6EmelUgbnF/weZoTtQ1Q== integrity checksum failed when using sha512: wanted sha512-nk+2iHnKtWHsUvRFiG77x5A5GmScQKc+MHDJOFB6GYmqTomhakyPdfw1Dkupj+iDQc6EmelUgbnF/weZoTtQ1Q== but got sha512-UtWmaTPHaSa6dv0FZlpNtA9d4Od3vk6t9929e+gKNjCwSYr6sMnC29h7Qls/SJwpOqArh2o0rEb83dgcfbPepg==. (151960 bytes)
Feature request: an option that can be passed via the query string that would slow acceleration during audio playback.
Context:
Many hardware accelerators (e.g. FASTChip, ZIP Chip, etc) and other emulators (e.g. Virtual ][) have settings to slow acceleration to 1MHz temporarily during audio playback. The duration of the slowdown is a heuristic; I don't know if there's a universally agreed upon value. 1-5ms maybe?
This was reported as an issue when using Apple II DeskTop with //jse - the alert sounds pay as quick chirps. You can try this out on a2desktop.com - click the "Try it now with Apple //jse" button, use the Apple menu > Control Panels > Sounds, click various options.
NB: The sound code does slow some hardware accelerators that don't auto-slow for audio (IIgs, Mac IIe Card, Laser 128). I don't think that's a good route to go down for //jse, though.
Is Apple IIgs emulation on the roadmap? Here is a project also under MIT license that has 64C816 emulation in JavaScript:
https://github.com/raddad772/jsmoo
I asked them the same in:
Hey, whscullin!
I love your emulator. Its allowed me to play some great old games from my childhood. I'm trying to host one of those old games that made a positive impact on me. I'm a pretty big noob with all of this, but I've isolated the game from the collection of games it came with. But, I'm having trouble understanding what/where to edit to create a static distribution that autoloads the game when accessed. Any advice or help would be greatly appreciated. Regardless, thanks again for your work on this emulator.
Repro:
Note one byte of the DHR screen visible on the left side of the screen.
There's no weird cycle counting going on; the order of softswitch flips to get from DHR to 40 column text mode might be slightly weird, and colored text mode is used if you have an RGB card, but that wouldn't result in this effect.
Hello, can someone please make a video about how to install this and the apple I emulator? Best would be youtube.
Hi, thank you so much for this great piece of software! Congratulations.
While playing around at https://www.scullinsteel.com/apple2/, I've discovered that when I select a disk image no Drive #2, it loads correctly, but the "disk image file name" appears as if it was loaded no Drive #1. Previously loaded drive image on Drive #1 still works, but its "imagem name" gets overwritten in the interface with the Drive #2 selected "image name".
Again, congatulations for this great emulator!
Hi,
Thanks for the wonderful emulator.
When i try:
GR
COLOR=8
HLINE 5,15 AT 10
It behaves as:
HLINE 0,15 AT 10
Thanks!
In this line:
apple2js/js/formats/format_utils.js
Line 289 in e1b807b
it seems that drive.fmt
should actually be drive.format
as I can't find any code that sets drive.fmt
. @whscullin can you confirm this? I have a Typescript conversion here:
that I believe fixes the issue. If you agree, I'll add it to PR #46.
Thanks!
hello?
I know that CFFA and Smart drive are implemented.
But I don't know how to use them.
Can I use them to read from or write to a file?
(I want to use a .hdv file.)
Or can I speed up reading and writing while using drive2 ?
How do I type lowercase character in Apple 2 emulator ?
When everyone in the party dies, there is usually a "fade to black" sequence before Lord British resurrects the party. That does not happen with the emulator. Instead, the hard drive light stays on and nothing happens.
Repro steps:
A
until the whole sequence is done.Expected result: The fade to black sequence happens and then Lord British resurrects the party.
Actual result: Nothing happens.
Could this be related to the game activating the accelerated mode? Possibly. But since it's a ProDOS block device, I wouldn't think that timing would be that important.
I've tested this image on Virtual ][ and it works as expected. It also works correctly on real hardware.
how do i exit fullscreen
As seen in Pinball construction set when you are test playing your pinball the right mouse button activates the right flipper but the context menu pops up as well.
One workaround that I do is to go into the browser console and execute.
document.addEventListener('contextmenu', event => event.preventDefault());
Apple2js is a really good emulator.
It's perfect for running my personal Apple 2 game on the web.
The last feature I want is Mocking board emulation.
Sound like this looks good.
Thanks again for a great project.
In the current Apple 2JSE, there are rare cases that the memory bank writing is not functioning like the real Apple 2e.
Shown below is the snippet on the code that shows the problem. Expected value in $06 should be #$A1
LDA $C08B
LDA $C08B ; Enable Read and Write to Bank 1
STA $C089 ; Reset the prewrite
LDA $C089 ; Set the prewrite
LDA #$A1
STA $D000 ; Store A1 to Bank 1
LDA $C08B
LDA $C08B ; Enable Read and Write to Bank 1
LDA $D000 ; Read D000 value in Bank 1
STA $06 ; Store value into $06
STA $C08A ; Read ROM and no write to bank RAM`
RTS
The fix to the issue is proposed below
private _accessLangCard(off: byte, val?: byte) {
const readMode = val === undefined;
const result = readMode ? 0 : undefined;
const writeSwitch = off & 0x01;
const offSwitch = off & 0x02;
const bank1Switch = off & 0x08;
let bankStr;
let rwStr;
if (writeSwitch) { // 0xC081, 0xC083
if (readMode) {
if (this._prewrite) {
this._writebsr = this._prewrite;
this._prewrite = false;
} else {
this._prewrite = true;
}
} else {
this._prewrite = false;
}
if (offSwitch) { // 0xC08B
this._readbsr = true;
rwStr = 'Read/Write';
} else {
this._readbsr = false;
rwStr = 'Write';
}
} else { // 0xC080, 0xC082
this._writebsr = false;
this._prewrite = false;
if (offSwitch) { // 0xC082
this._readbsr = false;
rwStr = 'Off';
} else { // 0xC080
this._readbsr = true;
rwStr = 'Read';
}
}
if (bank1Switch) {
this._bank1 = true;
bankStr = 'Bank 1';
} else {
this._bank1 = false;
bankStr = 'Bank 2';
}
this._debug(bankStr, rwStr);
this._updateBanks();
return result;
}
Thank you for this amazing program! It's been a delight to play some of my childhood video games without having to install anything or fiddle with setup.
One of the games I wanted to play only works with the joystick though, and that didn't seem to work, so I took a look at the source code.
I found the function processGamepad really easily, but it wasn't being called anywhere.
Looks like it was removed in a refactor (commit bcbe36d) presumably by accident.
I added a call to processGamepad() right after this.tick() and that worked great for me when I did a build and opened up apple2js.html
Patch:
re-enable-joystick.txt
Given the following input (text after the |
is explanatory comments, not input):
F666G | load the mini assembler
1000: LDA #FE |
STA 33 | set PROMPT to '>'
JSR FD67 | Run the GetLineZ command in the system monitor
STX 00 | Store the line length (X) at 00
LDX #00 | X=0
LDA 200,X | Get the Xth char from the input buffer
JSR FDED | Run the COUT command from the system monitor
INX | X++
CPX 00 | Compare X to line length
BNE 100B | if (X != length) goto the LDA 200,X line
RTS | Return
$1000G | Run the code at 1000
HELLO ALL | In response to > prompt
Expected output:
HELLO ALL
Actual output: byte listing as if AL
was entered to monitor.
Additional runs (with various inputs) can produce all sorts of weird outputs. My guess is there's an error in the rom bytes, as this code works as expected on real hardware & other emulators. I'm guessing it has something to do with the space in the input, as I haven't gotten this on single word inputs
I told the program to disable the mouse joystick, and it didn't do that. My character keeps moving toward the mouse cursor. It's very annoying. All the reloading in the world didn't help.
I used to be able to press F6 and F9 to save and load state, but this doesn't work in the current build.
Is there a reason for this?
How can I make it possible to save and load state?
Thanks.
I fiddled with Apple][js/e a few years ago, and I am only today discovering how much has been added to it (e.g. HDV support) and that I don't know exactly what its expected behaviors are (e.g. automatically putting 800K+ disks into S7 -- I just had to guess at that). It's an excellent accomplishment -- is there any documentation? Or a changelog besides commit comments (which are a little too granular and cryptic to be fully useful)? I think it would be of massive benefit to those using it, since everything it can do is not automatically apparent!
In the first section
Hello,
I stumbled today on something very weird.
"Beneath Apple DOS" says that the epilog of an address field is DE AA EB
, and your code conforms to that :
But if you take an hexadecimal editor and analyze for example https://mirrors.apple2.org.za/ftp.apple.asimov.net/images/masters/blank.nib, you will see that there is DE AA
directly followed by 5 bytes of gap FF FF FF FF FF
. The EB
is missing.
I traced what an Apple II+ ROM does when I save a file, and indeed it starts writing the gap 1 byte earlier.
I get an I/O error if I do a SAVE HELLO
in an emulator, save the resulting bytes to a disk with the extra EB
, and read the disk again. I don't get this I/O error if I remove the extra byte.
"Beneath Apple DOS" says about this byte "Oddly, the $EB
is always written during initialization, but is never verified when an address field is read". I did not check what happens during an initialization. It could be that the $EB
is overwritten at the first occasion, I do not know.
In any case, it seems to me that emulators work better if first epilogue is made only of 2 bytes, like what is found on all nib disks I checked so far.
In the hope it helps,
When browsing http://www.6502.org/tutorials/65c02opcodes.html, as one does, I noticed that the 65C02 emulation in apple2js does not cover all of the differences between the 6502 and 65C02 mentioned in these sections:
It also doesn't cover the bogus instructions on the 6502, but I'm guessing that's OK.
I've been playing around with the ThunderClock card. The following program is expected to increase the variable cnt. This is per the examples given here.
100 D$ = CHR$ (4)
110 PRINT D$"BLOAD TCPUTIL"
120 LCNT = 768
130 HCNT = 769
140 SLOTNO = 770
150 GTSLOT = 775
160 STROBE = 817
170 ZERO = 833
180 IGO = 877
190 IHLT = 897
200 ENABLE = 895
210 DISABLE = 905
220 SOUND = 907
230 MUTE = 911
290 CALL GTSLOT
300 CALL IGO
310 CALL ZERO
320 CALL STROBE
330 CNT = PEEK (HCNT) * 256 + PEEK (LCNT)
340 PRINT CNT
350 GOTO 320
When ran, the variable cnt is resultant in 0. I then ran some diagnostics disks. When running the ThunderClock test program provided on the ThunderClock disk, it simply reports that, "the ThunderClock in slot #5 has a problem." The Basic commands to get the time works but the commands to set the time do not. When running the supplied demo program on the ThunderClock Disk, the options to set the interrupt rate and time both result in undefined behavior. Setting the clock manually with my own program does not work either. Maybe there is something I am missing?
Wasn't getting any sound on Chrome, Microsoft Edge or Samsung Internet mobile browsers then discovered that virtual power button has to be pressed to get sound working. Any way to get this fixed otherwise everything else is working great so far. Thank you.
I used an old version of the emulator and it had superior crispness and colors.
Now it's blurry and over brighten full disaster. I see this new GL thing but even after turning it off and reload it only gets a bit better but it's still no way near to the old rendering. Can you please fix it to have a proper crispness and RGB colors?
Maybe there is a temporary fix I can set somewhere in the code to use the old rendering way.
Thank you!
Something got broken somewhere because using the on-screen keyboard for lower-case letters is not working. Typing lowercase works fine.
This leads to loss of data. :(
How to reproduce:
I was having loads of fun coding in Applesoft BASIC for the first time in decades, and when I got to the point where I had enough progress that I wanted to save my program onto a blank disk and then save into a .DSK file, everything vanished :(
I was extremely unlucky to not have my program in memory when it happened (step 4!), otherwise I could have saved it again, but alas, a few hours of fun are gone!
Still, thank you so much for keeping the Apple II alive! I had a blast playing with it again with this emulator!
I use Apple 2 Emulator to boot up Apple DOS 3.3 Master Disk in Drive 1, then I insert a Blank DOS 3.3 disk in Drive 2 and initialize the disk with "INIT HELLO". After that, I type in an Applesoft BASIC program and save to Drive 2. I perform a CATALOG and it looks like this.
I download the disk from Drive 2 and rename the DSK as "B GREET.DSK". Then I reset the Apple 2 Emulator and this time I load up the "B GREET.DSK". After boot up, I perform a CATALOG and the disk contents look like this. All the files shown are called HELLO but I only have one HELLO and one B.GREET file in the disk.
Hi, I'm working on creating a docker image of your work, but I now realized the emulator you have on your website at https://www.scullinsteel.com/apple//e has a lot of disk images that are not here in github. Can you make these available, if only as a zip if possible?
Thanks for your work!
If I save the state while using the Smart drive, it cannot return to the original state when the state is loaded.
Is there any way to fix or work around something?
Would be nice to have the ability to paste text into the command line to allow applesoft basic programs to be easily moved into the emulation or to be able to copy the text on the screen out of the emulation.
It looks like there is a 384k memory card in slot 2 when in //e emulation.
Can the aux slot configuration be configured to max memory? Emulating something like this:
https://www.tindie.com/products/garrettswrkshp/ram2e-ii-gw4203b-8mb-ram-for-apple-iie/
Per https://github.com/whscullin/apple2js/#updates-2017-08-31 and looking at the monoDHRMode
flag in the code, DHR mono should be supported. But Apple II DeskTop fails to trigger it in apple2js, although it works on real hardware, MAME, and AppleWin.
Repro:
(1) Use an Incognito/Private Browsing window to ensure you don't have saved mono color settings
(2) Launch: https://www.scullinsteel.com/apple//e?accelerator_toggle=true#https://a2desktop.s3.amazonaws.com/lkg.2mg
Expected:
Actual:
Additional repro:
If it helps, the triggering sequence used to enter DHR mono is:
sta $C00C ; CLR80VID - set register to 0
sta $C05E ; AN3 off
sta $C05F ; AN3 on - shift 0 in as first bit
sta $C05E ; AN3 off
sta $C05F ; AN3 on - shift 0 in as second bit
sta $C00D ; SET80VID - enable 80-column hardware
sta $C05E ; AN3 off - enable DHIRES
And the toggle to DHR color is:
sta $C00D ; SET80VID - set register to 1
sta $C05E ; AN3 off
sta $C05F ; AN3 on - shift 1 in as first bit
sta $C05E ; AN3 off
sta $C05F ; AN3 on - shift 1 in as second bit
sta $C05E ; AN3 off - enable DHIRES
I see the code handling an3 toggles and shifting in the mode bit, but I didn't debug.
On the front page, you have:
To add additional disk images, use scripts/dsk2json.pl, then "make index"
When I type that command, all it does is open the Apple emulator I have installed. It doesn't make a JSON version of the disk (which is what I assume it's meant to do). How is it normally supposed to work?
First, I want to start off by thanking you for all of your hard work and effort on this project. As someone born post-Apple II, it has been a joy discovering the system in an easy-to-approach manner.
I realize this question may be a product of my own ignorance, as opposed to an issue, so my apologies if this is the wrong forum to ask. I wrote a basic BASIC program using the interpreter and was wondering if there was a way to export the program to a JSON file readable by your emulator, whether it be as some sort of output file or stored to browser localStorage. I tried what I thought might be a couple ways, but didn't find a way to do so.
Thank you very much.
Hiya - I just updated my instance of apple2js, and I'm loving the added copy/paste feature - will surely save some time typing example programs or the like in ^_^
...But, I've just noticed that, whereas previously it had been possible to print to the virtual printer, select the text-field output and copy it, doing so now seems to copy just the current screen instead. Perhaps the copy handler should detect whether the virtual printer dialog is open?
It's not a huge deal, since the printer also offers a download option. But I figured you'd want to know.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.