News for hackers. Stuff that matters.
Re:Apollo 11 Guidance Computer vs. USB-C Chargers by TazeTSchnitzel on Friday February 07, 2020 @05:19PM (#22271720)
I wonder if you can write fast C for the 6502, though, but you'll have to constrain your use of the language considerably?
Re:Apollo 11 Guidance Computer vs. USB-C Chargers by spc476 on Saturday February 08, 2020 @12:52AM (#22274201)
The 6502 is a very constrained CPU. It only has 6 registers, only one of which (PC) is 16 bits. The stack is fixed at addresses 0x0100 to 0x01FF, and the two index registers are 8-bits in size. So is the accumulator and the stack register (hence the fixed address for the system stack) and no stack-based addressing modes. You'll have a severe penalty in doing any 16-bit arithmetic. There is no general multiply or divide instructions. I think the architecture is about as hostile to C as you can get and still be popular.
Re:Apollo 11 Guidance Computer vs. USB-C Chargers by bsder on Saturday February 08, 2020 @02:27PM (#22277805)
The main problem is that most compilers really need lots of registers to optimize well. Without lots of registers, you're constantly spilling to memory and that makes things slow. If you program in assembly, you have visceral knowledge of when you overrun you registers and you will restructure the entire architecture of your program to avoid that.