3 ms·
How to code a sine scroll on Amiga
- kazinator 8y ago> And it is far more easy to remember the contents of this stack than the contents of 13 registers. Get a macro assembler, or at least a preprocessor; then give the registers names.
- chillingeffect 8y agoi think they mean its more about remembering which variables are in which registers. i dont think macros can keep track of which registers are available for new use.
- kazinator 8y agoMacros help remember which variables are in which registers by giving alias names to registers. I didn't think this requires explanation. If a register is used for more than one purpose and there are multiple macros aliasing for it which look like distinct variable, that could be a problem. If there are enough registers so that a function can avoid this, then it isn't a problem.
- chillingeffect 8y agoi'm curious if you've written optimized code for these platforms... it's not about remembering the registers within a routine. it's about maximizing register use across several routines. E.g. You call "circle" which uses registers d0-d3. Then it calls "line" which uses d4 and d5. Then you want to call "draw_point" which uses d3 and d7, but you realize you don't want to stomp on d3, so you write an alternate version of draw_point which uses d6 and d7 instead. The OP is that platforms with few registers, such as x86, rely on the stack and don't have this problem. Macros won't help either, bc it's not about naming, it's about resource allocation. A good C compiler could do it well, but OP was talking about programming in Assembly.
- Annatar 8y agoI don't see a problem here, never had an issue keeping track which register I was using for what. And I almost never used the stack in my code, other than saving and restoring the registers I was going to use before and after the subroutine. Even that was unnecessary, I did it just to be clean.
- jepler 8y ago"So, it should be considered mandatory to read the documentation of a technology to masterize this technology. By documentation, I mean the reference manual, not a popularized version. The authors who popularize documentation often treat it loosely, using shortcuts that lead to a dead end, misleading talent and flattering mediocrity."
- onion2k 8y agoI made one of these in JS a while ago - https://codepen.io/onion2k/pen/zPQvrv https://codepen.io/onion2k/pen/zPQvrv And a nicer 2D wobble - https://codepen.io/onion2k/pen/rYgxdJ https://codepen.io/onion2k/pen/rYgxdJ Porting old demo effects to browsers is a lot of fun.