2014-08-29 19:19:19 +00:00
;
; unit_test.s
; WeeGui
;
; Unit tests of various systems
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
2014-09-03 00:43:09 +00:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; tortureTestPrint
; Prints strings in a range of positions and scrolling offsets
;
; Stack:
; Curr Scroll X
; Curr Scroll Y
; Delta X
; Delta Y
tortureTestPrint :
jsr W G C l e a r S c r e e n
lda #0 ; Initialize
jsr W G S c r o l l X
jsr W G S c r o l l Y
tortureTestPrint_init :
lda #< t e s t P r i n t V i e w
sta P A R A M 0
lda #> t e s t P r i n t V i e w
sta P A R A M 1
jsr W G C r e a t e V i e w
lda #0
jsr W G S e l e c t V i e w
jsr W G P a i n t V i e w
lda #0
pha
pha
lda #- 1
pha
pha
tsx
inx
tortureTestPrint_loop :
phx
ldx #0 ; Initialize
ldy #0
jsr W G S e t C u r s o r
plx
inx ; Grab current delta X
lda $ 0 1 0 0 ,x
inx
inx
clc
adc $ 0 1 0 0 ,x ; Add Scroll X
sta $ 0 1 0 0 ,x
beq t o r t u r e T e s t P r i n t _ f l i p D e l t a X ; Check for bounce
cmp #- 5
beq t o r t u r e T e s t P r i n t _ f l i p D e l t a X
bra t o r t u r e T e s t P r i n t _ c o n t i n u e X
tortureTestPrint_flipDeltaX :
dex
dex
lda $ 0 1 0 0 ,x
eor #$ f f
inc
sta $ 0 1 0 0 ,x
inx
inx
tortureTestPrint_continueX :
lda $ 0 1 0 0 ,x
jsr W G S c r o l l X ; Apply current X scroll
dex
dex
dex
lda $ 0 1 0 0 ,x ; Grab current delta Y
inx
inx
clc
adc $ 0 1 0 0 ,x ; Add Scroll Y
sta $ 0 1 0 0 ,x
beq t o r t u r e T e s t P r i n t _ f l i p D e l t a Y ; Check for bounce
cmp #- 5
beq t o r t u r e T e s t P r i n t _ f l i p D e l t a Y
bra t o r t u r e T e s t P r i n t _ c o n t i n u e Y
tortureTestPrint_flipDeltaY :
dex
dex
lda $ 0 1 0 0 ,x
eor #$ f f
inc
sta $ 0 1 0 0 ,x
inx
inx
tortureTestPrint_continueY :
lda $ 0 1 0 0 ,x
jsr W G S c r o l l Y
dex
dex
tortureTestPrint_print :
VBL_ S Y N C
jsr W G E r a s e V i e w C o n t e n t s
2014-09-05 23:31:33 +00:00
lda #< u n i t T e s t S t r
2014-09-03 00:43:09 +00:00
sta P A R A M 0
2014-09-05 23:31:33 +00:00
lda #> u n i t T e s t S t r
2014-09-03 00:43:09 +00:00
sta P A R A M 1
jsr W G P r i n t
jsr W G P r i n t
; jmp tortureTestPrint_lock
jsr d e l a y S h o r t
jmp t o r t u r e T e s t P r i n t _ l o o p
tortureTestPrint_reset :
pla
pla
jmp t o r t u r e T e s t P r i n t _ i n i t
tortureTestPrint_lock :
jmp t o r t u r e T e s t P r i n t _ l o c k
2014-08-29 19:19:19 +00:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; tortureTestRects
; Strokes and paints rectangles of many different geometries
;
; Stack:
; Curr X
; Curr Y
; Curr Width
; Curr Height
tortureTestRects :
jsr W G C l e a r S c r e e n
2014-09-03 00:43:09 +00:00
tortureTestRectsEven :
2014-08-29 19:19:19 +00:00
lda #38 ; Initialize
pha
lda #11
pha
lda #2
pha
lda #2
pha
2014-09-03 00:43:09 +00:00
tortureTestRectsEvenLoop :
jsr W G C l e a r S c r e e n
2014-08-29 19:19:19 +00:00
2014-09-03 00:43:09 +00:00
tsx
inx
lda $ 0 1 0 0 ,x ; Load Height, then modify
sta P A R A M 3
inc
inc
sta $ 0 1 0 0 ,x
cmp #25
bcs t o r t u r e T e s t R e c t s E v e n D o n e
inx ; Load Width, then modify
lda $ 0 1 0 0 ,x
sta P A R A M 2
inc
inc
inc
inc
inc
inc
sta $ 0 1 0 0 ,x
inx ; Load Y, then modify
lda $ 0 1 0 0 ,x
sta P A R A M 1
dec
sta $ 0 1 0 0 ,x
inx ; Load X, then modify
lda $ 0 1 0 0 ,x
sta P A R A M 0
dec
dec
dec
sta $ 0 1 0 0 ,x
ldx #' Q ' + $ 8 0
jsr W G F i l l R e c t
jsr W G S t r o k e R e c t
jsr d e l a y S h o r t
jsr d e l a y S h o r t
jsr d e l a y S h o r t
jmp t o r t u r e T e s t R e c t s E v e n L o o p
tortureTestRectsEvenDone :
pla
pla
pla
pla
tortureTestRectsOdd :
lda #37 ; Initialize
pha
lda #11
pha
lda #2
pha
lda #2
pha
tortureTestRectsOddLoop :
2014-08-29 19:19:19 +00:00
jsr W G C l e a r S c r e e n
tsx
inx
lda $ 0 1 0 0 ,x ; Load Height, then modify
sta P A R A M 3
inc
inc
sta $ 0 1 0 0 ,x
cmp #25
2014-09-03 00:43:09 +00:00
bcs t o r t u r e T e s t R e c t s O d d D o n e
2014-08-29 19:19:19 +00:00
inx ; Load Width, then modify
lda $ 0 1 0 0 ,x
sta P A R A M 2
inc
inc
inc
inc
inc
inc
sta $ 0 1 0 0 ,x
inx ; Load Y, then modify
lda $ 0 1 0 0 ,x
sta P A R A M 1
dec
sta $ 0 1 0 0 ,x
inx ; Load X, then modify
lda $ 0 1 0 0 ,x
sta P A R A M 0
dec
dec
dec
sta $ 0 1 0 0 ,x
2014-09-03 00:43:09 +00:00
ldx #' Q ' + $ 8 0
jsr W G F i l l R e c t
2014-08-29 19:19:19 +00:00
jsr W G S t r o k e R e c t
2014-09-03 00:43:09 +00:00
jsr d e l a y S h o r t
jsr d e l a y S h o r t
jsr d e l a y S h o r t
2014-08-29 19:19:19 +00:00
2014-09-03 00:43:09 +00:00
jmp t o r t u r e T e s t R e c t s O d d L o o p
2014-08-29 19:19:19 +00:00
2014-09-03 00:43:09 +00:00
tortureTestRectsOddDone :
2014-08-29 19:19:19 +00:00
pla
pla
pla
pla
2014-09-03 00:43:09 +00:00
jmp t o r t u r e T e s t R e c t s E v e n
testPrintView :
.byte " 0 0 0 F0 6 1 E 0 A 2 8 7 E " ; 0, 7,3,62,19,75,126
2014-09-05 23:31:33 +00:00
unitTestStr :
2014-09-03 00:43:09 +00:00
.byte " This i s a t e s t o f t h e e m e r g e n c y b r o a d c a s t s y s t e m . I f t h i s h a d b e e n a r e a l e m e r g e n c y , y o u w o u l d b e d e a d n o w . A m u s i n g l y , i t c a n b e n o t e d t h a t i f t h i s h a d b e e n a r e a l e m e r g e n c y , a n d y o u w e r e n o w a s t e a m i n g p i l e o f a s h , t h e r e w o u l d o f c o u r s e b e n o b o d y . " ,0 ; to read this message. That begs any number",0; of extistential questions about this very text.",0