5 ms·
Can anyone speak on how it is to move from an older assembly, to a modern CPU? I asked to take an assembly class in local/public college, and was told they woul
by progmetaldev 2y ago
Can anyone speak on how it is to move from an older assembly, to a modern CPU? I asked to take an assembly class in local/public college, and was told they wouldn't hold the class because not enough students were interested. This was in 1998, and I truly couldn't believe my ears.
I feel like learning modern assembly would be more useful, but maybe 6502 assembly is far easier to pick up? The first language I learned was Atari BASIC around 1991, and it was enough to get me to keep on moving to better languages and more powerful CPUs, but I wonder where I would have ended up if I learned assembly either before or after Atari BASIC. I try to keep up with technology, and have read quite a bit on different assembly dialects. I still haven't learned an assembly that I can program in, and I suppose it's because there are so many other high-level languages now and I feel like I need to keep up to what is used in "industry" rather than what is more obscure (but might help in debugging).
- adiabatichottub 2y agoOne thing to consider is that there's a whole world of 8, 16, and 32-bit microcontrollers out there being used in new products every day. They are all readily programmable in assembly language, and if you have the basics down then the learning curve isn't terribly steep.
- __alexander 2y agoCheck out Assembly Language for x86 Processors by Kip Irvine. It’s probably one of the best books on x86. The older editions are way cheaper.
- professoretc 2y agoDoesn't it still treat 64-bit code as something of an afterthought?
- leptons 2y agoI started with BASIC on a Vic 20 in 1979 in a computer class for kids. Then I got my own Atari 400 at home, so I learned BASIC on that. Then around 1984 I got a Commodore 64 and it was amazing. I quickly got past the BASIC part of the C64 manual and in the back of the manual they had a memory map, all the hardware registers for all the chips, and then all the 6502/6510 opcodes. There was even an entire schematic for the C64 in the back of the book as a fold-out poster. 14 year old me was hooked. I got into assembly when I was about 15 and never looked back to BASIC. I wrote a lot of assembly code for many years, creating "crack intros" for cracking groups and demos on the C64. I then moved on to Amiga and 68000 assembly, and I even got into SNES 65C816 (16 bit version of 6502) assembly coding using a 30th generation photocopy of the pirated SNES developer manual and a floppy disk game copier, which also had a parallel port that I managed to connect to my Amiga and use that as the development system uploading the compiled program to the SNES via parallel port. I would make "crack intros" for SNES games being traded on pirate BBS's. It was a lot of fun. Many years later, I'm still doing some 8-bit assembly code for microcontroller projects where I'm trying to use the smallest possible CPU to do interesting things. Everything I learned about Assembly on the C64 still applies to the modern microcontrollers (PIC/AVR) that I use today. In so many of these years I had not learned C. I went from assembly to scripting languages, and was a very early adopter of Javascript since the same month it first came out. Only in the last 10 years have I learned C, and it was so easy! After learning Assembly and Javascript, C was right in the middle. I've programmed in over a dozen languages through the years, but I'm really happy with Assembly, C, and Javascript as my stack depending on the project.
- progmetaldev 2y agoThank you for this, I was born in 1979, but got introduced to the Atari 8-bit computers VERY early, and connected immediately. I have a Raspberry Pi v4, and it sounds like learning assembly on nearly anything right now will pay off. I don't have a problem learning a new language, but the C-style of languages are easiest for me. I'm sure them being imperative is a huge plus for me learning new things about any imperative language. I actually find JavaScript to be quite satisfying to write code in, mostly because I can test out functional features more easily than adopting an entirely different language to do it in. I spent my teenage years grabbing cracks and texts from BBS', and enjoyed the whole scene. It's really what sparked my interest into writing software, and I always wished I had learned some lower-level skills beyond running a debugger and poking at memory. I felt like if I knew Assembly, I could get into deeper debugging (cracking was initially my "exciting" topic to cover, but now I feel like it would just be understanding memory better when I run into a strange error).
- spauldo 2y agoWas the 400 as much of a pain to type on as it looks? I was lucky to inherit an 800 when my uncle bought his first IBM clone, and those had nice keyboards.
- leptons 2y agoBefore I got the C64 I got an Atari 600XL because the keyboard was a real keyboard. I had really hacked a lot on the Atari 400 keyboard, so much that it was becoming pretty worn in places, so the better keyboard was really an upgrade.
- kiwih 2y agoI noted in a different comment in this thread that we teach all first-year compsci and software engineering students at my university MIPS assembly. They may then specialise into other areas, security, operating systems, embedded, etc., and in those specialties may need assembly for more modern CPUs. We have found that when needed, students pick up the newer/more advanced assembly languages (e.g. ARM, x86) fairly well, so we believe the early and universal introduction to MIPS does provide benefits.
- classichasclass 2y agoI moved from 6502 assembly to PowerPC assembly. I found 6502 assembly easy to understand because of the limited number of registers, instructions and addressing modes. You didn't have to learn very many. And as it turned out, I didn't have any problems adapting to the expanded PPC ISA. Being on the 6502 already taught me how to chop problems down into tiny bits and now the bits didn't have to be so tiny. I certainly wasn't trying to do 8-bit chained adds for bigger quantities anymore; it didn't make sense to when I had 32-bit registers and an FPU.
- Someone 2y ago> Can anyone speak on how it is to move from an older assembly, to a modern CPU? The modern CPU with orthogonal instruction set is just as easy (possibly easier because you have more and larger registers, making it easier to get ‘real’ results) until you start to look at performance. Then, you hit the problem of having to understand how your target CPU does out-of-order execution, how large its caches are, how they are organized, etc. Modern CPUs out there that have very little of that exist, though.
- Dwedit 2y agoARM borrowed most of its design from 6502. So if you learn 6502, you've learned many of the tricky parts of ARM (such as how the carry flag works with subtraction). Many of the instructions have similar mnemonics, such as the conditional branch instructions (BEQ, BNE, BCC, BCS, BMI, BPL, BVS, BVC), as well as the arithmetic instructions like ADC, SBC, EOR.
- klelatti 2y ago> ARM borrowed most of its design from 6502 Not really (perhaps leaving mnemonics aside). The 6502 has little in common with the first ARM. The ARM's designers liked the simplicity and speed of the 6502 and it was their favourite 8-bit ISA. And a visit to the Western Design Center convinced them to design their own CPU. However, the early RISC papers were the biggest influence on the design of the ARM. There is even a clue in the name 'Acorn RISC Machine'.
- rbanffy 2y agoI believe both are true. Early ARM feels like a refreshed 6502.
- klelatti 2y agoCould you say why? It doesn’t feel much like it to me at all!
- rbanffy 2y agoARM designers liked and had extensive experience with 6502 - it WAS their bread and butter for a long time - and this might be why the mnemonics are so similar (and carry in subtraction - that might have been for making porting easy, but I won't risk assuming that without a primary source). They obviously also studied foundational papers on RISC and understood the possibility of having a simple design (such as the 6502, which was very powerful considering its small transistor count) applied to a simple, more regular, instruction set. Assigning weight to these factors might a futile exercise, as the designers themselves might not agree. They were not blind to RISC and, therefore, it made sense to put it in the name of the architecture.
- pjc50 2y agoThe two approaches that work best are: - learn assembly as subroutines inside your "daily driver" language on your regular PC, which is going to be x64 - microcontroller with in-circuit debugger where you can connect it to flashing lights (obvious candidate is Arduino, which is AVR, or STM32 which is ARM) Back in the day the first of these was easier in environments like BBC Basic inline assembler or MS-DOS COM files (which are headerless executables that can be extremely small.) You could also learn either of those in emulators.
- adrian_b 2y agoModern CPUs are more difficult to program in assembly. The simplicity of RISC-V is illusory. Because it lacks many features of normal ISAs, like ARM or Intel/AMD x86-64, writing programs that are both efficient and robust, i.e. which handle safely any errors, is quite difficult in assembly language. For a simpler programming in assembly language it is hard to beat DEC PDP-11 and Motorola 68000 derivatives. However those are no longer directly useful in practice. For something useful, the best would be to learn assembly programming using a development board for some Cortex-M microcontroller, preferably a less ancient core, e.g. with Cortex-M23 or Cortex-M33 or Cortex-M55 or Cortex-M85, i.e. cores implementing the Armv8-M ISA (the latter 2 also implement the Helium vector extension). Probably some development board with a microcontroller using Cortex-M33 would be the easiest to find and it should cost no more than $20 to $30. I would not recommend for learning today any of the development boards with obsolete cores, like Cortex-M0+, Cortex-M3, Cortex-M4 or Cortex-M7, even if those boards can be found e.g. at $10 or even less. Such a development board can be connected to any PC with a USB cable. All the development tools are free (there are paid alternatives, but those are not better than the free GNU tools). You can compile or assemble your program on the PC, then load and run it on the development board. You can have a serial console window connecting to your program, by using a serial port on the development board and a USB serial interface. All such development boards have LEDs and various connectors for peripherals, allowing you to see what your program does. I think that learning to program in assembly such an Armv8-M microcontroller is more useful than learning something like 6502. Armv8-M is less quirky than 6502 or RISC-V and it is something that you can use for implementing some useful home device or even professionally. Otherwise, the best is to learn the assembly language of your personal computer, e.g. x86-64 or Aarch64, but that is much more difficult than starting with a microcontroller development board from ST (e.g. a cheap STM32 Nucleo variant), NXP, Infineon, Renesas, Microchip, etc.