4. CONTROLAh, that's because I have forgotten something. If you want your sprites to be running around the screen, you're probably going to need a way to tell them to do it. So, here's a smidge of code to get inputs from the Sinclair joystick ports. JOYSTICK2 .equ 61438 JOYSTICK2 .equ 63486 input_j1 ld bc, JOYSTICK2 in a, (c) ; Get input from JOYSTICK1 input_j1_left: bit 4,a jp nz, input_j1_right ; Insert the code for moving left here jp input_j1_done input_j1_right: bit 3,a jp nz, input_j1_down ; Insert the code for moving right here jp input_j1_done input_j1_down: bit 2,a jp nz, input_j1_up ; Insert the code for moving down here jp input_j1_done input_j1_up: bit 1,a jp nz, input_j1_fire ; Insert the code for moving up here jp input_j1_done input_j1_fire: bit 0,a jp nz, input_j1_done ; Insert the code for firing here input_j1_done: ret input_j2 ld bc, JOYSTICK2 in a, (c) ; Get input from JOYSTICK2 input_j2_left: bit 0,a jp nz, input_j2_right ; Insert the code for moving left here jp input_j2_done input_j2_right: bit 1,a jp nz, input_j2_down ; Insert the code for moving right here jp input_j2_done input_j2_down: bit 2,a jp nz, input_j2_up ; Insert the code for moving down here jp input_j2_done input_j2_up: bit 3,a jp nz, input_j2_fire ; Insert the code for moving up here jp input_j2_done input_j2_fire: bit 4,a jp nz, input_j2_done ; Insert the code for firing here input_j2_done: ret Well, that really is it for this month. I hope this has helped some of you, especially since I've been promising to do it for so blimmin' long. Next issue I'll be going into memory management and multiloading. (But don't hold your breath for it, eh?) If you've any comments on what we've done this issue, or any questions or suggestions, you can send them to [email protected]. May the source be with you! |