13. Original IIF tests for 0xA0, 0xA1, and 0xB1
# test_iif.int - test the inner interpreter opcodes for processing
# the content of an iif file.
#
# usage: ./interp -Nf DOC/SAMPLE_SCRIPTS/test_iif.int [a]
#
# optional parameters:
# a - will use "FA fA" as the auto-start string
#
# This script creates a memory image that contains (in order),
# one Global Function Record, one Local Function Record, and one
# End-of-Data record.
#
# The script will optionally use a canned auto-start string. Without this
# CLI option, autostart is not activated. With this CLI option
# autostart is also tested.
#
# EXAMPLE COMMAND LINES:
# 1. doesn't test auto-start
# ./interp -N -f DOC/SAMPLE_SCRIPTS/test_iif.int
# 2. also tests auto-start
# ./interp -N -f DOC/SAMPLE_SCRIPTS/test_iif.int a
#define IIFgfr=0xA1
#define IIFlfr=0xB1
#define IIFeodr=0xA0
#define IIFdata=0V
#define ARGC=24K
#define ARGV=25K
#define OPTIND=26K@
# create a GFR for function A with a body of "gfr A\n"
IIFgfr IIFdata b! __ Global Function Record
0x00 0x00 0x00 0x0B __ Length of name+body, stores LSB first
IIFdata 1+ b! IIFdata 2+ b! IIFdata 3+ b! IIFdata 4+ b!
'A IIFdata 5+ b! __ function name is "A"
IIFdata 6+ M"\"gfr A\\n\"" __ function body is "gfr A\n"
# create a LFR for function A with a body of "LFR A\n"
IIFlfr IIFdata 16+ b! __ Local Function Record
0x00 0x00 0x00 0x0B __ Length of name+body, stores LSB first
IIFdata 17+ b! IIFdata 18+ b! IIFdata 19+ b! IIFdata 20+ b!
'A IIFdata 21+ b! __ function name is "A"
IIFdata 22+ M"\"LFR A\\n\"" __function body is "LFR A\n"
#BUFFER
OPTIND ARGC >= if
__create a EODR without autostart
IIFeodr IIFdata 32+ b! __ End-of-Data Record
0x00 0x00 0x00 0x00 __ Length of auto-start string
IIFdata 33+ b! IIFdata 34+ b! IIFdata 35+ b! IIFdata 36+ b!
__put junk after the EODR
0xF2 0xF1 0xF0
IIFdata 37+ b! IIFdata 38+ b! IIFdata 39+ b!
else
__create a EODR with "FA fA" as the autostart string
IIFeodr IIFdata 32+ b! __ End-of-Data Record
0x00 0x00 0x00 0x06 __ Length of auto-start string
IIFdata 33+ b! IIFdata 34+ b! IIFdata 35+ b! IIFdata 36+ b!
IIFdata 37+ M"FA fA" __ auto-start string is "FA fA"
__put junk after the EODR
0xF2 0xF1 0xF0
IIFdata 43+ b! IIFdata 44+ b! IIFdata 45+ b!
endif
#EXECUTE
# execute the IIF data as a MEMORY-MACRO
IIFdata m@
#BUFFER
OPTIND ARGC >= if
dGA dLA
endif
#EXECUTE