Hacker News new | comments | show | ask | jobs | submit login
Apple ][+ in HTML5 (porkrind.org)
206 points by shawndumas 1608 days ago | hide | past | web | 81 comments | favorite



  10 X=1
  20 FOR Y=1 TO X
  30 PRINT " ";
  40 NEXT Y
  50 PRINT "HELLO"
  60 IF X=34 THEN LEFT=1
  70 IF X=0 THEN LEFT=0
  80 IF LEFT=1 THEN X=X-1
  90 IF LEFT=0 THEN X=X+1
  100 GOTO 20
  
  RUN
Notes: Use ^C to stop it. Type LIST to see the program you wrote. If you screw up a line, just type the line number and hit <return> to delete that line.


    10 X=1
    20 D=1
    30 FOR Y=1 TO X
    40 PRINT " ";
    50 NEXT Y
    60 PRINT "HELLO"
    70 IF X=0 OR X=34 THEN D=D*-1
    80 X=X+D
    90 GOTO 30


  5 PRINT "WHAT'S YOUR FIRST NAME?"
  7 INPUT NAME$
  10 X=1
  20 D=1
  30 FOR Y=1 TO X
  40 PRINT " ";
  50 NEXT Y
  60 PRINT NAME$
  70 IF X=0 OR X=39-LEN(NAME$) THEN D=D*-1
  80 X=X+D
  90 GOTO 30

  RUN


How do you type quotes? I stumbled on the fact that my keyboard's "minus" key outputs an equals sign, but quotes I can't get. I grew up on the C64, not this one.


Just typing a quote (single or double) in the usual way works fine for me.


    70 IF X=1 THEN LEFT=0
Makes for a more symmetric pattern.


What? No FizzBuzz?


I do hope Apple is in a good mood about this, because apple2+.rom.js loads an Apple ][ Applesoft ROM image, which is technically still copyrighted by Apple.

As an old geezer who earned his programming wings on an Apple ][ coding 6502 machine language and later UCSD Pascal, I am absolutely delighted about this project. I had been toying with the same idea for some time but skipped it due to lack of time and the fear of Apples legal stormtroopers.

Now if only I find disk images of Bandits and Dogfight...


As far as I know, Apple does release some of their older OSes as downloadable images from their website.


I know, but this is only some classic MacOS disk images - no ROM files either.

I hope that after Job's demise, someone at Apple is sane enough to understand abandonware. But I am not counting on that.


In all seriousness, I don't think Apple can free the Autostart ROM image unilaterally because Microsoft owns the copyright on Applesoft BASIC. It would be a great joint release if you could get them both to agree on it though!


Awesome!!! Took me back many years. Kudos to David Caldwell.


Thanks! I appreciate the comment.

Something I'd like to do is write up an article on what it takes to emulate an Apple 2. Getting the disk to work was surprisingly complicated--the Apple does all the low level track formatting in software which means the emulator has to take the logical disk image and generate a bitstream that the emulated software expects so it can turn it back into logical bytes in memory. That required getting a lot of details right about the bit format, rotation speed of the disk, etc.


Beautiful piece of hacking, David. Woz would be psyched if he saw it.


Yes, a great piece of hacking. Thanks again, David. :)


And that's why I love HN. Thanks for the down vote.


The whole upvoting/downvoting concept seems to be aimed at recreating communities where the majority can shout down any minorities. At the village level. A fear tactic aimed at making you subconsciously consider whether what you say will please the majority.

Ironic that it's called "karma", which is a complete perversion of the original religious meaning of the concept, perverted into a means of recording a "permanent record" of how antisocial or unsubmissive you've been to community opprobrium. Purely regressive adaptation of technology, and a crime against the spirit of those who created it.


It would be interesting if, say, when you upvoted something then your perception of upvotes and downvotes from people who similarly upvoted that thing were subtly changed and so forth. In essence, by upvoting something you would be changing your perception of the universe.

Which, I guess, is kind of how Google works in the long run, and also would tend to self-select people into like-minded groups. Overall, I think that our options are somewhat limited -- we either end up in a self-selected community or in a self-selected sub-community. E.g. I was "repelled" by digg because any politically "liberal" comment I made would be downvoted to oblivion within minutes. While similar things would happen on reddit if, say, one said things critical of libertarianism, I didn't find this quite so frustrating, and simply learned to curb my views accordingly.

Here on Hackernews (which I find to be the most reasonable community since the glory days of slashdot) I have learned to accept that, say, being critical of Android or having anything nice to say about PHP is likely to lead to a lot of welts.


I haven't seen any site do anything more creative then up/down. Maybe crowd-sourcing the ranking of content is a dead end road. I wonder what a better solution could be.

