Advanced 6502 Assembly Programming for the Apple II

  Рет қаралды 25,367

Stephen Edwards

Stephen Edwards

Күн бұрын

The first half contains a detailed description of the 6502 instruction set; the second half is a tutorial on writing graphical programs for the Apple II.
Production credits:
OpenShot 2.5.1 .............. Video editing and smooth animation
Audacity ............ Audio editing
LaTeX with beamer and tikz ............. Technical drawings and coarse animation
ImageMagick ........... Rasterizing PDF images
Kazam ........ Screen capture
The Gimp ..... Raster image editing
Linapple ........ Apple IIe emulation
Merlin32 ....... 6502 Cross-Assembler
Apple Commander .... Apple II Disk Image management
Visual6502.org ...... 6502 die photograph, diagrams, and animation
Apple Computer's DOS 3.3 System Disk ....... Phone List, Little Brick Out
Sirius Software Phantoms Five ..... Hires loading animation
Sega's Congo Bongo ..... Hires game splash page
Broderbund Software's Choplifter, Karateka, Lode Runner ..... Hires game images
Weekly Reader Software's Chivalry .... Hires game image
Wikipedia .... Still images

Пікірлер: 41
@r.d.machinery3749
@r.d.machinery3749 2 жыл бұрын
One of the best videos on KZbin for the retro crowd. Your summation of the 6502 instruction set was excellent.
@peter.mccullagh
@peter.mccullagh 3 жыл бұрын
Superb video. If I had a time machine, I'd go back and show it to my teenage self!
@vanhetgoor
@vanhetgoor 3 жыл бұрын
This is very informative, explaining the instructions in logical groups is excellent.
@user-uq2ks2dr4p
@user-uq2ks2dr4p 27 күн бұрын
I am just starting out. I am building the Ben Eater computer on a breadboard. I am using the ca65 and ld65 (assembler and linker). I am going to be watching your awesome guide lets says many many times, and taking notes. Ty for sharing.
@chromosundrift
@chromosundrift 11 ай бұрын
So well spoken, thank you.
@randomlifts
@randomlifts 3 жыл бұрын
Another 6502 programmer here from Commodore 64 camp Instruction manuals which came with the computers post 8bit continue to lack. So hard to find books back then. Much longer distance than a click away.
@gbeck1065
@gbeck1065 3 жыл бұрын
If I had been born in those times and had known you, I would consider you my best friend. We would have been two nerds doing awesome nerd things!
@ericstorm4613
@ericstorm4613 3 жыл бұрын
This video's place is in a museum. Woz would agree.
@zgrunschlag
@zgrunschlag 3 жыл бұрын
This is a masterpiece!!!!
@LukeAvedon
@LukeAvedon 2 жыл бұрын
Such a clear and well done presentation!
@waynehawkins654
@waynehawkins654 7 ай бұрын
Amazing.
@GeorgesChannel
@GeorgesChannel Жыл бұрын
Great video! Very well explains Assembly! Thank you!
@ClassicTVMan1981X
@ClassicTVMan1981X Жыл бұрын
In other 1975 events: Linda Ronstadt had her first and only number 1 single with "You're No Good" (for one week in February 1975). Elton John's Captain Fantastic and the Brown Dirt Cowboy and Rock of the Westies both debuted at number 1 on the Billboard 200.
@mr_noodler
@mr_noodler 2 жыл бұрын
This is such a cool video!! Thank you for sharing
@lostlakeboy4765
@lostlakeboy4765 3 жыл бұрын
very good!
@adamdonovan88
@adamdonovan88 Жыл бұрын
This video is amazing. I wish I found it sooner.
@berighteous
@berighteous 3 жыл бұрын
I use BIT to toggle soft switches. I saw it somewhere and started do it.
@heinzk023
@heinzk023 7 ай бұрын
Video memory addresses were often arranged in an unintuitive way - although not always as tricky as in the Apple II. The reason for this is that it was Dynamic RAM, that had to be refreshed within a certain time frame to retain its contents. To create the video output signal, the video chip had to read the RAM in a repetitive way anyway, and if the addresses were interwoven in the right manner, this continuous read operation could have been used as the DRAM refresh.
@Jeff-xy7fv
@Jeff-xy7fv Жыл бұрын
I took lots of Apple II programming classes when I was a child back in the 80's. Why was I never taught any of this material in any of the classes?
@alexloktionoff6833
@alexloktionoff6833 2 жыл бұрын
BCD Decimal arithmetic commands we often used in apple][ games in fact! They were used just to increment/display game score in decimal. It saved dozens of bytes.
@bjbell52
@bjbell52 Жыл бұрын
Atari Basic is slow because it uses a BCD library in the O.S. that was written by someone who didn't know how to write a math package. Years later someone came out with Turbo Basic where they replaced the BCD library with one written to be much faster. It's about 4 times faster than the original Atari Basic.
@shinyhappyrem8728
@shinyhappyrem8728 Ай бұрын
The NES CPU core acually had the decimal mode circuits still on the chip, just disconnected.
@cigmorfil4101
@cigmorfil4101 3 жыл бұрын
5:56 There are actually only 3 instruction groups (according to my 1976 650x programming manual). If bit 0 is set it is a group 1 instruction with 16 addressing modes, 8 of which have been defined. These are the Accumulator work horse instructiinsxand every instruction has every one of the 16 address modes. If bit 0 is 0 and bit 1 is 1 it is a group 2 instruction which are the bit shifting, X and INC/DEC instructions - not all instructions can have all 8 of the possible addressing modes. If bits 0 and 1 are both clear then it's the group 3 instructions which are the Y and the rest instructions. These have near enough the same addressing modes as group 1. In group 1 if bit 1 is set it is one of the 8 addressing modes reserved/defined for future expansion, so group 1 can be split into 1A if bit 1 is unset and 1B if it is set. This does allow the split you gave with bits 0&1 the group: 0 - Group 3 1 - Group 1A 2 - Group 2 3 - Group 1B (all future expansion) The 3 address mode bits are consistent in group 1A, and fairly consistent between Groups 2&3 where the moses are defined slightly differently. Using the 3-bit, 3-bit, 2-bit model you suggest shows that some instructions have the wrong OP Code. eg TYA ought to be $88, CLV ought to be $98 (based on how the other instructions in their groups behave with the same addressing modes). DEX, DEY, INX, INY, NOP ought to be elsewhere as well. Missing instructions can be seen where they should be in the instruction set based on the addressing modes available (eg STX Z,Y; CPY Z,X; CPY abs, X). JMP ought to be, say $40 (as that then matches the addressing mode 000 for group 3 instructions which is immediate data, instructions 0-3 use 2 bytes, 4-7 use 1 byte - BRK, RTI and RTS effectively ignore the 2 byte immediate data, and it vaguely explains BRK pushing instruction address + 2 on the stack).
@hangonsnoop
@hangonsnoop 9 ай бұрын
Despite all of its weirdness and limitations, the fact that the Apple ][ had built-in color graphics made it the first personal computer that could be a video game platform. Other 8-bit computers had much better capabilities, but they came later and were able to use custom chips.
@RemcovanZuijlen
@RemcovanZuijlen 3 жыл бұрын
I am a bit surprised noone mentioned the STY HGRY, referring to the Steve Jobs speech ending with the phrase "Stay hungry, stay foolish" :)
@cigmorfil4101
@cigmorfil4101 3 жыл бұрын
11:47 The group 2 addressing modes are: 000 - £ (immediate) 001 - ZP 010 - A 011 - absolute 100 - PC relative (not used) * 101 - ZP,X (ZP,Y for X reg instr) 110 - S (stack pointer) 111 - absolute,X (abs,Y for X reg instr) STX A = TXA, LDX A = TAX STX S = TXS, STX A = TXS No other instructions in group 2 use S. DEC A and INC A are replaced by DEX and NOP * This was "guessed" by group 3 addressing modes which are the same, except A and S are implied modes.
@haljohnson6947
@haljohnson6947 2 жыл бұрын
In your opinion what is the most notable hires app written for the apple ii?
@tr1p1ea
@tr1p1ea 10 ай бұрын
... doesn't mention the z80? Seems deliberate.
@acasualviewer5861
@acasualviewer5861 Жыл бұрын
I remember struggling trying to write Assembly code in High School with no book to refer to. Was able to do things, but the concept of the interrupt was beyond me at the time. I would have loved to have had those two books you refer to. Alas, the age of the 6502 has passed.
@ihuitson
@ihuitson 9 ай бұрын
I thew my Apple II Reference manual out in about 1999, :(
@MrCoreyTexas
@MrCoreyTexas 3 ай бұрын
feels like wozniak on LSD when he came up with the graphics scheme. So you can't have 3 pixels blue green purple next to each other horizontally. Talk about limitations!
@brianwild4640
@brianwild4640 2 жыл бұрын
wow 27 free page zero addresses you should try the 8 bit atari range I would have loved 26 page zero addresses
@user-bp6wk4qe9z
@user-bp6wk4qe9z Ай бұрын
It's a shame that you can't tag people here. Else I would be tagging Ben Eater, or The 8 Bit Guy on this video, they'd for sure enjoy this just as I did.
@54egg
@54egg Жыл бұрын
Very nice video! ...but at 1:00 "Everything had to go through the accumulator" is not totally true (Ack, watching your entire video, I now see you cover this really well and this comment should probably be deleted!) . Many useful operations do not require the accumulator. For example you can rotate, shift, increment, decrement memory locations. Yes, a read modify write operation is performed by the processor on the data, but it, does not affect the accumulator. Instead an "invisible" data register on the CPU (and actually an "invisible" address register) is used. For example to left shift a 24 bit value located at $1 to $3 in memory. (zero page in this case) the instructions ASL $1, ROL $2, ROL $3 would be executed with no impact on the accumulator. This is a lot nicer than having to write LDA $1, ASL, STA $1, LDA $2, ROL, STA $2, LDA $3, ROL STA $3 which you would have to do without this feature and saves a few machine cycles (9 - I think) and code length (9 bytes shorter). Similarly you can increment and decrement memory locations where zero flag is useful if you have a multi-byte data where branch would be used to skip incrementing higher order byte when the lower order byte is not zero after its increment, e.g. 16 bit counter stored in $0 and $1: INC $0, BNE 1, INC $1 (where BNE is branch if not zero +1 instructions skipping INC $1. Hopefully this is pretty accurate, I wrote a ton of 6502 code 1979 to 1982 and NONE since, except I did kind of check my comment using an Apple II emulator I just downloaded with Integer basic ROM model including WOZ's mini-assembler. One final comment, of course if you wanted to do something like add two values in memory or add a constant to a value, then the accumulator would be needed for that.
@diakritika
@diakritika Жыл бұрын
Sorry, what means "DAdj"?
@byteme6346
@byteme6346 2 жыл бұрын
Where can I get these slides?
@stephen70edwards
@stephen70edwards 2 жыл бұрын
www.cs.columbia.edu/~sedwards/presentations/2022-vcf-6502-programming.pdf
@saganandroid4175
@saganandroid4175 9 ай бұрын
I am always baffled when programmers (who ought to know better) don't grasp, fundamentally, what a sprite is. Maybe it's just too exotic a hardware construct for softees to understand? This is the first time however I have ever seen a serious programmer conflate Apple II shape tables with sprites. This is like having a division routine and calling it a "math coprocessor".
@user-yr1uq1qe6y
@user-yr1uq1qe6y 8 ай бұрын
The term morphed over time to have a broader meaning than just hardware sprites.
@SnakebitSTI
@SnakebitSTI 4 ай бұрын
I'm baffled how someone managed to make it to 2023 without realizing that the vast majority of people are not talking about hardware sprites when they say "sprite".
@jeffnay6502
@jeffnay6502 10 ай бұрын
I am interested in learning more about 6502 machine language. I have only been working with it on the KIM-1 for about 1 year and I created my own OP Code diagram which included the different addressing modes. That you explained in this video very well. Keep in mind that I am new to studying the 6502 and it's Op Codes, so there may be a mistake or two in my diagram. Please let me know if you find one. drive.google.com/file/d/1stT1klHHyHeuhXuHmm77puHzOgLKEF2Q/view?usp=drive_link I hope this table helps other 6502 enthusiasts like myself. Anyhow, I was interested in the way you were looking at the least significant bits starting with Group One (01) - Which basically repeats everything down columns 1,5,9,D and Group Two (10) - Which repeats everything down columns 2,6,A and E. I could also see how Group Three (11) - Which would include columns 3,7,B,F have nothing in them at all and Group 4 (00) which contains columns 0,4,8,C that do not repeat each other. Now when I look at the most significant bits or the rows across my table. I can see a similar pattern when it applies to addressing modes. Group 0 (0000) and 2 (0010) contain the same addressing modes as you look across each row and down each column. Group 1 (0001) and 3 (0011) also contain the same addressing modes as you look across and down each column.
Inside the Apple II
32:51
Stephen Edwards
Рет қаралды 26 М.
27c3: Reverse Engineering the MOS 6502 CPU (en)
51:57
Christiaan008
Рет қаралды 428 М.
I MADE A CARDBOARD SWING!#asmr
00:40
HAYATAKU はやたく
Рет қаралды 17 МЛН
Сын Расстроился Из-за Новой Стрижки Папы 😂
00:21
Глеб Рандалайнен
Рет қаралды 6 МЛН
CAN FOXY TRICK HIM?! 🤣 #shorts *FOXY AND NUGGET!*
00:17
LankyBox
Рет қаралды 17 МЛН
【獨生子的日常】让小奶猫也体验一把鬼打墙#小奶喵 #铲屎官的乐趣
00:12
“獨生子的日常”YouTube官方頻道
Рет қаралды 84 МЛН
The first LowSpec Processor
28:11
LowSpecGamer
Рет қаралды 589 М.
i cant stop thinking about this exploit
8:40
Low Level Learning
Рет қаралды 120 М.
Games That Push the Limits of the Apple II
23:05
Sharopolis
Рет қаралды 43 М.
How Wozniak’s code for the Apple 1 works
37:18
Ben Eater
Рет қаралды 321 М.
Stephen Edwards and Bill Mensch - The Genesis of the 6502 Microprocessor
43:12
Vintage Computer Federation
Рет қаралды 12 М.
GeckOS: a Unix-like 6502 operating system | VCFMW 2019
50:29
VCF Midwest
Рет қаралды 80 М.
Basics - 6502 Assembly Crash Course 01
12:49
NesHacker
Рет қаралды 105 М.
Steve Wozniak Debunks One of Apple's Biggest Myths
5:22
Bloomberg Originals
Рет қаралды 3 МЛН
How Machine Language Works
19:48
The 8-Bit Guy
Рет қаралды 934 М.
Simpler than Ben Eater's SAP-1?
32:32
DrMattRegan
Рет қаралды 14 М.
Такого вы точно не видели #SonyEricsson #MPF10 #K700
0:19
BenJi Mobile Channel
Рет қаралды 3 МЛН
Наушники Ой🤣
0:26
Listen_pods
Рет қаралды 123 М.
Apple, как вас уделал Тюменский бренд CaseGuru? Конец удивил #caseguru #кейсгуру #наушники
0:54
CaseGuru / Наушники / Пылесосы / Смарт-часы /
Рет қаралды 2,7 МЛН