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-10-14 02:12:14 +00:00
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 :
2014-10-14 02:12:14 +00:00
ldx #W G C l e a r S c r e e n
jsr W e e G U I
2014-09-03 00:43:09 +00:00
lda #0 ; Initialize
2014-10-14 02:12:14 +00:00
ldx #W G S c r o l l X
jsr W e e G U I
ldx #W G S c r o l l Y
jsr W e e G U I
2014-09-03 00:43:09 +00:00
tortureTestPrint_init :
2014-10-14 02:12:14 +00:00
WGCALL1 6 W G C r e a t e V i e w ,t e s t P r i n t V i e w
2014-09-03 00:43:09 +00:00
lda #0
2014-10-14 02:12:14 +00:00
ldx #W G S e l e c t V i e w
jsr W e e G U I
ldx #W G P a i n t V i e w
jsr W e e G U I
2014-09-03 00:43:09 +00:00
lda #0
pha
pha
lda #- 1
pha
pha
tsx
inx
tortureTestPrint_loop :
phx
2014-10-03 19:22:19 +00:00
lda #0 ; Initialize
sta P A R A M 0
sta P A R A M 1
2014-10-14 02:12:14 +00:00
ldx #W G S e t C u r s o r
jsr W e e G U I
2014-09-03 00:43:09 +00:00
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 :
2014-10-14 02:12:14 +00:00
phx
2014-09-03 00:43:09 +00:00
lda $ 0 1 0 0 ,x
2014-10-14 02:12:14 +00:00
ldx #W G S c r o l l X ; A p p l y c u r r e n t X s c r o l l
jsr W e e G U I
plx
2014-09-03 00:43:09 +00:00
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 :
2014-10-14 02:12:14 +00:00
phx
2014-09-03 00:43:09 +00:00
lda $ 0 1 0 0 ,x
2014-10-14 02:12:14 +00:00
ldx #W G S c r o l l Y
jsr W e e G U I
plx
2014-09-03 00:43:09 +00:00
dex
dex
tortureTestPrint_print :
2014-10-14 02:12:14 +00:00
; VBL_SYNC
phx
ldx #W G E r a s e V i e w C o n t e n t s
jsr W e e G U I
2014-09-03 00:43:09 +00:00
2014-10-14 02:12:14 +00:00
WGCALL1 6 W G P r i n t ,u n i t T e s t S t r
2014-09-03 00:43:09 +00:00
2014-10-14 02:12:14 +00:00
ldx #W G P r i n t ; D o i t a g a i n
jsr W e e G U I
2014-09-03 00:43:09 +00:00
; jmp tortureTestPrint_lock
2014-10-14 02:12:14 +00:00
jsr d e l a y
plx
2014-09-03 00:43:09 +00:00
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-10-14 02:12:14 +00:00
2014-09-03 00:43:09 +00:00
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 :
2014-10-11 23:12:15 +00:00
ldx #W G C l e a r S c r e e n
jsr W e e G U I
2014-08-29 19:19:19 +00:00
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 :
2014-10-11 23:12:15 +00:00
@0: lda $C019 ; Sync to VBL
bmi @0
ldx #W G C l e a r S c r e e n
jsr W e e G U I
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
2014-10-03 19:22:19 +00:00
ldy #' Q ' + $ 8 0
2014-10-11 23:12:15 +00:00
ldx #W G F i l l R e c t
jsr W e e G U I
ldx #W G S t r o k e R e c t
jsr W e e G U I
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
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-10-11 23:12:15 +00:00
ldx #W G C l e a r S c r e e n
jsr W e e G U I
2014-08-29 19:19:19 +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
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-10-03 19:22:19 +00:00
ldy #' Q ' + $ 8 0
2014-10-11 23:12:15 +00:00
ldx #W G F i l l R e c t
jsr W e e G U I
ldx #W G S t r o k e R e c t
jsr W e e G U I
2014-08-29 19:19:19 +00:00
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
2014-10-14 02:12:14 +00:00
delayShort : ; ~1/30 sec
2014-10-11 23:12:15 +00:00
pha
phx
phy
ldy #$ 06 ; Loop a bit
delayShortOuter :
ldx #$ f f
delayShortInner :
nop
nop
nop
nop
nop
nop
nop
dex
bne d e l a y S h o r t I n n e r
dey
bne d e l a y S h o r t O u t e r
ply
plx
pla
rts
2014-10-14 02:12:14 +00:00
delay : ; ~1 sec
pha
phx
phy
ldy #$ c e ; L o o p a b u n c h
delayOuter :
ldx #$ f f
delayInner :
nop
nop
nop
nop
nop
nop
nop
dex
bne d e l a y I n n e r
dey
bne d e l a y O u t e r
ply
plx
pla
rts
2014-09-03 00:43:09 +00:00
testPrintView :
2014-10-14 02:12:14 +00:00
.byte 0 , 0 , 1 5 , 6 , 3 0 , 1 0 , 4 0 , 1 2 6
2014-09-03 00:43:09 +00:00
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