TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Easy 6502 - Learn the 6502 Assembly Language

179 点作者 n8agrin将近 13 年前

17 条评论

mechanical_fish将近 13 年前
It's fun to see people being encouraged to relive my youth. And 6502 assembly is indeed a nice, compact thing to learn.<p>Though I think the most valuable thing I learned from studying assembly was actually about higher-level languages: How function calls work, and the mechanism of stack frames. This discussion doesn't reach quite that far, and actually I'm not sure how one would work such things into a discussion of 6502 assembly – I learned about them in the context of 680x0 assembly. Back in my 6502 days, I never even encountered a compiler, so I never had the chance to disassemble a C or Pascal program. (To this day I can't name a 6502-based C compiler, though I'm sure they existed someplace. I knew about Pascal compilers, but I never got my hands on one; back in the 1980s compilers actually cost money.)
评论 #4214194 未加载
评论 #4214924 未加载
评论 #4214454 未加载
评论 #4214093 未加载
colanderman将近 13 年前
I recommend also the 6809 as an example of another very well-designed processor from the same era. Most notably, it has post-increment and pre-decrement addressing, and basic 16-bit arithmetic support.<p><a href="http://www.textfiles.com/programming/CARDS/6809" rel="nofollow">http://www.textfiles.com/programming/CARDS/6809</a><p><a href="http://en.wikipedia.org/wiki/Motorola_6809" rel="nofollow">http://en.wikipedia.org/wiki/Motorola_6809</a><p>The modern Atmel AVR is in many ways a spiritual successor to the 6502 and 6809:<p><a href="http://en.wikipedia.org/wiki/Atmel_AVR_instruction_set" rel="nofollow">http://en.wikipedia.org/wiki/Atmel_AVR_instruction_set</a><p>(That said, I cut my teeth on the 6502 and it will always have a spot in my heart!)
评论 #4214620 未加载
评论 #4214496 未加载
kghose将近 13 年前
We were taught on the 8085. We had these cute little kits that were hinged wooden boxes that you opened up. They had all the circuitry exposed which was awesome, a 4 or 6 digit 8-segment LED display and a numeric keypad. Sometimes the kits would go on the fritz and the most common solution was to press all the chips into the sockets. Did I mention it was awesome.<p>My proudest/excitingest moment with them was at the end of the semester when I implemented a long division program on them. It would take two numbers and output the decimal fraction to an arbitrary number of digits using long division.<p>Aaah!
bitcracker将近 13 年前
&#62; So, why would you want to learn 6502? It’s a dead language isn’t it? Well, yeah, but so’s Latin<p>6502 isn't dead, it has even been relaunched:<p><a href="http://www.h-online.com/open/news/item/Relaunched-the-6502-microprocessor-1422007.html" rel="nofollow">http://www.h-online.com/open/news/item/Relaunched-the-6502-m...</a><p>6502 was my first processor, and it was real fun to learn Assembler. I used also figForth and learned from the ground up how it was implemented. Amazing days!<p>Today Assembler isn't fun anymore.. I don't even know the exact name of my current quad core :)<p>Could it be that FPGA programming will be the next golden age of "Assembler"? Content industry works hard to lock computer hardware with DRM. So if we want to keep our freedom then we'll have no other choice than to build our future computers ourselves - again.
评论 #4215766 未加载
评论 #4214116 未加载
评论 #4214444 未加载
Smerity将近 13 年前
This is an excellent introduction -- thanks for posting it :) I teach high school students programming as part of a summer camp and this is a perfect resource for students who are already further along and want another challenge. The introduction to assembly will help them in their later careers and 6502 assembly is likely less of a shock than any recent ASM.<p>With the 32x32 display they could even do some simple graphics to stretch themselves :)
评论 #4215467 未加载
cjauvin将近 13 年前
Very elegant and well done! I recently went through the process of learning 6502 C64 ASM (an unfulfilled childhood dream), by writing a simple Tetris clone:<p><a href="https://github.com/cjauvin/tetris-c64" rel="nofollow">https://github.com/cjauvin/tetris-c64</a><p>The basic concepts came very easily (with a quick skim through Jim Butterfield's ML book), but I struggled a bit more with the C64 hardware intricacies: zero page addressing, IRQs, double-buffering to avoid flickers, etc. This was a very interesting and enlightening experiment (in terms of the perspective it sheds on modern-day tools and languages), and I plan to write about it soon.
评论 #4215780 未加载
dizzib将近 13 年前
I'm attempting to finish writing my unpublished BBC micro game 'Zen' written in 1988...<p><a href="http://www.youtube.com/watch?v=Gg8Dtod83qA" rel="nofollow">http://www.youtube.com/watch?v=Gg8Dtod83qA</a><p>It's so much fun developing in 6502 assembler again!!!
评论 #4214672 未加载
davepeck将近 13 年前
So much fun, thank you. Some of my earliest programming was on a C64 with the Merlin Assembler -- this brought me back _and_ brought a big grin to my face.
n-gauge将近 13 年前
This brought back my collage days! I had job coding Z80 ASM to control electronics and RS232 data links... such fun :)<p>People would give you such funny looks when they saw you staring into a terminal of hex and you pointing out .. ahh that 3E CF needs to be 3E D3 :)<p>Best thing is that I ending up knowing all the op-codes and most of the instruction timings of by heart (which made interfacing to those 16 x 2 line LCD modules easier)<p>NMI anyone?
mjcohenw将近 13 年前
Both the Apple II and the Commodore PET used the 6502.<p>I'm amazed that these were not mentioned in the original article.<p>I wrote a bunch of 6502 code for Micro Technology Unlimited's music and graphics boards for the PET, and even wrote my own assembler in PET Basic. Fun Times!
facorreia将近 13 年前
I remember the 6502 from the days the Apple II hit the market. It was huge back then. Strangely, the article lists a number of 6502 systems down to Futurama's Bender but doesn't mention Apple II.
sethish将近 13 年前
If anyone would like to use this to write emulation instructions for Prince-of-Persia II [0], I would be happy to merge them into the github repo [0].<p>[0] <a href="https://github.com/jmechner/Prince-of-Persia-Apple-II" rel="nofollow">https://github.com/jmechner/Prince-of-Persia-Apple-II</a>
Kelliot将近 13 年前
This brings back memories of painful Friday morning lectures in yr1 of uni! XD
ColinWright将近 13 年前
As a humorous aside, from Futurama the robot Bender allegedly runs on a 6502.
hcarvalhoalves将近 13 年前
Educational hacks are the best hacks. Bonus points for historical value!
michaelochurch将近 13 年前
This is cool stuff. A few noob questions:<p>I notice that the 0x00-ff memory space has no 0xff byte and that 0xfe seems to change a lot, but it's not explained. What's going on here? What's in 0xfe and why is 0xff not shown?<p>I noticed that there's no multiplication operator. Does that mean that multiplication was performed using looping addition? What about division, floating-point, et al?
评论 #4215597 未加载
评论 #4216089 未加载
评论 #4215656 未加载
Zenst将近 13 年前
For a assembly language designed for humans they sure did like there 3 letter TLA's.<p>How hard would it of been to have STORE_ADDRESS instead of STA.<p>To realy learn a assembly language you realy need to write code and to write code you realy have to have a project/purpose.<p>Now 6502 is one of the oldest assembly languages still in active use as they still do very well in the microcontroler sector. Though that said ARM is also in that area and alot cheaper to obtain ARM compatable kit. ARM was born out of frustrations/limitation with the original 6502 CPU and in that may be a better more practical use of your educational time.<p>That all said - every programmer of any language should at least learn/play with one assembly language sometime in there life, maybe one or two. I remember after my ZX81 I opted for the Oric-1 over the Spectrum just becasue it had a different CPU (6502) and after that I opted for the AtariST (6800) and a amstrad PC (X86).<p>Also inventing your own CPU/assembler is not as hard and intimidating as alot will think. All are very rewarding and a good use of your time on a rainy day.
评论 #4214262 未加载
评论 #4214320 未加载
评论 #4216119 未加载
评论 #4214053 未加载