*= $1000

; will draw a line from one edge of the screen
; to the other when you press the Triangle button


INT #$13
LDA #$FF
STA $AFE03
LDA #0
STA $AFE04
STA $AFE05

GAME

INT #$15 ; virtual interupt $15

INT #$14 ; virtual interupt $14 
; test for keys
LDY #0
INT #$19
CPY #1
BEQ MOVERIGHT
LDY #1
INT #$19
CPY #1
BEQ MOVELEFT
OLDSPOT

JSR DRAWSCREEN ; jump to draw screen subroutine
JMP GAME




DRAWRECT

LDX $AFE04
LDY $AFE05
DX INX
LDY $AFE05
DY INY

; plot the pixel
LDA $AFE03
ADC #1
STA $AFE03
INT #$16
ADC #25
CPY A 
BNE DY
LDA $AFE04
ADC #25
CPX A
BNE DX
RTS


DRAWSCREEN


JSR DRAWRECT 

RTS


MOVERIGHT LDA $AFE04
ADC #1
STA $AFE04
INT #$103 ; fast memory fill
JMP OLDSPOT

MOVELEFT
LDA $AFE04
SBC #1
STA $AFE04
INT #$103
JMP OLDSPOT