News for hackers. Stuff that matters.
Re:MEGA65 – An open-source C65-like 8-bit computer by blt on Thursday April 23, 2015 @12:14PM (#9427696)
random question - with a screen width of 320, how do you deal with screen coordinates in 8-bit variables?
Re:MEGA65 – An open-source C65-like 8-bit computer by xacto75 on Thursday April 23, 2015 @02:06PM (#9428595)
The C64 had one byte at $D010 -- 8 bits, one for each sprite -- that, when set, would add an offset to that sprite's X position, moving it beyond the 256 limit. This would allow the contents of each sprite's X position register to reset at 0, staying within the 8-bit limit.
Re:MEGA65 – An open-source C65-like 8-bit computer by pkaye on Thursday April 23, 2015 @12:15PM (#9427709)
You use 16-bit variables.
Re:MEGA65 – An open-source C65-like 8-bit computer by blt on Thursday April 23, 2015 @12:33PM (#9427891)
So, 2 registers and 16-bit math in software? Was this common, or did games find a way around it?
Re:MEGA65 – An open-source C65-like 8-bit computer by pkaye on Thursday April 23, 2015 @01:37PM (#9428379)
Well the 6502 didn't have many registers but the CPU and SRAM were of similar speed back then so most of the temporary values were stored in SRAM. Not too long ago I did firmware on an 8-bit processor using the C language. It would support 32/16/8-bit variables. You just have to choose the smallest one possible to be most efficient.
Re:MEGA65 – An open-source C65-like 8-bit computer by daeken on Thursday April 23, 2015 @01:01PM (#9428132)
Yes, it was common. Also common was to have entities in your game exist on a grid, and multiply/shift those positions to get screen coordinates, when they were needed.
Re:MEGA65 – An open-source C65-like 8-bit computer by ddingus on Thursday April 23, 2015 @01:16PM (#9428236)
Sure. Toss up some side bar / status / score thing, and run the game in 8 bit coordinates.

Or, double up on movement, make the game 160 pixels, and just run that way.

The multi-color mode on C64 is 160 pixels, and that got used for a ton of games.

Finally, mixed screen setups. Sprites, high resolution (320) and multi-color (160) all were used concurrently. The coordinates for those could easily be 8 bits, and just operate in regions of the screen.