// sum 1..10
//   i = 0
//   s = 0
//   while i <= 10
//     s = s + i
//     i = i + 1
//   print s

//   i <= 10 is (i + (-11)) != 0)
//   -11 is 245  8-bit 2's complement

.s 
print 1000
stop  1001
S     50 
I     51
M11   52
.a 0
.c
  lda #0
  sta I
  sta S
:while
  lda I
  add M11
  jpz exit
  lda S
  add I
  sta S
  lda I
  add #1
  sta I
  jmp while
:exit
  lda S
  jsr print
  jsr stop
.a 50
.b 0 0 245
.e 

   