cpu 6502
nam Bitmap
ilist off
	
page 128,128
	bitblk = $DCF7		;for setting an 8k block of mem for the bitmap
	clrblk = $D018		;for setting other bitmap data
	clrmd  = $D016		;4 color mode
	bitmp1 = $D011
	getin  = $FFE4
	screen = $A000		; start of bitmap
	vidbnk = $DD00		; video bank
	size   = $1F3F

* = $0900  ; assemble at $900
code

	lda clrblk
	ora #$0A		; where is everything at?
	sta clrblk

	lda bitmp1
	ora #$20		; #$3b?
	sta bitmp1
	
	lda clrmd
	ora #$18		; #$08 = Single Colour | #$18 Multi Colour
	sta clrmd

	lda #$05
	sta vidbnk

		
	ldx #$00		;set loop index to 0
	lda #$00		;use a zero to poke into each loc.
	
.top	lda scrnmem, x
	sta $A000, x
	sta $A100, x
	sta $A200, x
	sta $A300, x
	sta $A400, x
	sta $A500, x
	sta $A600, x
	sta $A700, x
	sta $A800, x
	sta $A900, x
	sta $AA00, x
	sta $AB00, x
	sta $AC00, x
	sta $AD00, x
	sta $AE00, x
	sta $AF00, x
	sta $B000, x
	sta $B100, x
	sta $B200, x
	sta $B300, x
	sta $0400, x
	sta $0500, x
	sta $0600, x
	sta $B400, x
	sta $B500, x
	sta $B600, x
	sta $B700, x
	sta $B800, x
	sta $B900, x
	sta $BA00, x
	sta $BB00, x
	sta $BC00, x
	sta $BD00, x
	sta $BE00, x
	inx
	cpx #$00		; end after 256
	bne .top
	clc			;clear the carry flag
	ldx #$00		; reset the index

	;; to finish off from $BF00 - $BF3F
.top3   lda #$00
	sta $BF00, x
	inx
	cpx $40
	bne .top3

	;; check for "q"
.top2	jsr $FFE4
	cmp #$51
	bne .top2
	
	;; quit
.quit	lda #$1B
	sta bitmp1
	lda #$C8
	sta clrmd
	lda #$14
	sta clrblk
	lda #$97
	sta $DD00
	rts
	
scrnmem db $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F
	db $F0, $E0, $D0, $C0, $B0, $A0, $90, $80, $70, $60, $50, $40, $30, $20, $10, $00
	db $F0, $F1, $F2, $F3, $F4, $F5, $F6, $F7, $F8, $F9, $FA, $FB, $FC, $FD, $FE, $FF
	db $F0, $E0, $D0, $C0, $B0, $A0, $90, $80, $70, $60, $50, $40, $30, $20, $10, $00
	db $02, $02, $04, $04, $08, $08, $0F, $0F, $20, $20, $40, $40, $80, $80, $F0, $F0
	db $F0, $E0, $D0, $C0, $B0, $A0, $90, $80, $70, $60, $50, $40, $30, $20, $10, $00
	db $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F
	db $F0, $E0, $D0, $C0, $B0, $A0, $90, $80, $70, $60, $50, $40, $30, $20, $10, $00
	db $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F
	db $F0, $E0, $D0, $C0, $B0, $A0, $90, $80, $70, $60, $50, $40, $30, $20, $10, $00
	db $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F
	db $F0, $E0, $D0, $C0, $B0, $A0, $90, $80, $70, $60, $50, $40, $30, $20, $10, $00
	db $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F
	db $F0, $E0, $D0, $C0, $B0, $A0, $90, $80, $70, $60, $50, $40, $30, $20, $10, $00
	db $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F
	db $F0, $E0, $D0, $C0, $B0, $A0, $90, $80, $70, $60, $50, $40, $30, $20, $10, $00
	db $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F

	


.rnd    lda $DC04   ;CIA#1  Timer A  Lo byte 
        eor $DC05   ;CIA#1  Timer A  Hi byte 
        eor $DD04   ;CIA#2  Timer A  Lo byte 
        adc $DD05   ;CIA#2  Timer A  Hi byte 
        eor $DD06   ;CIA#2  Timer B  Lo byte 
        eor $DD07   ;CIA#2  Timer B  Hi byte 
        rts         ;

	;; an #$FF count loop of transfers to delay
.delay 	pha
	php
	ldx #$00
	
.del1	tay
	tya
	inx
	cpx #$FF
	bne .del1
	
	plp
	pla
	rts
	nop
	nop
	nop
	

code
