5 ms·
The 6502 changed my life by really hooking me on computers. Got my first professional gig (fixing a bug in a truck driving simulator using Commodore PET Basic)
by rbobby 7y ago
The 6502 changed my life by really hooking me on computers. Got my first professional gig (fixing a bug in a truck driving simulator using Commodore PET Basic) that paid in a pizza outing.
An interesting feature of the 6502 was that memory between 0 and 255 was the fastest to access (literally twice as fast). Apple Basic's "GetNextToken" routine lived somewhere below 255 just for the speed advantage (might have been Commodore's Basic).
Another interesting feature was that the 6502 instruction set did not include 16 bit add/subtract nor any sort of multiply/divide. Add/subtract are easy enough but efficient multiply/divide is "weird".
I once interviewed for an assembly level programming job for the Z80 cpu (they were building a weird APL variant). The tech interviewer wanted to see me read some 6502 assembly from just the byte code. I was flummoxed and explained I could only do it with a disassembler. One of my earliest tech interview failures :)
Thanks Chuck!
- timbit42 7y agoIf by "Apple Basic" you mean Applesoft BASIC, it and Commodore BASIC were both based on Microsoft's 6502 BASIC so they would both likely have the same routine.
- rbobby 7y ago> Applesoft BASIC Lol. A purist among us sinners :) But yes, Applesoft BASIC. I never saw an Apple ] (heheheh) only an Apple ][.
- joezydeco 7y agoPurists wrote in Woz’s Integer BASIC! Microsoft’s version came on a cassette in the early Apple ][ days.
- chillingeffect 7y agoYeah I just happen to have been hacking on Microsoft BASIC over the last two weeks and stumbled on it. Here is its disassembly. Self-modifying, looks for colons and spaces: > (C:$00b7) d 73 > .C:0073 E6 7A INC $7A > .C:0075 D0 02 BNE $0079 > .C:0077 E6 7B INC $7B > .C:0079 AD 00 08 LDA $0800 > .C:007c C9 3A CMP #$3A > .C:007e B0 0A BCS $008A > .C:0080 C9 20 CMP #$20 > .C:0082 F0 EF BEQ $0073 > .C:0084 38 SEC >.C:0085 E9 30 SBC #$30 >.C:0087 38 SEC >.C:0088 E9 D0 SBC #$D0 >.C:008a 60 RTS
- pvg 7y agoGoogled up an Apple ][ in-browser emu (what a time to be alive, etc) and poked around for a moment, think this might be it: https://i.imgur.com/jvFvdsF.png https://i.imgur.com/jvFvdsF.png Edit: You can see how it's used here: https://bigflake.com/disasm/applesoft/Applesoft.html https://bigflake.com/disasm/applesoft/Applesoft.html It's actually two (overlapping) subroutines with entry points $B01 and $B07, their symbols in the source are CHRGET and CHRGOT. So 20-odd bytes in page zero for two calls. The code is, of course, also self-modifying. All in all, a fitting little tribute to Chuck Peddle.
- karmakaze 7y agoThat's funny, I still recognize some of the op-codes--though I was more familiar with them in decimal or their ATASCII characters. I used to be able to write machine language subroutines with character escapes in a string and JSR the string address from BASIC.
- jacquesm 7y ago> Apple Basic's "GetNextToken" routine lived somewhere below 255 just for the speed advantage (might have been Commodore's Basic). It lived there for another reason as well: it allowed the keyword table to be extended, which would have been impossible if that routine lived in ROM. All MS and MS derived BASIC variations had this feature.
- xxs 7y agoZero page had (has) 3 access modes actually, with index with Y was my favorite, i.e. stuff like 'STA zeroPage,Y' That being said the processor got so many address modes that looking at nowadays flat page full 64bit address space feels surreal.
- quantified 7y agoSimilar here. The KIM-1 was my entry to programming. So simple and understandable. I still remember some of the opcodes, hand-assembling and punching them in was a powerful rote teaching method. Obviously I had some nerd in me if I thought it was easy to understand. IMHO every programmer should spend some time coding this close to the metal. The chess game that fit in 1K was a goood example of what someone smarter than me could do, too. Thanks Chuck! We’ll raise a toast to you as we close out the year.