I have a feeling the first site to dramatically improve content ranking is going to explode.


Empty boat. Google it.


I don't get it. Can you explain, please? :)


Basically, it's pointless to get upset at a number that goes up or down when someone you will never know presses an arrow that goes up or down. Treat it like a natural random process rather than an intentionally malevolent one.


Nice one, thanks.


The level of anal retentivity is creditable. Goodbye HN.

Edit: Thanks mparlane. I was on my way out, but you are right of course. :)


I wouldn't worry about karma points on HN. Karma isn't meant to happen as a result of the votes of others, but instead on cosmic feedback, synchronizing with our activities and perceptions.

According to those who subscribe, anyway. But whether you believe or not, karma is not decided by a committee of down-voting equipped readers, each with his/her own desire for points. That's not karma, that's polling or rating.


Thanks exodust. :)


Dw, more People can upvote than downvote.


I fired up conan, figured out the key mappings, then my stored neurons kicked in, found the hidden life then immediately got to the third level without dying. God help anyone trying to figure this game out for the first time. I want to use basic, but my keyboard mapping is fubar'ed, I figured out ctrl maps to " but I haven't figured out which key generates "," which is needed for a program I wanna write.


Firefox seems to work much better than Chrome here, as in comma works. I have a script that allows you to copy and paste things into the emulator (via keystroke sending). It's totally not-for-production-use but I can use it.

I did a mandelbrot and a ray tracer with it; I wrote the copy/paste tool for bellards http://bellard.org/jslinux/


How did you fire up Conan?


choose the conan1 disk, click cold start, when it says flip disk, choose conan2 disk, hit space, and you're in.



I would like to add this link also, Linapple[1], an Apple][ emulator for Linux, which is pretty good too. More fun on your Linux box, from the good old days. :)

[1] http://linapple.sourceforge.net/


Thanks for the links. Apple Basic was a lot of fun.


Oh, wow, I can't believe how quickly BASIC comes back. I spent a lot of time typing programs in at that prompt. I loved the hours I spent writing programs out on notebook paper, and I absolutely loathed typing them in. I always did, though. Seeing them run gave me a little thrill. (Not that I ever wrote a single program that I would have enjoyed using if it wasn't mine.) The best thing in the world was when my mother typed in a program for me, which she only did a few times when I was really, really sick.

Good times. I think I will now make a low-res snowman.


Whoa, Chromium 18 under Ubuntu doesn't work as well as Chrome on OSX does. 18 is ancient, so I can't really complain; this is just information. I got visual artifacts until I deselected "Use WebGL." Now everything displays fine, but I can't type quote marks or commas. When I type ' or " I get ^. When I type , I get <. On OSX, I know I could type double quotes and commas. For what it's worth, I'm using Dvorak under both Linux and OSX.


FYI, on my system (Chrome 23, Ubuntu Precise), the SHIFT key has no effect. I am unable to type quotes, exclamation marks, etc. I noticed a couple of other posters mentioned similar problems, but wanted to call it out clearly in a separate top-level comment.


Without SHIFT, I can't type PR#6!


My father had one and somehow it's the only Apple product I have ever really used :)

IIRC (and as the emulation does apparently) the games started themselves at boot, so I don't think I have ever typed any command on it !


I had these Beagle Brothers posters -- http://beagle.applearchives.com/posters.htm Lots of great info on 'em.


The WebGL version has some interesting results in Safari:

http://imgur.com/KYgM1


Nice project. Trying it out on my iPad 3. It can do 1 sec of emulated time in ~1.6 secs.


Getting just below that on my Galaxy Nexus, a phone.

Interesting times we live in, indeed.


I wonder if the number of extra pixels the ipad has to draw would account for this decrease in performance, seeing that it doesn't have a graphics card.


Chrome/Nexus 7: ~0.5

IE10/SurfaceRT: ~1.17

Note they both use the same chipset (Tegra T30). V8 definitely makes a difference, similar gap between Chrome and IE10 on my 2011 13" MBA in Parallels (.1/.4)


For Reference: 2011 Macbook Air 11: 1sec emulated in 0.35s


Hmm, there's something wrong with Macbooks' performance. My lenovo laptop running Linux with a very modest cpu (AMD E-450 APU) gives out 1 sec / 0.17s.

Then again, perhaps the browser technology matters more than anything else: I'm running it on latest stable chromium.


On Win7 Firefox only gives me 0.19 whereas Chrome does 0.03.

So I guess it's the browser that matters a lot here.


I think that may be it. My i5 win7 runs it in approximately the same time, also on the latest chromium.


Chrome on my i7 Lynnfield is doing 1sec in 0.01s. Occasionally 0.02s.


