diff --git a/cli/opctest/opctest.tal b/cli/opctest/opctest.tal index a55a3ad..fa02540 100644 --- a/cli/opctest/opctest.tal +++ b/cli/opctest/opctest.tal @@ -1,21 +1,25 @@ ( Opcode Tester ) -( Source: https://git.sr.ht/~rabbits/uxn-utils/tree/main/item/cli/opctest/opctest.tal ) |0013 @Zeropage &byte $1 &short $2 -|0100 @on-reset ( -> ) +|0100 + +@on-reset ( -> ) ( part 1 > LIT2: Puts a short on the stack - > #18 DEO: Write a letter in terminal ) + > LIT: Puts a byte on the stack + > #18 DEO: Write a letter in terminal + > ;meta: Push short + > #06 DEO: Write to metadata ports ) [ LIT2 "kO ] #18 DEO #18 DEO #0a18 DEO + ;meta #06 DEO2 ( part 2 > LITr: Put a byte on return stack - > LIT: Puts a byte on the stack > STH: Move a byte from working stack to return stack > STH2r: Move a short from return stack to working stack ) @@ -50,21 +54,50 @@ [ LIT2r 0000 ] ;tests/end ;tests &l - run-test STH ADDr + run-test [ LITr 00 ] STH ADD2r INC2 INC2 GTH2k ?&l POP2 POP2 - STH2r ;Dict/done pstr + STH2r ;tests/end ;tests SUB2 #01 SFT2 + EQU2 ;Dict/opctests test-part + + ( Part 7 + > Testing RAM wrapping + > Storing 12 in 0xffff, and 34 in 0x0000 ) + + #1234 #ffff STA2 + #ffff LDA #0000 LDA ADD #46 EQU + #ffff LDA2 ADD #46 EQU + AND ;Dict/ram-wrap test-part + + ( Part 8 + > Stack wrapping ) ( end ) + [ LIT &fail 80 ] + DUP #80 EQU ;Dict/result test-part + #0f DEO - [ LIT &fail 80 ] #0f DEO + ( #0a18 DEO + #010e DEO ) BRK +@meta 00 + ( name ) "Opctest 0a + ( details ) "A 20 "Testing 20 "Program 0a + ( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a + ( date ) "31 20 "Oct 20 "2023 $2 + +@test-part ( f name* -- ) + pstr ?{ + #01 ;on-reset/fail STA + ;Dict/failed !pstr } + ;Dict/passed !pstr + @run-test ( addr* -- addr* f ) LDA2k JSR2 DUP ?&pass - ;Dict/failed pstr + ;Dict/missed pstr [ LIT2 &name $2 ] pstr/ #0a18 DEO #01 ;on-reset/fail STA JMP2r &pass @@ -364,7 +397,12 @@ JMP2r @Dict [ &ok "Ok $1 &done "Tests 20 "Complete. 0a $1 - &failed "-- 20 "failed: 20 $1 + &opctests "Opcode 20 "tests $1 + &ram-wrap "RAM-wrap $1 + &result "Result: $1 + &passed 20 "passed! 0a $1 + &missed "Opcode 20 "Failed 20 "-- 20 $1 + &failed 20 "failed. 0a $1 &equ "EQU $1 &neq "NEQ $1 >h "GTH $1 <h "LTH $1 &add "ADD $1 &sub "SUB $1 &mul "MUL $1 &div "DIV $1 &inc "INC $1 &pop "POP $1 &dup "DUP $1 &nip "NIP $1