; test.eal ; ***************************************************** ; example test data for the EAL assembler ; Author: Douglas W. Jones, Jun. 10, 2003 V0.0 (MP0) ; Revised: Douglas W. Jones, Jun. 25, 2003 V1.0 (MP1) ; Revised: Douglas W. Jones, July 2, 2003 V2.2 (MP2) ; ***************************************************** ; demonstrate basic assembly notation B 12 ; decimal byte B #C ; hex byte W 528 ; decimal word W #210 ; hex word W 2#1011111011101111 ; binary word #V1.0# W 4#23323233 ; base 4 word #V1.0# W 8#137357 ; octal word #V1.0# W 32#1FNF ; base 32 word #V1.0# W LB ; use of a defined label LA: ; a label on a line by itself LB: W LA ; a label on the same line W LC ; use of something defined later LC = 32 ; a definition W LC ; use of that definition LC = 64 ; a redefinition W LC ; use of the redefinition ; verify that underline works in identifiers A_B = 1 W A_B ; demo parenthesized expression parsing and evaluation W 1 W 1+1 W (1+1) + 1 W (1) + ((1)+1) + 1 ; demonstrate other operators W (1) - (2-3) - 4 ; should be -2 or FFFE W (4) & (6&7) & 12 ; should be 4 W (1) | (2|4) | 8 ; should be 15 or 000F W 1 + 2 - 3 | 4 & 5 ; should be 4 ; demonstrate that it works in other contexts A_B = 1 + 2 - 3 | 4 & 5 W A_B ; demonstrate functions #V2.0# B DEF( 1 ) ; should output 1 #V2.0# B DEF( A_B ) ; should output 1 #V2.0# B DEF( A_B + 1 ) ; should output 1 #V2.0# B DEF( UNDEF ) ; should output 0 #V2.0# B DEF( 1 + UNDEF ) ; should output 0 #V2.0# B DEF(DEF( UNDEF )) ; should output 1 #V2.0# ; demonstrate conditional assembly #V2.0# IF 0 ; not assembled #V2.0# NOTanOP ; so no error #V2.0# LA: ENDIF ; #V2.0# B 3 ; does this #V2.0# IF 0 ; not assembled #V2.0# NOTanOP ; so no error #V2.0# LB: IF UNDER ; not evaluated #V2.0# NOTanOP ; so no error #V2.0# ELSE ; ignored #V2.1# NOTanOP ; so no error #V2.1# ENDIF ; ignored #V2.0# NOTanOP ; so no error #V2.0# ENDIF ; #V2.0# B 4 ; does this #V2.0# IF 1 ; assembled #V2.0# B 5 ; does this #V2.0# B 6 ; and this! #V2.0# ENDIF ; #V2.0# B 7 ; does this #V2.1# IF 1 ; assembled #V2.1# B 8 ; does this #V2.1# ELSE ; attended to #V2.1# IF UNDER ; not evaluated #V2.1# NOTanOP ; so no error #V2.1# ELSE ; ignored #V2.1# NOTanOP ; so no error #V2.1# ENDIF ; ignored #V2.1# NOTanOP ; ignored #V2.1# ENDIF ; #V2.1# B 9 ; does this #V2.2# IF 0 ; assembled #V2.2# NOTanOP ; ignored #V2.2# ELSE ; attended to #V2.2# B 10 ; does this #V2.2# ENDIF ; #V2.2# B 11 ; does this #V2.2# ; strange semantics that are a bit embarrassing #V2.2# ELSE ; not an error!! #V2.2# NOTanOP ; ignored #V2.2# ELSE ; not an error!! #V2.2# B 12 ; does this! #V2.2# ELSE ; not an error!! #V2.2# NOTanOP ; ignored #V2.2# ENDIF ; #V2.2# ENDIF ; not an error!! #V2.2# ; it would be a good idea to catch these errors #V2.2# ; demonstrate what happens to errors NOTanOP ; undefined opcode #V2.0# B # ; missing hex number #V1.0# B #0G ; illegal hex digit B 9876543210 ; number way too large B 345 ; number too large W 65536 ; number too large B 0#00 ; illegal radix #V1.0# B 37#00 ; illegal radix #V1.0# B 2#30 ; illegal digit #V1.0# B 2# ; missing number #V1.0# B UNDEF ; undefined operand A_B = UNDEF ; undefined operand in definition B A_B ; indirectly undefined operand B (1 ; missing paren B 1) ; extra paren B 1 + ; missing operand B 1 + QQ ; undefined operand in expression B quiddle( trump ) ; undefined function #V2.0# B DEF( LC ; missing paren #V2.0# IF 0 ; (not an error) #V2.1# ; missing endif #V2.1#