; Altirra Acid800 test suite ; Copyright (C) 2010 Avery Lee, All Rights Reserved. ; ; Permission is hereby granted, free of charge, to any person obtaining a copy ; of this software and associated documentation files (the "Software"), to deal ; in the Software without restriction, including without limitation the rights ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the Software is ; furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included in ; all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ; SOFTWARE. ; initialized zp zpoffs = $0080 dc_con = zpoffs + $00 ; !byte $00 ;decompression control byte dc_in0 = zpoffs + $01 ; !byte $60 ;instruction dc_in1 = zpoffs + $02 ; !byte $60 dc_in2 = zpoffs + $03 ; !byte $60 ; !byte $60 dc_a1 = zpoffs + $05 ; !byte 0 ;input data dc_x1 = zpoffs + $06 ; !byte 0 dc_y1 = zpoffs + $07 ; !byte 0 dc_p1 = zpoffs + $08 ; !byte 0 dc_m1 = zpoffs + $09 ; !byte 0 dc_a2 = zpoffs + $0a ; !byte 0 ;output data dc_x2 = zpoffs + $0b ; !byte 0 dc_y2 = zpoffs + $0c ; !byte 0 dc_p2 = zpoffs + $0d ; !byte 0 dc_m2 = zpoffs + $0e ; !byte 0 rand0 = zpoffs + $0f ; !byte $78 ;32-bit LFSR rand1 = zpoffs + $10 ; !byte $56 rand2 = zpoffs + $11 ; !byte $34 rand3 = zpoffs + $12 ; !byte $12 randt = zpoffs + $13 ; !byte 0 !src "common.s" zpinit _dc_con !byte $00 ;decompression control byte _dc_in0 !byte $60 ;instruction _dc_in1 !byte $60 _dc_in2 !byte $60 !byte $60 _dc_a1 !byte 0 ;input data _dc_x1 !byte 0 _dc_y1 !byte 0 _dc_p1 !byte 0 _dc_m1 !byte 0 _dc_a2 !byte 0 ;output data _dc_x2 !byte 0 _dc_y2 !byte 0 _dc_p2 !byte 0 _dc_m2 !byte 0 _rand0 !byte $78 ;32-bit LFSR _rand1 !byte $56 _rand2 !byte $34 _rand3 !byte $12 _randt !byte 0 zpend * = $2000 main: ldy #>testname lda #test_start sta a0+1 loop_start: ;load control byte ldy #0 lda (a0),y iny sta dc_con ;check if we should reload the opcode asl dc_con bcc same_opcode lda (a0),y ; new opcode iny sta dc_in0 lda #$60 sta dc_in1 sta dc_in2 same_opcode: ;update instruction bytes if needed asl dc_con ;scc bcc + lda (a0),y iny sta dc_in1 + asl dc_con ;scc bcc + lda (a0),y iny sta dc_in2 + ;compute implicit A1 jsr detrand2 sta dc_a1 ;decompress X1 and Y1; note that X1 = ~Y1 lda (a0),y iny sta dc_y1 eor #$ff sta dc_x1 ;compute implicit P1 and M1 jsr detrand2 ora #$30 and #$f7 sta dc_p1 jsr detrand2 sta dc_m1 ;decompress A2, X2, Y2, P2, and M2 asl dc_con lda dc_a1 ;scc bcc + lda (a0),y iny + sta dc_a2 asl dc_con lda dc_x1 ;scc bcc + lda (a0),y iny + sta dc_x2 asl dc_con lda dc_y1 ;scc bcc + lda (a0),y iny + sta dc_y2 asl dc_con lda dc_p1 ;scc bcc + lda (a0),y iny + sta dc_p2 asl dc_con lda dc_m1 ;scc bcc + lda (a0),y iny + sta dc_m2 ;bump test pointer tya clc adc a0 sta a0 ;scc bcc + inc a0+1 + ;setup temp registers ;+mwa d5, a1 ;+mwa d4, a2 lda #>d5 sta a1+1 lda #d4 sta a2+1 lda #test_end beq loop_exit loop_end: ;donecnt: ldx #0 ; inc $0400+(7*40),x ; inc donecnt+1 ; inc $0400+(24*40)+39 jmp loop_start loop_exit: jmp _testPassed fail: cld cli ;failcnt: ldx #0 ; ldx failcnt+1 ; inc $0400+(14*40),x ; inc failcnt+1 jsr _printfinit jsr _imprintf ;1234567890123456789012345678901234567890 !scr "fail: a=00 x=00 y=00 p=00 m=00 ",0 ldx #5 copyloop: lda dc_a1-1,x sta d0,x dex bne copyloop jsr _imprintf !scr "input: a=00 x=00 y=00 p=00 m=00 ",0 ; jmp nofail ;+mva dc_in0, d1 ;+mva dc_in1, d2 ;+mva dc_in2, d3 ldy #>failmsg lda #