Total Time: 2010 Macbook Air 13": 1sec emulated in 0.5s


Ipad3- 2sec per 1 sec


Macbook pro retina 0.05s


2008 MacBook Pro 2.5 Ghz 1s in 0.4s (Firefox 16)


Thinkpad T61p (w/ Ubuntu 12.04)- 0.09s to 0.14s


iPad 1: ~11.5 sec


Where did you get that? Mine took around 3.1 second per second of emulation (at the prompt; earlier, it got to 4, but never even close to 10)


Woah, obviously something needs to be done. My iPad has been getting so slow recently..


I sat for about an hour playing with it. Went as far as finding the original Apple manual (on scribd) online and reading it through for the commands. Thi sis just an amazing project. Great work.


10 PRINT "HELLO"

20 GOTO 10

RUN

7th grade memories come flooding back ...


Who says skeuomorphism is a bad thing? This is simply brilliant!


My goodness, it even switches from black & white to the messed-up color rendering of text characters when you enter graphics mode (type "GR").

Incredible.


Anyone else having trouble getting Adventure Construction Set to run? (Seeing ACS in the list brings back so many memories)


The emulation isn't perfect--I know there are still some 6502 bugs lurking around. I did this in about a week last year and have only spent a few sporadic days here and there improving it.

One of the things on my todo list is to use websockets or something to ship the emulation log back to the server and compare against an independent (and presumably better tested) 6502 emulator. From there I can detect inconsistencies and fix the JS implementation. As I side effect I can build up a set of (hopefully) comprehensive test vectors that anyone writing a 6502 emulator can use to validate their implementation.


The C64 6502 test suite is easy to bodge into an emulator. I used it to verify the 6502 emulation code in mine. Very worthwhile - I found a number of bugs because of it, particularly with BCD mode and a number of the illegal instructions. (Obviously no guarantee the 6510 illegal instructions are the same as the 6502's, but the few that BBC Micro games used seemed to be. I believe the BBC Micro 6502 is the same one as in the Apple II, but 2MHz.)

An explanation of how to fit it into a non-C64 emulator:

http://www.softwolves.com/arkiv/cbm-hackers/7/7114.html

Mirror of the actual file:

http://modelb.bbcmicro.com/tech.html


Entering machine language monitor:

call 151

l

it unassembly a portion of memory.


I can type the minus before the 151. See http://stackoverflow.com/questions/143374/call-151-what-did-...


That's simply awesome.

Can this thing run Aztec or Microwave, too?


man i was struggling to remember various commands, hat to run, etc and thanks for the comments, i remembered some more.

peek and poke ftw!


CALL -151

and then everything comes to mind :)


BLOAD the INTBASIC roms, go F666G, and then you can play with the mini-assembler!


CALL151

I remember this from a cloned Apple II computer (Pravetz).


Impressive in so many ways!


"The kids of today should defend themselves against the Seventies" - Pearl Jam, itself a somewhat dated cultural icon.

It's interesting to think about the cultural impact of this if it really catches on, at least in the hacker/geek world. This isn't just a tech demo: It's a self-conscious reconstruction of a cultural artifact, and drags along with it other cultural references and context. Nobody these days is going to 'grow up' with an Apple ][ because of things like this, but, previously, the only way to experience that specific system was to either have been born in the narrow window of time where you had one when they were still at least vaguely mainstream, or to decide to run an emulator and likely get into emulation as a hobby. It's the difference between knowing every Beach Boys song because you grew up in 1960s California, knowing them because you deliberately chose to collect that era's music, and knowing them because, like me, your parents played them practically from your birth and so they became the first band you really liked.

This just makes the past that much more mainstream, the software equivalent of the deliberately dated aesthetic of a Quentin Tarantino film.


I know this is the wrong place to be a music pedant (is there a right place?), but that's a Mike Watt song, featuring Eddie Vedder on vocals, not a Pearl Jam tune.


http://jsmess.textfiles.com/

Stuff like this is just the tip of the iceberg.


Ooh! There's been a MAME port too, right?


I was actually aware of that. Jason Scott is going to be personally responsible for some interesting cultural developments.


Are you saying this is a bad thing? Continuity of culture is a good thing.


> Are you saying this is a bad thing?

No, I'm saying it's a new thing. This kind of continuity hasn't been anywhere near this accessible before.


Yeah, but I feel the fact that culture shifts this fast is also a bit of a new thing. For most of the entire rest of human history, technology didn't change as much in a 10 year period, let alone in 1-3 generations. Hence elders were held in great regards in most societies, probably because their accumulated knowledge never became obsolete in their lifetimes.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: