% Test Utility % COMPARE(addr-current,addr-expected,N) % Check if the N first nodes of the stacks do match the expected layout PREFIX COMPARE: addr_current IS $0 addr_expected IS $1 N IS $2 nn IS $3 test IS $4 current IS $5 expected IS $6 :COMPARE 8ADDU N,N,0 SET nn,0 1H LDO current,addr_current,nn LDO expected,addr_expected,nn CMP test,current,expected BNZ test,8F ADD nn,nn,8 CMP test,nn,N BN test,1B 7H LDA $255,:MSG:DEBUG:OK TRAP 0,:Fputs,:StdOut JMP 9F 8H LDA $255,:MSG:DEBUG:KO TRAP 0,:Fputs,:StdOut LDA $255,:MSG:DEBUG:AT TRAP 0,:Fputs,:StdOut GET $7,:rJ LDA $9,addr_current,nn PUSHJ $8,:OCTA2ASCII PUT :rJ,$7 LDA $255,:MSG:DEBUG:VAL TRAP 0,:Fputs,:StdOut LDA $255,:MSG:DEBUG:EXP TRAP 0,:Fputs,:StdOut GET $7,:rJ SET $9,expected PUSHJ $8,:OCTA2ASCII PUT :rJ,$7 LDA $255,:MSG:DEBUG:VAL TRAP 0,:Fputs,:StdOut LDA $255,:MSG:DEBUG:CUR TRAP 0,:Fputs,:StdOut GET $7,:rJ SET $9,current PUSHJ $8,:OCTA2ASCII PUT :rJ,$7 LDA $255,:MSG:DEBUG:VAL TRAP 0,:Fputs,:StdOut % Exit now with error SET $255,42 TRAP 0,:Halt,0 9H POP 0,0 PREFIX : PREFIX EXP_OCTA: GOT IS $0 EXP IS $1 t IS $2 :EXP_OCTA LDA $255,:MSG:DEBUG:EXP_OCTA TRAP 0,:Fputs,:StdOut SET $4,EXP GET $2,:rJ PUSHJ $3,:OCTA2ASCII PUT :rJ,$2 LDA $255,:MSG:DEBUG:VAL TRAP 0,:Fputs,:StdOut CMP t,GOT,EXP BZ t,1F LDA $255,:MSG:DEBUG:KO_EXP_OCTA TRAP 0,:Fputs,:StdOut SET $4,GOT GET $2,:rJ PUSHJ $3,:OCTA2ASCII PUT :rJ,$2 LDA $255,:MSG:DEBUG:VAL TRAP 0,:Fputs,:StdOut % Exit now with error SET $255,42 TRAP 0,:Halt,0 1H LDA $255,:MSG:DEBUG:OK_EXP_OCTA TRAP 0,:Fputs,:StdOut 9H POP 0,0 PREFIX :