14 ms·
Can you complete the Oregon Trail if you wait at a river for 14272 years?
- bluedino 2y ago> So 1985 Oregon Trail is written in Applesoft BASIC This surprised me for some reason, I guess it's been 30-some years but I remember my adventures in Apple II BASIC not running that quickly, but maybe Oregon Trail's graphics was simpler than I remember I guess I just assumed any "commercial" Apple II games were written in assembly, but perhaps the actions scenes had machine code mixed in with the BASIC code.
- Scuds 2y agoThere are two versions of Ultima 1, the original has BASIC is basic with assembly and there is a remake in pure assembly. You can definitely tell the improvements the asm version brings with the overworld scrolling faster and the first person dungeons redrawing very quickly. So - I'm guessing game logic of MECC Oregon was in Basic with some assembly routines to re-draw the screen. BTW original Oregon Trail was also 100% basic and a PITA to read. You're really getting to the edges of what applesoft basic is practically capable of with games like Akalabeth and Oregon
- vidarh 2y agoThat reminds me of finding out Sid Meier's Pirates! on the C64 was a mix of BASIC and assembly. You could LIST a lot of it, but the code was full of SYS calls to various assembly helpers, which I remember was incredibly frustrating as I did not yet have any idea how assembly worked so it felt so close but so far to being able to modify it.
- ianbicking 2y agoI also thought it was interesting that it was actually several BASIC programs with data passed back and forth by stuffing it in specific memory locations.
- Suppafly 2y agoThere are so many different versions of Oregon Trail, you might have played the old version first but substituted the graphics and game play you remember with a later version you also played. Not to mention that imagination fills in a lot of the details when you're playing those games, usually as a child.
- egypturnash 2y agoWikipedia tells me that the 1985 version's hunting minigame is in assembly; it does not explicitly say that the rest is in Basic but it definitely implies this.
- bluGill 2y agoOregon trail was conceptually simple and so well crafted BASIC would be plenty fast. Most other games were move complex and probably needed assembly. Though it was common to call inline assembly (as binary code) in that era as well.
- classichasclass 2y agoNot uncommon, at least on the A2 and C64, to have a BASIC scaffold acting like a script that runs various machine language subroutines and/or the main game loop.
- nadermx 2y ago"The game dicks you at the last possible moment by expecting the year to be sensible" Great read on how to actually hack. Takes you through the walls he hits and then how by hitting that wall it "opens up a new vector of attack"
- rbanffy 2y ago> If you want to modify anything else in the 16-bit address space, you first need to write a 16-bit pointer to the Zero Page containing the location you want, then use an instruction which references that pointer. This is so completely wrong I question the person's ability to understand what's happening in the emulator. Also, that LDA instruction reads the 2-byte pointer from the memory location, adds Y, and loads the accumulator from the resulting memory position. IIRC, the address + Y can't cross a page - Y is added to the least significant byte without a carry to the MSB. > and the program is stored as some sort of bytecode We call it "tokenized". Most BASIC interpreters did that to save space and to speed parsing the code (it makes zero sense to store the bytes of P, R, I, N, and T when you can store a single token for "PRINT".
- toast0 2y ago> This is so completely wrong I question the person's ability to understand what's happening in the emulator. I'd argue that it's not completely wrong in the context of a BASIC program; other addressing modes exist, but I don't think the BASIC interpreter will use self-modifying code to make LDA absolute work. > IIRC, the address + Y can't cross a page - Y is added to the least significant byte without a carry to the MSB. If wikipedia is accurate, the address + Y can cross a page boundary, but it will take an extra cycle --- the processor will read the address + Y % 256 first, and then read address + Y on the next cycle (on a 65C02 the discarded read address will be different). But if you JMP ($12FF), it will read the address from 12FF and 1200 on an 6502 and a 12FF and 1300 on a 65C02 --- that's probably what you're thinking of.
- rbanffy 2y agoThanks. It’s been 40+ years since I last programmed in 6502 assembly. I am rusty.
- anonymousiam 2y agoYeah. I got as far as the zero-page description and stopped reading. The 6502 was the first microprocessor I learned (on the KIM-1) in 1979. All that zero page addressing offers is a faster way to access memory, because when using zero-page addressing modes, you only need one octet for the address instead of two. When using them on a 1MHz CPU with no cache, you've just saved many microseconds because you didn't need to fetch the high order address octet from program memory! On the 6502, you can absolutely access all 64K of memory space with an LDA instruction. The other weird thing about the 6502 is "page one", which is always the stack, and is limited in size to 256 bytes. The 256 byte limit can put a damper on your plans for doing recursive code, or even just placing lots of data on the stack. I've done lots of embedded over the years, and the only other processor I've developed on that has something similar to the 6502 "zero page" memory was the Intel 8051, with it's "direct" and "indirect" memory access modes for the first 128 bytes of volatile memory (data, idata, bdata, xdata, pdata). What a PITA that can be!
- gnkyfrg 2y ago[dead]
- LeifCarrotson 2y agoSometimes, I hate working with code where the developer was either a Basic developer or a mathematician: variable names limited to two characters (like "H" for health and "PF" for pounds of food remaining) work when when manipulating an equation and are a lot better than 0x005E, but the code isn't nearly self-documenting. On the other hand, the variable name could be "MessageMappingValuePublisherHealthStateConfigurationFactory". Naming things is one of the hard problems in computer science, and I'm glad we're past the point where the number of characters was restricted to 2 for performance reasons. Unrelated, my monitor and my eyeballs hates the moire patterns developed by the article's background image at 100% zoom - there's a painful flicker effect. Reader mode ruins the syntax highlighting and code formatting. Fortunately, zooming in or out mostly fixes it.
- harrison_clarke 2y agohave you seen arthur whitney's code style? https://www.jsoftware.com/ioj/iojATW.htm https://www.jsoftware.com/ioj/iojATW.htm i tried this style for a minute. there are some benefits, and i'll probably continue going for code density in some ways, but way less extreme there's a tradeoff between how quickly you can ramp up on a project, and how efficiently you can think/communicate once you're loaded up. (and, in the case of arthur whitney's style, probably some human diversity of skills/abilities. related: i've thought for a while that if i started getting peripheral blindness, i'd probably shorten my variable names; i've heard some blind people describe reading a book like they're reading through a straw)
- bluedino 2y ago40x25 text screens and line-by-line editors encourage short variable names as well
- sumtechguy 2y agoAlso some of that older stuff it can be the compiler only let you have 8 chars for a variable name.
- 2y ago
- ourmandave 2y agoCan you pass the 14,000+ years by going hunting? You'd have load up on ammo like it's a war wagon. And it's likely you'd blow you leg off at some point, yet still somehow die of dysentery.
- Animats 2y ago> You'd have load up on ammo like it's a war wagon. And it's likely you'd blow your leg off at some point, yet still somehow die of dysentery. XKCD says that's what happened in real life.[1] And that was for the people who made it to Oregon. [1] https://xkcd.com/623/ https://xkcd.com/623/
- bluGill 2y agoWell if you tried this in real life your great...grandkids would now have modern cars to drive to the nearest store and buy more ammo anytime they want. Or they could just buy food from a modern grocery store.
- ForOldHack 2y agoThe scarce hunting was a lie. Dysentery was a risk of speed. Rest and eat well, and it would go away. Wagons were limited, as were Oxen, clothes, food, wagon wheels. The only thing that could grow without limit was money, and there was the 'cook.' A provable way to get as high a score as you wanted. The true weakness was trading a clothes for an ox. $5 profit every time. If you hung back a few miles from the Dalles, you could trade as much as you want, back and forth, and then sell all your profits. You could pass the 14,000+ years by hunting... and trading... at some point, all you need to do was trade... I had not played the CDC-Cyber mainframe version, nor the Apple II version, I started with the Macintosh version, and having passed Econ with flying colors set my sight on 'cooking' the game, but the same 'cook' was available on the Apple ][ and the PC. I would suspect that in 10,000 years... that Oxen in 500 generations would have been bred for extreme longevity, as well as the humans too. Finally, the source code was published at May 1978, Creative Computing, page 137. So.... hack the source. ( CDC-Cyber Basic, I believe... ) for which "On CDC Cyber Basic, the size of an integer is typically 16 bits, meaning it can represent whole numbers ranging from -32,768 to 32,767."
- __alexander 2y ago> Specialist knowledge is for cowards What a strange and thought provoking statement.
- suprfnk 2y ago“A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.” ― Robert A. Heinlein
- 8bitsrule 2y agoGreat quote ... but: Warning from experience: do not try using that last part in a job application.
- NotYourLawyer 2y agoOr the first part.
- egypturnash 2y ago> Several days later, I tried writing a scrappy decompiler for the Applesoft BASIC bytecode. From past experience I was worried this would be real complex, but in the mother of all lucky breaks the "bytecode" is the original program text with certain keywords replaced with 1-byte tokens. After nicking the list of tokens from the Apple II ROM disassembly I had a half-decent decompiler after a few goes. Applesoft has a BASIC decompiler built in, it's called "break the program and type LIST". Maybe Oregon Trail did something to obscure this? I know there were ways to make that stop working.
- sumtechguy 2y agoIf I remember correctly applesoft also had a few single bytecodes that would decode to other key words. Like PRINT and ?. But I could be remembering badly.
- bongodongobob 2y agoDepends on the version. The original was BASIC, but the one with graphics and sound (which I think was more popular?) was assembly.
- egypturnash 2y agoWikipedia implies this version was mostly BASIC, the hunting minigame was in assembly.
- canucker2016 2y agoYes, a few minutes spent reading about Applesoft BASIC or Microsoft BASIC would've reduced the cringe factor in reading a neophyte trying to mentally grapple with old technology. "bytecode" and "virtual machine", no, no, no. That's not the path to enlightenment... in this case, print debugging, is your best bet.
- jandrese 2y agoThe mental image conjured up by this scenario is amusing. Your impossibly patient party waits almost 15,000 years to cross a river in a state of suspended animation. Then they finally cross the river and instantly wither away to dust because they had not had a good meal in 15 centuries. Something that was very common with BASIC interpreters but still baffling is how they were running on machines with extremely limited memory and fairly limited CPU time, but for some reason decided not to make integer types available to programmers. Every number you stored was a massive floating point thing that ate memory like crazy and took forever for the wimpy 8 bit CPU with no FPU to do any work on. It's like they were going out of their way to make BASIC as slow as possible. It probably would have been faster and more memory efficient if all numbers were BCD strings.
- davedx 2y agoSounds like JavaScript!
- em3rgent0rdr 2y agoaround 1999 when I stumbled upon JavaScript I was aghast that numbers were always 64-bit floating point. I thought that language would go nowhere.
- Mountain_Skies 2y agoMost of the 8-bit BASICs of the time share a common ancestor. Perhaps making every number a floating point was a reasonable decision for the hardware that the common ancestor BASIC was written for and it just got carried over through the generations.
- jandrese 2y agoI think it's more likely that the language had no concept of types so number had to "just work". You can do integer math (slowly) using floating point, but you can't do floating point math with integers. Especially since the language is targeted at beginners who don't really understand how their machines work. Would have been interesting to see a version of BASIC that encoded numbers as 4 bit BCD strings. Compared to the normal 40 bit floating point format you would save memory in almost every case, and I bet the math would be just as fast or faster than the floating point math in most cases as well. The 4 bit BCD alphabet would be the numbers 0-9, as well as -, ., E, and a terminator and a coupld of open numbers if you can think of something useful. Maybe an 'o' prefix for octal and a 'b' for binary?
- varelse 2y ago[dead]
- csours 2y agoYou board the Generation Ship Oregon Trail with some trepidation. If the scientists are correct you will be in suspended animation for the next 14272 years. You already feel colder somehow. To the West you see a robotic barkeep.
- happyopossum 2y agoPedantic note - if you have suspended animation, you don’t need Generation ships.
- csours 2y agoFirst Class tickets get suspended animation tanks
- PepperdineG 2y ago"Excuse the mess. Most unfortunate. A diode blew in one of the life support computers. When we came to revive our cleaning staff, we discovered they'd been dead for thirty thousand years. Who's going to clear away the bodies? That's what no-one seems to have an answer for."
- NikkiA 2y agoISTR seeing a sci-fi themed Oregon Trail, actually. Ah yes, Orion Trail https://store.steampowered.com/app/381260/Orion_Trail/ https://store.steampowered.com/app/381260/Orion_Trail/
- losvedir 2y ago> If you're into retro computing, you probably know about Oregon Trail Damn, that made me feel really old.
- jazzyjackson 2y agoLol. I played Oregon Trail as part of curriculum in elementary school in the mid 90s, I guess by then it was already a retro throwback. EDIT: I played the 1985 version, I didn't know there was a text adventure.
- jedberg 2y agoYesterday I was at a gaming parlor in SF and they had "Oregon Trail the card game". I sent my brother a picture. I couldn't my kids to even know why it was special.
- JoeAltmaier 2y agoSome early tiny computers were actually calculator chips. So, only floating point. And, implemented in BCD. So slow as f*k. I remember a TI home computer, on a counter in a store. I type FOR I = 1 to 10000; NEXT I and RUN It never finished. I changed it to 1000; still didn't finish. So I changed it FOR I=1 to 10 and PRINT I and it printed 1 and delay and 2 and delay and so on. Took ten seconds to finish.
- classichasclass 2y agoTI BASIC has some unique implementational own goals, however, particularly with respect to system architecture and the middle-level interpreted language TI BASIC is written in. It really makes the 9900 CPU look unfairly bad.
- layer8 2y agoRealistically, the river would have changed its course after 14272 years.
- 8bitsrule 2y agoThe geology of the PNW has been so unstable for millions of years ... that about once every century your riverside would likely either be flooded-out or buried in volcanic ash.
- itslennysfault 2y agoI find it amusing that the bug in the final screen is essentially the Y2K bug.
- quuxplusone 2y agoCan someone fill in the missing link in my understanding here? It seems like the post never gets around to explaining why waiting for 14272 years should make the river passable. (Nor why this river in particular, as opposed to any other obstacle.) The post alludes to a quirk that causes people not to get sicker while waiting; but it says they still get hungry, right? So you can't wait 14272 years there for any purpose unless you have 14272 years' worth of food, right? IIUC, the blogger goes on to patch the game so that you don't get hungry either. But if patching the game is fair play, then what's the point of mentioning the original no-worsening-sickness quirk? It kinda feels like asking "Can you win Oregon Trail by having Gandalf's eagles fly you to Willamette?" and then patching the game so the answer is "yes." Like, what's the reason I should care about that particular initial question? care so badly that I'd accept cheating as an interesting answer?
- deleted 2y ago[deleted]
- albrot 2y agoHi, I'm the guy who discovered the quirk in the first place. You can survive pretty much indefinitely at the river, with or without food. You could cross the river at any point. I just thought it would be a laugh to see if you could get to a five-digit year. Then, upon resumption of the journey, the party very rapidly deteriorates and you can only survive about 5 or 6 days before they're all dead, even if you gather food immediately and wait to restore health. So the unmodded achievement was "I lived for 15,000 years in The Oregon Trail" and then I asked moralrecordings for help in reverse-engineering the game so I could get the satisfaction of a successful arrival. Just a bit of fun. edit: And the answer to "Why THAT river?" is simply that it's the last river in the game, and when I was hoping to complete a run without any modding, I thought it might be possible to play normally, get to the final river, wait 15,000 years, and then try to limp my decrepit deathwagon to the finish line before we all expired. This proved impossible, sadly.
- Ruthalas 2y agoThank you for the context! I also was a little confused by the goal, but that clears it up.
- narrator 2y agoIt sold 65 million copies? You've got to be kidding me. Someone made 9 figures off of Oregon trail? Bwahahaha.
- dekhn 2y agoIn the dungeon crawling classic Wizardry, there was a cheat, if you used your bishop to try to 'I'dentify object in inventory slot 9 (there were only 8 slots) over and over, you'd get an 100,000,000 XP bonus. I believe it was unintentional bug.
- scarface_74 2y agoAs an old AppleSoft Basic/65C02 assembly language hacker, I actually followed the article from first principles and I remembered how AppleSoft basic was stored in memory - one byte code for each command and each line ended in memory with a pointer to the next line in sequence. But this I got lost in… > Most of the game is handled by the main program "OREGON TRAIL" (written by John Krenz), which loads in modules like "RIVER.LIB" and keeps access to all the variables. AppleSoft basic didn’t have the concept of libraries. Were they just POKEing values in memory, loading the next AppleSoft Basic program calling them LIBs and the next one PEEKing to retrieve the values?