# Shell archive made by dwjones on Tue Mar 26 05:56:56 PM CDT 2024 # To install this software on a UNIX system: # 1) create a directory (e.g. with the shell command mkdir stuff) # 2) change to that directory (e.g. with the command cd stuff), # 3) direct the remainder of this text to sh (e.g. sh < ../savedmail). # This will make sh create files in the new directory; it will do # nothing else (if you're paranoid, you should scan the following text # to verify this before you follow these directions). Then read README # in the new directory for additional instructions. cat > README <<\xxxxxxxxxx README FOR DEMO BIG PROJECT this project will demonstrate a stack to show how big programs can be managed TO BUILD THE PROJECT run make stackdemo see the makefile for the relationship between the project components xxxxxxxxxx cat > Makefile <<\xxxxxxxxxx # Makefile for the project demonstrating a stack # Make uses sh, not bash, so we need to install the hawk and hawklink commands; # these definitions are lifted from the aliases in .bashrc # (If you try to use this makefile on a different system, you will need # to change the file names to where hawk and hawklink are installed there.) smal=~dwjones/bin/smal32 -P 45 -U ~dwjones/lib/hawk hawklink=~dwjones/bin/hawklink ########## # primary make target stackdemo: main.o stack.o $(hawklink) -o stackdemo main.o stack.o ########## # other make targets main.o: main.a stack.h $(smal) main.a stack.o: stack.a stack.h $(smal) stack.a ########## # Make utilities # remove object and listing files clean: rm -f *.o *.l # create a shell archive of the project stackdemo.shar README Makefile main.a stack.a stack.h: shar README Makefile main.a stack.a stack.h > stackdemo.shar xxxxxxxxxx cat > main.a <<\xxxxxxxxxx TITLE "main.a -- main program to demo stacks" USE "hawk.h" USE "stdio.h" USE "stack.h" INT MAIN S MAIN ; AR for main program ;RETAD = 0 ARSIZE = 4 MAIN: STORES R1,R2 ADDSI R2,ARSIZE LEA R3,TEXTB ; -- parameter LIL R1,PUSH JSRS R1,R1 ; push( textb ) LEA R3,TEXTA ; -- parameter LIL R1,PUSH JSRS R1,R1 ; push( texta ) LIL R1,POP JSRS R1,R1 ; -- parameter pop() LIL R1,PUTSTR JSRS R1,R1 ; putstr( pop() ) -- texta = hello LIL R1,POP JSRS R1,R1 ; -- parameter pop() LIL R1,PUTSTR JSRS R1,R1 ; putstr( pop() ) -- textb = world ADDSI R2,-ARSIZE LOADS PC,R2 TEXTA: ASCII "hello ",0 TEXTB: ASCII "world",0 END xxxxxxxxxx cat > stack.a <<\xxxxxxxxxx TITLE "stack.a -- placeholder for missing code" xxxxxxxxxx cat > stack.h <<\xxxxxxxxxx ; stack.h ; definitions used by all users of stacks EXT PUSH ; push a word on the stack ; given R3 -- word to push ; returns nothing ; wipes out R3-R7 EXT POP ; pop a word from the stack ; given nothing ; returns R3 -- a word popped from the stack ; wipes out R4-R7 xxxxxxxxxx