ASM-11_EXPECT(1) Retro Project Manual ASM-11_EXPECT(1) NNAAMMEE asm-11_expect - expect checker for asm-11 test bench SSYYNNOOPPSSIISS aassmm--1111__eexxppeecctt [_O_P_T_I_O_N]... _F_I_L_E_._._. aassmm--1111__eexxppeecctt ----hheellpp DDEESSCCRRIIPPTTIIOONN Reads one of more aassmm--1111(1) listing files and checks for unexpected as- sembly errors and tests for expected address and generated data values. What is expected is specified by comments, described in the section EX- PECT COMMENTS, which are added to the asm-11 source code. asm-11 will copy these comments to the listing file and asm-11_expect extracts them and checks whether the actual assembly results match the expected ones. asm-11_expect produces at least a one-line summary per file like asm-11_expect: test_0010_alloc.lst OK asm-11_expect: test_0020_expr.lst OK where each file is marked either OOKK or FFAAIILLEEDD. In case of detected er- rors, additional output follows which describes each error and the af- fected listing line, like asm-11_expect: test_0110_op_gg.lst FAILED FAIL: data 1 mismatch: found=177736, expect=177734 in: 1 27 001042 067700 177736 add @pa,r0 ;;!! 067700 177734 The main application for asm-11_expect is to build self-checking test benches for aassmm--1111(1). EEXXPPEECCTT CCOOMMMMEENNTTSS The special comments which describe what to expect for an assembly line have the format ;;!! [_e_t_a_g_s] [_a_d_d_r:] [_d_a_t_a]... with eettaaggss list of expected assembly error flags, given as a sequence of uppercase letters without white space between letters. aaddddrr expected location counter (value of '.'), given as 6 digit octal number. Note that all 6 digits must be specified, even leading zeros. ddaattaa expected generated assembly output data, given as a blank-sepa- rated list of either 3 (for byte output) or 6 (for word output) digit octal numbers. Again, all 3 or 6 digits must be speci- fied, even leading zeros. This is checked against the data sec- tion of the assembly listing. In general, this is used to check data emitted into the binary output. However, some assembler statements, e.g. assignments or directives like .end, indicate some result value in the data section, and this can of course be checked as well. All three components are optional. Error flags are always tested, if no _e_t_a_g_s are specified it is checked that no assembly error flag has been generated for the line. Address and data tests are only done in case _a_d_d_r or _d_a_t_a components have been given. If a line starts with an expect comment it will be applied to the asm-11 statement in the following line. Or it is simply appended to an asm-11 statement. CCoommmmeenntt eexxaammpplleess ;;;;!!!! DDMM expect a D and a M error flag ;;;;!!!! 000011002200:: expect that the current location will be 001020, data not checked ;;;;!!!! 007744116677 117777776622 expect that the listing data section shows two words, 074167 and 177762. The address is not checked. ;;;;!!!! 000011000044:: 000000220077 expect that the current location will be 001004 and that the list- ing data section shows one word with the value 000207. SSoommee pprraaccttiiccaall ccaasseess .word 65537. ;;!! T sob r4,s4 ;;!! A stkbot: .blkw 400 ;;!! 001000: .word 100+77 ;;!! 000177 .byte 2+<4*10> ;;!! 042 spl 5 ;;!! 000235 inc @1234(r4) ;;!! 005274 001234 add @p,@#a ;;!! 067737 177614 001000 jsr pc,sub ;;!! 001006: 004767 177772 cmp = 1234 ;;!! 001234 c2 = inc + 67 ;;!! 005267 .end ;;!! 000001 OOPPTTIIOONNSS ----ttlliinnee Prints input lines from the listing file as they are processed. Helpful to debug expect comments, e.g. in conjunction with the ----ttcchheecckk option. ----ttcchheecckk Prints for each detected expect comment in the listing file a line reflecting the content of the comment, like ...line generated by --tcheck ... | original expect comment exp: err=T | ;;!! T exp: dot=001000 | ;;!! 001000: exp: dat=060037 001000 | ;;!! 060037 001000 exp: dot=001006 dat=004767 | ;;!! 001006: 004767 ----hheellpp print full help text and exit. EEXXIITT SSTTAATTUUSS In case of an error, the exit codes are: 11 run time errors, like a bad option, file not found, etc 22 at least one expect FAILed, test bench has FAILed EEXXAAMMPPLLEESS aassmm--1111__eexxppeecctt **..llsstt Will check all listing files in the current directory and produce a listing with at least one summary line per file as described in section DESCRIPTION. SSEEEE AALLSSOO aassmm--1111(1) AAUUTTHHOORR Walter F.J. Mueller Retro Project 2018-11-03 ASM-11_EXPECT(1)