*=$1000               ;This is An Example Of Setting The Start Address Value
	jmp start
;
;set up some variables for use as immidiate  values
;
key1=#"1"
key2=#"2"
key3=#"3"
key4=#"4"
;
;set up more variables

getkey=$ffe4
;
;
		
start	lda 3			
	sta col			;clear screen and wait for 1,2,3,4,q
	sta bcol		;to be pressed
	jsr clear
	jsr menu
kloop	jsr $ff9f
	jsr getkey
	cmp 0
	beq kloop
	cmp key1
	bne br0
	jsr edit
	jmp start
br0	cmp key2
	bne br1
	jsr show
	jmp kloop
br1	cmp key3
	bne br2
	jsr save
	jmp kloop
br2	cmp key4
	bne br3
	jsr load
	jmp kloop
br3	cmp "q"		;`q` key
	bne kloop
	rts
	
;
;
edit 	nop			;edit function key `1`
	jsr clear
	lda 160
	jsr fbox
kl1	jsr $ff9f
	jsr getkey
	cmp 0
	beq kl1
	rts
;
show	nop		;key `2`
	inc $0402
	rts
;
save	nop		;key `3`
	inc $0404
	rts
;
load	nop		;key `4`
	inc $0406
	rts
;
;
;
clear	lda #32		;will clear screen
cl1   ldx #0
loop	sta $0400,x
	sta $0500,x
	sta $0600,x
	sta $06e8,x
	inx
	bne loop
	rts
;
;


;
menu	ldx 0
mloop	lda mtxt,x	;load text from table
	sta $0430,x		
	lda mtxt1,x	;load text from table
	sta $0480,x		
	lda mtxt2,x	;load text from table
	sta $04d0,x	
	lda mtxt3,x	;load text from table
	sta $0520,x		
	inx 
	cpx 20
	bne mloop
	rts


fbox  nop			;places a box in colour ram
	ldy #$00		;and on screen and fills with `col`
	ldx #$d8
	sty $fb
	stx $fc
	ldx 23
bra3	ldy 26
	lda col			;fill colour
bra1	sta ($fb),y
	dey
	bpl bra1
	lda $fb
	clc
	adc 40
	bcc bra2
	inc $fc
bra2 	sta $fb
	dex
	bne bra3
      ldy #$00
	ldx #$04
	sty $fb
	stx $fc
	ldx 23
bra4	ldy 26
	lda 160			;fill char reveresd space
bra5	sta ($fb),y
	dey
	bpl bra5
	lda $fb
	clc
	adc 40
	bcc bra6
	inc $fc
bra6 	sta $fb
	dex
	bne bra4
	lda 0
	ldx 26
bra7	sta $d800,x
	sta 56176,x
	dex
	bpl bra7
	lda #$28
	ldx #$d8
	sta $fb
	stx $fc
	ldx 0
bra9	lda 0
	ldy 0
	sta ($fb),y
	ldy 26
	sta ($fb),y
	lda $fb
	clc
	adc 40
	bcc bra8
	inc $fc
bra8	sta $fb
	inx
	cpx 21
	bne bra9
	rts
;
;
col	byte 0		;will hold col for colour operations
bcol	byte 0		;will hold back ground colour
;
;all below are screen store chars not ascii
;
mtxt	text `1 edit sprites      `	;single text string per line
mtxt1	text `2 load/save sprites `
mtxt2	text `3 view sprites      `
mtxt3	text `4 quit editor        `
;
;
;


 