;  demo embed sys simulator

;  use interrupt mode to display graphic

;  plot a line at 10,10 to 50,50

; x = 10
; y = 10
; while x <= 50
;   plot x, y
;   x++
;   y++

;  interrupt do increment x,y and plot
;  main  just keep track of the end

.symbol
  x  1
  y  2
  color 6
  plot 15
.code 0
;  setup interrupt
  mov r1 #int_plot
  st r1 1000		; int vector
  mov r1 #1
  trap r1 #12		; enable int
  mov r1 #100	
  trap r1 #10		; set timer1 = 100
  mov r1 #100
  trap r1 #11		; set div = 100

; main program
  mov x #10
  mov y #10
  mov color #1
:while
  le r3 x #50
  jf r3 exit
  jmp while
:exit
  trap r0 #0

:int_plot
  st x 1010
  st y 1011
  trap color #plot     ; plot new dot 
  add x x #1
  add y y #1
  ret r31

.data 100
 0
.end
  