;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- .debuginfo + ; Generate debug info ;;Macros .include "macros/16bitarithmetic.s" ;;inc files .include "routines/memory/mem.inc" ;;Code to run .include "STARTUP.s" ;.include "routines/line/line_test_time.s" ;;.include "routines/memory/memcpy_test.s" ;.include "fillscreen.s" ;Hacky hardcoding. I pick FC and FD to contain the 16 bit offset to the screen LDA #$40 ;Remember kids, C64 is a little endian computer. Why, why why! Big endian makes more sense! STA $FD ;THis means that the bitmap starts at $4000 LDA #$00 LDX #$60 STA $FC mainloop: ;fill screen with white pixels LDY #$00 LDA #%10000000 ; Start out with setting the leftmost pixel to white in every byte in the bitmap STA $FF ;$FF contains the pattern we are writing to part if the bitmap memory STA $FE ;$FE conatins the most recent bit/pixel we are adding ;The idea is now to bitshift this to the right, until A is 0. When this happens it is time to update which byte we are working on pixel_setting_loop: LDA $FF STA ($FC),Y LDA $FE ;FE contains the most recent bit/pixel we are adding LSR a BNE more_pixels_in_byte INC $FC ; if this overflows BNE not_incrementing_other_byte INC $FD CPX $FD ; if the carry flag is zero, branch BCC done_pixels not_incrementing_other_byte: LDA #%10000000 STA $FE STA $FF more_pixels_in_byte: STA $FE ;$FE conatins the most recent bit/pixel we are adding ORA $FF ;Add the previous pixels. STA $FF JMP pixel_setting_loop done_pixels: ;check is somebody has pressed space and if so exit, code blatantly stolen from Duuqnd LDX #%01111111 LDY #%00010000 LDA #$ff STA $DC02 LDA #$00 STA $DC03 STX $DC00 TYA AND $DC01 ;Check if A is 0 BEQ die jmp mainloop die: ;.include "routines/line/line.s" ;.include "routines/memory/pixel_draw.s" .include "routines/memory/memset.s" ;.include "routines/memory/memcpy.s"