Get the latest tech news
Dirty tricks 6502 programmers use (2019)
This post recaps some of the C64 coding tricks used in my little Commodore 64 coding competition. The competition rules were simple: make a C64 executable (PRG) that draws two lines to form the below image.
This CPU also doesn’t have a multiplier, so computing something like y*40+i usually involves either a bunch of logical shifts or a lookup table, again costing bytes. We keep adding the line slope to a fixed point counter yf and when the 8-bit addition sets the carry flag, add 40. Similarly, if you called any KERNAL ROM routines, you could totally take advantage of any side-effects they might have: returned CPU flags, temporary values set into zeropage, etc.
Or read this on Hacker News