MatrixBrandy-1.22.13/build/0000775000175000017500000000000014160662532014462 5ustar soruksorukMatrixBrandy-1.22.13/build/depends.mk0000664000175000017500000001407414154511575016446 0ustar soruksorukDEPCOMMON = $(SRCDIR)/common.h \ $(SRCDIR)/target.h \ $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h # Build VARIABLES.C VARIABLES_C = $(DEPCOMMON) \ $(SRCDIR)/variables.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/evaluate.h \ $(SRCDIR)/tokens.h \ $(SRCDIR)/stack.h \ $(SRCDIR)/heap.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/lvalue.h $(SRCDIR)/variables.o: $(VARIABLES_C) # Build TOKENS.C TOKENS_C = $(DEPCOMMON) \ $(SRCDIR)/tokens.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/convert.h $(SRCDIR)/tokens.o: $(TOKENS_C) # Build GRAPHSDL.C GSDL_C = $(DEPCOMMON) \ $(SRCDIR)/scrcommon.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/mos.h \ $(SRCDIR)/graphsdl.h \ $(SRCDIR)/textfonts.h \ $(SRCDIR)/keyboard.h \ $(SRCDIR)/iostate.h $(SRCDIR)/graphsdl.o: $(GSDL_C) # Build STRINGS.C STRINGS_C = $(DEPCOMMON) \ $(SRCDIR)/strings.h \ $(SRCDIR)/heap.h $(SRCDIR)/strings.o: $(STRINGS_C) # Build STATEMENT.C STATEMENT_C = $(DEPCOMMON) \ $(SRCDIR)/tokens.h \ $(SRCDIR)/commands.h \ $(SRCDIR)/stack.h \ $(SRCDIR)/heap.h \ $(SRCDIR)/editor.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/variables.h \ $(SRCDIR)/evaluate.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/fileio.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/iostate.h \ $(SRCDIR)/mainstate.h \ $(SRCDIR)/assign.h \ $(SRCDIR)/statement.h \ $(SRCDIR)/keyboard.h $(SRCDIR)/statement.o: $(STATEMENT_C) # Build STACK.C STACK_C = $(DEPCOMMON) \ $(SRCDIR)/stack.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/tokens.h $(SRCDIR)/stack.o: $(STACK_C) # Build MISCPROCS.C MISCPROCS_C = $(DEPCOMMON) \ $(SRCDIR)/tokens.h \ $(SRCDIR)/keyboard.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/miscprocs.o: $(MISCPROCS_C) # Build MAINSTATE.C MAINSTATE_C = $(DEPCOMMON) \ $(SRCDIR)/tokens.h \ $(SRCDIR)/variables.h \ $(SRCDIR)/stack.h \ $(SRCDIR)/heap.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/statement.h \ $(SRCDIR)/evaluate.h \ $(SRCDIR)/convert.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/editor.h \ $(SRCDIR)/mos.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/lvalue.h \ $(SRCDIR)/fileio.h \ $(SRCDIR)/mainstate.h $(SRCDIR)/mainstate.o: $(MAINSTATE_C) # Build LVALUE.C LVALUE_C = $(DEPCOMMON) \ $(SRCDIR)/tokens.h \ $(SRCDIR)/evaluate.h \ $(SRCDIR)/stack.h \ $(SRCDIR)/variables.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/lvalue.h $(SRCDIR)/lvalue.o: $(LVALUE_C) # Build KEYBOARD.C KEYBOARD_C = $(DEPCOMMON) \ $(SRCDIR)/screen.h \ $(SRCDIR)/keyboard.h \ $(SRCDIR)/inkey.h \ $(SRCDIR)/mos.h $(SRCDIR)/keyboard.o: $(KEYBOARD_C) # Build IOSTATE.C IOSTATE_C = $(DEPCOMMON) \ $(SRCDIR)/tokens.h \ $(SRCDIR)/stack.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/evaluate.h \ $(SRCDIR)/convert.h \ $(SRCDIR)/mos.h \ $(SRCDIR)/fileio.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/lvalue.h \ $(SRCDIR)/statement.h \ $(SRCDIR)/iostate.h $(SRCDIR)/iostate.o: $(IOSTATE_C) # Build HEAP.C HEAP_C = $(DEPCOMMON) \ $(SRCDIR)/heap.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/heap.o: $(HEAP_C) # Build FUNCTIONS.C FUNCTIONS_C = $(DEPCOMMON) \ $(SRCDIR)/tokens.h \ $(SRCDIR)/variables.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/convert.h \ $(SRCDIR)/stack.h \ $(SRCDIR)/evaluate.h \ $(SRCDIR)/keyboard.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/mos.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/fileio.h \ $(SRCDIR)/functions.h \ $(SRCDIR)/mos_sys.h $(SRCDIR)/functions.o: $(FUNCTIONS_C) # Build FILEIO.C FILEIO_C = $(DEPCOMMON) \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/fileio.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/net.h \ $(SRCDIR)/keyboard.h $(SRCDIR)/fileio.o: $(FILEIO_C) # Build NET.C NET_C = $(DEPCOMMON) $(SRCDIR)/net.h $(SRCDIR)/net.o: $(NET_C) # Build EVALUATE.C EVALUATE_C = $(DEPCOMMON) \ $(SRCDIR)/tokens.h \ $(SRCDIR)/variables.h \ $(SRCDIR)/lvalue.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/stack.h \ $(SRCDIR)/evaluate.h \ $(SRCDIR)/statement.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/functions.h $(SRCDIR)/evaluate.o: $(EVALUATE_C) # Build ERRORS.C ERRORS_C = $(DEPCOMMON) \ $(SRCDIR)/stack.h \ $(SRCDIR)/fileio.h \ $(SRCDIR)/tokens.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/keyboard.h \ $(SRCDIR)/graphsdl.h $(SRCDIR)/errors.o: $(ERRORS_C) # Build MOS.C MOS_C = $(DEPCOMMON) \ $(SRCDIR)/mos.h \ $(SRCDIR)/mos_sys.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/keyboard.h \ $(SRCDIR)/graphsdl.h \ $(SRCDIR)/soundsdl.h $(SRCDIR)/mos.o: $(MOS_C) # Build MOS_SYS.C MOS_SYS_C = $(DEPCOMMON) \ $(SRCDIR)/mos.h \ $(SRCDIR)/mos_sys.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/keyboard.h \ $(SRCDIR)/graphsdl.h $(SRCDIR)/mos_sys.o: $(MOS_SYS_C) # Build EDITOR.C EDITOR_C = $(DEPCOMMON) \ $(SRCDIR)/variables.h \ $(SRCDIR)/heap.h \ $(SRCDIR)/tokens.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/stack.h \ $(SRCDIR)/fileio.h $(SRCDIR)/editor.o: $(EDITOR_C) # Build CONVERT.C CONVERT_C = $(DEPCOMMON) \ $(SRCDIR)/convert.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/convert.o: $(CONVERT_C) # Build COMMANDS.C COMMANDS_C = $(DEPCOMMON) \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/tokens.h \ $(SRCDIR)/statement.h \ $(SRCDIR)/variables.h \ $(SRCDIR)/editor.h \ $(SRCDIR)/heap.h \ $(SRCDIR)/stack.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/evaluate.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/keyboard.h $(SRCDIR)/commands.o: $(COMMANDS_C) # Build BRANDY.C BRANDY_C = $(DEPCOMMON) \ $(SRCDIR)/tokens.h \ $(SRCDIR)/heap.h \ $(SRCDIR)/editor.h \ $(SRCDIR)/commands.h \ $(SRCDIR)/statement.h \ $(SRCDIR)/fileio.h \ $(SRCDIR)/mos.h \ $(SRCDIR)/keyboard.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/evaluate.h \ $(SRCDIR)/net.h $(SRCDIR)/brandy.o: $(BRANDY_C) # Build ASSIGN.C ASSIGN_C = $(DEPCOMMON) \ $(SRCDIR)/tokens.h \ $(SRCDIR)/heap.h \ $(SRCDIR)/stack.h \ $(SRCDIR)/strings.h \ $(SRCDIR)/variables.h \ $(SRCDIR)/miscprocs.h \ $(SRCDIR)/editor.h \ $(SRCDIR)/evaluate.h \ $(SRCDIR)/lvalue.h \ $(SRCDIR)/statement.h \ $(SRCDIR)/assign.h \ $(SRCDIR)/fileio.h \ $(SRCDIR)/mos.h \ $(SRCDIR)/graphsdl.h $(SRCDIR)/assign.o: $(ASSIGN_C) # Build TEXTONLY.C TEXTONLY_C = $(DEPCOMMON) \ $(SRCDIR)/scrcommon.h \ $(SRCDIR)/screen.h \ $(SRCDIR)/keyboard.h \ $(SRCDIR)/iostate.h $(SRCDIR)/textonly.o: $(TEXTONLY_C) # Build SIMPLETEXT.C $(SRCDIR)/simpletext.o: $(TEXTONLY_C) MatrixBrandy-1.22.13/build/makefile.app0000664000175000017500000000373314022414626016743 0ustar soruksoruk# Makefile for brandy under NetBSD and Linux # This makefile builds a static library, brandyapp.a. # Use the following to generate your app.o: # ld -r -b binary app -o app.o # where 'app' is the name of the BASIC program. # Since 'ld' uses the source name (app) to build its symbol table, # the code has to assume the name "app" - so copy it first! # Then, you can build your standalone app with: # gcc -o yourapp app.o /path/to/brandyapp.a -lX11 -lm -lSDL CC = gcc LD = gcc AR = ar include build/git.mk #CFLAGS = -g -DDEBUG -I/usr/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall -DBRANDYAPP $(GITFLAGS) #CFLAGS = -g -I/usr/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall -DBRANDYAPP $(GITFLAGS) CFLAGS = -O2 -I/usr/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall -DBRANDYAPP $(GITFLAGS) LDFLAGS += LIBS = -lX11 -lm -lSDL SRCDIR = src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/graphsdl.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/graphsdl.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c brandyapp.a: $(OBJ) $(AR) rcs brandyapp.a $(OBJ) include build/depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ clean: rm -f $(SRCDIR)/*.o brandyapp.a all: brandyapp.a MatrixBrandy-1.22.13/build/mkRISCOS.oby0000664000175000017500000000052714022414626016527 0ustar soruksoruk| Make Brandy Basic for RISC OS with GCC compiler | | This worked with Banana Brandy, now fails with Matrix Brandy | Echo WimpSlot -min 4000K Dir .^.riscos Spool listing /GCCbin:make -f ^.build.makeROgcc nodebug Spool SetType listing Text IfThere brandy Then Delete listing IfThere brandy Then Copy brandy ^.binaries.brandyRO ~CDF~V MatrixBrandy-1.22.13/build/git.mk0000664000175000017500000000063314022414626015574 0ustar soruksorukgitcommit=\""$(shell git log --abbrev-commit -1 2>/dev/null| head -1 |cut -d ' ' -f 2)"\" ifeq ($(gitcommit),\"""\") GITFLAGS = else gitbranch=\""$(shell git status | head -1 | rev | cut -d ' ' -f 1 | rev)"\" gitdate=\""$(shell git log --abbrev-commit -1 | grep 'Date:' | cut -d ' ' -f 4-9)"\" GITFLAGS = -DBRANDY_GITCOMMIT=$(gitcommit) -DBRANDY_GITBRANCH=$(gitbranch) -DBRANDY_GITDATE=$(gitdate) endif MatrixBrandy-1.22.13/build/makeROgcc.txt0000664000175000017500000001252414022414626017056 0ustar soruksoruk# Makefile for brandy under RISC OS using GCC CC = gcc LD = ld CFLAGS1 = -c -DDEBUG CFLAGS2 = -c LDFLAGS1 = LDFLAGS2 = LIBS = gcclib:unixlib gcclib:libscl gcclib:libgcc OBJ = o.variables o.tokens o.riscos o.strings o.statement\ o.stack o.miscprocs o.mainstate o.lvalue o.keyboard o.iostate\ o.heap o.functions o.fileio o.evaluate o.errors o.mos o.editor\ o.convert o.commands o.assign o.brandy SRC = c.variables c.tokens c.riscos c.strings c.statement\ c.stack c.miscprocs c.mainstate c.lvalue c.keyboard c.iostate\ c.heap c.functions c.fileio c.evaluate c.errors c.mos c.editor\ c.convert c.commands c.assign c.brandy brandy: $(OBJ) $(LD) $(LDFLAGS1) $(OBJ) $(LIBS) -o brandy # Build VARIABLES.C VARIABLES_C = h.common h.target h.basicdefs\ h.variables h.evaluate h.tokens\ h.stack h.heap h.errors\ h.miscprocs h.screen h.lvalue o.variables: $(VARIABLES_C) c.variables $(CC) $(CFLAGS1) c.variables # Build TOKENS.C TOKENS_C = h.common h.target h.basicdefs\ h.tokens h.miscprocs h.convert\ h.errors o.tokens: $(TOKENS_C) c.tokens $(CC) $(CFLAGS1) c.tokens # Build RISCOS.C RISCOS_C = h.common h.target h.basicdefs\ h.errors h.scrcommon h.screen\ h.keyboard o.riscos: $(RISCOS_C) c.riscos $(CC) $(CFLAGS1) c.riscos # Build STRINGS.C STRINGS_C = h.common h.target h.basicdefs\ h.strings h.heap h.errors o.strings: $(STRINGS_C) c.strings $(CC) $(CFLAGS1) c.strings # Build STATEMENT.C STATEMENT_C = h.common h.target h.basicdefs\ h.tokens h.commands h.stack\ h.heap h.errors h.editor\ h.miscprocs h.variables h.evaluate\ h.screen h.fileio h.strings\ h.iostate h.mainstate h.assign\ h.statement o.statement: $(STATEMENT_C) c.statement $(CC) $(CFLAGS1) c.statement # Build STACK.C STACK_C = h.common h.target h.basicdefs\ h.stack h.miscprocs h.strings\ h.tokens h.errors o.stack: $(STACK_C) c.stack $(CC) $(CFLAGS1) c.stack # Build MISCPROCS.C MISCPROCS_C = h.common h.target h.basicdefs\ h.tokens h.errors h.keyboard\ h.screen h.miscprocs o.miscprocs: $(MISCPROCS_C) c.miscprocs $(CC) $(CFLAGS1) c.miscprocs # Build MAINSTATE.C MAINSTATE_C = h.common h.target h.basicdefs\ h.tokens h.variables h.stack\ h.heap h.strings h.errors\ h.statement h.evaluate h.convert\ h.miscprocs h.editor h.mos\ h.screen h.lvalue h.fileio\ h.mainstate o.mainstate: $(MAINSTATE_C) c.mainstate $(CC) $(CFLAGS1) c.mainstate # Build LVALUE.C LVALUE_C = h.common h.target h.basicdefs\ h.tokens h.evaluate h.stack\ h.errors h.variables h.miscprocs\ h.lvalue o.lvalue: $(LVALUE_C) c.lvalue $(CC) $(CFLAGS1) c.lvalue # Build KEYBOARD.C KEYBOARD_C = h.common h.target h.basicdefs\ h.errors h.keyboard h.screen o.keyboard: $(KEYBOARD_C) c.keyboard $(CC) $(CFLAGS1) c.keyboard # Build IOSTATE.C IOSTATE_C = h.common h.target h.basicdefs\ h.tokens h.stack h.strings\ h.errors h.miscprocs h.evaluate\ h.convert h.mos h.fileio\ h.screen h.lvalue h.statement\ h.iostate o.iostate: $(IOSTATE_C) c.iostate $(CC) $(CFLAGS1) c.iostate # Build HEAP.C HEAP_C = h.common h.target h.basicdefs\ h.heap h.target h.errors\ h.miscprocs o.heap: $(HEAP_C) c.heap $(CC) $(CFLAGS1) c.heap # Build FUNCTIONS.C FUNCTIONS_C = h.common h.target h.basicdefs\ h.tokens h.variables h.strings\ h.convert h.stack h.errors\ h.evaluate h.keyboard h.screen\ h.mos h.miscprocs h.fileio\ h.functions o.functions: $(FUNCTIONS_C) c.functions $(CC) $(CFLAGS1) c.functions # Build FILEIO.C FILEIO_C = h.common h.target h.basicdefs\ h.errors h.fileio h.strings o.fileio: $(FILEIO_C) c.fileio $(CC) $(CFLAGS1) c.fileio # Build EVALUATE.C EVALUATE_C = h.common h.target h.basicdefs\ h.tokens h.variables h.lvalue\ h.strings h.stack h.errors\ h.evaluate h.statement h.miscprocs\ h.functions o.evaluate: $(EVALUATE_C) c.evaluate $(CC) $(CFLAGS1) c.evaluate # Build ERRORS.C ERRORS_C = h.common h.target h.basicdefs\ h.errors h.stack h.fileio h.keyboard\ h.tokens h.screen h.miscprocs o.errors: $(ERRORS_C) c.errors $(CC) $(CFLAGS1) c.errors # Build MOS.C MOS_C = h.common h.target h.errors\ h.basicdefs h.target h.mos\ h.screen o.mos: $(MOS_C) c.mos $(CC) $(CFLAGS1) c.mos # Build EDITOR.C EDITOR_C = h.common h.target h.basicdefs\ h.errors h.variables h.heap\ h.tokens h.strings h.miscprocs\ h.stack h.fileio o.editor: $(EDITOR_C) c.editor $(CC) $(CFLAGS1) c.editor # Build CONVERT.C CONVERT_C = h.common h.target h.basicdefs\ h.convert h.errors h.miscprocs o.convert: $(CONVERT_C) c.convert $(CC) $(CFLAGS1) c.convert # Build COMMANDS.C COMMANDS_C = h.common h.target h.basicdefs\ h.miscprocs h.tokens h.statement\ h.variables h.editor h.errors\ h.heap h.stack h.strings\ h.evaluate h.screen h.keyboard o.commands: $(COMMANDS_C) c.commands $(CC) $(CFLAGS1) c.commands # Build ASSIGN.C ASSIGN_C = h.common h.target h.basicdefs\ h.target h.tokens h.heap\ h.stack h.strings h.variables\ h.errors h.miscprocs h.editor\ h.evaluate h.lvalue h.statement\ h.assign h.fileio h.mos o.assign: $(ASSIGN_C) c.assign $(CC) $(CFLAGS1) c.assign # Build BRANDY.C BRANDY_C = h.common h.target h.basicdefs\ h.tokens h.errors h.heap\ h.editor h.commands h.statement\ h.fileio h.mos h.keyboard\ h.screen h.miscprocs o.brandy: $(BRANDY_C) c.brandy $(CC) $(CFLAGS1) c.brandy recompile: $(CC) $(CFLAGS1) $(SRC) $(LD) $(LDFLAGS1) $(OBJ) $(LIBS) -o brandy clean: wipe o.* ~CF~R~V wipe brandy ~CF~R~V wipe map ~CF~R~V nodebug: $(CC) $(CFLAGS2) $(SRC) $(LD) $(LDFLAGS2) $(OBJ) $(LIBS) -o brandy all: brandy MatrixBrandy-1.22.13/build/setRISCOS.oby0000664000175000017500000000012414022414626016704 0ustar soruksorukDir If "" = "" Then Filer_Run $.Apps.Programer.CandC++.GCC.!gcc MatrixBrandy-1.22.13/build/makefile.app.mingw-sdl0000664000175000017500000000412614022414626020640 0ustar soruksoruk# Makefile for Brandy under Windows x86 with MinGW using Cygwin as the # toolchain CC = i686-w64-mingw32-gcc LD = i686-w64-mingw32-gcc include git.mk #CFLAGS = -g -DDEBUG -I/usr/i686-w64-mingw32/sys-root/mingw/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall -DBRANDYAPP $(GITFLAGS) #CFLAGS = -g -I/usr/i686-w64-mingw32/sys-root/mingw/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall -DBRANDYAPP $(GITFLAGS) CFLAGS = -O2 -I/usr/i686-w64-mingw32/sys-root/mingw/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall -DBRANDYAPP $(GITFLAGS) LDFLAGS += LIBS = -lm /usr/i686-w64-mingw32/sys-root/mingw/lib/libSDL.a -lws2_32 -mwindows /usr/i686-w64-mingw32/sys-root/mingw/lib/libdxguid.a /usr/i686-w64-mingw32/sys-root/mingw/lib/libwinmm.a SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/graphsdl.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o \ $(SRCDIR)/app.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/graphsdl.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c brandyapp: $(OBJ) $(LD) $(LDFLAGS) -o brandyapp $(OBJ) $(LIBS) include depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ recompile: $(CC) $(CFLAGS) $(SRC) $(LIBS) -o brandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -o brandy strip brandyapp.exe check: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(LIBS) -o brandyapp clean: rm -f $(SRCDIR)/*.o brandyapp.exe all: brandyapp MatrixBrandy-1.22.13/build/CopyToRO,ffb0000664000175000017500000000142514022414626016613 0ustar soruksoruk  > CopyToRO . Copy source files into RISC OS structure  SetType to BASIC and run (: 2ș "OS_GetEnv" path$ <+path$=path$,path$," ",1+path$," "))) Fpath$=path$,3, path$-4) P/ȕ path$,1)<>".":path$=path$, path$-1): Zpath$=path$, path$-1) d/ȕ path$,1)<>".":path$=path$, path$-1): n"CDir "+path$+"riscos" x"CDir "+path$+"riscos.c" "CDir "+path$+"riscos.h" "CDir "+path$+"riscos.o"  ctrl% 31:idx%=0  ? ș "OS_GBPB",9,path$+"src",ctrl%,1,idx%,32 ,,,ret%,idx%  ret%=1 2 ctrl%?31=13:f$=$ctrl%:f$=f$,f$+0,0)-1)  f$, f$-1,1)="/"  f$; " c$=f$,1):f$=f$, f$-2) P "Copy "+path$+"src."+f$+"/"+c$+" "+path$+"riscos."+c$+"."+f$+" ~CF~V"   ret%=0  MatrixBrandy-1.22.13/build/makefile.macosx.text0000664000175000017500000000451314022414626020435 0ustar soruksoruk# Makefile for brandy in text mode under NetBSD and Linux CC = gcc LD = gcc STRIP = strip ADDFLAGS = ${BRANDY_BUILD_FLAGS} include build/git.mk #CFLAGS = -g -DDEBUG -I/usr/include/SDL -DNO_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) $(ADDFLAGS) #CFLAGS = -g -I/usr/include/SDL -DNO_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) $(ADDFLAGS) CFLAGS = -O3 -I/usr/include/SDL -DNO_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) $(ADDFLAGS) LDFLAGS = LIBS = -lm -ldl -lpthread SRCDIR = src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o TEXTONLYOBJ = $(SRCDIR)/textonly.o SIMPLETEXTOBJ = $(SRCDIR)/simpletext.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c TEXTONLYSRC = $(SRCDIR)/textonly.c SIMPLETEXTSRC = $(SRCDIR)/simpletext.c all: tbrandy sbrandy tbrandy: $(OBJ) $(TEXTONLYOBJ) $(LD) $(LDFLAGS) -o tbrandy $(OBJ) $(TEXTONLYOBJ) $(LIBS) sbrandy: $(OBJ) $(SIMPLETEXTOBJ) $(LD) $(LDFLAGS) -o sbrandy $(OBJ) $(SIMPLETEXTOBJ) $(LIBS) include build/depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ trecompile: $(CC) $(CFLAGS) $(SRC) $(TEXTONLYSRC) $(LIBS) -o tbrandy srecompile: $(CC) $(CFLAGS) $(SRC) $(SIMPLETEXTSRC) $(LIBS) -o sbrandy tnodebug: $(CC) $(CFLAGS2) $(SRC) $(TEXTONLYSRC) $(LIBS) -o tbrandy $(STRIP) tbrandy snodebug: $(CC) $(CFLAGS2) $(SRC) $(SIMPLETEXTSRC) $(LIBS) -o sbrandy $(STRIP) sbrandy tcheck: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(TEXTONLYSRC) $(LIBS) -o tbrandy scheck: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(SIMPLETEXTSRC) $(LIBS) -o sbrandy clean: rm -f $(SRCDIR)/*.o tbrandy sbrandy MatrixBrandy-1.22.13/build/makefile.riscos0000664000175000017500000001273414022414626017466 0ustar soruksoruk# Makefile for brandy under RISC OS (using Norcroft tools) CC = cc LD = link CFLAGS = -c -Wc -IC: -g -throwback -DDEBUG CFLAGS2 = -c -Wc -IC: -throwback LDFLAGS = -debug LIBS = C:o.stubs OBJ = variables.o tokens.o riscos.o strings.o statement.o \ stack.o miscprocs.o mainstate.o lvalue.o keyboard.o iostate.o \ heap.o functions.o fileio.o evaluate.o errors.o emulate.o editor.o \ convert.o commands.o brandy.o assign.o SRC = variables.c tokens.c riscos.c strings.c statement.c \ stack.c miscprocs.c mainstate.c lvalue.c keyboard.c iostate.c \ heap.c functions.c fileio.c evaluate.c errors.c emulate.c editor.c \ convert.c commands.c brandy.c assign.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) # Build VARIABLES.C VARIABLES_C = common.h target.h basicdefs.h \ variables.h evaluate.h tokens.h \ stack.h heap.h errors.h \ miscprocs.h screen.h lvalue.h variables.o: $(VARIABLES_C) variables.c $(CC) $(CFLAGS) variables.c # Build TOKENS.C TOKENS_C = common.h target.h basicdefs.h \ tokens.h miscprocs.h convert.h \ errors.h tokens.o: $(TOKENS_C) tokens.c $(CC) $(CFLAGS) tokens.c # Build RISCOS.C RISCOS_C = common.h target.h basicdefs.h \ errors.h scrcommon.h screen.h \ keyboard.h riscos.o: $(RISCOS_C) riscos.c $(CC) $(CFLAGS) riscos.c # Build STRINGS.C STRINGS_C = common.h target.h basicdefs.h \ strings.h heap.h errors.h strings.o: $(STRINGS_C) strings.c $(CC) $(CFLAGS) strings.c # Build STATEMENT.C STATEMENT_C = common.h target.h basicdefs.h \ tokens.h commands.h stack.h \ heap.h errors.h editor.h \ miscprocs.h variables.h evaluate.h \ screen.h fileio.h strings.h \ iostate.h mainstate.h assign.h \ statement.h statement.o: $(STATEMENT_C) statement.c $(CC) $(CFLAGS) statement.c # Build STACK.C STACK_C = common.h target.h basicdefs.h \ stack.h miscprocs.h strings.h \ tokens.h errors.h stack.o: $(STACK_C) stack.c $(CC) $(CFLAGS) stack.c # Build MISCPROCS.C MISCPROCS_C = common.h target.h basicdefs.h \ tokens.h errors.h keyboard.h \ screen.h miscprocs.h miscprocs.o: $(MISCPROCS_C) miscprocs.c $(CC) $(CFLAGS) miscprocs.c # Build MAINSTATE.C MAINSTATE_C = common.h target.h basicdefs.h \ tokens.h variables.h stack.h \ heap.h strings.h errors.h \ statement.h evaluate.h convert.h \ miscprocs.h editor.h emulate.h \ screen.h lvalue.h fileio.h \ mainstate.h mainstate.o: $(MAINSTATE_C) mainstate.c $(CC) $(CFLAGS) mainstate.c # Build LVALUE.C LVALUE_C = common.h target.h basicdefs.h \ tokens.h evaluate.h stack.h \ errors.h variables.h miscprocs.h \ lvalue.h lvalue.o: $(LVALUE_C) lvalue.c $(CC) $(CFLAGS) lvalue.c # Build KEYBOARD.C KEYBOARD_C = common.h target.h basicdefs.h \ errors.h keyboard.h screen.h keyboard.o: $(KEYBOARD_C) keyboard.c $(CC) $(CFLAGS) keyboard.c # Build IOSTATE.C IOSTATE_C = common.h target.h basicdefs.h \ tokens.h stack.h strings.h \ errors.h miscprocs.h evaluate.h \ convert.h emulate.h fileio.h \ screen.h lvalue.h statement.h \ iostate.h iostate.o: $(IOSTATE_C) iostate.c $(CC) $(CFLAGS) iostate.c # Build HEAP.C HEAP_C = common.h target.h basicdefs.h \ heap.h target.h errors.h \ miscprocs.h heap.o: $(HEAP_C) heap.c $(CC) $(CFLAGS) heap.c # Build FUNCTIONS.C FUNCTIONS_C = common.h target.h basicdefs.h \ tokens.h variables.h strings.h \ convert.h stack.h errors.h \ evaluate.h keyboard.h screen.h \ emulate.h miscprocs.h fileio.h \ functions.h functions.o: $(FUNCTIONS_C) functions.c $(CC) $(CFLAGS) functions.c # Build FILEIO.C FILEIO_C = common.h target.h basicdefs.h \ errors.h fileio.h strings.h fileio.o: $(FILEIO_C) fileio.c $(CC) $(CFLAGS) fileio.c # Build EVALUATE.C EVALUATE_C = common.h target.h basicdefs.h \ tokens.h variables.h lvalue.h \ strings.h stack.h errors.h \ evaluate.h statement.h miscprocs.h \ functions.h evaluate.o: $(EVALUATE_C) evaluate.c $(CC) $(CFLAGS) evaluate.c # Build ERRORS.C ERRORS_C = common.h target.h basicdefs.h \ errors.h stack.h fileio.h keyboard.h \ tokens.h screen.h miscprocs.h errors.o: $(ERRORS_C) errors.c $(CC) $(CFLAGS) errors.c # Build EMULATE.C EMULATE_C = common.h target.h errors.h \ basicdefs.h target.h emulate.h \ screen.h emulate.o: $(EMULATE_C) emulate.c $(CC) $(CFLAGS) emulate.c # Build EDITOR.C EDITOR_C = common.h target.h basicdefs.h \ errors.h variables.h heap.h \ tokens.h strings.h miscprocs.h \ stack.h fileio.h editor.o: $(EDITOR_C) editor.c $(CC) $(CFLAGS) editor.c # Build CONVERT.C CONVERT_C = common.h target.h basicdefs.h \ convert.h errors.h miscprocs.h convert.o: $(CONVERT_C) convert.c $(CC) $(CFLAGS) convert.c # Build COMMANDS.C COMMANDS_C = common.h target.h basicdefs.h \ miscprocs.h tokens.h statement.h \ variables.h editor.h errors.h \ heap.h stack.h strings.h \ evaluate.h screen.h keyboard.h commands.o: $(COMMANDS_C) commands.c $(CC) $(CFLAGS) commands.c # Build BRANDY.C BRANDY_C = common.h target.h basicdefs.h \ tokens.h errors.h heap.h \ editor.h commands.h statement.h \ fileio.h emulate.h keyboard.h \ screen.h miscprocs.h brandy.o: $(BRANDY_C) brandy.c $(CC) $(CFLAGS) brandy.c # Build ASSIGN.C ASSIGN_C = common.h target.h basicdefs.h \ target.h tokens.h heap.h \ stack.h strings.h variables.h \ errors.h miscprocs.h editor.h \ evaluate.h lvalue.h statement.h \ assign.h fileio.h emulate.h assign.o: $(ASSIGN_C) assign.c $(CC) $(CFLAGS) assign.c recompile: $(CC) $(CFLAGS) $(SRC) $(LD) $(LDFLAGS) $(OBJ) $(LIBS) -o brandy clean: wipe o.* ~CF~R~V wipe brandy ~CF~R~V wipe map ~CF~R~V nodebug: $(CC) $(CFLAGS2) $(SRC) $(LD) $(OBJ) $(LIBS) -o brandy -sym map squeeze brandy all: brandy MatrixBrandy-1.22.13/build/makefile0000664000175000017500000000351014160662532016161 0ustar soruksoruk# Makefile for Brandy under NetBSD and Linux CC = gcc LD = gcc include git.mk #CFLAGS = -g -DDEBUG -I/usr/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) #CFLAGS = -g -I/usr/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) CFLAGS = -O2 -I/usr/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) LDFLAGS += LIBS = -lX11 -lm -lSDL SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/graphsdl.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/soundsdl.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/graphsdl.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/soundsdl.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) include depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ recompile: $(CC) $(CFLAGS) $(SRC) $(LIBS) -o brandy cp -f brandy ../binaries/brandy rm -f brandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -o brandy strip brandy cp -f brandy ../binaries/brandy rm -f brandy check: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(LIBS) -o brandy clean: rm -f $(SRCDIR)/*.o brandy all: brandy MatrixBrandy-1.22.13/build/makefile.text0000664000175000017500000000433414160662532017151 0ustar soruksoruk# Makefile for Brandy in text mode under NetBSD and Linux CC = gcc LD = gcc include git.mk #CFLAGS = -g -DDEBUG -I/usr/include/SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) #CFLAGS = -g -I/usr/include/SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) CFLAGS = -O2 -I/usr/include/SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) LDFLAGS += LIBS = -lm SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o TEXTONLYOBJ = $(SRCDIR)/textonly.o SIMPLETEXTOBJ = $(SRCDIR)/simpletext.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c TEXTONLYSRC = $(SRCDIR)/textonly.c SIMPLETEXTSRC = $(SRCDIR)/simpletext.c all: tbrandy sbrandy tbrandy: $(OBJ) $(TEXTONLYOBJ) $(LD) $(LDFLAGS) -o tbrandy $(OBJ) $(TEXTONLYOBJ) $(LIBS) sbrandy: $(OBJ) $(SIMPLETEXTOBJ) $(LD) $(LDFLAGS) -o sbrandy $(OBJ) $(SIMPLETEXTOBJ) $(LIBS) include depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ trecompile: $(CC) $(CFLAGS) $(SRC) $(TEXTONLYSRC) $(LIBS) -o tbrandy echo tbrandy srecompile: $(CC) $(CFLAGS) $(SRC) $(SIMPLETEXTSRC) $(LIBS) -o sbrandy echo sbrandy tnodebug: $(CC) $(CFLAGS2) $(SRC) $(TEXTONLYSRC) $(LIBS) -o tbrandy strip tbrandy snodebug: $(CC) $(CFLAGS2) $(SRC) $(SIMPLETEXTSRC) $(LIBS) -o sbrandy strip sbrandy tcheck: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(TEXTONLYSRC) $(LIBS) -o tbrandy scheck: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(SIMPLETEXTSRC) $(LIBS) -o sbrandy clean: rm -f $(SRCDIR)/*.o tbrandy sbrandy MatrixBrandy-1.22.13/build/makefile.mingw-sdlKBD0000664000175000017500000000406214160662532020405 0ustar soruksoruk# Makefile for brandy under Windows x86 with MinGW using Cygwin as the # toolchain CC = gcc LD = gcc #CFLAGS += -g -DDEBUG -I/usr/include/SDL -DUSE_SDL -DUSE_SDL_SOUND -DDEFAULT_IGNORE CFLAGS = -IC:/Apps/Programming/TDM-GCC-32/include/SDL12 -O2 -DUSE_SDL -DDEFAULT_IGNORE -DNONET -DBODGESDL -Wall CFLAGS2 = -IC:/Apps/Programming/TDM-GCC-32/include/SDL12 -O2 -DUSE_SDL -DDEFAULT_IGNORE -DNONET -DBODGESDL -w LDFLAGS += #LIBS = -lm C:/Apps/Programming/TDM-GCC-32/SDL12/lib/libSDL.a -lws2_32 -mwindows C:/Apps/Programming/TDM-GCC-32/SDL12/lib/libdxguid.a C:/Apps/Programming/TDM-GCC-32/SDL12/lib/libwinmm.a LIBS = -lm C:/Apps/Programming/TDM-GCC-32/lib/SDL12/libSDL.dll.a SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/graphsdl.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/soundsdl.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/graphsdl.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/soundsdl.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) include depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ recompile: $(CC) $(CFLAGS) $(SRC) $(LIBS) -o brandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -o brandy strip brandy.exe check: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(LIBS) -o brandy clean: rm -f $(SRCDIR)/*.o brandy.exe all: brandy MatrixBrandy-1.22.13/build/mkMinGW.bat0000664000175000017500000000057514022414626016466 0ustar soruksoruk@rem Make Brandy Basic for DOS with MinGW compiler @rem Edit PATH to GCC tools to match your installation @cd %0\.. @set PATH=C:\Apps\Programming\TDM-GCC-32\bin;%PATH% @mingw32-make -f makefile.mingw nodebug @mkdir ..\binaries >NUL: 2>NUL: @if exist brandy.exe copy brandy.exe ..\binaries\brandyMGW.exe >NUL: @if exist brandy del brandy @if exist brandy.exe del brandy.exe @pause MatrixBrandy-1.22.13/build/makefile.djgppKBD0000664000175000017500000000301114160662532017601 0ustar soruksoruk# Makefile for Brandy under DOS (using gcc and DJGPP) CC = gcc LD = gcc CFLAGS1 = -march=i586 -c -g -DDEBUG -DNONET -DBODGEDJP CFLAGS2 = -march=i586 -O2 -fomit-frame-pointer -DNONET -DBODGEDJP LDFLAGS = LIBS = -lm SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/textonly.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/textonly.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/mos_sys.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) include depends.mk .c.o: $(CC) $(CFLAGS1) $< -o $@ recompile: $(CC) $(CFLAGS1) $(SRC) $(LIBS) -o brandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -o brandy strip brandy check: $(CC) $(CFLAGS1) -Wall $(SRC) $(LIBS) -o brandy clean: rm $(SRCDIR)/*.o brandy all: brandy MatrixBrandy-1.22.13/build/makefile.macosx0000664000175000017500000000423714022414626017455 0ustar soruksoruk# Makefile for brandy under NetBSD and Linux CC = gcc LD = gcc STRIP = strip ADDFLAGS = ${BRANDY_BUILD_FLAGS} include build/git.mk #CFLAGS = -g -DDEBUG $(shell sdl-config --cflags) -I/usr/local/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) $(ADDFLAGS) #CFLAGS = -g $(shell sdl-config --cflags) -I/usr/local/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) $(ADDFLAGS) CFLAGS = -O3 $(shell sdl-config --cflags) -DUSE_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) $(ADDFLAGS) LDFLAGS += LIBS = -lm $(shell sdl-config --libs) -ldl SRCDIR = src OBJ = \ $(SRCDIR)/evaluate.o \ $(SRCDIR)/graphsdl.o \ $(SRCDIR)/assign.o \ $(SRCDIR)/mainstate.o \ $(SRCDIR)/tokens.o \ $(SRCDIR)/mos.o \ $(SRCDIR)/commands.o \ $(SRCDIR)/functions.o \ $(SRCDIR)/iostate.o \ $(SRCDIR)/variables.o \ $(SRCDIR)/fileio.o \ $(SRCDIR)/soundsdl.o \ $(SRCDIR)/keyboard.o \ $(SRCDIR)/miscprocs.o \ $(SRCDIR)/editor.o \ $(SRCDIR)/stack.o \ $(SRCDIR)/mos_sys.o \ $(SRCDIR)/strings.o \ $(SRCDIR)/lvalue.o \ $(SRCDIR)/errors.o \ $(SRCDIR)/convert.o \ $(SRCDIR)/brandy.o \ $(SRCDIR)/statement.o \ $(SRCDIR)/net.o \ $(SRCDIR)/heap.o SRC = \ $(SRCDIR)/evaluate.c \ $(SRCDIR)/graphsdl.c \ $(SRCDIR)/assign.c \ $(SRCDIR)/mainstate.c \ $(SRCDIR)/tokens.c \ $(SRCDIR)/mos.c \ $(SRCDIR)/commands.c \ $(SRCDIR)/functions.c \ $(SRCDIR)/iostate.c \ $(SRCDIR)/variables.c \ $(SRCDIR)/fileio.c \ $(SRCDIR)/soundsdl.c \ $(SRCDIR)/keyboard.c \ $(SRCDIR)/miscprocs.c \ $(SRCDIR)/editor.c \ $(SRCDIR)/stack.c \ $(SRCDIR)/mos_sys.c \ $(SRCDIR)/strings.c \ $(SRCDIR)/lvalue.c \ $(SRCDIR)/errors.c \ $(SRCDIR)/convert.c \ $(SRCDIR)/brandy.c \ $(SRCDIR)/statement.c \ $(SRCDIR)/net.c \ $(SRCDIR)/heap.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) include build/depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ recompile: $(CC) $(CFLAGS) $(SRC) $(LIBS) -o brandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -o brandy $(STRIP) brandy check: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(LIBS) -o brandy clean: rm -f $(SRCDIR)/*.o brandy cleanall: rm -f $(SRCDIR)/*.o brandy sbrandy tbrandy text: $(MAKE) -f makefile.text textclean: rm -f $(SRCDIR)/*.o sbrandy tbrandy all: brandy MatrixBrandy-1.22.13/build/clean.bat0000664000175000017500000000050314022414626016226 0ustar soruksoruk@rem Clean source - remove *.o files @cd %0\.. @del /q ..\src\*.o @if exist brandy copy brandy ..\binaries\brandy >NUL: @if exist brandy del brandy @if exist sbrandy copy sbrandy ..\binaries\sbrandy >NUL: @if exist sbrandy del sbrandy @if exist tbrandy copy tbrandy ..\binaries\tbrandy >NUL: @if exist tbrandy del tbrandy MatrixBrandy-1.22.13/build/makeROgccY.txt0000664000175000017500000001253414022414626017210 0ustar soruksoruk# Makefile for brandy under RISC OS using GCC CC = gcc LD = ld CFLAGS1 = -c -DDEBUG CFLAGS2 = -c -DNONET LDFLAGS1 = LDFLAGS2 = LIBS = gcclib:unixlib gcclib:libscl gcclib:libgcc OBJ = o.variables o.tokens o.riscos o.strings o.statement\ o.stack o.miscprocs o.mainstate o.lvalue o.keyboard o.iostate\ o.heap o.functions o.fileio o.evaluate o.errors o.mos o.editor\ o.convert o.commands o.assign o.brandy SRC = c.variables c.tokens c.riscos c.strings c.statement\ c.stack c.miscprocs c.mainstate c.lvalue c.keyboard c.iostate\ c.heap c.functions c.fileio c.evaluate c.errors c.mos c.editor\ c.convert c.commands c.assign c.brandy brandy: $(OBJ) $(LD) $(LDFLAGS1) $(OBJ) $(LIBS) -o brandy # Build VARIABLES.C VARIABLES_C = h.common h.target h.basicdefs\ h.variables h.evaluate h.tokens\ h.stack h.heap h.errors\ h.miscprocs h.screen h.lvalue o.variables: $(VARIABLES_C) c.variables $(CC) $(CFLAGS1) c.variables # Build TOKENS.C TOKENS_C = h.common h.target h.basicdefs\ h.tokens h.miscprocs h.convert\ h.errors o.tokens: $(TOKENS_C) c.tokens $(CC) $(CFLAGS1) c.tokens # Build RISCOS.C RISCOS_C = h.common h.target h.basicdefs\ h.errors h.scrcommon h.screen\ h.keyboard o.riscos: $(RISCOS_C) c.riscos $(CC) $(CFLAGS1) c.riscos # Build STRINGS.C STRINGS_C = h.common h.target h.basicdefs\ h.strings h.heap h.errors o.strings: $(STRINGS_C) c.strings $(CC) $(CFLAGS1) c.strings # Build STATEMENT.C STATEMENT_C = h.common h.target h.basicdefs\ h.tokens h.commands h.stack\ h.heap h.errors h.editor\ h.miscprocs h.variables h.evaluate\ h.screen h.fileio h.strings\ h.iostate h.mainstate h.assign\ h.statement o.statement: $(STATEMENT_C) c.statement $(CC) $(CFLAGS1) c.statement # Build STACK.C STACK_C = h.common h.target h.basicdefs\ h.stack h.miscprocs h.strings\ h.tokens h.errors o.stack: $(STACK_C) c.stack $(CC) $(CFLAGS1) c.stack # Build MISCPROCS.C MISCPROCS_C = h.common h.target h.basicdefs\ h.tokens h.errors h.keyboard\ h.screen h.miscprocs o.miscprocs: $(MISCPROCS_C) c.miscprocs $(CC) $(CFLAGS1) c.miscprocs # Build MAINSTATE.C MAINSTATE_C = h.common h.target h.basicdefs\ h.tokens h.variables h.stack\ h.heap h.strings h.errors\ h.statement h.evaluate h.convert\ h.miscprocs h.editor h.mos\ h.screen h.lvalue h.fileio\ h.mainstate o.mainstate: $(MAINSTATE_C) c.mainstate $(CC) $(CFLAGS1) c.mainstate # Build LVALUE.C LVALUE_C = h.common h.target h.basicdefs\ h.tokens h.evaluate h.stack\ h.errors h.variables h.miscprocs\ h.lvalue o.lvalue: $(LVALUE_C) c.lvalue $(CC) $(CFLAGS1) c.lvalue # Build KEYBOARD.C KEYBOARD_C = h.common h.target h.basicdefs\ h.errors h.keyboard h.screen o.keyboard: $(KEYBOARD_C) c.keyboard $(CC) $(CFLAGS1) c.keyboard # Build IOSTATE.C IOSTATE_C = h.common h.target h.basicdefs\ h.tokens h.stack h.strings\ h.errors h.miscprocs h.evaluate\ h.convert h.mos h.fileio\ h.screen h.lvalue h.statement\ h.iostate o.iostate: $(IOSTATE_C) c.iostate $(CC) $(CFLAGS1) c.iostate # Build HEAP.C HEAP_C = h.common h.target h.basicdefs\ h.heap h.target h.errors\ h.miscprocs o.heap: $(HEAP_C) c.heap $(CC) $(CFLAGS1) c.heap # Build FUNCTIONS.C FUNCTIONS_C = h.common h.target h.basicdefs\ h.tokens h.variables h.strings\ h.convert h.stack h.errors\ h.evaluate h.keyboard h.screen\ h.mos h.miscprocs h.fileio\ h.functions o.functions: $(FUNCTIONS_C) c.functions $(CC) $(CFLAGS1) c.functions # Build FILEIO.C FILEIO_C = h.common h.target h.basicdefs\ h.errors h.fileio h.strings o.fileio: $(FILEIO_C) c.fileio $(CC) $(CFLAGS1) c.fileio # Build EVALUATE.C EVALUATE_C = h.common h.target h.basicdefs\ h.tokens h.variables h.lvalue\ h.strings h.stack h.errors\ h.evaluate h.statement h.miscprocs\ h.functions o.evaluate: $(EVALUATE_C) c.evaluate $(CC) $(CFLAGS1) c.evaluate # Build ERRORS.C ERRORS_C = h.common h.target h.basicdefs\ h.errors h.stack h.fileio h.keyboard\ h.tokens h.screen h.miscprocs o.errors: $(ERRORS_C) c.errors $(CC) $(CFLAGS1) c.errors # Build MOS.C MOS_C = h.common h.target h.errors\ h.basicdefs h.target h.mos\ h.screen o.mos: $(MOS_C) c.mos $(CC) $(CFLAGS1) c.mos # Build EDITOR.C EDITOR_C = h.common h.target h.basicdefs\ h.errors h.variables h.heap\ h.tokens h.strings h.miscprocs\ h.stack h.fileio o.editor: $(EDITOR_C) c.editor $(CC) $(CFLAGS1) c.editor # Build CONVERT.C CONVERT_C = h.common h.target h.basicdefs\ h.convert h.errors h.miscprocs o.convert: $(CONVERT_C) c.convert $(CC) $(CFLAGS1) c.convert # Build COMMANDS.C COMMANDS_C = h.common h.target h.basicdefs\ h.miscprocs h.tokens h.statement\ h.variables h.editor h.errors\ h.heap h.stack h.strings\ h.evaluate h.screen h.keyboard o.commands: $(COMMANDS_C) c.commands $(CC) $(CFLAGS1) c.commands # Build ASSIGN.C ASSIGN_C = h.common h.target h.basicdefs\ h.target h.tokens h.heap\ h.stack h.strings h.variables\ h.errors h.miscprocs h.editor\ h.evaluate h.lvalue h.statement\ h.assign h.fileio h.mos o.assign: $(ASSIGN_C) c.assign $(CC) $(CFLAGS1) c.assign # Build BRANDY.C BRANDY_C = h.common h.target h.basicdefs\ h.tokens h.errors h.heap\ h.editor h.commands h.statement\ h.fileio h.mos h.keyboard\ h.screen h.miscprocs o.brandy: $(BRANDY_C) c.brandy $(CC) $(CFLAGS1) c.brandy recompile: $(CC) $(CFLAGS1) $(SRC) $(LD) $(LDFLAGS1) $(OBJ) $(LIBS) -o brandy clean: wipe o.* ~CF~R~V wipe brandy ~CF~R~V wipe map ~CF~R~V nodebug: $(CC) $(CFLAGS2) $(SRC) $(LD) $(LDFLAGS2) $(OBJ) $(LIBS) -o brandy all: brandy MatrixBrandy-1.22.13/build/makefile.ansi0000664000175000017500000000360114160662532017113 0ustar soruksoruk# Makefile for Brandy under NetBSD and Linux with ANSI keyboard control CC = gcc LD = gcc include git.mk #CFLAGS = -g -DDEBUG -I/usr/include/SDL -DANSIKBD -DUSE_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) #CFLAGS = -g -I/usr/include/SDL -DANSIKBD -DUSE_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) CFLAGS = -O2 -I/usr/include/SDL -DANSIKBD -DUSE_SDL -DDEFAULT_IGNORE -Wall $(GITFLAGS) LDFLAGS += LIBS = -lX11 -lm -lSDL SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/graphsdl.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/soundsdl.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/graphsdl.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/soundsdl.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) include depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ recompile: $(CC) $(CFLAGS) $(SRC) $(LIBS) -o brandy cp -f brandy ../binaries/brandy rm -f brandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -o brandy strip brandy cp -f brandy ../binaries/brandy rm -f brandy check: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(LIBS) -o brandy clean: rm -f $(SRCDIR)/*.o brandy all: brandy MatrixBrandy-1.22.13/build/makefile.app.riscos.cross.sul0000664000175000017500000000332014160662532022172 0ustar soruksoruk# Makefile for Brandy under RISC OS cross-compiled from Linux CC = arm-unknown-riscos-gcc LD = arm-unknown-riscos-gcc STRIP = arm-unknown-riscos-strip ELFAIF = elf2aif ADDFLAGS = ${BRANDY_BUILD_FLAGS} include git.mk #CFLAGS = -g -DDEBUG -DNONET -Wall $(GITFLAGS) -mlibscl #CFLAGS = -g -DNONET -Wall $(GITFLAGS) -mlibscl CFLAGS = -O2 -DBRANDYAPP -DBRANDY_DEFAULT_SIZE=64 -Wall $(GITFLAGS) $(ADDFLAGS) LDFLAGS += LIBS = SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/riscos.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o $(SRCDIR)/app.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/riscos.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c $(SRCDIR)/app.c Brandy,ff8: $(OBJ) $(LD) $(LDFLAGS) -static -o BrandyAPP.elf $(OBJ) $(LIBS) $(STRIP) BrandyAPP.elf $(ELFAIF) BrandyAPP.elf BrandyAPP,ff8 include depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ clean: rm -f $(SRCDIR)/*.o BrandyAPP,ff8 BrandyAPP.elf all: Brandy,ff8 MatrixBrandy-1.22.13/build/tidyRISCOS.oby0000664000175000017500000000017014022414626017063 0ustar soruksoruk| > TidyRISCOS | Remove RISC OS source files | This file needs to be SetTyped to OBEY | Wipe .^.riscos ~CFR~V MatrixBrandy-1.22.13/build/mkDJGPP.bat0000664000175000017500000000064414022414626016346 0ustar soruksoruk@rem Make Brandy Basic for DOS with DJGPP compiler @rem Edit DJGPP and PATH paths to match your installation @set DJGPP=C:\Apps\Programming\djgpp\djgpp.env @set PATH=C:\Apps\Programming\djgpp\bin;%PATH% @ @cd %0\.. @make -f makefile.djgpp nodebug @mkdir ..\binaries >NUL: 2>NUL: @if exist brandy.exe copy brandy.exe ..\binaries\brandyDJP.exe >NUL: @if exist brandy del brandy @if exist brandy.exe del brandy.exe @pause MatrixBrandy-1.22.13/build/makefile.mingw0000664000175000017500000000304014160662532017277 0ustar soruksoruk# Makefile for Brandy under DOS (using gcc and MINGW) CC = gcc LD = gcc CFLAGS = -march=i586 -c -g -DDEBUG -DNONET -DBODGEMGW -w CFLAGS2 = -march=i586 -O2 -fomit-frame-pointer -DNONET -DBODGEMGW -w LDFLAGS = LIBS = -lm SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/textonly.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/textonly.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/mos_sys.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) include depends.mk .c.o: $(CC) $(CFLAGS) $< -o $@ recompile: $(CC) $(CFLAGS) $(SRC) $(LIBS) -o brandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -o brandy strip brandy.exe check: $(CC) $(CFLAGS) -Wall $(SRC) $(LIBS) -o brandy clean: del /q $(SRCDIR)\*.o del /q brandy.exe all: brandy MatrixBrandy-1.22.13/build/depends.mk.old0000664000175000017500000001572414022414626017217 0ustar soruksoruk# Build VARIABLES.C VARIABLES_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/variables.h $(SRCDIR)/evaluate.h $(SRCDIR)/tokens.h \ $(SRCDIR)/stack.h $(SRCDIR)/heap.h $(SRCDIR)/errors.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/screen.h $(SRCDIR)/lvalue.h $(SRCDIR)/variables.o: $(VARIABLES_C) # Build TOKENS.C TOKENS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/miscprocs.h $(SRCDIR)/convert.h \ $(SRCDIR)/errors.h $(SRCDIR)/tokens.o: $(TOKENS_C) # Build GRAPHSDL.C GSDL_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/scrcommon.h $(SRCDIR)/screen.h \ $(SRCDIR)/mos.h $(SRCDIR)/graphsdl.h $(SRCDIR)/textfonts.h $(SRCDIR)/graphsdl.o: $(GSDL_C) # Build STRINGS.C STRINGS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/strings.h $(SRCDIR)/heap.h $(SRCDIR)/errors.h $(SRCDIR)/strings.o: $(STRINGS_C) # Build STATEMENT.C STATEMENT_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/commands.h $(SRCDIR)/stack.h \ $(SRCDIR)/heap.h $(SRCDIR)/errors.h $(SRCDIR)/editor.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/variables.h $(SRCDIR)/evaluate.h \ $(SRCDIR)/screen.h $(SRCDIR)/fileio.h $(SRCDIR)/strings.h \ $(SRCDIR)/iostate.h $(SRCDIR)/mainstate.h $(SRCDIR)/assign.h \ $(SRCDIR)/statement.h $(SRCDIR)/statement.o: $(STATEMENT_C) # Build STACK.C STACK_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/stack.h $(SRCDIR)/miscprocs.h $(SRCDIR)/strings.h \ $(SRCDIR)/tokens.h $(SRCDIR)/errors.h $(SRCDIR)/stack.o: $(STACK_C) # Build MISCPROCS.C MISCPROCS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/errors.h $(SRCDIR)/keyboard.h \ $(SRCDIR)/screen.h $(SRCDIR)/miscprocs.h $(SRCDIR)/miscprocs.o: $(MISCPROCS_C) # Build MAINSTATE.C MAINSTATE_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/variables.h $(SRCDIR)/stack.h \ $(SRCDIR)/heap.h $(SRCDIR)/strings.h $(SRCDIR)/errors.h \ $(SRCDIR)/statement.h $(SRCDIR)/evaluate.h $(SRCDIR)/convert.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/editor.h $(SRCDIR)/mos.h \ $(SRCDIR)/screen.h $(SRCDIR)/lvalue.h $(SRCDIR)/fileio.h \ $(SRCDIR)/mainstate.h $(SRCDIR)/mainstate.o: $(MAINSTATE_C) # Build LVALUE.C LVALUE_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/evaluate.h $(SRCDIR)/stack.h \ $(SRCDIR)/errors.h $(SRCDIR)/variables.h $(SRCDIR)/miscprocs.h \ $(SRCDIR)/lvalue.h $(SRCDIR)/lvalue.o: $(LVALUE_C) # Build KEYBOARD.C KEYBOARD_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/keyboard.h $(SRCDIR)/screen.h \ $(SRCDIR)/inkey.h $(SRCDIR)/keyboard.o: $(KEYBOARD_C) # Build IOSTATE.C IOSTATE_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/stack.h $(SRCDIR)/strings.h \ $(SRCDIR)/errors.h $(SRCDIR)/miscprocs.h $(SRCDIR)/evaluate.h \ $(SRCDIR)/convert.h $(SRCDIR)/mos.h $(SRCDIR)/fileio.h \ $(SRCDIR)/screen.h $(SRCDIR)/lvalue.h $(SRCDIR)/statement.h \ $(SRCDIR)/iostate.h $(SRCDIR)/iostate.o: $(IOSTATE_C) # Build HEAP.C HEAP_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/heap.h $(SRCDIR)/target.h $(SRCDIR)/errors.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/heap.o: $(HEAP_C) # Build FUNCTIONS.C FUNCTIONS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/variables.h $(SRCDIR)/strings.h \ $(SRCDIR)/convert.h $(SRCDIR)/stack.h $(SRCDIR)/errors.h \ $(SRCDIR)/evaluate.h $(SRCDIR)/keyboard.h $(SRCDIR)/screen.h \ $(SRCDIR)/mos.h $(SRCDIR)/miscprocs.h $(SRCDIR)/fileio.h \ $(SRCDIR)/functions.h $(SRCDIR)/functions.o: $(FUNCTIONS_C) # Build FILEIO.C FILEIO_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/fileio.h $(SRCDIR)/strings.h \ $(SRCDIR)/net.h $(SRCDIR)/fileio.o: $(FILEIO_C) # Build NET.C NET_C = $(SRCDIR)/net.h $(SRCDIR)/errors.h $(SRCDIR)/net.o: $(NET_C) # Build EVALUATE.C EVALUATE_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/variables.h $(SRCDIR)/lvalue.h \ $(SRCDIR)/strings.h $(SRCDIR)/stack.h $(SRCDIR)/errors.h \ $(SRCDIR)/evaluate.h $(SRCDIR)/statement.h $(SRCDIR)/miscprocs.h \ $(SRCDIR)/functions.h $(SRCDIR)/evaluate.o: $(EVALUATE_C) # Build ERRORS.C ERRORS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/stack.h $(SRCDIR)/fileio.h \ $(SRCDIR)/tokens.h $(SRCDIR)/screen.h $(SRCDIR)/miscprocs.h \ $(SRCDIR)/keyboard.h $(SRCDIR)/graphsdl.h $(SRCDIR)/errors.o: $(ERRORS_C) # Build MOS.C MOS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/errors.h \ $(SRCDIR)/basicdefs.h $(SRCDIR)/mos.h $(SRCDIR)/graphsdl.h \ $(SRCDIR)/screen.h $(SRCDIR)/keyboard.h $(SRCDIR)/mos_sys.h $(SRCDIR)/mos.o: $(MOS_C) # Build MOS_SYS.C MOS_SYS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/errors.h \ $(SRCDIR)/basicdefs.h $(SRCDIR)/mos.h \ $(SRCDIR)/screen.h $(SRCDIR)/keyboard.h $(SRCDIR)/mos_sys.h $(SRCDIR)/mos_sys.o: $(MOS_SYS_C) # Build EDITOR.C EDITOR_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/variables.h $(SRCDIR)/heap.h \ $(SRCDIR)/tokens.h $(SRCDIR)/strings.h $(SRCDIR)/miscprocs.h \ $(SRCDIR)/stack.h $(SRCDIR)/fileio.h $(SRCDIR)/editor.o: $(EDITOR_C) # Build CONVERT.C CONVERT_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/convert.h $(SRCDIR)/errors.h $(SRCDIR)/miscprocs.h $(SRCDIR)/convert.o: $(CONVERT_C) # Build COMMANDS.C COMMANDS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/tokens.h $(SRCDIR)/statement.h \ $(SRCDIR)/variables.h $(SRCDIR)/editor.h $(SRCDIR)/errors.h \ $(SRCDIR)/heap.h $(SRCDIR)/stack.h $(SRCDIR)/strings.h \ $(SRCDIR)/evaluate.h $(SRCDIR)/screen.h $(SRCDIR)/keyboard.h $(SRCDIR)/commands.o: $(COMMANDS_C) # Build BRANDY.C BRANDY_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/errors.h $(SRCDIR)/heap.h \ $(SRCDIR)/editor.h $(SRCDIR)/commands.h $(SRCDIR)/statement.h \ $(SRCDIR)/fileio.h $(SRCDIR)/mos.h $(SRCDIR)/keyboard.h \ $(SRCDIR)/screen.h $(SRCDIR)/miscprocs.h $(SRCDIR)/net.h $(SRCDIR)/brandy.o: $(BRANDY_C) # Build ASSIGN.C ASSIGN_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/target.h $(SRCDIR)/tokens.h $(SRCDIR)/heap.h \ $(SRCDIR)/stack.h $(SRCDIR)/strings.h $(SRCDIR)/variables.h \ $(SRCDIR)/errors.h $(SRCDIR)/miscprocs.h $(SRCDIR)/editor.h \ $(SRCDIR)/evaluate.h $(SRCDIR)/lvalue.h $(SRCDIR)/statement.h \ $(SRCDIR)/assign.h $(SRCDIR)/fileio.h $(SRCDIR)/mos.h $(SRCDIR)/assign.o: $(ASSIGN_C) # Build TEXTONLY.C TEXTONLY_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/scrcommon.h $(SRCDIR)/screen.h $(SRCDIR)/textonly.o: $(TEXTONLY_C) # Build SIMPLETEXT.C $(SRCDIR)/simpletext.o: $(TEXTONLY_C) MatrixBrandy-1.22.13/build/makefile.mingw-sdl0000664000175000017500000000406214160662532020064 0ustar soruksoruk# Makefile for brandy under Windows x86 with MinGW using Cygwin as the # toolchain CC = gcc LD = gcc #CFLAGS += -g -DDEBUG -I/usr/include/SDL -DUSE_SDL -DUSE_SDL_SOUND -DDEFAULT_IGNORE CFLAGS = -IC:/Apps/Programming/TDM-GCC-32/include/SDL12 -O2 -DUSE_SDL -DDEFAULT_IGNORE -DNONET -DBODGESDL -Wall CFLAGS2 = -IC:/Apps/Programming/TDM-GCC-32/include/SDL12 -O2 -DUSE_SDL -DDEFAULT_IGNORE -DNONET -DBODGESDL -w LDFLAGS += #LIBS = -lm C:/Apps/Programming/TDM-GCC-32/SDL12/lib/libSDL.a -lws2_32 -mwindows C:/Apps/Programming/TDM-GCC-32/SDL12/lib/libdxguid.a C:/Apps/Programming/TDM-GCC-32/SDL12/lib/libwinmm.a LIBS = -lm C:/Apps/Programming/TDM-GCC-32/lib/SDL12/libSDL.dll.a SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/graphsdl.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/soundsdl.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/graphsdl.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/soundsdl.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) include depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ recompile: $(CC) $(CFLAGS) $(SRC) $(LIBS) -o brandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -o brandy strip brandy.exe check: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(LIBS) -o brandy clean: rm -f $(SRCDIR)/*.o brandy.exe all: brandy MatrixBrandy-1.22.13/build/mkSDL.bat0000664000175000017500000000061114022414626016116 0ustar soruksoruk@rem Make Brandy Basic for Windows-SDL with MinGW compiler @rem Edit PATH to GCC tools to match your installation @cd %0\.. @set PATH=C:\Apps\Programming\TDM-GCC-32\bin;%PATH% @mingw32-make -f makefile.mingw-sdl nodebug @mkdir ..\binaries >NUL: 2>NUL: @if exist brandy.exe copy brandy.exe ..\binaries\brandySDL.exe >NUL: @if exist brandy del brandy @if exist brandy.exe del brandy.exe @pause MatrixBrandy-1.22.13/build/makefile.mingw-sdl-original0000664000175000017500000000352214022414626021662 0ustar soruksoruk# Makefile for brandy under Windows x86 with MinGW using Cygwin as the # toolchain CC = i686-w64-mingw32-gcc LD = i686-w64-mingw32-gcc #CFLAGS += -g -DDEBUG -I/usr/include/SDL -DUSE_SDL -DDEFAULT_IGNORE CFLAGS = -O2 -I/usr/i686-w64-mingw32/sys-root/mingw/include/SDL -DUSE_SDL -DDEFAULT_IGNORE -Wall LDFLAGS += LIBS = -lm /usr/i686-w64-mingw32/sys-root/mingw/lib/libSDL.a -lws2_32 -mwindows /usr/i686-w64-mingw32/sys-root/mingw/lib/libdxguid.a /usr/i686-w64-mingw32/sys-root/mingw/lib/libwinmm.a SRCDIR = src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/graphsdl.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/graphsdl.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) include build/depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ recompile: $(CC) $(CFLAGS) $(SRC) $(LIBS) -o brandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -o brandy strip brandy check: $(CC) $(CFLAGS) -Wall -O2 $(SRC) $(LIBS) -o brandy clean: rm -f $(SRCDIR)/*.o brandy.exe all: brandy MatrixBrandy-1.22.13/build/makeROgcc0000664000175000017500000001272414160662532016246 0ustar soruksoruk# Makefile for brandy under RISC OS using GCC CC = gcc LD = ld CFLAGS1 = -w -c -DNONET -DDEBUG CFLAGS2 = -w -c -DNONET LDFLAGS1 = LDFLAGS2 = LIBS = gcclib:unixlib gcclib:libscl gcclib:libgcc OBJ = o.variables o.tokens o.riscos o.strings o.statement\ o.stack o.miscprocs o.mainstate o.lvalue o.keyboard o.iostate\ o.heap o.functions o.fileio o.evaluate o.errors o.mos o.editor\ o.convert o.commands o.assign o.brandy o.net SRC = c.variables c.tokens c.riscos c.strings c.statement\ c.stack c.miscprocs c.mainstate c.lvalue c.keyboard c.iostate\ c.heap c.functions c.fileio c.evaluate c.errors c.mos c.editor\ c.convert c.commands c.assign c.brandy c.net brandy: $(OBJ) $(LD) $(LDFLAGS1) $(OBJ) $(LIBS) -o brandy # Build VARIABLES.C VARIABLES_C = h.common h.target h.basicdefs\ h.variables h.evaluate h.tokens\ h.stack h.heap h.errors\ h.miscprocs h.screen h.lvalue o.variables: $(VARIABLES_C) c.variables $(CC) $(CFLAGS1) c.variables # Build TOKENS.C TOKENS_C = h.common h.target h.basicdefs\ h.tokens h.miscprocs h.convert\ h.errors o.tokens: $(TOKENS_C) c.tokens $(CC) $(CFLAGS1) c.tokens # Build RISCOS.C RISCOS_C = h.common h.target h.basicdefs\ h.errors h.scrcommon h.screen\ h.keyboard o.riscos: $(RISCOS_C) c.riscos $(CC) $(CFLAGS1) c.riscos # Build STRINGS.C STRINGS_C = h.common h.target h.basicdefs\ h.strings h.heap h.errors o.strings: $(STRINGS_C) c.strings $(CC) $(CFLAGS1) c.strings # Build STATEMENT.C STATEMENT_C = h.common h.target h.basicdefs\ h.tokens h.commands h.stack\ h.heap h.errors h.editor\ h.miscprocs h.variables h.evaluate\ h.screen h.fileio h.strings\ h.iostate h.mainstate h.assign\ h.statement o.statement: $(STATEMENT_C) c.statement $(CC) $(CFLAGS1) c.statement # Build STACK.C STACK_C = h.common h.target h.basicdefs\ h.stack h.miscprocs h.strings\ h.tokens h.errors o.stack: $(STACK_C) c.stack $(CC) $(CFLAGS1) c.stack # Build MISCPROCS.C MISCPROCS_C = h.common h.target h.basicdefs\ h.tokens h.errors h.keyboard\ h.screen h.miscprocs o.miscprocs: $(MISCPROCS_C) c.miscprocs $(CC) $(CFLAGS1) c.miscprocs # Build MAINSTATE.C MAINSTATE_C = h.common h.target h.basicdefs\ h.tokens h.variables h.stack\ h.heap h.strings h.errors\ h.statement h.evaluate h.convert\ h.miscprocs h.editor h.mos\ h.screen h.lvalue h.fileio\ h.mainstate o.mainstate: $(MAINSTATE_C) c.mainstate $(CC) $(CFLAGS1) c.mainstate # Build LVALUE.C LVALUE_C = h.common h.target h.basicdefs\ h.tokens h.evaluate h.stack\ h.errors h.variables h.miscprocs\ h.lvalue o.lvalue: $(LVALUE_C) c.lvalue $(CC) $(CFLAGS1) c.lvalue # Build KEYBOARD.C KEYBOARD_C = h.common h.target h.basicdefs\ h.errors h.keyboard h.screen o.keyboard: $(KEYBOARD_C) c.keyboard $(CC) $(CFLAGS1) c.keyboard # Build IOSTATE.C IOSTATE_C = h.common h.target h.basicdefs\ h.tokens h.stack h.strings\ h.errors h.miscprocs h.evaluate\ h.convert h.mos h.fileio\ h.screen h.lvalue h.statement\ h.iostate o.iostate: $(IOSTATE_C) c.iostate $(CC) $(CFLAGS1) c.iostate # Build HEAP.C HEAP_C = h.common h.target h.basicdefs\ h.heap h.target h.errors\ h.miscprocs o.heap: $(HEAP_C) c.heap $(CC) $(CFLAGS1) c.heap # Build FUNCTIONS.C FUNCTIONS_C = h.common h.target h.basicdefs\ h.tokens h.variables h.strings\ h.convert h.stack h.errors\ h.evaluate h.keyboard h.screen\ h.mos h.miscprocs h.fileio\ h.functions o.functions: $(FUNCTIONS_C) c.functions $(CC) $(CFLAGS1) c.functions # Build FILEIO.C FILEIO_C = h.common h.target h.basicdefs\ h.errors h.fileio h.strings o.fileio: $(FILEIO_C) c.fileio $(CC) $(CFLAGS1) c.fileio # Build EVALUATE.C EVALUATE_C = h.common h.target h.basicdefs\ h.tokens h.variables h.lvalue\ h.strings h.stack h.errors\ h.evaluate h.statement h.miscprocs\ h.functions o.evaluate: $(EVALUATE_C) c.evaluate $(CC) $(CFLAGS1) c.evaluate # Build ERRORS.C ERRORS_C = h.common h.target h.basicdefs\ h.errors h.stack h.fileio h.keyboard\ h.tokens h.screen h.miscprocs o.errors: $(ERRORS_C) c.errors $(CC) $(CFLAGS1) c.errors # Build MOS.C MOS_C = h.common h.target h.errors\ h.basicdefs h.target h.mos\ h.screen o.mos: $(MOS_C) c.mos $(CC) $(CFLAGS1) c.mos # Build EDITOR.C EDITOR_C = h.common h.target h.basicdefs\ h.errors h.variables h.heap\ h.tokens h.strings h.miscprocs\ h.stack h.fileio o.editor: $(EDITOR_C) c.editor $(CC) $(CFLAGS1) c.editor # Build CONVERT.C CONVERT_C = h.common h.target h.basicdefs\ h.convert h.errors h.miscprocs o.convert: $(CONVERT_C) c.convert $(CC) $(CFLAGS1) c.convert # Build COMMANDS.C COMMANDS_C = h.common h.target h.basicdefs\ h.miscprocs h.tokens h.statement\ h.variables h.editor h.errors\ h.heap h.stack h.strings\ h.evaluate h.screen h.keyboard o.commands: $(COMMANDS_C) c.commands $(CC) $(CFLAGS1) c.commands # Build ASSIGN.C ASSIGN_C = h.common h.target h.basicdefs\ h.target h.tokens h.heap\ h.stack h.strings h.variables\ h.errors h.miscprocs h.editor\ h.evaluate h.lvalue h.statement\ h.assign h.fileio h.mos o.assign: $(ASSIGN_C) c.assign $(CC) $(CFLAGS1) c.assign # Build BRANDY.C BRANDY_C = h.common h.target h.basicdefs\ h.tokens h.errors h.heap\ h.editor h.commands h.statement\ h.fileio h.mos h.keyboard\ h.screen h.miscprocs o.brandy: $(BRANDY_C) c.brandy $(CC) $(CFLAGS1) c.brandy # Build NET.C NET_C = h.target h.errors h.net o.net: $(NET_C) c.net $(CC) $(CFLAGS1) c.net recompile: $(CC) $(CFLAGS1) $(SRC) $(LD) $(LDFLAGS1) $(OBJ) $(LIBS) -o brandy clean: wipe o.* ~CF~R~V wipe brandy ~CF~R~V wipe map ~CF~R~V nodebug: $(CC) $(CFLAGS2) $(SRC) $(LD) $(LDFLAGS2) $(OBJ) $(LIBS) -o brandy all: brandy MatrixBrandy-1.22.13/build/makeROgccX.txt0000664000175000017500000001272414160662532017214 0ustar soruksoruk# Makefile for brandy under RISC OS using GCC CC = gcc LD = ld CFLAGS1 = -w -c -DNONET -DDEBUG CFLAGS2 = -w -c -DNONET LDFLAGS1 = LDFLAGS2 = LIBS = gcclib:unixlib gcclib:libscl gcclib:libgcc OBJ = o.variables o.tokens o.riscos o.strings o.statement\ o.stack o.miscprocs o.mainstate o.lvalue o.keyboard o.iostate\ o.heap o.functions o.fileio o.evaluate o.errors o.mos o.editor\ o.convert o.commands o.assign o.brandy o.net SRC = c.variables c.tokens c.riscos c.strings c.statement\ c.stack c.miscprocs c.mainstate c.lvalue c.keyboard c.iostate\ c.heap c.functions c.fileio c.evaluate c.errors c.mos c.editor\ c.convert c.commands c.assign c.brandy c.net brandy: $(OBJ) $(LD) $(LDFLAGS1) $(OBJ) $(LIBS) -o brandy # Build VARIABLES.C VARIABLES_C = h.common h.target h.basicdefs\ h.variables h.evaluate h.tokens\ h.stack h.heap h.errors\ h.miscprocs h.screen h.lvalue o.variables: $(VARIABLES_C) c.variables $(CC) $(CFLAGS1) c.variables # Build TOKENS.C TOKENS_C = h.common h.target h.basicdefs\ h.tokens h.miscprocs h.convert\ h.errors o.tokens: $(TOKENS_C) c.tokens $(CC) $(CFLAGS1) c.tokens # Build RISCOS.C RISCOS_C = h.common h.target h.basicdefs\ h.errors h.scrcommon h.screen\ h.keyboard o.riscos: $(RISCOS_C) c.riscos $(CC) $(CFLAGS1) c.riscos # Build STRINGS.C STRINGS_C = h.common h.target h.basicdefs\ h.strings h.heap h.errors o.strings: $(STRINGS_C) c.strings $(CC) $(CFLAGS1) c.strings # Build STATEMENT.C STATEMENT_C = h.common h.target h.basicdefs\ h.tokens h.commands h.stack\ h.heap h.errors h.editor\ h.miscprocs h.variables h.evaluate\ h.screen h.fileio h.strings\ h.iostate h.mainstate h.assign\ h.statement o.statement: $(STATEMENT_C) c.statement $(CC) $(CFLAGS1) c.statement # Build STACK.C STACK_C = h.common h.target h.basicdefs\ h.stack h.miscprocs h.strings\ h.tokens h.errors o.stack: $(STACK_C) c.stack $(CC) $(CFLAGS1) c.stack # Build MISCPROCS.C MISCPROCS_C = h.common h.target h.basicdefs\ h.tokens h.errors h.keyboard\ h.screen h.miscprocs o.miscprocs: $(MISCPROCS_C) c.miscprocs $(CC) $(CFLAGS1) c.miscprocs # Build MAINSTATE.C MAINSTATE_C = h.common h.target h.basicdefs\ h.tokens h.variables h.stack\ h.heap h.strings h.errors\ h.statement h.evaluate h.convert\ h.miscprocs h.editor h.mos\ h.screen h.lvalue h.fileio\ h.mainstate o.mainstate: $(MAINSTATE_C) c.mainstate $(CC) $(CFLAGS1) c.mainstate # Build LVALUE.C LVALUE_C = h.common h.target h.basicdefs\ h.tokens h.evaluate h.stack\ h.errors h.variables h.miscprocs\ h.lvalue o.lvalue: $(LVALUE_C) c.lvalue $(CC) $(CFLAGS1) c.lvalue # Build KEYBOARD.C KEYBOARD_C = h.common h.target h.basicdefs\ h.errors h.keyboard h.screen o.keyboard: $(KEYBOARD_C) c.keyboard $(CC) $(CFLAGS1) c.keyboard # Build IOSTATE.C IOSTATE_C = h.common h.target h.basicdefs\ h.tokens h.stack h.strings\ h.errors h.miscprocs h.evaluate\ h.convert h.mos h.fileio\ h.screen h.lvalue h.statement\ h.iostate o.iostate: $(IOSTATE_C) c.iostate $(CC) $(CFLAGS1) c.iostate # Build HEAP.C HEAP_C = h.common h.target h.basicdefs\ h.heap h.target h.errors\ h.miscprocs o.heap: $(HEAP_C) c.heap $(CC) $(CFLAGS1) c.heap # Build FUNCTIONS.C FUNCTIONS_C = h.common h.target h.basicdefs\ h.tokens h.variables h.strings\ h.convert h.stack h.errors\ h.evaluate h.keyboard h.screen\ h.mos h.miscprocs h.fileio\ h.functions o.functions: $(FUNCTIONS_C) c.functions $(CC) $(CFLAGS1) c.functions # Build FILEIO.C FILEIO_C = h.common h.target h.basicdefs\ h.errors h.fileio h.strings o.fileio: $(FILEIO_C) c.fileio $(CC) $(CFLAGS1) c.fileio # Build EVALUATE.C EVALUATE_C = h.common h.target h.basicdefs\ h.tokens h.variables h.lvalue\ h.strings h.stack h.errors\ h.evaluate h.statement h.miscprocs\ h.functions o.evaluate: $(EVALUATE_C) c.evaluate $(CC) $(CFLAGS1) c.evaluate # Build ERRORS.C ERRORS_C = h.common h.target h.basicdefs\ h.errors h.stack h.fileio h.keyboard\ h.tokens h.screen h.miscprocs o.errors: $(ERRORS_C) c.errors $(CC) $(CFLAGS1) c.errors # Build MOS.C MOS_C = h.common h.target h.errors\ h.basicdefs h.target h.mos\ h.screen o.mos: $(MOS_C) c.mos $(CC) $(CFLAGS1) c.mos # Build EDITOR.C EDITOR_C = h.common h.target h.basicdefs\ h.errors h.variables h.heap\ h.tokens h.strings h.miscprocs\ h.stack h.fileio o.editor: $(EDITOR_C) c.editor $(CC) $(CFLAGS1) c.editor # Build CONVERT.C CONVERT_C = h.common h.target h.basicdefs\ h.convert h.errors h.miscprocs o.convert: $(CONVERT_C) c.convert $(CC) $(CFLAGS1) c.convert # Build COMMANDS.C COMMANDS_C = h.common h.target h.basicdefs\ h.miscprocs h.tokens h.statement\ h.variables h.editor h.errors\ h.heap h.stack h.strings\ h.evaluate h.screen h.keyboard o.commands: $(COMMANDS_C) c.commands $(CC) $(CFLAGS1) c.commands # Build ASSIGN.C ASSIGN_C = h.common h.target h.basicdefs\ h.target h.tokens h.heap\ h.stack h.strings h.variables\ h.errors h.miscprocs h.editor\ h.evaluate h.lvalue h.statement\ h.assign h.fileio h.mos o.assign: $(ASSIGN_C) c.assign $(CC) $(CFLAGS1) c.assign # Build BRANDY.C BRANDY_C = h.common h.target h.basicdefs\ h.tokens h.errors h.heap\ h.editor h.commands h.statement\ h.fileio h.mos h.keyboard\ h.screen h.miscprocs o.brandy: $(BRANDY_C) c.brandy $(CC) $(CFLAGS1) c.brandy # Build NET.C NET_C = h.target h.errors h.net o.net: $(NET_C) c.net $(CC) $(CFLAGS1) c.net recompile: $(CC) $(CFLAGS1) $(SRC) $(LD) $(LDFLAGS1) $(OBJ) $(LIBS) -o brandy clean: wipe o.* ~CF~R~V wipe brandy ~CF~R~V wipe map ~CF~R~V nodebug: $(CC) $(CFLAGS2) $(SRC) $(LD) $(LDFLAGS2) $(OBJ) $(LIBS) -o brandy all: brandy MatrixBrandy-1.22.13/build/makefile.riscos.cross.sul0000664000175000017500000000322414173342536021421 0ustar soruksoruk# Makefile for Brandy under RISC OS cross-compiled from Linux CC = arm-unknown-riscos-gcc LD = arm-unknown-riscos-gcc STRIP = arm-unknown-riscos-strip ELFAIF = elf2aif ADDFLAGS = ${BRANDY_BUILD_FLAGS} include git.mk #CFLAGS = -g -DDEBUG -DNONET -Wall $(GITFLAGS) -mlibscl #CFLAGS = -g -DNONET -Wall $(GITFLAGS) -mlibscl CFLAGS = -O2 -DBRANDY_DEFAULT_SIZE=1024 -Wall $(GITFLAGS) $(ADDFLAGS) LDFLAGS += LIBS = SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/riscos.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/riscos.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c Brandy,ff8: $(OBJ) $(LD) $(LDFLAGS) -static -o Brandy.elf $(OBJ) $(LIBS) $(STRIP) Brandy.elf $(ELFAIF) Brandy.elf Brandy,ff8 include depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ clean: rm -f $(SRCDIR)/*.o Brandy,ff8 Brandy.elf all: Brandy,ff8 MatrixBrandy-1.22.13/build/makefile.djgpp0000664000175000017500000000301114160662532017260 0ustar soruksoruk# Makefile for Brandy under DOS (using gcc and DJGPP) CC = gcc LD = gcc CFLAGS1 = -march=i586 -c -g -DDEBUG -DNONET -DBODGEDJP CFLAGS2 = -march=i586 -O2 -fomit-frame-pointer -DNONET -DBODGEDJP LDFLAGS = LIBS = -lm SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/textonly.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/textonly.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/mos_sys.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) include depends.mk .c.o: $(CC) $(CFLAGS1) $< -o $@ recompile: $(CC) $(CFLAGS1) $(SRC) $(LIBS) -o brandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -o brandy strip brandy check: $(CC) $(CFLAGS1) -Wall $(SRC) $(LIBS) -o brandy clean: rm $(SRCDIR)/*.o brandy all: brandy MatrixBrandy-1.22.13/build/makeROcc0000664000175000017500000001273414022414626016074 0ustar soruksoruk# Makefile for brandy under RISC OS (using Norcroft tools) CC = cc LD = link CFLAGS = -c -Wc -IC: -g -throwback -DDEBUG CFLAGS2 = -c -Wc -IC: -throwback LDFLAGS = -debug LIBS = C:o.stubs OBJ = variables.o tokens.o riscos.o strings.o statement.o \ stack.o miscprocs.o mainstate.o lvalue.o keyboard.o iostate.o \ heap.o functions.o fileio.o evaluate.o errors.o emulate.o editor.o \ convert.o commands.o brandy.o assign.o SRC = variables.c tokens.c riscos.c strings.c statement.c \ stack.c miscprocs.c mainstate.c lvalue.c keyboard.c iostate.c \ heap.c functions.c fileio.c evaluate.c errors.c emulate.c editor.c \ convert.c commands.c brandy.c assign.c brandy: $(OBJ) $(LD) $(LDFLAGS) -o brandy $(OBJ) $(LIBS) # Build VARIABLES.C VARIABLES_C = common.h target.h basicdefs.h \ variables.h evaluate.h tokens.h \ stack.h heap.h errors.h \ miscprocs.h screen.h lvalue.h variables.o: $(VARIABLES_C) variables.c $(CC) $(CFLAGS) variables.c # Build TOKENS.C TOKENS_C = common.h target.h basicdefs.h \ tokens.h miscprocs.h convert.h \ errors.h tokens.o: $(TOKENS_C) tokens.c $(CC) $(CFLAGS) tokens.c # Build RISCOS.C RISCOS_C = common.h target.h basicdefs.h \ errors.h scrcommon.h screen.h \ keyboard.h riscos.o: $(RISCOS_C) riscos.c $(CC) $(CFLAGS) riscos.c # Build STRINGS.C STRINGS_C = common.h target.h basicdefs.h \ strings.h heap.h errors.h strings.o: $(STRINGS_C) strings.c $(CC) $(CFLAGS) strings.c # Build STATEMENT.C STATEMENT_C = common.h target.h basicdefs.h \ tokens.h commands.h stack.h \ heap.h errors.h editor.h \ miscprocs.h variables.h evaluate.h \ screen.h fileio.h strings.h \ iostate.h mainstate.h assign.h \ statement.h statement.o: $(STATEMENT_C) statement.c $(CC) $(CFLAGS) statement.c # Build STACK.C STACK_C = common.h target.h basicdefs.h \ stack.h miscprocs.h strings.h \ tokens.h errors.h stack.o: $(STACK_C) stack.c $(CC) $(CFLAGS) stack.c # Build MISCPROCS.C MISCPROCS_C = common.h target.h basicdefs.h \ tokens.h errors.h keyboard.h \ screen.h miscprocs.h miscprocs.o: $(MISCPROCS_C) miscprocs.c $(CC) $(CFLAGS) miscprocs.c # Build MAINSTATE.C MAINSTATE_C = common.h target.h basicdefs.h \ tokens.h variables.h stack.h \ heap.h strings.h errors.h \ statement.h evaluate.h convert.h \ miscprocs.h editor.h emulate.h \ screen.h lvalue.h fileio.h \ mainstate.h mainstate.o: $(MAINSTATE_C) mainstate.c $(CC) $(CFLAGS) mainstate.c # Build LVALUE.C LVALUE_C = common.h target.h basicdefs.h \ tokens.h evaluate.h stack.h \ errors.h variables.h miscprocs.h \ lvalue.h lvalue.o: $(LVALUE_C) lvalue.c $(CC) $(CFLAGS) lvalue.c # Build KEYBOARD.C KEYBOARD_C = common.h target.h basicdefs.h \ errors.h keyboard.h screen.h keyboard.o: $(KEYBOARD_C) keyboard.c $(CC) $(CFLAGS) keyboard.c # Build IOSTATE.C IOSTATE_C = common.h target.h basicdefs.h \ tokens.h stack.h strings.h \ errors.h miscprocs.h evaluate.h \ convert.h emulate.h fileio.h \ screen.h lvalue.h statement.h \ iostate.h iostate.o: $(IOSTATE_C) iostate.c $(CC) $(CFLAGS) iostate.c # Build HEAP.C HEAP_C = common.h target.h basicdefs.h \ heap.h target.h errors.h \ miscprocs.h heap.o: $(HEAP_C) heap.c $(CC) $(CFLAGS) heap.c # Build FUNCTIONS.C FUNCTIONS_C = common.h target.h basicdefs.h \ tokens.h variables.h strings.h \ convert.h stack.h errors.h \ evaluate.h keyboard.h screen.h \ emulate.h miscprocs.h fileio.h \ functions.h functions.o: $(FUNCTIONS_C) functions.c $(CC) $(CFLAGS) functions.c # Build FILEIO.C FILEIO_C = common.h target.h basicdefs.h \ errors.h fileio.h strings.h fileio.o: $(FILEIO_C) fileio.c $(CC) $(CFLAGS) fileio.c # Build EVALUATE.C EVALUATE_C = common.h target.h basicdefs.h \ tokens.h variables.h lvalue.h \ strings.h stack.h errors.h \ evaluate.h statement.h miscprocs.h \ functions.h evaluate.o: $(EVALUATE_C) evaluate.c $(CC) $(CFLAGS) evaluate.c # Build ERRORS.C ERRORS_C = common.h target.h basicdefs.h \ errors.h stack.h fileio.h keyboard.h \ tokens.h screen.h miscprocs.h errors.o: $(ERRORS_C) errors.c $(CC) $(CFLAGS) errors.c # Build EMULATE.C EMULATE_C = common.h target.h errors.h \ basicdefs.h target.h emulate.h \ screen.h emulate.o: $(EMULATE_C) emulate.c $(CC) $(CFLAGS) emulate.c # Build EDITOR.C EDITOR_C = common.h target.h basicdefs.h \ errors.h variables.h heap.h \ tokens.h strings.h miscprocs.h \ stack.h fileio.h editor.o: $(EDITOR_C) editor.c $(CC) $(CFLAGS) editor.c # Build CONVERT.C CONVERT_C = common.h target.h basicdefs.h \ convert.h errors.h miscprocs.h convert.o: $(CONVERT_C) convert.c $(CC) $(CFLAGS) convert.c # Build COMMANDS.C COMMANDS_C = common.h target.h basicdefs.h \ miscprocs.h tokens.h statement.h \ variables.h editor.h errors.h \ heap.h stack.h strings.h \ evaluate.h screen.h keyboard.h commands.o: $(COMMANDS_C) commands.c $(CC) $(CFLAGS) commands.c # Build BRANDY.C BRANDY_C = common.h target.h basicdefs.h \ tokens.h errors.h heap.h \ editor.h commands.h statement.h \ fileio.h emulate.h keyboard.h \ screen.h miscprocs.h brandy.o: $(BRANDY_C) brandy.c $(CC) $(CFLAGS) brandy.c # Build ASSIGN.C ASSIGN_C = common.h target.h basicdefs.h \ target.h tokens.h heap.h \ stack.h strings.h variables.h \ errors.h miscprocs.h editor.h \ evaluate.h lvalue.h statement.h \ assign.h fileio.h emulate.h assign.o: $(ASSIGN_C) assign.c $(CC) $(CFLAGS) assign.c recompile: $(CC) $(CFLAGS) $(SRC) $(LD) $(LDFLAGS) $(OBJ) $(LIBS) -o brandy clean: wipe o.* ~CF~R~V wipe brandy ~CF~R~V wipe map ~CF~R~V nodebug: $(CC) $(CFLAGS2) $(SRC) $(LD) $(OBJ) $(LIBS) -o brandy -sym map squeeze brandy all: brandy MatrixBrandy-1.22.13/build/makefile.bcc0000664000175000017500000002223114022414626016704 0ustar soruksoruk# Makefile for brandy under DOS (for Borland BCC compiler) CC = bcc32 LD = bcc32 CFLAGS = -c -n$(SRCDIR) -O2 -WC -DTARGET_BCC32 LDFLAGS = LIBS = SRCDIR = src OBJ = $(SRCDIR)/variables.obj $(SRCDIR)/tokens.obj $(SRCDIR)/textonly.obj \ $(SRCDIR)/strings.obj $(SRCDIR)/statement.obj $(SRCDIR)/stack.obj \ $(SRCDIR)/miscprocs.obj $(SRCDIR)/mainstate.obj $(SRCDIR)/lvalue.obj \ $(SRCDIR)/keyboard.obj $(SRCDIR)/iostate.obj $(SRCDIR)/heap.obj \ $(SRCDIR)/functions.obj $(SRCDIR)/fileio.obj $(SRCDIR)/evaluate.obj \ $(SRCDIR)/errors.obj $(SRCDIR)/emulate.obj $(SRCDIR)/editor.obj \ $(SRCDIR)/convert.obj $(SRCDIR)/commands.obj $(SRCDIR)/brandy.obj \ $(SRCDIR)/assign.obj SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/textonly.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/emulate.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c brandy: $(OBJ) $(LD) $(LDFLAGS) -ebrandy $(SRCDIR)/*.obj $(LIBS) # Build VARIABLES.C VARIABLES_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/variables.h $(SRCDIR)/evaluate.h $(SRCDIR)/tokens.h \ $(SRCDIR)/stack.h $(SRCDIR)/heap.h $(SRCDIR)/errors.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/screen.h $(SRCDIR)/lvalue.h $(SRCDIR)/variables.obj: $(VARIABLES_C) $(SRCDIR)/variables.c $(CC) $(CFLAGS) $(SRCDIR)/variables.c # Build TOKENS.C TOKENS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/miscprocs.h $(SRCDIR)/convert.h \ $(SRCDIR)/errors.h $(SRCDIR)/tokens.obj: $(TOKENS_C) $(SRCDIR)/tokens.c $(CC) $(CFLAGS) $(SRCDIR)/tokens.c # Build TEXTONLY.C TEXTONLY_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/scrcommon.h $(SRCDIR)/screen.h \ $(SRCDIR)/keyboard.h $(SRCDIR)/textonly.obj: $(TEXTONLY_C) $(SRCDIR)/textonly.c $(CC) $(CFLAGS) $(SRCDIR)/textonly.c # Build STRINGS.C STRINGS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/strings.h $(SRCDIR)/heap.h $(SRCDIR)/errors.h $(SRCDIR)/strings.obj: $(STRINGS_C) $(SRCDIR)/strings.c $(CC) $(CFLAGS) $(SRCDIR)/strings.c # Build STATEMENT.C STATEMENT_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/commands.h $(SRCDIR)/stack.h \ $(SRCDIR)/heap.h $(SRCDIR)/errors.h $(SRCDIR)/editor.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/variables.h $(SRCDIR)/evaluate.h \ $(SRCDIR)/screen.h $(SRCDIR)/fileio.h $(SRCDIR)/strings.h \ $(SRCDIR)/iostate.h $(SRCDIR)/mainstate.h $(SRCDIR)/assign.h \ $(SRCDIR)/statement.h $(SRCDIR)/statement.obj: $(STATEMENT_C) $(SRCDIR)/statement.c $(CC) $(CFLAGS) $(SRCDIR)/statement.c # Build STACK.C STACK_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/stack.h $(SRCDIR)/miscprocs.h $(SRCDIR)/strings.h \ $(SRCDIR)/tokens.h $(SRCDIR)/errors.h $(SRCDIR)/stack.obj: $(STACK_C) $(SRCDIR)/stack.c $(CC) $(CFLAGS) $(SRCDIR)/stack.c # Build MISCPROCS.C MISCPROCS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/errors.h $(SRCDIR)/keyboard.h \ $(SRCDIR)/screen.h $(SRCDIR)/miscprocs.h $(SRCDIR)/miscprocs.obj: $(MISCPROCS_C) $(SRCDIR)/miscprocs.c $(CC) $(CFLAGS) $(SRCDIR)/miscprocs.c # Build MAINSTATE.C MAINSTATE_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/variables.h $(SRCDIR)/stack.h \ $(SRCDIR)/heap.h $(SRCDIR)/strings.h $(SRCDIR)/errors.h \ $(SRCDIR)/statement.h $(SRCDIR)/evaluate.h $(SRCDIR)/convert.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/editor.h $(SRCDIR)/emulate.h \ $(SRCDIR)/screen.h $(SRCDIR)/lvalue.h $(SRCDIR)/fileio.h \ $(SRCDIR)/mainstate.h $(SRCDIR)/mainstate.obj: $(MAINSTATE_C) $(SRCDIR)/mainstate.c $(CC) $(CFLAGS) $(SRCDIR)/mainstate.c # Build LVALUE.C LVALUE_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/evaluate.h $(SRCDIR)/stack.h \ $(SRCDIR)/errors.h $(SRCDIR)/variables.h $(SRCDIR)/miscprocs.h \ $(SRCDIR)/lvalue.h $(SRCDIR)/lvalue.obj: $(LVALUE_C) $(SRCDIR)/lvalue.c $(CC) $(CFLAGS) $(SRCDIR)/lvalue.c # Build KEYBOARD.C KEYBOARD_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/keyboard.h $(SRCDIR)/screen.h $(SRCDIR)/keyboard.obj: $(KEYBOARD_C) $(SRCDIR)/keyboard.c $(CC) $(CFLAGS) $(SRCDIR)/keyboard.c # Build IOSTATE.C IOSTATE_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/stack.h $(SRCDIR)/strings.h \ $(SRCDIR)/errors.h $(SRCDIR)/miscprocs.h $(SRCDIR)/evaluate.h \ $(SRCDIR)/convert.h $(SRCDIR)/emulate.h $(SRCDIR)/fileio.h \ $(SRCDIR)/screen.h $(SRCDIR)/lvalue.h $(SRCDIR)/statement.h \ $(SRCDIR)/iostate.h $(SRCDIR)/iostate.obj: $(IOSTATE_C) $(SRCDIR)/iostate.c $(CC) $(CFLAGS) $(SRCDIR)/iostate.c # Build HEAP.C HEAP_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/heap.h $(SRCDIR)/target.h $(SRCDIR)/errors.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/heap.obj: $(HEAP_C) $(SRCDIR)/heap.c $(CC) $(CFLAGS) $(SRCDIR)/heap.c # Build FUNCTIONS.C FUNCTIONS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/variables.h $(SRCDIR)/strings.h \ $(SRCDIR)/convert.h $(SRCDIR)/stack.h $(SRCDIR)/errors.h \ $(SRCDIR)/evaluate.h $(SRCDIR)/keyboard.h $(SRCDIR)/screen.h \ $(SRCDIR)/emulate.h $(SRCDIR)/miscprocs.h $(SRCDIR)/fileio.h \ $(SRCDIR)/functions.h $(SRCDIR)/functions.obj: $(FUNCTIONS_C) $(SRCDIR)/functions.c $(CC) $(CFLAGS) $(SRCDIR)/functions.c # Build FILEIO.C FILEIO_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/fileio.h $(SRCDIR)/strings.h $(SRCDIR)/fileio.obj: $(FILEIO_C) $(SRCDIR)/fileio.c $(CC) $(CFLAGS) $(SRCDIR)/fileio.c # Build EVALUATE.C EVALUATE_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/variables.h $(SRCDIR)/lvalue.h \ $(SRCDIR)/strings.h $(SRCDIR)/stack.h $(SRCDIR)/errors.h \ $(SRCDIR)/evaluate.h $(SRCDIR)/statement.h $(SRCDIR)/miscprocs.h \ $(SRCDIR)/functions.h $(SRCDIR)/evaluate.obj: $(EVALUATE_C) $(SRCDIR)/evaluate.c $(CC) $(CFLAGS) $(SRCDIR)/evaluate.c # Build ERRORS.C ERRORS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/stack.h $(SRCDIR)/fileio.h \ $(SRCDIR)/tokens.h $(SRCDIR)/screen.h $(SRCDIR)/miscprocs.h $(SRCDIR)/errors.obj: $(ERRORS_C) $(SRCDIR)/errors.c $(CC) $(CFLAGS) $(SRCDIR)/errors.c # Build EMULATE.C EMULATE_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/errors.h \ $(SRCDIR)/basicdefs.h $(SRCDIR)/target.h $(SRCDIR)/emulate.h \ $(SRCDIR)/screen.h $(SRCDIR)/emulate.obj: $(EMULATE_C) $(SRCDIR)/emulate.c $(CC) $(CFLAGS) $(SRCDIR)/emulate.c # Build EDITOR.C EDITOR_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/errors.h $(SRCDIR)/variables.h $(SRCDIR)/heap.h \ $(SRCDIR)/tokens.h $(SRCDIR)/strings.h $(SRCDIR)/miscprocs.h \ $(SRCDIR)/stack.h $(SRCDIR)/fileio.h $(SRCDIR)/editor.obj: $(EDITOR_C) $(SRCDIR)/editor.c $(CC) $(CFLAGS) $(SRCDIR)/editor.c # Build CONVERT.C CONVERT_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/convert.h $(SRCDIR)/errors.h $(SRCDIR)/miscprocs.h $(SRCDIR)/convert.obj: $(CONVERT_C) $(SRCDIR)/convert.c $(CC) $(CFLAGS) $(SRCDIR)/convert.c # Build COMMANDS.C COMMANDS_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/miscprocs.h $(SRCDIR)/tokens.h $(SRCDIR)/statement.h \ $(SRCDIR)/variables.h $(SRCDIR)/editor.h $(SRCDIR)/errors.h \ $(SRCDIR)/heap.h $(SRCDIR)/stack.h $(SRCDIR)/strings.h \ $(SRCDIR)/evaluate.h $(SRCDIR)/screen.h $(SRCDIR)/keyboard.h $(SRCDIR)/commands.obj: $(COMMANDS_C) $(SRCDIR)/commands.c $(CC) $(CFLAGS) $(SRCDIR)/commands.c # Build BRANDY.C BRANDY_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/tokens.h $(SRCDIR)/errors.h $(SRCDIR)/heap.h \ $(SRCDIR)/editor.h $(SRCDIR)/commands.h $(SRCDIR)/statement.h \ $(SRCDIR)/fileio.h $(SRCDIR)/emulate.h $(SRCDIR)/keyboard.h \ $(SRCDIR)/screen.h $(SRCDIR)/miscprocs.h $(SRCDIR)/brandy.obj: $(BRANDY_C) $(SRCDIR)/brandy.c $(CC) $(CFLAGS) $(SRCDIR)/brandy.c # Build ASSIGN.C ASSIGN_C = $(SRCDIR)/common.h $(SRCDIR)/target.h $(SRCDIR)/basicdefs.h \ $(SRCDIR)/target.h $(SRCDIR)/tokens.h $(SRCDIR)/heap.h \ $(SRCDIR)/stack.h $(SRCDIR)/strings.h $(SRCDIR)/variables.h \ $(SRCDIR)/errors.h $(SRCDIR)/miscprocs.h $(SRCDIR)/editor.h \ $(SRCDIR)/evaluate.h $(SRCDIR)/lvalue.h $(SRCDIR)/statement.h \ $(SRCDIR)/assign.h $(SRCDIR)/fileio.h $(SRCDIR)/emulate.h $(SRCDIR)/assign.obj: $(ASSIGN_C) $(SRCDIR)/assign.c $(CC) $(CFLAGS) $(SRCDIR)/assign.c recompile: $(CC) $(CFLAGS) $(SRC) $(LIBS) -ebrandy nodebug: $(CC) $(CFLAGS2) $(SRC) $(LIBS) -ebrandy strip brandy clean: erase $(SRCDIR)/*.obj erase brandy.exe all: brandy MatrixBrandy-1.22.13/build/buildflags.txt0000664000175000017500000000041214022414626017330 0ustar soruksorukI've added to the top-level makefiles, the option to read from environment variable BRANDY_BUILD_FLAGS so you can add additional defines without having to modify the makefiles - this might be useful for your keyboard work instead of maintaining separate makefiles? MatrixBrandy-1.22.13/build/makefile.riscos.cross0000664000175000017500000000312214160705100020576 0ustar soruksoruk# Makefile for Brandy under RISC OS cross-compiled from Linux CC = arm-unknown-riscos-gcc LD = arm-unknown-riscos-gcc STRIP = arm-unknown-riscos-strip ADDFLAGS = ${BRANDY_BUILD_FLAGS} include git.mk #CFLAGS = -g -DDEBUG -DNONET -Wall $(GITFLAGS) -mlibscl #CFLAGS = -g -DNONET -Wall $(GITFLAGS) -mlibscl CFLAGS = -O2 -DNONET -DBRANDY_DEFAULT_SIZE=512 -Wall $(GITFLAGS) $(ADDFLAGS) -mlibscl LDFLAGS += -mlibscl LIBS = SRCDIR = ../src OBJ = $(SRCDIR)/variables.o $(SRCDIR)/tokens.o $(SRCDIR)/riscos.o \ $(SRCDIR)/strings.o $(SRCDIR)/statement.o $(SRCDIR)/stack.o \ $(SRCDIR)/miscprocs.o $(SRCDIR)/mainstate.o $(SRCDIR)/lvalue.o \ $(SRCDIR)/keyboard.o $(SRCDIR)/iostate.o $(SRCDIR)/heap.o \ $(SRCDIR)/functions.o $(SRCDIR)/fileio.o $(SRCDIR)/evaluate.o \ $(SRCDIR)/errors.o $(SRCDIR)/mos.o $(SRCDIR)/editor.o \ $(SRCDIR)/convert.o $(SRCDIR)/commands.o $(SRCDIR)/brandy.o \ $(SRCDIR)/assign.o $(SRCDIR)/net.o $(SRCDIR)/mos_sys.o SRC = $(SRCDIR)/variables.c $(SRCDIR)/tokens.c $(SRCDIR)/riscos.c \ $(SRCDIR)/strings.c $(SRCDIR)/statement.c $(SRCDIR)/stack.c \ $(SRCDIR)/miscprocs.c $(SRCDIR)/mainstate.c $(SRCDIR)/lvalue.c \ $(SRCDIR)/keyboard.c $(SRCDIR)/iostate.c $(SRCDIR)/heap.c \ $(SRCDIR)/functions.c $(SRCDIR)/fileio.c $(SRCDIR)/evaluate.c \ $(SRCDIR)/errors.c $(SRCDIR)/mos.c $(SRCDIR)/editor.c \ $(SRCDIR)/convert.c $(SRCDIR)/commands.c $(SRCDIR)/brandy.c \ $(SRCDIR)/assign.c $(SRCDIR)/net.c $(SRCDIR)/mos_sys.c Brandy,ff8: $(OBJ) $(LD) $(LDFLAGS) -o Brandy,ff8 $(OBJ) $(LIBS) include depends.mk .c.o: $(CC) $(CFLAGS) $< -c -o $@ clean: rm -f $(SRCDIR)/*.o Brandy,ff8 all: Brandy,ff8 MatrixBrandy-1.22.13/CMakeLists.txt0000664000175000017500000000374314160662532016132 0ustar soruksorukcmake_minimum_required(VERSION 3.0.1) project(brandy) set(BRANDY_USE_GRAPHICS ON CACHE BOOL "Use Graphics") set(BRANDY_USE_ANSI ON CACHE BOOL "Use ANSI Escape Sequences") set(SRCDIR src) set(SRC ${SRCDIR}/variables.c ${SRCDIR}/tokens.c ${SRCDIR}/strings.c ${SRCDIR}/statement.c ${SRCDIR}/stack.c ${SRCDIR}/miscprocs.c ${SRCDIR}/mainstate.c ${SRCDIR}/lvalue.c ${SRCDIR}/keyboard.c ${SRCDIR}/iostate.c ${SRCDIR}/heap.c ${SRCDIR}/functions.c ${SRCDIR}/fileio.c ${SRCDIR}/evaluate.c ${SRCDIR}/errors.c ${SRCDIR}/mos.c ${SRCDIR}/editor.c ${SRCDIR}/convert.c ${SRCDIR}/commands.c ${SRCDIR}/brandy.c ${SRCDIR}/assign.c ${SRCDIR}/net.c ${SRCDIR}/mos_sys.c) if(BRANDY_USE_GRAPHICS) set(SRC ${SRC} ${SRCDIR}/graphsdl.c) if(NOT WIN32) find_package(X11 REQUIRED) include_directories(${X11_INCLUDE_DIR}) link_libraries(${X11_LIBRARIES}) endif() find_package(SDL REQUIRED) include_directories(${SDL_INCLUDE_DIR}) link_libraries(${SDL_LIBRARY}) add_definitions(-DUSE_SDL) else() if(BRANDY_USE_ANSI) set(SRC ${SRC} ${SRCDIR}/textonly.c) else() set(SRC ${SRC} ${SRCDIR}/simpletext.c) endif() if (WIN32) add_definitions(-DBODGEMGW) endif() add_definitions(-DNO_SDL) endif() if(WIN32) link_libraries(wsock32 ws2_32) endif() execute_process( COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND git log -1 --format=%cd WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE ) add_definitions(-DBRANDY_GITCOMMIT=\"${GIT_COMMIT}\" -DBRANDY_GITBRANCH=\"${GIT_BRANCH}\" -DBRANDY_GITDATE=\"${GIT_DATE}\") add_definitions(-DDEFAULT_IGNORE) link_libraries(m) add_executable(brandy ${SRC}) add_library(brandyapp ${SRC}) target_compile_definitions(brandyapp PUBLIC -DBRANDYAPP) MatrixBrandy-1.22.13/COPYING0000664000175000017500000004325414156732602014427 0ustar soruksoruk GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. MatrixBrandy-1.22.13/docs/0000775000175000017500000000000014174212675014317 5ustar soruksorukMatrixBrandy-1.22.13/docs/banana-bugs.txt0000664000175000017500000000456214156732602017242 0ustar soruksorukBanana Brandy update v1.20/v0.02 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BEAT and BEATS seperated, they do two different things. BEAT reads current microbeat number, BEATS reads total number of microbeats in a bar. tokens.c/editor.c ----------------- Can load Russell format BASIC programs (Z80/DOS/Windows BASIC). mos.c ----- All mos_oscli() functions combined together. CALL OSBYTE and OSWORD on RISC OS passed directly to OS_Byte and OS_Word. Apple Brandy update v1.20/v0.01 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error.c ------- Fixed some ERR error numbers. Added OSCLI error messages. Fixed REPORT and default error reporter to output \r\n before message. keyboard.c ---------- Handles zero-length function key strings correctly. statement.s ----------- Executing DEF correctly skips past to next line, allowing correct execution of, multiple-entry procedures, eg: 10 DEFPROCtimed(delay%) 20 DEFPROCdefault:LOCAL delay%:delay%=100 30 delay%=TIME+delay%:REPEAT UNTIL TIME>delay%:ENDPROC Renamed emulate.c and emulate.h to mos.c and mos.h -------------------------------------------------- mos.c ----- OSCLI passed to OS restores text cursor to next line after any output. Rewritten *FX to correctly parse numbers and call OSBYTE. Added mos_osbyte() to provide low-level OSBYTE functions. Serial handling FXs translated to OSBYTEs and renumbered to correct OSBYTE calls. Written cmd_parse_dec() for *FX and *KEY and any other future commands. Added *HELP with help topics. See *HELP BASIC, *HELP MOS. *KEY rewritten, with generalised gstrans() function. Need to write proper command table parser to replace command_check(). Bugs identified to be fixed =========================== GSTrans terminates at a quote when it shouldn't, eg *KEY 1 hello"there should assign the string hello"there but instead assigns hello". When sys_font[] is available, implement OSWORD 10 to read font bitmap. Need to add *LOAD and *SAVE commands. Integrate extensions from WinCE fork (^variable, SYS to host OS, etc.) Add $$ to reference null-terminated strings. Move toupper()/tolower() to in-code functions, removes need for UnixLib on RISC OS. Probably need host-specific modules for SYS calls. Make *FX0,0 give appropriate error string. RISC OS Brandy should be able to claim memory on startup instead of needing *WimpSlot beforehand. *cd doesn't give any error. MinGW: Escape causes next char to also be Escape. MatrixBrandy-1.22.13/docs/graphics.txt0000664000175000017500000000516614156732602016665 0ustar soruksorukGraphics Support ---------------- Brandy includes limited graphics support under Linux. It includes only a subset of the facilities provided by the RISC OS VDU drivers but it should be enough for now. The graphics support is based around SDL 1.2 The graphic support includes all of the Basic graphics statements with some restrictions and a small number of the VDU 23 commands. Features such as the extended colour fill patterns are not supported. The standard RISC OS palettes in 2, 4, 16 and 256 colour modes are emulated and both colour and greyscale palettes are possible. Colour depth 16777216 is also supported for 24-bit colour. Flashing colours are not supported, they are instead shown as dimmed versions of their non-flashing counterparts. Modes can be set using either MODE , MODE or MODE , , . Any (sensible) dimensions can be supplied, and if a requested mode is not a predefined one, MODE 126 will be configured with the desired values, then selected. All available screen modes are available under X, the window will be sized accordingly. When running on a console frame buffer, only those which will fit on the console screen will be available. New display modes can be created with *NewMode, use a mode in the range 64-126. Teletext graphics are also supported in Mode 7, see docs/Mode7. Four display banks are available (except in Mode 7), they are controlled by *FX112 and FX113 as on a BBC Master or RISC OS machine. All screen modes use the primary display, so *FX112,0 is synonymous to *FX112,1, similarly for *FX113. These are also available as OSBYTE calls via CALL/USR &FFF4 and SYS "OS_Byte" (SYS 6). *REFRESH (borrowed from BB4W/BBCSDL by Richard Russell) *REFRESH One-shot refresh of the display. *REFRESH OFF Suspends updates to the display window. *REFRESH ON Resume updates to the display window, updating it with any pending changes. *REFRESH ONERROR Suspends updates to the display window until an error condition is encountered. This option is not present in BB4W/BBCSDL. This can also be set - and read - by OSBYTE &2A (42). See osbyte.txt for more details on this. Additionally to this, the "tbrandy" text-mode build, when built on a UNIX-like system (excluding Cygwin) also supports Tektronix graphics when enabled with SYS "Brandy_TekEnabled",1 and thus can output graphics when run in an xterm window or through an emulator such as Rene Richarz's Tek4010 emulator https://github.com/rricharz/Tek4010 - and, while untested, it should even run when output to real hardware. In the SDL builds, MODEs 72-75 are dimensioned to give a graphical area the same as a Tektronix system. MatrixBrandy-1.22.13/docs/ChangeLog0000664000175000017500000010371414174212675016077 0ustar soruksorukChangeLog for Matrix Brandy - as forked from Sourceforge after V1.20.1 ====================================================================== * V1.22.13 - 26 January 2022 - System: Stricter handling of oversize variable and PROC/FN names. - System: Improved handling of ESCAPE under RISC OS (notably, it no longer crashes the interpreter). - System: Improve behaviour on Linux console framebuffer, particulary Raspberry Pi. Experience may vary across other hardware. - System: Remove the old keyboard code, JGH's NEWKBD code is now the only version present. - System: On non-RISC OS platforms, when using LOAD, CHAIN, OPENIN and OPENUP, if file isn't found, retry with a .bbc suffix before complaining. SAVE and OPENOUT will not use a .bbc suffix unless explicitly provided in the filename. - System: Permit system memory to be up to 4194303K (4GB less 1K) - System: Programs saved under RISC OS now get file type &FD1 (allocated by Acorn as BASIC stored as text). The file type is associated with Matrix Brandy for loading and running by double-clicking on the desktop. - System: RISC OS: MODE in form xres,yres,depth was broken. Fixed. - Graphics: Reworked line drawing, the earlier adaption of upstream was not right. This new version is based on PiTubeDirect's implementation. - Graphics: Dot patterns, VDU23,6 and OSBYTE 163,242 now implemented - Graphics: Fixed a crash bug due to SDL not being particularly thread-safe. - BASIC: PRINT and STR$ now support displaying a decimal comma instead of a point. - BASIC: PRINT and STR$ now show exponents in the style used by the BBC and RISC OS, rather than the C standard. - BASIC: @% with precision 0 now uses &11 (except in fixed-precision mode), same as ARM BBC BASIC VI. - BASIC: @% with width set to 0 now left-justifies, as per Acorn BASICs, RTR's assembly-language builds and (as of V0.40) BB4C. - BASIC: @% precisions greater than &11xx are now capped at &11xx. - BASIC: LVAR now includes @% in its output, displaying both in hex and its string form. - BASIC: Extended TRACE with TRACE VDU [OFF], this redirects TRACE output to Brandy's controlling terminal, specifying OFF puts it back to normal. * V1.22.12 - 05 December 2021 - System: Fix some floating-point data size mismatches - System: Fix calculations of matrix dot products (thank you mikefairbank@Github!) - System: New RISC OS build process using GCCSDK under Linux (thank you Cameron Cawley!) - Keyboard: Fixed keyboard from eating too much from event queue (thanks David Hawes!) - Graphics: Implemented GCOL action codes 5-7 - Graphics: Hopefully fixed a triangle drawing bug. - Graphics: Implement VDU23,16 (as far as already implemented) in VDU5 mode. - Teletext: Implemented VDU23,18,4,pri,alt| to select character sets. This is much cleaner than using SAA505Xlib in the examples, but that will remain as an example for OSWORDs &8B and &8C. - BASIC: Fix COLOUR(r,g,b) function to return correct values in 256-colour modes. - BASIC: Fix behaviour of RND followed by a space before parentheses to match ARM and 6502 BBC BASIC. - BASIC: Change the behaviour of cascaded IF calls to match the behaviour of BBCSDL and friends. This is switchable and can be switched back to Acorn's (strange) behaviour via a SYS call. - INKEY(-256) now returns ASC("M") (&4D) on ALL platforms, including RISC OS. * V1.22.11 - 11 July 2021 - System: Mouse position wasn't taking into account change of ORIGIN. - System: Changes to dlopen, otherwise symbols weren't being recognised. - System: SYS "Brandy_dlgetaddr" optionally takes a second parameter of a library handle returned by SYS "Brandy_dlopen". - System: SYS now only operates in 64-bit mode on 64-bit hardware. - System: Fixed a bug where the keyboard would stop responding after a while in full-screen mode. - System: Bug fix on new-style MODE call where MODEs 3, 6 and 7 could be matched. It now only matches existing graphics-capable modes, and will construct one (effectively doing *NewMode 126 x y bpp 1 1) if no matches to existing modes are found. - System: Emulated syscall OS_ReadModeVariable was incorrectly also returning VDU variables. Now only Mode variables are returned, attempts to get any other variable return 0, as they do on RISC OS. - System: Implemented OSWORDs 11 and 12, and SYS "OS_ReadPalette" - System: Implemented VDU flags 148-152, so 0-12 and 128-161 are now supported. - System: Reading VDU variables for TINT was giving incorrect values. - System: VDU20 wasn't updating the display (unlike VDU19), fixed. - BASIC: Fixed a bug whereby the OSCLI command might have its parameter trampled on. - BASIC: On non-RISC OS platforms, increase SYS parameters to 16 to support "Brandy_dlcall" calling symbols which take a lot of parameters. - BASIC: Power was broken in the upper echelons of 64-bit ints, also conversion to ints was a bit broken for edge cases. - BASIC: Evaluations now carried out internally with 80-bit floats (where available), cast to 64-bit when returning values to BASIC. * V1.22.10 - 14 February 2021 - System: *Refresh OnError wasn't working correctly. Fixed. - System: Added a fix reducing the likelihood of where a textfile BASIC program could be misinterpreted as a tokenised one. - System: Implemented enough of SYS "OS_File" to hopefully be useful. - System: SDL graphics in its own thread. MODE 7 now runs like a startled cat. As a bonus, we now have a flashing cursor too. The performance tweak call SYS "Brandy_RefreshInterval" has been removed. - System: MODE 7 is now fast enough that VDU 23,18,1 is a no-op. - Graphics: New ellipse drawing code. Based on RISC OS ARM implementation, translated to C by hoglet@Stardot for PiTubeDirect. - Graphics: Fix a crash where somehow PLOT generates negative offset values. - BASIC: CLEAR now deallocates arrays (not memory blocks) allocated using DIM HIMEM. - BASIC: CLEAR extended to allow CLEAR HIMEM [], which frees arrays (not memory blocks), but otherwise leaves variables untouched. Specifying which array will de-allocate only that array. The array variable can subsequently be re-dimensioned using DIM [HIMEM]. - BASIC: DIM HIMEM can no longer attempt to create string arrays. - BASIC: SWAP now works correctly on off-heap arrays. - BASIC: Fixed a bug in array arithmetic on uint8 arrays - BASIC: Implemented PTR(string$) and PTR(array()). - BASIC: PTR#0 now returns 0 (in line with BBC BASIC 2-5, 1 unknown) rather than throwing an error. Note ARM BBC BASIC VI returns the temporary file number as per OS_Args 0,0 with zero meaning none in use. - BASIC: Brandy internally used separate tokens for TIME and TIME$ meaning TI.$ couldn't be used as an abbreviation (and it confused the parser). The TIME$ token has been removed, so TI.$ works as per Acorn BBC BASIC. * V1.22.9 - 06 January 2021 - Code: Removed some pointless comparisons (e.g. unsigned < 0) - System: Accept -- on the commmand line to indicate all further options to be passed into the BASIC program even if it's otherwise a Brandy option. - System: Implemented BBC MOS calls OSRDCH, OSNEWL, OSASCI and OSCLI via the traditional CALL &FFxx route. - System: Enabled generic plain-text printing under Linux (or other platform with CUPS, it uses 'lpr' to do the heavy lifting). - System: Implemented OSBYTE 6 (Printer ignore character), default is 13. (Maybe it's a quirk of my printer, but ignoring 10 as default on the BBC doesn't print right. Could be CUPS though.) - Platforms: Fixed a 64-bit regression in the NEW command. - BASIC: Fix regression on MODE command caused by uint8 data type introduction. - BASIC: Implemented 64-bit unary indirection using ']' (as per BBCSDL). - BASIC: Implemented DIM HIMEM (a Basalt extension), in Matrix Brandy this allocates memory outside the heap, using malloc() and friends. Memory blocks for indirection, and numeric arrays can be created in this. String arrays control blocks will be off the heap, but the strings themselves will still be stored on the heap. * V1.22.8 - 16 September 2020 - BASIC: Fix REM behaviour of DEF line. - BASIC: Implemented SYS() function, somewhat in line with BBCSDL's version. In Matrix Brandy, this calls OS_SWINumberFromString, and also works under RISC OS. - System: Implement two SYS calls for obtaining the address of a system call (Brandy_dlgetaddr) and to call it (Brandy_dlcalladdr). - System: Implement OS_SWINumberToString. - System: Fix bugs in string handling on OPENIN, OPENOUT and OPENUP (CVE-2019-14662 and CVE-2019-14663 reported on upstream Brandy) - Display: Fix a subtle VDU23,16,1| bug. Thanks to Richard Russell for this. - Examples: Telstar client updated with ANSItex BBS added. * V1.22.7 - 01 August 2020 - Platforms: Native display builds for RISC OS available, including networking. 26-bit and 32-bit builds both possible. - Platforms: SYS calls on RISC OS can call the Brandy_* calls from within the interpreter in addition to the RISC OS native calls. OS_SWINumberFromString is intercepted to also recognise the Brandy_* calls. - Platforms: BrandyApp build mechanism changed, no longer relies on ld to build a .o file, instead uses a BASIC program to build a .c file with the program data embedded. - System: pthreads used for timer thread on non-SDL (and non-RISC OS) builds. - System: Timer uses monotomic clock instead of gettimeofday(). - System: *EXEC now interruptable with ESCAPE, and not aborted on other errors. - BASIC: Unsigned 8-bit data type (var&) implemented. - BASIC: Overflowing a 32-bit integer variable will now raise an error instead of silently wrapping. (uint8 variables will wrap.) - BASIC: OLD keyword now reports Unsupported. It never worked properly and in Brandy it is rather pointless. - BASIC: DELETE keyword now requires at least one parameter. - BASIC: Lowercase immediate mode commands no longer allowed, unless compiled with -DBRANDY_ALLOW_LOWERCASE_COMMANDS - BASIC: RENUMBER edge cases fixed. - BASIC: GET(x,y) and GET$(x,y) are now relative to the current text viewport as set with VDU28. - Examples: Teletext screen editor updated with mouse support, inspired by code written as examples for Pixelblip@Stardot's editor. * V1.22.6 - 19 June 2020 - BASIC: Implemented BB4W/BBCSDL extension GET(x,y) and GET$(x,y) - BASIC: Fixed TINT, both function and command as they were rather broken. - System: Some subtle bugs fixed as a result of clang compiler warnings. - System: Block attempts to free workspace memory that shouldn't be randomly freed. - System: INKEY(-256) now returns &4D (M) for all builds except RISC OS. System specifics can be obtained from SYS "Brandy_Platform". - System: OSBYTE &87 implemented for non-MODE7 screen modes. (MODE 7 was previously implemented) - System: Now builds on MacOS High Sierra and Catalina. Note, it requires the latest snapshot of SDL 1.2 from SDL's Mercurial repository. - System: Bug fixes for *SAVE and *LOAD. Additionally, MODE 7 screens can now be *SAVEd and *LOADed. - System/Display: Several bugs fixed, highlighted by Jan Vibe's graphical demos. - Display: Some optimisations in the scaled blitting code. - Display: Added a hugely optimised code path for scrolling, when no VDU28 window is in place, and not MODE 7. - Display: VDU23,7 implemented apart from movement option. - Display: While 32K colour modes aren't directly implemented, instead of reporting an error when such a mode is requested, a 24bit colour mode is selected instead. - Keyboard: Implemented OSBYTE 4, including function keys on cursor keys with *FX4,2. *FX4,1 makes cursor keys generate BBC Micro values. - Keyboard: Try to fix some glitches around softkeys and the cursor keys. - Keyboard: Rework INKEY delay as on Windows messages were sometimes just getting lost in the post. - Keyboard/Mouse: *FX15 and *FX21 (x=0,9 only) implemented to flush buffers. - Mouse: Mouse event queue implemented. - Teletext: Don't mimic SAA5050 "hold bug" if Alpha and Graphics Black enabled (VDU23,18,3,1|) - Teletext: Hold characer wasn't being cleared when switching between double height and normal size. - Teletext: Fixed a bug where flash wasn't flashing while INKEY(delay). - Teletext: Implemented the Alternative character set, toggled with &9B. - Implemented an equivalent to OSWORD 10 for the Teletext font. Using OSWORD &8B as it appears to be undefined. Requires a 44 byte block. - Teletext: Implemented OSWORD &8C to change a Teletext character definition. These two are specific to Matrix Brandy and Richard Russell's BBCSDL. Details on these calls are in docs/Mode7.txt - Teletext: Added example library SAA505Xlib, which uses the new OSWORD calls to allow language changes as per the SAA505x family (0-7 supported). * V1.22.5 - 08 May 2020 - Fixed a bug in CLS where it missed the bottom of the screen if the vertical resolution wasn't a multiple of the text height. - Fixed various bugs in 64-bit variable handling. - Fixed an omission - indirection offsets on 64-bit variables are now supported. - Changed the appearance of the * character in MODE 7, as I never really liked the RISC OS 5 shape, it's now much closer to the SAA5050 shape while retaining the RISC OS 5 dimensions. - Removed Teletext 12x20 and 14x20 displays, thus VDU23,18,255,x is no more. * V1.22.4 - 10 March 2020 - Enable building on Cygwin 64-bit - Some more 64-bit fixes - Initial steps to allow SYS to call host library functions. Enabled for Linux and Windows (thank you Richard Russell for the code snippet!) - SDL surface handle now available from Brandy_GetVideoDriver in R5. - Raise function now handles invalid values gracefully. Range is slightly more permissive than BASIC I-V, but closely matches BASIC VI. - Add option to use SW surface on command line, and allow brandy-apps to accept some command line options. - Fix a setjmp crash in Win64. - Correct a substitution error in MODE 7 high-bit graphics. - Fix an incorrect stack pull, and add verification to the stack pull code. - Bit shifts now 32-bit by default (as per old behaviour and BASIC VI), switchable to 64-bit with SYS "Brandy_BitShift64",1 * V1.22.3 - 29 November 2019 - Fix stack and array regressions caused by the 64-bit int work. - Fix a flood filling crash when new colour is the same as the old colour. * V1.22.2 - 25 November 2019 - Merge in 64-bit int capability - Remove offset memory model, PAGE, HIMEM and indirection operators now use actual memory locations. - Text-mode builds available for Windows with Cygwin build environment. - Change to Escape handling (thanks Jonathan Harston), bringing it more in line with the way the Acorn MOS handles it. - Many more keyboard fixes from Jonathan Harston. - Separate out memory information from *HELP BASIC (in Debug mode) to *HELP MEMINFO (available on any build). - Fixed VDU5 font painting in black. It now honours the graphics window and the GCOL action code. - RECTANGLE FILL now honours the graphics window. - GOTO and GOSUB no longer require parentheses around an expression. - Tektronix graphics added to tbrandy (textonly.c), but not enabled by default. - New graphics demos (converted from Teklib demos), and all non-Teklib graphics demos checked to work with both regular graphics and the newly Tek-enhanced text-mode build. - RESTORE LOCAL (BB4W/BBCSDL extension) implemented. - ON ERROR behaviour corrected, variables declared LOCAL shouldn't be restored to their global values when the stack is unwound. * V1.22.1 - 20 September 2019 - Make the old BASIC I-IV compatible integer mathematics available via a run-time switchable setting. - Integer addition and subtraction will now return integer if it fits, else a float. (Legacy mode: unchanged, will always return an int, with wraparound). - Integer multiplication follows new code path at all times, old int-only implementation didn't match any Acorn BBC BASIC version and is thus a bug. - Fixed stack pointer leak bug. - Fixed behaviour setting HIMEM immediately after LOADing a file - SYS "Brandy_GetVideoDriver" extended, returns MODE 7 framebuffer base in R4. - RISC OS style sound working. MANY thanks to David Hawes. - Separate out segfault memory error to its own error message. - Fix pass-back of strings from SYS on 64-bit systems. - Fix sound with volume = 0 (Thanks David Hawes) - Sound updates in StringLib family (Thanks David Hawes) - Bug fix for VAL - it should ONLY handle decimal numbers (not hex or binary) - Fix flood fill (it just didn't work right), new implementation is however quite memory hungry and recursive. - Signal handler updated, longjmps now use siglongjmp. check_read() and check_write() no longer required. Note this also allows a program to trample on the BASIC stack. - Many keyboard updates (Thanks Jonathan Harston) * V1.22.0 - 23 July 2019 - Change identifier to BASIC VI (which is BASIC V with 64-bit FP maths, which is what Brandy has always done) - *SPOOL and *SPOOLON implemented. - Fix integer overflows when converting from floats. - Fix intermittent crash when execution hits a DEF statement. - Added a run-time switchable setting for INT() whether it can process numbers out of range of a 32-bit int data type. Default is off. - Implement the AUTO command. * V1.21.21 - 08 July 2019 - Centisecond timer polling hived off to its own thread, as polling it every command iteration for ESCAPE checking was expensive. - Program execution now much faster than before, and slightly faster again when ESCAPE is disabled via *FX200. - Renamed some #DEFINEs as they were colliding on a new gcc on Cygwin. - ESCAPE on VDU14 paged mode now works. - INKEY no longer swallows a non-matching keypress. - Some more OS SWIs implemented (the Snow demo from RISC OS Pico for RasPi now runs unmodified). - Optionally allow an unselectable MODE to be substituted with another one instead of reporting "Screen mode is not available". - Some more Raspberry Pi GPIO stuff, including recognising most RISC OS GPIO module SWI names, and implementing a few. - Unsupported colour depths are mapped to 24-bit (previously was 8-bit), so a program asking for a 15-bit mode will be able to draw colours as largely intended. - Extended OSBYTE 42 to allow an immediate refresh - SYS6,42,16 may be faster than parsing "*REFRESH" for anything time-critical (and obvious functionality that was missing from the interface) - Quotes are stripped if appropriate from *ScreenSave and *ScreenLoad. They remain optional for filenames which include spaces. * V1.21.20 - 12 June 2019 - Improved CIRCLE FILL and ELLIPSE FILL routines. - Added -v CLI option - thanks TheBrokenRail @ Github. - Reworked graphics window clipping, as it was completely broken. - Fixed string return values from SWI calls, hopefully they will not break on 64-bit systems - Added SWI "Brandy_GetVideoDriver" as a wrapper for SDL_VideoDriverName, additionally returns "no_sdl" for non-SDL builds - Extended SWI "Brandy_Version" to also return host OS and whether or not it's an SDL build. * V1.21.19 - 01 March 2019 - Hopefully fixed the spurious cursor remnants. - Ellipses with shears now implemented, PLOT &C5 and PLOT &CD now work correctly (fill implementation could possibly be improved). Other variants to be tested. - ELLIPSE [FILL] command with non-zero angle now supported. - MODE 7: Update screen on WAIT-delay, and flash continues during WAIT. - MODE 7: Increase display accuracy at the expense of performance, switchable via VDU23,18,1,x| - bit 0 is also now implemented. - MODE 7: *REFRESH now does the right thing. - WAIT can now be interrupted with ESCAPE. - Invocation behaviour change: brandy now assumes -quit instead of -chain. - Support for shrouded BASIC programs, examples/shroud will shroud a program hiding the source code. It is itself shrouded. A shrouded program cannot be LOADed or CHAINed, and can only be invoked from the command line. - Makefile and code improvement contributions from ccawley2011 @ github. - Corrected behaviour of EOF#0, BPUT#0, BGET#0 etc, thanks dhg2 @ Stardot. - *EXEC implemented. Idea from Richard Russell. - *-commands that call out to external commands from Windows no longer cause a CMD window to open, also fixing the "stuck key" problem associated with this. Thanks to Richard Russell for the guidance here. * V1.21.18 - 15 Jan 2019 - *SHOW implemented (JGHarston) - Bug fix for DEL in text-only builds (JGHarston) - Limit *WinTitle to SDL and UNIX builds - it's a no-op otherwise. - MODE 7 scrolling text fix - MODE 135 now selects MODE 7. - Fix VDU20 for text-mode UNIX build - Top-level makefiles now read BRANDY_BUILD_FLAGS environment variable for additional build flags - New keyboard handler (JGHarston) - add -DNEWKBD to makefile to CFLAGS or define BRANDY_BUILD_FLAGS=-DNEWKBD in your shell environment to use. * V1.21.17 - 05 December 2018 - Fix memory leak in MODE change - Fix Filled Rectangles and CLG with GCOL actions, previously implemented and rather promptly broken. - Fixed Flash on Mode 7 on 64-bit machines. - Fixed Escape on 32-bit machines. - Improved INKEY(negative) handling and other keyboard bugs, thank you JGHarston. - Fix reading strings from DATA with included quote marks. - Fix LSL (<<), ASR (>>) and LSR (>>>) to replicate RISC OS behaviour. - VDU19 palette changes now update the screen immediately. Also, now has no effect in MODE 7. - Mouse display behaviour changed - if fullscreen mode enabled, mouse is off upon mode change or startup; if windowed, mouse is on. - Telstar client now includes NXtel, and a new, more robust, mechanism of calculating high-bit escaped characters, as NXtel did it differently to Telstar or CCl4. * V1.21.16 - 04 November 2018 - Added auto-sensing support for the Raspberry Pi's GPIO interface, with memory-mapped I/O and SYS calls. While the calls are recognised on all builds, it's only active on the Raspberry Pi. - Bug fix (regression): LIST in text builds would error after one line. - Adjust graphsdl.c:buff_convex_poly bounds checking to allow off-screen drawing (we limit this elsewhere). For example, triangles drawn offscreen. will now appear to be chopped off, rather than squashed into the screen. - Bug fix for out-of-bounds array scribbling when off screen. - Code refactor - SYS calls are now (with a few exceptions) in their own file. - Performance improvements to Mode 7, and fix rendering bug when ESCAPE was disabled. - Telstar client now includes Authentic mode, where a delay is added to each character rendering to simulate (approximately) a 1200baud modem. - Implemented AND=, OR=, EOR=, MOD= and DIV= from BB4W/BBCSDL and JGH's ARM BBC BASIC Plus. * V1.21.15 - 12 October 2018 - Bug fix: Setting *KEY15 scribbled outside array bounds. - Bug fix: Erroneously trimming a string introduced in V1.21.8. - Improvement: In networking code, move WSAStartup (MinGW) to init, if this fails, disable networking. - Enabled VDU14/15 scroll paging. Note, by default Brandy uses CTRL-N for accessing the next line in the command line history (along with CTRL-P for previous line). OSBYTE 44 with x=0 disables this, so CTRL-N will send the VDU14 code, CTRL-P will send the VDU16 (CLG) code. (CTRL-O will always send the VDU15 code) - Enabled VDU23,16; currently bits other than 3 are observed. This sets the scroll protect mode, X and Y cursor movement and whether the screen is overprinted or scrolled when the Y limit is reached, and whether VDU5 mode linewraps. (Bit 3, making Y horizontal and X vertical is NOT supported.) Default value is 1 (*CONFIGURE NOSCROLL on RISC OS or BBC Master) and the VDU mode when RISC OS Desktop is running (or in a single tasking state from F12 or Exit) regardless of Scroll/NoScroll configuration setting. - Fix compiler warnings for MinGW - and allow DOS-type commands to return their output to the SDL window (so *dir works for example). - Flush SDL queue on INKEY and MOUSE reads, otherwise events start to get missed (bonus point: Close window icon is more responsive.) - LISTing a program now stops on ESCAPE. - Code cleanup part 1: Identify functions that can be declared static. - Code cleanup part 2: Remove static functions that are never called from anywhere. - Updated some of the documentation to reflect the changes introduced in Matrix Brandy. - Improved the Mode 7 appearance (thanks to Risc OS 5!) - see docs/Mode7.txt * V1.21.14 - 28 September 2018 - ChangeLog layout change: Most recent release first. - Similar to the GET fix in V1.21.11, the same problem of spurious zero returns was occurring with INKEY(delay). This is now fixed. - Bug fix for CLS when a text window is active, the cursor was not being homed. - Bug fix for VDU28 text windows where bottom or right were out of range. - Bug fix for text cursor appearing inappropriately in VDU5 mode. - Fix more compiler warnings - thanks bakoulis and Coeus at Stardot for highlighting where their compilers were warning where mine wasn't, and for suggesting a fix. - PLOT actions redirected to new primitives that support GCOL action codes, both foreground and background codes work. - Behaviour of DELETE (and VDU127) is corrected. - WAIT (with no parameters) to wait for VSYNC implemented, as far as is possible in SDL. - 24-bit colour support enabled. - MOUSE TO implemented. - Code clean-up, "text mode" in SDL screen removed. It's never been used since the appearance of MODEs 3 and 6 were corrected. - BrandyApp compilation on Linux changed to using a library to simplify the build process. - Telstar client updated, enhancements from gARetH baBB - thank you! * V1.21.13 - 14 September 2018 - Rework temp file bits to use mkstemp instead of tmpnam. - Reinstated MODE 7 width setting via VDU23,18,255 (from 1.21.7). Note that it does not resize the window, and re-selecting MODE 7 restores the default glyph width of 16. - Add *ScreenSave - saves the displayed screen as a Windows Bitmap file - Add *ScreenLoad - Loads the screen into the currently selected display bank for VDU writes - Initial makefile for SDL on MinGW. Much testing required. - New Mode 7 demo. Some Prestel graphics, and images from the edit.tf online Teletext page editor. Unlike the BBCSDL demo this embeds the data in the program itself. Apart from pressing R to reveal it isn't Brandy-specific. - New Telstar client. Screen updates seem faster, with more convincing double-height. * V1.21.12 - 02 September 2018 - Bug fixed: Closed file warning clobbered ERR value. Thanks to dhg2 @ Stardot for highlighting this one. - Bug fixed: OSWORD via &FFF1 wasn't returning the A register. Thanks to luigino @ Github for highlighting this. - Bugs fixed: Multiple compiler warnings when compiled with -Wall, and static analysis. - Bug fixed: Text-only builds no longer complain about "Unsupported Basic V feature" when using WAIT. - Brought the text-only builds up to date, brought makefile.text back to top level. - *WinTitle now works on text-only builds using XTerm control codes. - Changing screen mode no longer clears FULLSCREEN. - Expanded OSBYTE 42 to get or set fullscreen state, and fixed an off-by-one error in returning Refresh state. - RPM SPEC file now builds text builds as well as the graphical build, the resulting RPM includes all three builds (graphical, text, simple-text). * V1.21.11 - 24 August 2018 - Bug fixed: POINT(x,y) should return the logical mode-specific colour number rather than an RGB value. - Bug fixed: GET returning 0 and key value for some keys - Bug fixed: Crash when ON ERROR handler invoked in program run using CHAIN at immediate mode - Initial structure in place for OSWORD; OSWORD 10 implemented including BBC-style call to &FFF1 and SWI &07. - OSBYTEs 134 and 165 implemented. As Brandy doesn't have the Acorn-style editing cursor, these two function identically. - OSBYTEs 106 and 135 implemented partially (135 only complete in MODE 7), 106 can only turn the pointer on or off. - Invocation behaviour change: If BASIC program starts with # as the first character, assume we have a shell-compatible start line that is invoking Brandy. In this case, if the program is started on the Linux command line as a parameter to Brandy, it will exit upon program completion instead of returning to immediate mode (as if -quit was set on the command line). This also means a BASIC program can be made executable and will run when run as a script, and Brandy will exit upon completion. * V1.21.10 - 20 August 2018 - *REFRESH now follows BB4W/BBCSDL behaviour, with extension *REFRESH ONERROR which uses the behaviour from V1.21.9 (disabled, re-enabled on error) - COLOUR r,g,b and GCOL r,g,b now behaves properly when values > 255 supplied. - OSBYTE 42 implemented to allow BASIC and user programs to get and set REFRESH state, allowing access while maintaining logical separation of language and MOS. - OSBYTEs 40 and 41 implmented for fine-tuning the ESCAPE polling. OSBYTE 40 with X=0 resets to default. - Screen banks enabled, set at compile time (default is 4). Use with OSBYTE 112 and 113. Not enabled for MODE 7. - OSBYTEs 20 and 25 implemented for resetting the system font. - BB4W/BBCSDL's VDU23,22 implemented to a degree, defining MODE 126. - MODEs 3 and 6 now have black bars when background colour used. - RISC OS 3.5-style MODE commands will define a new mode (126) if a previously defined mode is not available. The extended RISC OS 5.x format is not supported. - *NewMode extended to allow input of X and Y eigen factors, used internally by the MODE "string" format. - Initial SWI support, currently only a few SWIs are supported. No support for external modules, all supported SWIs are part of the MOS code. - examples/teklib updated - this pre-dates SDL support for Brandy, using Tek to provide an element of graphics. This has been updated to use OSBYTE 43 to send characters to the controlling terminal, so if run from an xterm, the old Tek demos once again run correctly as intended. * V1.21.9 - 10 August 2018 - Implement *REFRESH (based on RTR's BB4W/BBCSDL). Possible divergence: An error condition will re-enable Refresh. - INKEY implementation improved, we now also pick up mouse keys. - ESCAPE now works within the SDL window. *FX229 also implemented to disable or enable ESCAPE. - Display warnings/help for *NewMode - Improve rendering of MODEs 3 and 6. - MODE 7 flash now locked to the centisecond timer. - MODE 7 screen memory: An earlier omission meant only the byte pointer functions worked, now word pointer functions also work. * V1.21.8 - 07 August 2018 - Networking: Uses getaddrinfo instead of gethostbyname, this also means we can connect to IPv6 hosts. The port can be specified by name (as per /etc/services) or by number. - New command *FULLSCREEN - switches SDL fullscreen mode on or off - Graphics cursor now on right-most point of circle after drawing, as per RISC OS. - VDU5 text plotting is now transparent. - Resize window on mode change. We also now start in Mode 0, and report bad mode to the program if SDL is unable to select the desired mode. This has broken the teletext aspect control, so that is for now disabled. - Can now define your own screen modes with *NewMode. - INKEY now working with multiple keys. * V1.21.7 - 03 August 2018 - Bug fixes for Mode 7 flash and Networking - String handling was not 64-bit clean. Bins are now multiples of 64-bits long. - Initial framework for building standalone applications written in BASIC. - Mode 7 now runs with a high-resolution font. - MOUSE ON and MOUSE OFF control whether or not the mouse is displayed. As per RISC OS it is OFF upon mode change. - Mode 7 glyph width can be changed on the fly to 12, 14 or 16 pixels wide, using VDU23,18,255,x| where x is 12, 14 or 16. Other values are ignored. - New command *WINTITLE - sets the SDL window title bar amd icon text. - Background operation now working, as is launching from a non-console source for example a Window Manager launcher icon. * V1.21.6 - 27 July 2018 - Implemented some network connectivity. Connect using OPENUP"ip4:host:port". Currently only EOF#, BGET# and BPUT# work (both bytes and strings for BPUT) - New demo: examples/Mode7/telstar - a client for Telstar! - Fix for bad plotting, again from Coeus @ Stardot. Thank you! * V1.21.5 - 24 July 2018 - Merged J.G.Harston's "Banana Brandy" fork, and cleaned up some breakages caused by this. - Refactor code to use new mos.c function names, remove aliases from mos.h - PLOT codes for drawing dotted lines implemented, along with skipping start and end points as required. - Fix behaviour of OPENUP for file not found - thanks Phlamethrower @ *. for the pointer. * V1.21.4 - 18 July 2018 - Slight rename of application to Matrix Brandy, to distinguish between this and the "base" version from Sourceforge, and other forks. - MOUSE commands no longer error as unsupported. Most now no-op, but MOUSE X, Y, B[, C] returns mouse position and button state. If specified, C contains a centisecond counter. (In this implementation, it equals the value of TIME). - INKEY with negative argument partially supported. (-129 to -255 not supported) * V1.21.3 - 10 July 2018 - Teletext fixes for edge cases - Big performance enhancement when running in Mode 7 no-update mode (VDU23,18,1,0|) - Nested FOR..NEXT fix - thanks Coeus @ stardot.org.uk forums for the patch - *. is remapped to *ls - so running *. now lists the contents of your current directory. - Mode 7 screen memory access, mapped to &FFFF7C00-&FFFF7FFF. Althought Tube BASIC didn't directly allow host screen access, this is where it would have been mapped for file system access and OSWORD 6. In Matrix Brandy, just access the memory directly. Note that scrolling does NOT move the start address of the screen, the top left character cell will ALWAYS be at &FFFF7C00. - Fix for PLOTting out of range causing a segfault. - Fix for DRAWing out of bounds on non-scaled modes with < 800x600 resolution. * V1.21.2 - 06 July 2018 - Mode 7 character frame buffer implemented, line and screen recalculation implemented. - Glyph size changed to 8x9 (was 8x8). - Implemented some of RISC OS 5's Teletext extensions on VDU23,18. See docs/Mode7 for more details. * V1.21.1 - 03 July 2018 - Software double buffering implemented, Mode 7 Flash supported. * V1.21.0 - 01 July 2018 - Replaced system font with hand-reconstructed Acorn system font based on that found in RISC OS 3.1 - Initial Teletext support. Font similar to the SAA5050, teletext codes handled as a stream. MatrixBrandy-1.22.13/docs/Mode7.txt0000664000175000017500000000575214156732602016041 0ustar soruksorukMODE 7 support in Brandy BASIC V/VI =================================== Mode 7 teletext charactes use 16x20 character cells, this allows for a decent rendering of mosaic graphics, especially separated graphics. Direct screen memory access is implemented, the address can be obtained by doing SYS "Brandy_GetVideoDriver" TO ,,,,addr% Usually this will return &7C00 but will return &FFFF7C00 if &7C00 is in BASIC workspace. It will always be a 32-bit address. Some RISC OS 5 extensions are also supported: (source: http://beebwiki.mdfs.net/VDU_23) VDU 23,18,2,flags,0,0,0,0,0,0 - Set Teletext reveal state bit 0 - if set, any concealed text will be displayed. If cleared, concealed text is concealed. Setting or clearing this will cause an immediate refresh of the display. VDU 23,18,3,enable,0,0,0,0,0,0 - Set Teletext black enable enable = 0: Control codes &80 and &90 do nothing (default) enable = 1: Control code &80 selects alphanumeric black, control code &90 selects graphics black. More strictly, this code toggle is an extended features toggle, which include Alpha Black (&80), Graphics Black (&90) and Alternative Character Set (&9B), and also corrects the Hold "bug" in the SAA5050 Teletext chip. VDU23,18,4,pri,alt,0,0,0,0,0 - Select Teletext character set The values are as per the SAA505x family of chips. This is extended in Matrix Brandy by ORing the value with 128 to substitute the solid block with the Euro symbol. pri is the Primary character set that is normally displayed, alt is the Alternative Character Set selected with &9B (if enabled using VDU23,18,3,1|) Two new OSWORD calls are available, one to read the character definition of a teletext character, another to change a character with a new definition. These OSWORD calls are specific to Matrix Brandy and Richard Russell's BBCSDL with whom these extensions were developed in parallel. OSWORD &8B (139) - Read a Teletext character definition. Requires a block size of 44. block%?0 = 4 block%?1 = 44 block%?2 = Character code block%?3 = Bank selecter, default 0 block%?4..43 - Returned data OSWORD &8C (140) - Write a Teletext character definition to bank 0 Requires a block size of 44 block%?0 = 44 block%?1 unused block%?2 = Character code block%?3 unused block%?4..43 = Character definition, in the same layout as &8B. OSBYTE 20 will reset the definition back to default along with the regular non-MODE7 font. OSBYTE 25 has been extended, if X=16 then reset teletext font only. The Alternative Character Set is implemented, it is toggled with teletext code ESCAPE (&9B), and defaults to the US-ASCII set as implemented on the SAA5055. The Alternative Character Set can be read and written to, use bank 0 and set the high bit on the character code. Note that the characters are shuffled, so the redefinitions are as follows: Redefine &23, change &60 and &A3. Redefine &5F, change &23 and &DF. Redefine &60, change &5F and &E0. This is also true for redefining &A3, &DF and &E0 in the alternative character set bank. MatrixBrandy-1.22.13/docs/ScreenModes.txt0000664000175000017500000001630114167245355017273 0ustar soruksorukThe built-in screen modes in Matrix Brandy are based on those from RISC OS, the first 8 themselves based on the BBC Micro. Mode Text resolution Graphics resolution Colours Pixel size Logical res 0 80x32 640x256 2 1x2 1280x1024 1 40x32 320x256 4 2x2 1280x1024 2 20x32 160x256 16 4x2 1280x1024 3 80x25 Text only 2 1x2 Text only 4 40x32 320x256 2 2x2 1280x1024 5 20x32 160x256 4 4x2 1280x1024 6 40x25 Text only 2 2x2 Text only 7 40x25 (Teletext mode, this works differently to other modes) 8 80x32 640x256 4 1x2 1280x1024 9 40x32 320x256 16 2x2 1280x1024 10 20x32 160x256 256 4x2 1280x1024 11 80x25 640x250 4 1x2 1280x1000 12 80x32 640x256 16 1x2 1280x1024 13 40x32 320x256 256 2x2 1280x1024 14 80x25 640x250 16 1x2 1280x1000 15 80x32 640x256 256 1x2 1280x1024 16 132x32 1056x256 16 1x2 2112x1024 17 132x25 1056x250 16 1x2 2112x1000 18 80x64 640x512 2 1x1 1280x1024 19 80x64 640x512 4 1x1 1280x1024 20 80x64 640x512 16 1x1 1280x1024 21 80x64 640x512 256 1x1 1280x1024 22 96x36 768x288 16 1x2 768x576 23 144x112 1152x896 2 1x1 2304x1792 24 132x32 1056x256 256 1x2 2112x1024 25 80x60 640x480 2 1x1 1280x960 26 80x60 640x480 4 1x1 1280x960 27 80x60 640x480 16 1x1 1280x960 28 80x60 640x480 256 1x1 1280x960 29 100x75 800x600 2 1x1 1600x1200 30 100x75 800x600 4 1x1 1600x1200 31 100x75 800x600 16 1x1 1600x1200 32 100x75 800x600 256 1x1 1600x1200 33 96x36 768x288 2 1x2 1536x1152 34 96x36 768x288 4 1x2 1536x1152 35 96x36 768x288 16 1x2 1536x1152 36 96x36 768x288 256 1x2 1536x1152 37 112x44 896x352 2 1x2 1792x1408 38 112x44 896x352 4 1x2 1792x1408 39 112x44 896x352 16 1x2 1792x1408 40 112x44 896x352 256 1x2 1792x1408 41 80x44 640x352 2 1x2 1280x1408 42 80x44 640x352 4 1x2 1280x1408 43 80x44 640x352 16 1x2 1280x1408 44 80x25 640x200 2 1x2 1280x800 45 80x25 640x200 4 1x2 1280x800 46 80x25 640x200 16 1x2 1280x800 47 45x60 360x480 256 2x1 1280x800 48 40x60 320x480 16 2x1 1280x960 49 40x60 320x480 256 2x1 1280x960 50 40x30 320x240 2 2x2 1280x960 51 40x30 320x240 4 2x2 1280x960 52 40x30 320x240 16 2x2 1280x960 53 40x30 320x240 256 2x2 1280x960 54-63 reserved for future expansion within RISC OS. Modes from 64 can be redefined with *NewMode, these definitions are local to Matrix Brandy, and may be changed in the future. Modes 64-68 use the same coordinate system as Tektronix graphical terminals 64 128x97 1024x780 2 1x1 2048x1560 65 128x97 1024x780 4 1x1 2048x1560 66 128x97 1024x780 16 1x1 2048x1560 67 128x97 1024x780 256 1x1 2048x1560 68 128x97 1024x780 16777216 1x1 2048x1560 Modes 69-93 are widescreen modes, possibly useful for full-screen use. 69 128x72 1024x576 2 1x1 2048x1152 70 128x72 1024x576 4 1x1 2048x1152 71 128x72 1024x576 16 1x1 2048x1152 72 128x72 1024x576 256 1x1 2048x1152 73 128x72 1024x576 16777216 1x1 2048x1152 74 170x48 1360x384 2 1x2 2720x1536 75 170x48 1360x384 4 1x2 2720x1536 76 170x48 1360x384 16 1x2 2720x1536 77 170x48 1360x384 256 1x2 2720x1536 78 170x48 1360x384 16777216 1x2 2720x1536 79 170x96 1360x768 2 1x1 2720x1536 80 170x96 1360x768 4 1x1 2720x1536 81 170x96 1360x768 16 1x1 2720x1536 82 170x96 1360x768 256 1x1 2720x1536 83 170x96 1360x768 16777216 1x1 2720x1536 84 240x67 1920x540 2 1x2 3840x2160 85 240x67 1920x540 4 1x2 3840x2160 86 240x67 1920x540 16 1x2 3840x2160 87 240x67 1920x540 256 1x2 3840x2160 88 240x67 1920x540 16777216 1x2 3840x2160 89 240x135 1920x1080 2 1x1 3840x2160 90 240x135 1920x1080 4 1x1 3840x2160 91 240x135 1920x1080 16 1x1 3840x2160 92 240x135 1920x1080 256 1x1 3840x2160 93 240x135 1920x1080 16777216 1x1 3840x2160 Note 1: MODEs 22 and 35 differ in that MODE 22 uses a non-standard pixel addressing with a 768x288 display on a 768x576 pixel addressing range, while MODE 35 uses the more standard doubling of 1536x1152. Note 2: COLOUR/GCOL numbers and TINT in 24-bit colour modes give the same colours as 256-colour modes. Using the newer form of COLOUR r,g,b or COLOUR OF r,g,b ON r,g,b (and likewise for GCOL) provide access to the full range of 16,777,216 colours. Custom screen modes can be used, via *NewMode, VDU23,22 or the newer forms of the MODE command. MatrixBrandy-1.22.13/docs/keyboard-codes0000664000175000017500000000275314156732602017141 0ustar soruksorukThis is an inexhaustive list of keyboard codes returned by GET and INKEY(x) (where x >= 0). Normal keys (and shifted keys) just return their ASCII values. Key Normal value Shifted value CTRL value Shift-CTRL PrtSc 128 &80 144 &90 160 &A0 176 &B0 F1 129 &81 145 &91 161 &A1 177 &B1 F2 130 &82 146 &92 162 &A2 178 &B2 F3 131 &83 147 &93 163 &A3 179 &B3 F4 132 &84 148 &94 164 &A4 180 &B4 F5 133 &85 149 &95 165 &A5 181 &B5 F6 134 &86 150 &96 166 &A6 182 &B6 F7 135 &87 151 &97 167 &A7 183 &B7 F8 136 &88 152 &98 168 &A8 184 &B8 F9 137 &89 153 &99 169 &A9 185 &B9 F10 202 &CA 218 &DA 234 &EA 250 &FA F11 203 &CB 219 &DB 235 &EB 251 &FB F12 204 &CC 220 &DC 236 &EC 252 &FC Insert 205 &CD 221 &DD 237 &ED 253 &FD Pause 196 &C4 196 &C4 244 &F4 244 &F4 Delete 127 &7F 215 &D7 231 &E7 247 &F7 Home 30 &1E 216 &D8 232 &E8 248 &F8 PgUp 159 &9F 143 &8F 191 &BF 175 &AF PgDn 158 &9E 142 &8E 190 &BE 174 &AE PrtSc is redefinable with *KEY0 The following keys change depending on *FX4 value. *FX4,0 (and *FX4,2 if not redefined with *KEY): Key Normal value Shifted value CTRL value Shift-CTRL End 139 &8B 155 &9B 171 &AB 187 &BB Left 140 &8C 156 &9C 172 &AC 188 &BC Right 141 &8D 157 &9D 173 &AD 189 &BD Down 142 &8E 158 &9E 174 &AE 190 &BE Up 143 &8F 159 &9F 175 &AF 191 &BF *FX4,1 (matches BBC Micro, End is mapped to Copy): Key Normal value End 135 &87 Left 136 &88 Right 137 &89 Down 138 &8A Up 139 &8B Values with modifier keys are not changed by *FX4,1. On the BBC Micro and Master, the modifier keys have no effect. MatrixBrandy-1.22.13/docs/internals.txt0000664000175000017500000020073214156732602017060 0ustar soruksorukIntroduction ~~~~~~~~~~~~ These notes are an introduction to the internals of the interpreter. They describe the files and discuss some of the more important areas of the program. They do not describe how the interpreter works in detail. The intention is just to provide a starting point for understanding the program. This file has been amended to describe the Matrix Brandy fork. Files ~~~~~ The source files that make up the interpreter are as follows: assign.c brandy.c commands.c convert.c editor.c errors.c evaluate.c fileio.c functions.c graphsdl.c heap.c iostate.c keyboard.c lvalue.c mainstate.c miscprocs.c mos.c mos_sys.c net.c riscos.c simpletext.c stack.c statement.c strings.c textonly.c tokens.c variables.c As a general rule there are include files for each of the above that declare the functions found in them. In addition there are three general include files: target.h common.h basicdefs.h Basicdefs.h is the most important include file as all of the main structures used by the interpreter are declared in it. The other one to look at is target.h. This contains target-specific declarations. The files containing the functions that interpret Basic programs are as follows: assign.c Assignment statements iostate.c I/O statements mainstate.c All Other statements statement.c Dispatches statement functions evaluate.c Evaluate Expressions functions.c Evaluate Built-in functions commands.c Perform Basic commands RISC OS emulation is carried out in: fileio.c File I/O mos.c Most features emulated mos_sys.c Most SYS calls keyboard.c Keyboard input riscos.c } simpletext.c } Different flavours of screen output graphsdl.c } textonly.c } RISC OS emulation is covered in more detail below. Briefly, each of the files performs the following tasks: Assign.c Functions in here deal with assignments to all types of variable and pseudo variables, and writing to memory locations. Brandy.c The main program. It processes command line options and contains the main interpreter command line loop. Commands.c This deals with the Basic commands, for example, LIST, SAVE and EDIT. Convert.c Contains the function that performs character to number conversions plus one or two minor functions in this area. Editor.c This file contains all the program editor functions. It also contains the code to load and save programs and to read libraries. A very important initialisation function, clear_program(), is found here. It sets up many of the values in basicvars to do with the program in memory. Errors.c Error handling. Functions in here report errors or pass control to error handlers. All of the messages the interpreter can display are defined in this files with the exception of the program's debugging messages. Evalute.c This contains all the expression evaluation code excluding the built-in functions (which are in functions.c). Fileio.c Contains functions that deal with emulating RISC OS's file handling. See below. Functions.c This file contains all of the built-in Basic functions Graphsdl.c This is one of the emulation modules. It emulates the RISC OS VDU drivers where both text and graphics output is possible. As written, this code is tied to SDL 1.2. See further notes below. Heap.c Memory management. The functions in this file allocate and release the Basic workspace as well as control the Basic heap. The string memory management in string.c is a layer of code that sits on top of this one. Iostate.c Contains the functions that interpret I/O, graphics and sound statements. Keyboard.c Contains functions for reading keyboard input for all supported operating systems. The command line editing and history functions are located here as well. Lvalue.c Evaluates expressions where an lvalue is required, for example, on the left hand side of an assignment. Whenever an address is required at which data is to be stored, the function get_lvalue provides it. Mainstate.c The bulk of the functions that interpret Basic statements are found here. Miscprocs.c This file contains a variety of functions that carry out such tasks as skipping white space characters, converting a Basic string to C string and so forth. Mos.c and mos_sys.c RISC OS emulation. See below. Net.c Basic networking support. Riscos.c Contains the screen output functions for RISC OS. Simpletext.c This is one of the screen output emulation modules. The functions in here provide the most elementary support for screen output. None of the screen control features such as cursor positioning, clearing the screen and so forth are supported. This is a 'get you going' screen output module that does not using anything more sophisticated than printf() for output. When built using makefile.text, the resulting binary is 'sbrandy'. Stack.c Functions for manipulating the Basic stack are located in here. This includes allocating memory from the Basic stack for such things as local arrays as well as pushing values on to and popping values from the stack. There are also functions for updating items on the stack in place, for example, adding values to or subtracting values from integer and floating point values. The operator stack is created in this module but is handled directly by the expression code. Statement.c Contains the dispatch code for the functions that handle the individual Basic statements as well as a number of general routines used by these functions, for example, check_ateol(), which checks that the interpreter has reached a legal end of Basic statement token. Strings.c The functions here are concerned with memory management for strings. Strings have their own memory management but use the functions in heap.c to acquire more memory from the Basic heap when needed. Textonly.c This is also one of the emulation modules. It contains functions to emulate the RISC OS VDU drivers where only text output is possible. It can be used by any operating system. See further notes below. When built using makefile.text, the resulting binary is 'tbrandy'. Tokens.c The functions in here are concerned with tokenising lines of Basic and converting them back into plain text. The functions needed to manipulate tokens are found in here as well. There are also functions to convert Acorn Basic programs to text. Variables.c This module is principly concerned with creating variables, arrays, procedures and functions and searching for them. There are also functions for scanning libraries for procedures and functions and for parsing procedure and function definitions Target.h This file defines any implementation-specific constants, types and so forth and the very important 'TARGET_xxx' macros. The types for 32-bit integer and 64-bit floating point values used for Basic variables are declared here. The idea is that using these types will help to make the program more portable. Other items defined here are: Maximum string length Default and minimum Basic workspace sizes Characters used as directory separators in file names Name of the editor invoked by the EDIT command The values in the file as it stands should be okay for Windows and Unix-type operating systems. The 'TARGET_xxx' macros control the OS-specific parts of the compilation. These are defined automatically according to the predefined macros supplied by the compiler being used, for example, under NetBSD, gcc defines the macro __NetBSD__. If this exists, the macro 'TARGET_NETBSD' is defined. Similarly, the Norcroft C compiler under RISC OS defines the macro '__riscos' and the presence of this means that the target macro 'TARGET_RISCOS' is defined. Common.h A number of constants, macros and types used throughout the interpreter are declared here. Basicdefs.h The majority of the structures used by the program are defined in this file, for example, the symbol table layout, Basic stack entries, array descriptors and so forth are all found here. The most important structure is 'workspace'. It contains all of the variables the interpreter uses for a Basic program. There is one instance of a workspace structure, a variable called 'basicvars' which is declared in brandy.c. This file should be the first place to look for any type definitions or constants in the program code. In general the code is not very well organised. RISC OS Emulation ~~~~~~~~~~~~~~~~~ The interpreter is split into two layers, the interpreter proper and an emulation layer that deals with all of the operating system-specific processing. The functions in this layer provide an emulation of the facilities of RISC OS that this program needs. The RISC OS version consists of little more than wrappers for various SWI calls but it is a lot more elaborate in other environments. Consider, for example, the Basic graphics statement 'PLOT'. This is handled by the function exec_plot() in iostate.c. This evaluates the three parameters that PLOT takes and then calls emulate_plot() to carry out the actions of the statement. Under RISC OS this is nothing more than a call to the SWI 'OS_Plot' but under SDL emulate_plot() calls functions that emulate the RISC OS VDU drivers. These in turn call a variety of SDL graphics library functions that carry out the different actions PLOT can do. Other features are not as complex as this, for example, the Basic pseudo-variable 'TIME$' returns the current date and time as a string. This turns into calls to a couple of standard C functions. The rule is that the OS-independent layer (the interpreter really) deals with the Basic statement or function until it has to make an operating system call at which point it calls a function in the emulation code. The emulation functions are spread across the following modules: General emulation functions: mos.c (mos.h) mos_sys.c (mos_sys.h) Keyboard input: keyboard.c (keyboard.h) Screen output: riscos.c (screen.h) graphsdl.c (screen.h) textonly.c (screen.h) simpletext.c (screen.h) File input and output: fileio.c (fileio.h) The names in parentheses are the names of the 'include' files that define the functions found in the emulation files. Each file contains one or more implementations of the functions listed in the include file for that aspect of the emulation. To put it another way, each file contains the operating system-specific functions for every supported environment for that part of the emulation. The exception is screen output: it used to consist of a single file (screen.c) but that file was split into three separate files as it was becoming unreadable. There is only one include file for screen output, however, screen.h. All three screen output files contain the functions defined in that one. Keyboard Input -------------- The functions in keyboard.c deal with keyboard input. There are functions to read a line, read a single key and the variations on this needed for INKEY. The line input function provides command line editing and history facilities for all operating systems except RISC OS. The only operating system-specific code is that which reads a single character from the keyboard. The RISC OS SWIs emulated are OS_ReadLine, OS_ReadC (read character) and OS_Byte 129 (read character with time limit, check if key pressed, return operating system version, take dog for walk, etc, etc). Operating systems other than RISC OS map keys such as function and cursor keys to the corresponding RISC OS keys codes so that what RISC OS does is the common factor that links all versions of the code. Screen Output ------------- Screen output is the most complex area to emulate. The idea is to provide a partial emulation of the RISC OS VDU drivers. At the simplest level the functions emulate two RISC OS SWI calls, OS_WriteC and OS_Plot, but these SWIs both carry out an enormous number of functions. The equivalent of OS_WriteC in the program is the function emulate_vdu(). emulate_plot() is the equivalent of OS_Plot. It deals only with graphics commands whereas emulate_vdu can handle either. The three screen output files emulate OS_WriteC and OS_Plot to varying degrees. Whilst text output has its own difficulties, the main problem is graphics support. Under operating systems other that RISC OS text output and graphics output are two entirely distinct things whereas under RISC OS they are combined. There are four versions of the screen output functions: riscos.c This contains the functions used by the RISC OS version of the interpreter. They are really nothing more than prepackaged calls to RISC OS. simpletext.c This file is used in the 'sbrandy' version of the interpreter that does not include graphics support and it is meant to be suitable for use under any operating system. No translation of VDU calls is made (unlike textonly.c which translates some RISC OS codes to ANSI / conio). textonly.c This file is used in the 'tbrandy' version of the interpreter that does not include graphics support and it is meant to be suitable for use under any operating system except RISC OS. There are two versions of the functions here, one that uses ANSI control sequences and one that uses the DOS 'conio' library. The conio-based emulation is the more complete but it is tied to DOS. The ANSI- based one can be used by Linux and NetBSD or by DOS but the emulation is limited. graphsdl.c This is used when the interpreter supports graphics. It includes both text and graphics output. It uses the SDL 1.2 for all of the graphics functions. Only a subset of the RISC OS graphics facilities are supported. This runs in a graphics mode at all times in the SDL window (including text-only modes 3 and 6, and Teletext mode 7), and is platform-independent. As of version 1.21.13 this works for both Linux; and Windows via MinGW using Cygwin as a build environment. There are two include files for screen output: scrcommon.h screen.h 'scrcommon.h' defines constants, types and variables needed by all of the VDU driver emulation files. 'screen.h' defines the functions that can be called in the files. Each emulation file has to provide all of these functions. File Input and Output --------------------- This is handled in a different way to the keyboard and screen emulation in that it uses ANSI standard C functions to provide a simple emulation of RISC OS's file handling. The same code should therefore run unchanged under all operating systems. The functions do not equate to RISC OS SWIs this time. They emulate only those calls that the interpreter needs. Note that this code is also used by the RISC OS version of the program intead of using RISC OS SWIs directly but this will probably be changed. Others ------ The files 'mos.c' and 'mos_sys.c' provide the emulation functions for things that are not covered by the above, for example, reading the date and time. Supported Environments ~~~~~~~~~~~~~~~~~~~~~~ The Matrix Brandy interpreter has been run under the following operating systems: Linux NetBSD/arm32 and NetBSD/i386 Windows as a windowed application. The intention is that the code should be portable but it will probably give problems on big endian processors and ones with other than 32-bit. (Big endian processors will probably give problems due to assumptions made about the format of numbers by the indirection operators. This is part of the language, not the way the interpreter is written.) However, it builds and runs correctly on Linux x86-64. Stacks ~~~~~~ The interpreter uses two stacks, the main Basic stack and the operator stack. The Basic Stack --------------- The Basic stack is central to the operation of the program. A great deal more than just the intermediate results from evaluating expressions is stored on it, for example, return addresses for procedures and functions, the old values of variables being used for local variables, saved 'ON ERROR' details, information on open loops and so forth is also kept on the stack. The operator stack is also found on the Basic stack as a stack within a stack. Memory for local arrays is also allocated on the stack. The Basic stack starts at the top of the Basic workspace at basicvars.himem and grows towards the bottom. The stack pointer is basicvars.stacktop. The stack is not allowed to overwrite the heap. Basicvars.stacklimit marks the lowest point the stack is allowed to reach. This is set a little way above the top of the Basic heap and varies as memory is allocated from the heap. The code tries to eliminate as many checks for stack overflow as possible. When a function is called it ensures that there is enough room on the stack to add operands corresponding to every level of the operator stack. In other cases an explicit check is made for overflow, for example, before saving the value of a variable being used as a local variable on the stack. The program makes use of macros to speed up manipulation of the Basic stack in the expression evaluation code. There are macros and functions in stack.c that do the same task, for example, 'PUSH_FLOAT' is a macro that pushes a floating point value on the stack and push_float() is a functions that does the same thing. Operator Stack -------------- The operator stack hold details of pending operations when an expression is being evaluated. Each entry on the stack gives the operator's priority and identification. The stack is quite small (twenty entries) but this should be more than enough. An expression would have to be extremely complicated for there to be this many pending operations. A new operator stack is created every time a function is called to take care of the case of operations pending over a function call. (Twenty entries would severely limit the number of nested function calls possible otherwise.) The space for it is taken from the Basic stack. C Stack ------- The program is written in C and can make heavy use of the C stack, especially when interpreting deeply nested functions. Tokens ~~~~~~ The main problem of an interpreter is the overhead incurred in such actions as having to search for the same variables every time a statement is executed. One of the principle features of this interpreter is that it tries to eliminate as much of the overhead as possible by filling the addresses of variables in expressions and the destinations of branches in the code. To do this it uses several different tokens to represent the same item in a program, for example, seven tokens are used for references to variables that indicate whether the reference has been seen before, whether it is an integer variable, whether it is followed by an indirection operator and so forth. The first time the reference to the variable is seen the interpreter determines the type of the variable and its address. It changes the token type and fills in the address. The next time the reference is seen the interpreter can access the variable and deal with it without having to perform any checks. The normal interpreter overheads of referencing the variable has been completely eliminated. Another example: there are three tokens for 'IF', representing an 'IF' that has not been seen before, an 'IF' at the start of a single line 'IF' statement and one at the start of a block 'IF'. The first time the 'IF' is encountered the interpreter determines the type of 'IF' and fills in two offsets that give the addresses of the first statements after the 'THEN' and 'ELSE' parts of the statement. Similarly, there are four different 'ELSE' tokens, two for an 'ELSE' that has not been seen before and two where the offset of the first statement after the end of the 'IF' statement have been filled in. This gets rid of the overhead of looking for the 'ELSE' and the end of the statement every time the 'IF' is executed. The interpreter uses this sort of trick to eliminate overheads wherever possible. Apart from filling in pointers to variables and branch offsets it also converts numbers to binary and preprocesses strings. The tokens used for variables also include the length of the variable name. Some tokens are used to handle common cases quickly, for example, there are tokens representing the values 0, 1 and 0.0 and an experimental token that is used for references to arrays with one dimension. Another use of these tokens is to avoid syntax checking parts of the Basic program although this is fairly minor. The file 'tokens.h' defines the token set used by the interpreter. The program uses more tokens than the Acorn interpreter as it has separate tokens for cases such as 'DRAW' and 'DRAW BY' where the Acorn interpreter has one token. It also tokenises operators such as '<>' and '>>>'. The interpreter can read programs tokenised using either Acorn's Basic interpreter's tokens or Richard Russell's interpreters' tokens, converting them to its own tokens. The format of a tokenised line is: Bytes 0 and 1 Line number Bytes 2 and 3 Length of the line Bytes 4 and 5 Offset to executable tokens Bytes 6..n Source version of line Bytes n+1..x Executable tokens The tokenised line is split into two parts, the original source line and an executable version where all blanks, variable names, comments and so forth have been removed. The source part of the line is partially tokenised in that Basic keywords are replaced by tokens and the positions of variables and line numbers marked with other tokens. In the executable tokens, references to variables are given in terms of an offset to the first character of the name in the source part. The same trick is used for strings, except that there are two different string tokens, a 'fast' token for handling the most common case where the string does not contain embedded '"' and a 'slow' one where the interpreter has to allow for '"'. All numeric constants are converted to binary. Certain common values such as 0 and 1 (integer and floating point) have their own token. There is also a token for small integer values between 1 and 256 where the binary value occupies only one byte instead of four. When the program is run, the offsets to variable names are replaced with pointers to the variable in the symbol table, line number references are replaced with the address of the line and offsets of tokens such as 'ELSE' and 'ENDCASE' filled in. When a program is edited or run afresh, the executable tokens have to be converted back to their original form. This is where the marker tokens in the source part of the line are used. The executable tokens are scanned and when a reference to a variable is found, the code looks for the next marker in the source part of the line. References to lines could be dealt with in the same way but at the moment the code extracts the line number from the line at the end of the pointer and inserts that. It is not necessary to restore all the tokens in the executable part of the line to their original state. If the program has not been edited then the offsets after tokens such as 'WHEN' will still be valid and there is no need to touch them. The 'lvalue' Structure ~~~~~~~~~~~~~~~~~~~~~~ An important structure that is widely used in the program is struct lvalue. This contains the address at which a value is to be stored and the type of the value to be stored there. It is used in a number of places including: 1) To note the address at which a value will be stored in an assignment. 2) To give the addresses at which parameters will be saved in procedure and function calls 3) To note the addresses of items used as local variables 4) The index variable of a FOR loop is referenced as an lvalue. The lvalue structure is the most convenient way to hold this information. When they are to be used to store a value, references to variables, elements of arrays and addresses generated by the use of indirection operators are all converted into lvalues. The type of an lvalue is given by one of the constants whose name is of the form 'VAR_xxx'. These constants are used here and also in the symbol table. The values defined are: VAR_INTWORD Four-byte integer VAR_FLOAT Eight byte floating point VAR_STRINGDOL String ('string$' type) VAR_PROC Entry is for a procedure VAR_FUNCTION Entry is for a function VAR_MARKER Entry marks location of a proc/fn VAR_ARRAY Array Array entries are further qualified to give the type of the array: VAR_INTARRAY (VAR_INTWORD + VAR_ARRAY) Integer array VAR_FLOATARRAY (VAR_FLOAT + VAR_ARRAY) Floating point array VAR_STRARRAY (VAR_STRINGDOL + VAR_ARRAY) String array The following entries are used only for items referenced using indirection operators: VAR_INTBYTE One-byte integer VAR_DOLSTRING String ('$string' type) VAR_POINTER Pointer VAR_INTBYTEPTR (VAR_INTBYTE + VAR_POINTER) Pointer to 1 byte integer VAR_INTWORDPTR (VAR_INTWORD + VAR_POINTER) Pointer to 4 byte integer VAR_FLOATPTR (VAR_FLOAT + VAR_POINTER) Pointer to floating point VAR_DOLSTRPTR (VAR_DOLSTRING+VAR_POINTER) Pointer to string These values are treated as bitfields in the program. Note tha these values should not be confused with the types of entries stored on the Basic stack. Symbol Table ~~~~~~~~~~~~ The symbol table is where the details and values of variables are kept with the exception of the static integer variables, which are found in the structure 'basicvars'. The symbol table is organised as a hash table with chains of variables from each entry in the table. Variables, procedures and functions are all stored in the table. Struct 'variable' is the main symbol table structure. The symbol table entries themselves are created on the heap. In the case of integer and floating point variables, the value of the variable is stored in the symbol table entry. The entries for string variables contain the string descriptor. This gives the current length of the string and has a pointer to the string on the heap. The entries for arrays contains a pointer to the array descriptor. This is found on the heap for global arrays and on the Basic stack for local arrays. Similarly, the array itself is stored on the heap or on the Basic stack depending on the type. Symbol table entries are never destroyed. Everything concerned with the symbol table can be found in the include file 'basicdefs.h' Variable Types -------------- The 'VAR_xxx' type constants are used to identify the type of a variable. The values used in the symbol table are: VAR_INTWORD Four-byte integer VAR_FLOAT Eight byte floating point VAR_STRINGDOL String ('string$' type) VAR_ARRAY Array VAR_PROC Entry is for a procedure VAR_FUNCTION Entry is for a function VAR_MARKER Entry marks location of a procedure or function Array entries are further qualified to give the type of the array: VAR_INTARRAY (VAR_INTWORD + VAR_ARRAY) Integer array VAR_FLOATARRAY (VAR_FLOAT + VAR_ARRAY) Floating point array VAR_STRARRAY (VAR_STRINGDOL + VAR_ARRAY) String array The 'VAR_MARKER' entry for a procedure or function is used when a procedure of function is found to note its location. When searching through the program to find a procedure or function, function scan_fnproc() (in variables.c) adds each procedure and function it comes across as far as the one required to the symbol table with a 'VAR_MARKER' entry. Nothing is done with the procedure or function: it is only when it is called for the first time that a proper VAR_PROC or VAR_FUNCTION entry is constructed. Array Descriptor ---------------- This is fixed in size and so limits the number of dimensions an array can have. The limit is ten, which should be enough. The layout is fairly straightforwards. When working with entire arrays a pointer to the descriptor is stored on the Basic stack, except in the case of temporary arrays when the descriptor itself goes on the stack. The descriptor sfor local arrays are built on the stack but they are otherwise treated like normal arrays. Procedure and Function Parameters --------------------------------- The formal parameters of procedures and functions are kept in linked lists of lvalue structures. The parameter list is parsed the first time a function or procedure is called. There is one extra 'VAR_xxx' constant that appears only in the lvalue structure for a formal parameter: VAR_RETURN Marks variable as a 'return' variable Basic Program Organisation ~~~~~~~~~~~~~~~~~~~~~~~~~~ Basic programs live in the Basic workspace. This is an area of memory acquired when the interpreter is started. By default it is half a megabyte in size but its size can be changed by means of an extended version of the 'new' command or at start up by means of the command line option '-size'. The organisation of the workspace is: Highest address Basicvars.end Basicvars.himem Basic stack Basicvars.stacktop Basicvars.stacklimit Basicvars.vartop Basic heap Basicvars.lomem Basicvars.top Basic program Lowest address Basicvars.page Variables, non-local arrays, strings, byte arrays allocated via DIM and libraries loaded via 'LIBRARY' are all stored on the heap. The heap grows up from 'lomem'. The current top of the heap is given by 'vartop'. 'stacklimit' marks the point beyond which the Basic stack is not allowed to go. It is set to vartop+256 to provide a 'nogo' area between the stack and heap. The contents of the Basic stack are described above. Normally himem = end, but it is in theory possible to change himem to give some space that referenced by the indirection operators. At present this is disabled as the interpreter will crash as the Basic stack has to be moved and there are various pointers and linked lists that thread their way through it, for example, the procedure and functions return blocks are held as a linked list. The operator stack will give problems as the first one created is found just below himem. Another way of creating some free space is to change the value of 'end' using the statement 'END=
'. This increases the size of the Basic workspace and can be used in a running program. It is not practical to implement this form of the statement. A new, larger workspace could be allocated and everything copied to it but there will be a lot of pointers that would have to be relocated as well. Libraries loaded via 'INSTALL' are allocated memory outside of the Basic workspace. Basic Heap ~~~~~~~~~~ The program acquires one large area of memory, the Basic workspace, and uses its own memory management functions. The diagram in the previous section shows how the Basic workspace is used. The Basic heap is the area of memory between the top of the program and the Basic stack. Heap management is quite simple. Heap usage grows when a program runs and that is all. Memory is not, in general, returned to the heap, although the string memory management can do so under one set of circumstance. The heap is primarily used for: - Variables (symbol table) - Arrays - Strings - Case statement tables 'heap.c' contains all of the heap manangement functions. The main one used for allocating memory is allocmem(). If there is not enough memory to satisfy a request, this function reports a fatal error, that is, it calls the error functions directly. It will only return to the caller is the memory allocation works. There is a second function, condalloc(), that does not abort the program if the heap is exhausted. It returns a null pointer instead. The calling routine has to handle the error. This is used by the string memory management code and the function that creates arrays. (Note: the memory for local arrays is allocated on the Basic stack, not the heap. Function alloc_stackmem() in stack.c is called to take memory from the stack. This corresponds to function condalloc() in the way it works.) Memory can only be returned to the heap if the block being released is at the top of the heap. The function freemem() is used to return memory. String Memory Management ------------------------ Strings can be up to 65536 characters long in this version of the interpreter. The code has been written so that the maximum could be increased, although the string memory management would need to be altered to allow for the longer strings. The program has a string workspace but this is not heavily used by the string code. (It is used as a general string workspace when a block of memory is needed to hold a C string, so it cannot be removed altogether.) All of the functions that handle string memory management are found in 'strings.c'. The main allocation function is alloc_string(). free_string() is called to return a string when it is no longer required. The string memory management is based around allocating memory blocks of set sizes for the different string lengths. There is a 'bin' for free strings of each length. When a string memory request is made, the bin of the right length is checked first. If the bin is empty, memory is taken either from the free string list, of if there is nothing suitable there, the Basic heap. (The free string list is described below.) When a string memory block is released it is added to the bin for that size of string. There are forty six bins covering string lengths from eight to 65536 bytes. Between eight and 256 bytes, the lengths of the blocks that can be allocated increase by eight bytes from one bin to the next. Beyond 256 bytes and up to 2048 bytes the length increases by 256 bytes per bin. After 2048, the next bins are 3072 and 4096, then it doubles from bin to bin. It is assumed that programs will allocate many short strings so the granularity of the string size is small. There will be some medium sized strings but only a few long ones. Of course this might not hold true for many programs but it seems to work quite well. If there is not enough memory left to allocate a block for a string, the program attempts to merge the free strings in the bins and the free string list. The merged strings are put back in the bins if they are of the right size. If they are not, they are added to the free string list. if there is a free block that is the last item on the Basic heap, that block is returned to the heap. Function collect() deals with this. The free string list is a list of all memory blocks whose size does not correspond to one of the bin sizes. Entries can only be added to the list as a result of trying to merge blocks when memory is running short. If a string of the required size is not available from a bin, the free string list is searched and the first entry large enough selected. The string is cut down to the length wanted and the excess either moved to one of the bins (if it is of a suitable size) or added to the free string list again. If the length of a string is being changed, function resize_string() is called. If the new string length exceeds the maximum length that the memory block will hold, a new memory block is allocated and the old string copied to it. If the old block is large enough then there is no problem. This is designed to work best with the medium granularity string memory blocks (those in the size range 256 to 2048 bytes) and the large ones (strings longer that 2048 bytes) where there is normally a lot of unused space in the memory block. It avoid a lot of potential string copying. In the case where the new string is shorter, the function will either allocate a new string or, if the excess length of the old string corresponds to a bin size, the extra is cut off and returned to that bin. In general the functions that manipulate strings always allocate strings from the heap to carry out their work. There are few places where the string workspace is used. One example is the code that handles the function 'GET$' when reading from a file, where a block large enough to hold the maximum length string is required. The string workspace is really what sets the upper limit on the string length. The maximum could be increased if cases such as the 'GET$' one could be got rid of. (Of course, the size of the Basic workspace would then impose a limit.) It is vital that the program releases strings when they are no longer required. There is no garbage collection. There are debug options (see below) that can be used to check for memory leaks. Other Memory Areas ------------------ The only other memory the interpreter acquires when running is to hold libraries loaded via the 'INSTALL' statement and a workspace the size of the largest string allowed used when manipulating strings. Libraries --------- Libraries can be loaded using either the INSTALL command or the LIBRARY statement. INSTALL'ed libraries are kept outside the Basic workspace whereas those loaded via LIBRARY go on the Basic heap (and as such are only available until the heap is cleared by NEW, editing the program and so forth). To speed up searches for procedures and functions in the libraries, a linked list pointing at all of the procedures and functions in a library is constructed the first time the library is searched. Floating Point Numbers ---------------------- The interpreter uses eight byte floating point numbers, the same as the 'Basic64' version of the Acorn interpreter. However, it is assumed that the representation of floating point numbers on the machine on which the program is being run conforms to IEEE standard 754. This should not be an issue, but there is one case where it is important. This is when the program is reading and writing binary floating point values. For compatability with the original Acorn interpreter, values are written using the byte order that they would have on an ARM processor. There is code to convert between the ARM byte order and that used by other processors so that the data is always written in the same format. The program tries to determine the format when it starts by looking for the exponent in the number 1.0. It can identify four different layouts and defaults to writing the values in the byte order in which they are found in memory if it cannot figure out the format. It puts out the message 'floating point number format is not known' if it cannot determine the format. Error Handling ~~~~~~~~~~~~~~ The interpreter makes extensive use of setjmp and longjmp to handle errors. The basic idea is that the code calls a function to deal with the error when an error is detected. The error function will then use 'longjmp' to continue at the designated point for handling the error. All errors are dealt with in this way with only a couple of exceptions. It is not necessary for functions to check values returned from the functions they call to see if an error occured: if a function returns, whatever it did worked. There are several levels of error handler. The first and most important is the one set up when the function 'run_interpreter' is called. This function contains the main interpreter command loop. Whenever a program stops running (including lines typed in and executed immediately) control passes back to this point via a longjmp. It is used when a program executes 'STOP' or 'END' or if an error occurs and there is no 'ON ERROR' or 'ON ERROR LOCAL' to trap the error. The environment structure for this is 'basicvars.restart'. Function 'run_program' is called when a program is run. This sets up two more error handlers to deal with errors trapped by 'ON ERROR' and 'ON ERROR LOCAL'. The details of these two are held in 'basicvars.error_restart' and 'basicvars.local_restart' respectively. When an error is detected and an 'ON ERROR' error handler has been defined, control passes from the Basic error handling functions in 'errors.c' to this point and program execution resumes at the point of the 'ON ERROR'. Do not forget that 'ON ERROR' is a fairly crude error handling mechanism that behaves as if there is a 'GOTO' statement that takes you from the point of the error to the statements after the 'ON ERROR'. There is no cleaning up. (Actually, Brandy does clean up the Basic stack, but the effect is still as if there is a 'GOTO' statement.) 'ON ERROR LOCAL' introduces a third level of error handler. It is the most complex one. Everything is reset when an 'ON ERROR' error trap fires: the Basic stack is cleared, local variables set back to their original values, the function and procedure call stack emptied and so forth. On the other hand, 'ON ERROR LOCAL' restores the Basic program's environment to its state at the point where the 'ON ERROR LOCAL' error trap was defined. Because of the way in which the interpreter works, a new environment structure has to be set up for every level of function call. (Function calls are dealt with by recursive calls from the expression code to the statement code and this has to be reflected in the environment structure. The only way to do this is to create a new structure every time a function is called.) The environment structure is allocated on the Basic stack. 'Basicvars.local_restart' is a pointer to the current structure. On returning from a function, the old structure is reinstated as the error handler. When an error is detected the function 'error' in errors.c is called. This calls 'handle_error' to recover from the error. Recovery can be to either report the error, halt the program and branch back to the command loop or to restart the program if an 'ON ERROR' or an 'ON ERROR LOCAL' error trap has been set up. Note that a call to 'error' is, in general, a one way trip. One or two of the error messages are classed as warnings but the vast majority of them stop program execution. One feature of the interpreter is that it can be set to close all open files when an error occurs. This option is on by default. It should also be noted that Brandy's handling of errors differs from the Acorn interpreter in that it cleans up the Basic stack before restarting at the point of the 'ON ERROR' and 'ON ERROR LOCAL'. The Acorn interpreter appears to just reset the stack pointer. This means that with the Acorn interpreter, variables used as local variables retain the values they had at the point of the error and so forth. Brandy will reset them to the values they had when they were declared 'LOCAL'. The Acorn interpreter's approach can lead to problems with local arrays. Brandy uses something closer to proper exception handling. Program Flow ~~~~~~~~~~~~ Once the intepreter has been initialised and parameters on the command line dealt with, the program enters its main loop in the function 'run_interpreter' in brandy.c. This is fairly simple: each line is read and tokenised then passed to 'exec_line'. If the line starts with a line number control passes to the line editor otherwise it goes to 'exec_thisline' in statement.c to be executed. 'exec_thisline' calls 'exec_statements' to deal with the statements in the line. 'exec_statements' contains the main statement execution loop. Dispatching a statement is a case of using the first token in the statement as an index into a table of functions and then calling the corresponding function. One thing to note is that the loop is an infinite loop. The only ways out of the function are either to execute a 'STOP' or 'END' statement or to hit an error. In both cases, control passes directly back to the command loop in 'run_interpreter' by means of a 'longjmp'. If the token is 'RUN', the program ends up in 'run_program' by way of 'exec_run'. After initialising everything the function makes a recursive call to 'exec_statements' to run the program in memory. 'run_program' sets up an error handler here to deal with 'ON ERROR' and 'ON ERROR LOCAL'. If one of these error traps is in use and an error occurs, the longjmp in 'errors.c' will end up here. All that the code does is jump back into 'exec_statements' with the address of the statement after the 'ON ERROR' as the place to start. (Actually the comment about ending up here after an error is not strictly true: if an error occurs when executing statements in a function and an 'ON ERROR LOCAL' error trap is in effect, the longjmp from 'errors.c' branches back to a similar piece of code in 'do_function' in expressions.c) The program sits in the loop in 'exec_statements' unless a function is called. Functions can only be called from the expression code (do_function). do_function calls another function in statement.c, exec_fnstatements, to interpret the statements in the function. This one is just about the same as exec_statements except it includes a check for an '=' at the start of a statement and returns to do_function if it finds one. (exec_statements and exec_fnstatements could be merged.) The interpreter handles functions in the Basic program by recursion. This means that use of the C stack can be quite heavy. 'do_function' is the only point where the C stack usage really has to be checked. The DOS/DJGPP version of the code has to include an explicit check on stack usage at this point as there seem to be no stack checks added by the version of gcc used under DJGPP. There is not a lot to say about the handling of Basic statements. The code is split across four main files: assign.c Assignment statements iostate.c I/O statements mainstate.c All other statements statement.c Dispatches statement functions Expressions are dealt with by: evaluate.c Evaluate Expressions functions.c Evaluate Built-in functions and Basic commands by: commands.c Embedded Offsets ---------------- A number of the statements have tokens that contain embedded offsets, for example, the IF statement tokens are followed by two offsets, the offset to the first token of the statement after the THEN token and the equivalent after the ELSE token (or the next line if there is no ELSE part). In such cases there are two different versions of the function to handle the token, one which carries out any processing needed to fill in the offset and one that assumes that the offset has been filled in. In some cases the first version of the function has to carry out the work of the statement as well as fill in the offsets, for example, the IF first function has to evaluate the expression after the IF token to find out if there is a 'THEN' or 'ELSE' token after it and whether this is a single line IF or a block IF. In most cases, though, the first function does its work and then calls the second one. Tokens Used for Variables ------------------------- The intepreter uses a number of different tokens to represent variables of different types. They are: XVAR Reference to variable in source code INTVAR Simple reference to an integer variable FLOATVAR Simple reference to a floating point variable STRINGVAR Simple reference to a string variable ARRAYVAR Reference to a whole array ARRAYREF Reference to an array element, possibly followed by an indirection operator INTINDVAR Integer variable followed by an indirection operator FLOATINDVAR Floating point variable followed by an indirection operator. STATICVAR Simple reference to a static variable STATINDVAR Static variable with indirection operator All dynamic variables start off with their token set to 'XVAR'. It is changed to one of the tokens in the range INTVAR..FLOATINDVAR the first time the variable is referenced. This allows the program to use specific, optimised functions to read from and write to the variables. The location of the variable's value is stored after the token to eliminate the overhead of searching for the variable each time it is referenced. The offset stored is the byte offset from the start of the Basic workspace (basicvars.workspace). It is four bytes wide. This is different from other tokens which are followed by offsets where the offset stored is that from the token. The reason for this is to ensure that the offset is always positive to avoid problems on machines where integers are not four bytes wide. Static variables can be identified when the line is being tokenised so they have their own tokens (STATICVAR and STATINDVAR). Assignments ----------- The comments about variables above also applies to them when they appear on the left-hand side of an expression. Ignoring static variables, the first time an assignment is seen it is dealt with by function exec_assignment(). In the call to exec_assignment() (in get_lvalue(), to be precise) the type of the variable will be identified and the type token changed. In the case of INTVAR, FLOATVAR and STRINGVAR, specific functions for dealing with these types of variables will be used in future instead of exec_assignment(), for example, integer variables are handled by assign_intvar(). The other types, for example, ARRAYVAR, will continue to go via exec_assignment() as the processing required is much greater for these. exec_assignment() uses tables of functions to deal with the individual types of assignment. There are eight tables for the eight assignment operators, '=', '+=', '-=', 'AND=', 'OR=', 'EOR=', 'MOD=' and 'DIV=', indexed by the type of the operand on the left-hand side of the expression, for example, assignments to whole integer arrays is handled by assign_intarray(). There is a large number of functions like assign_intarray() and some of them appear to duplicate existing functions, for example, assign_intword() could be confused with assign_intvar(). The difference is that assign_intvar() is specifically for integer variables whereas assign_intword() is a general 'store a four byte integer on a word boundary' routine. Static variables always use their own assignment function as they can be identified when the program is tokenised. Static variables followed by indirection operators use exec_assignment(), just like dynamic variables. Expression Evaluation --------------------- This is dealt with almost in its entirety by functions in 'expressions.c'. There are two functions that can be called from elsewhere, expression() and factor(0. expression() is the general expression evaluation function and factor() is used when only so-called 'factor' is allowed. expression() is also the heart of the expression code and contains the interpreter's inner loop. The code has been optimised to handle simple expressions, that is, those that consist of, say, a constant or reference to a variable, and ones of the form . The code uses operator precedence to evaluate expressions, where operators are put on a stack and each time checked to see if they have a higher or lower priority than the next operator in the expression. The operator is evaluated if its priority is greater than or equal to that of the next operator. The code does make use of recursive descent to handle the unary operators '+' and '-' and brackets, although these could have been dealt with via the operator precedence method as well. Just like dispatching statements, the expression code uses tables of functions to handle expressions. There are two, factor_table, which is indexed by the token type of the start of an operand, and 'opfunctions' which is indexed by the operator and the type of the *right hand* operand as given by its Basic stack entry. 'optable' says whether a token is an operator and gives its priority and the index value to use for the operator in opfunctions. An optable entry of zero means that the token is not an operator and indicates that the end of the expression has been reached. The only 'nasty' in the expression code is that BASIC V/VI does not allow the comparision and shift operators to be chained together, that is, expressions such as: abc% >> 4 < 10 will give a syntax error and have to be put in brackets to work. There is code specifically to handle comparision operators (or, to be more precise, those with the priority of comparison operators) in expression(). Indirection Operators --------------------- The interpreter fully supports the BASIC V/VI indirection operators. To protect the integrity of the interpreter and for security the address range they can point to is restricted to the Basic workspace. They can be used to read any location in the workspace but can only write to the Basic heap, that is, from basicvars.lomem to basicvars.stacktop and from basicvars.himem to basicvars.end. It is not possible to modify the Basic program or to overwrite the Basic stack. The operators work in terms of byte offsets from the start of the Basic workspace (except in the RISC OS version of the program). By default, PAGE is set to zero and HIMEM to the size of the Basic workspace. This is completely transparent to the Basic program and makes the code more portable. The only exception is the RISC OS version of the program where the start of memory, that is, address zero, is used as the base address for the offsets. The offsets therefore take the values they would if they were proper addresses on an ARM processor. This is necessary for the SYS statement to work. The base address is stored in basicvars.offbase. This can change if the NEW command is used to alter the size of the Basic workspace (except under RISC OS). The value is otherwise fixed. Procedure and Function Calls ---------------------------- One nasty area of the code is the functions that handle procedure and function calls. These are spread across evalute.c and stack.c. This code would probably benefit from a rewrite. All of the parameters have to be evaluated before they can be assigned to the variables being used as formal parameters. At present the code evaluates each parameter and stores its value outside the Basic program (in a variable in function push_oneparm()). The next parameter is dealt with by a recursive call to the same function. Once the parameter list has been exhausted the values are assigned to the parameter variables as the recursion unwinds. The parameter variables are treated as local variables, that is, their old values are saved on the Basic stack along with an lvalue structure that specifies where the value goes and its type. They are restored whe the procedure or function call ends. RETURN parameters have to store extra information in addition to that needed for local variables, namely an lvalue structure that gives the address at which the returned value is to be stored and its type. Dealing with these is a game of musical chairs where the returned value is copied from the parameter variable to its destination and then the original value of the parameter varaible is restored. All of the functions for saving parameter variable values and restoring them and local variables are found in stack.c Array Operations ---------------- The interpreter supports array operations as a part of normal expression handling. On the other hand, general array expressions are not allowed and only a limited range of operations are supported. Dealing with whole arrays is based around the use of array descriptors. When an array is referenced in this way, a pointer to its descriptor is pushed on to the Basic stack. The following operations are supported: addition, subtraction, multiplication, division, integer division, integer remainder and matrix multiplication. Whenever an operation is carried out involving an array, a temporary array for the results and a descriptor are created on the Basic stack. This array can also be used as an operand under some circumstances, namely, that the array is on the left-hand side of the operator and that the result is of the same type and size as the existing temporary array, for example: array1$() = array2$()+" "+array3$()+" "+array4$() This gives some flexibility in using arrays as operands but it is by no means general. It also goes beyond what the Acorn interpreter supports. Filenames and Directories ~~~~~~~~~~~~~~~~~~~~~~~~~ In order to make the interpreter operating system independent the manipulation of file names is kept to a minimum. The format of file names and directory structures varies from OS to OS. The normal rule seems to be to assume that a Unix-type file system in use. DOS file names maps fairly simply into this but RISC OS programmers have suffered many hours of grief. The easiest way to prevent this is to avoid anything that relies on the format of the names of files. Having said that, though, the functions isapath() in fileio.c and open_file() in editor.c do have to know something about this. isapath() is used to determine whether the name of a file is just that of the file or includes directories and open_file() has to be able to construct a name that includes directories. These are the only two places in the interpreter where there are any dependencies like this. Debug Code ~~~~~~~~~~ To help debug the interpreter itself, debugging code can be compiled into a number of the files. It is controlled by the macro 'DEBUG'. This is done on 'CFLAGS' in the makefile (-DDEBUG). Whether or not any debugging output is produced is controlled by a number of flags in basicvars (defined in 'debug_flags'). These are set and cleared by means of the Basic 'LISTO' command, for example, 'LISTO &1100' will turn on general debugging output and displaying the string usage statistics. There are six debugging options: DEBUG_DEBUG &100 Show general debugging output. Check Basic heap for memory leaks after program has finished running. DEBUG_TOKENS &200 Show tokenised lines on input plus addresses on listings. DEBUG_VARIABLES &400 List addresses of variables when created and on listing produced by LVAR. DEBUG_STRINGS &800 Show memory allocated and released for strings. DEBUG_STATS &1000 Show string heap statistics when program finishes. DEBUG_STACK &2000 Show various control blocks pushed and popped from the Basic stack. DEBUG_ALLSTACK &4000 Show in detail values and intermediate results push and popped from the stack The values given are the LISTO value needed to turn on or off each option, that is, 'listo &100' will turn on general dubugging output and a second 'listo &100' will turn it off again. Debug output is sent to 'stderr' and is probably best redirected to a file, for example, starting the interpreter with brandy 2>tracefile under Linux or NetBSD will send all debugging output to the file 'tracefile'. This is probably the best way to deal with it. Note that stderr cannot be redirected under DOS. Note that a huge amount of debugging output can be produced if all the debugging options are turned on. A program that runs for a few seconds can produced several megabytes of it. Basic TRACE output and error messages will also be written to 'stderr' if general debugging is enabled, that is, 'listo &100' is used. This will confuse things if stderr is being written to the screen as two copies of everything will appear but is more useful if stderr is being written to a file. 'TRACE PROC' and 'TRACE GOTO' will probably be the most useful trace options to use. There is one debugging option on the command line used to run the program, -!. The program does not set up any signal handlers if this option is used, so that errors such as illegal addresses are not trapped by the program. This is useful if a program fails with an 'address out of range' error to determine whether the program or the interpreter is at fault. When the debugging output shows addresses, these are proper addresses and not offsets. (Not to be confused with the Basic indirection operators, which work in terms of offsets.) There are three extra Basic commands that can be used for debugging as well. LISTB [ , ] This displays memory from to in byte form. The offsets are the byte offsets from the start of the Basic workspace (except under RISC OS where they are effectively addresses). If is omitted, 64 bytes are displayed. LISTW [ , ] This displays memory from to as four-byte words. The offsets are the byte offsets from the start of the Basic workspace (except under RISC OS where they are effectively addresses). If is omitted, 64 bytes are displayed. LISTL This displays a hex dump of line . In addition, the Basic TRACE statement can be used, especially the form that sends debugging output to a file (TRACE TO). A copy of gdb helps enormously too. Interfacing to the Operating System and the SYS Statement ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Under RISC OS, the mechanism used to make operating system calls from Basic programs is the SYS statement. This is a very simple interface that maps directly on to the ARM processor's 'SWI' (Software Interrupt) instruction. It is envisaged that the SYS statement will also be used to make use of the facilities of operating systems other than RISC OS. Currently, on non-RISC OS platforms, SYS is only minimally supported, primarily emulating some RISC OS functionality, and providing some functionality specific to Matrix Brandy. The format of the SYS statement is as follows: SYS [ , ] [ TO [ ] [ ; ] ] is the number of the SWI to call. It can either be a number or a string giving the name of the SWI, which the interpreter maps on to the SWI number. specifies the parameters for the call. This is a list of expressions separated by commas that give either numeric or string values. They correspond to the values passed in the ARM's registers to the SWI. There can be up to ten of these. and is a list of the variables to receive the values returned by the SWI. Again, items in the list are comma-separated. The state of the processor flags after the call can be returned in the variable given by . Note that this is the last item in the list and follows a ';'. Again, up to ten variables can be listed here to receive the values returned in the corresponding ARM registers. There are two types of SWI, normal ones and the so-called 'X' SWIs. The difference between them is the way in which errors are handled. In the case of normal SWIs, the operating system takes cares of errors. The default action is to abort the program with an error message. If the 'X' form of the SWI is used, control is returned to the calling program with the ARM processor's 'overflow' flag set to indicate that an error occured. ARM register R0 then points at an error block. The format of the error block is given below. The numeric values passed from the program to the SWI can be either parameter values or addresses. There is no way to tell them apart: they are just values in registers. Strings are normal Basic strings, but the interpreter converts them to C-style null terminated strings and passes pointers to these when the SWI is called. When the call finishes, the interpreter deals with the values returned in the registers according to the type of the variables in the parameter list. If the variable is an integer, the ARM register value is stored in it. If it is floating point, the contents of the ARM register are converted to a floating point value. If it is a string, the ARM register is assumed to point at a null-terminated string. This string is converted to a Basic-style string. SWIs sometimes return information in the processor flags. Only the 'carry' and 'overflow' flags are used for this. The variable is set to the processor flag state after the SWI. The 'overflow' flag is the most important as it is used to indicate whether or not the SWI call worked. If everything was okay, the overflow flag is cleared. If the SWI failed, it is set. Bit masks for the processor flags as stored in are defined in the file mos.c. There is no checking of parameter types in the SYS statement. It is entirely left up to the programmer to ensure that the right number of parameters is passed and that the type of each parameter is correct. SWI Error Block --------------- The format of this is: Bytes 0 to 3: Error number (four bytes, little endian) Bytes 4+: Null terminated error message. Implementing SWIs ----------------- Brandy fully implements the SYS statement. The code that handles SWI calls is the function emulate_sys() in mos.c. This forms the heart of any SWI emulation code under operating systems other than RISC OS. Unfortunately there is a problem with this: the handling of pointers. Within a Basic program, anything that looks like an address, for example, the address of a block of memory allocated via a DIM statement, is really an offset from the start of the Basic workspace. The SWI emulation code will have to compensate for this. This would have to be done on a SWI-by-SWI basis. Similarly, if a SWI returns a pointer to something, that pointer will have to be an offset within the Basic workspace as addresses within the Basic program are not allowed to go outside the workspace. The variable basicvars.offbase always points to the start of the Basic workspace and is the value that should be added to values passed as addresses to turn them into real addresses. basicvars.offbase is of type 'unsigned char *'. There are two functions in miscprocs.c that can be used to verify that an address is legal. These are check_read() and check_write(). void check_read(int32 low, int32 size) void check_write(int32 low, int32 size) 'low' is the offset within the Basic workspace of the start of the block to be checked and 'size' is its size in bytes. Reads are allowed anywhere in the Basic workspace but only the memory between the top of the Basic program and the Basic stack (the Basic heap) and from basicvars.himem to basicvars.end (the memory above the Basic stack) can be written to. If an offset is out of range these functions just report an 'address out of range' error using the normal Basic error handling mechanism. Of course, this means that the SWI emulation code cannot take any action to deal with the error. Another function that might be of use is emulate_getswino(), located in mos.c. It takes the name of a SWI and returns its SWI number. Bit masks for the processor flags as stored in are also defined in this file, as well as a macro to define the 'X' bit set in the 'X' form SWIs. On platforms other than RISC OS, emulate_sys() and emulate_getswino() only support a minimal set of SWIs, as listed in mos.c and mos_sys.h. MatrixBrandy-1.22.13/docs/keymap.txt0000664000175000017500000001463714156732602016356 0ustar soruksoruk*FX254,128 is set by default to set the keyboard map to match the OSBYTE 0 value. *FX254,192 forces the keymap to match the RISC OS keyboard map. RISC OS Keymap - OSBYTE 0 = %000x0xxx, Acorn hardware/MOS or forced with *FX254,192 (b6=1) ========================================================================================== +===+======+======+=====+=====+=====+=====+=====+=====+======+=====+=======+=====+=====+=====+======+======+ | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | +===+======+======+=====+=====+=====+=====+=====+=====+======+=====+=======+=====+=====+=====+======+======+ |00x| | | | | | | | | BS | Tab | | | |Retrn| | | +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ |01x| | | | | | | | | | | | Esc | | | Home | | +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ |07x| | | | | | | | | | | | | | | | Del | +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ |18x| F0 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | Tab | End | <- | -> | Dn | Up | | | Prnt | | | | | | | | | | Break | | | | sPgDn| sPgUp| +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ |19x| sF0 | sF1 | sF2 | sF3 | sF4 | sF5 | sF6 | sF7 | sF8 | sF9 | sTab | sEnd| s<- | s-> | sDn | sUp | | |sPrnt | | | | | | | | | | sBreak| | | | PgDn | PgUp | +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ |1Ax| cF0 | cF1 | cF2 | cF3 | cF4 | cF5 | cF6 | cF7 | cF8 | cF9 | cTab | cEnd| c<- | c-> | cDn | cUp | | |cPrnt | | | | | | | | | | cBreak| | | |scPgDn|scPgUp| +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ |1Bx| scF0 | scF1 |scF2 |scF3 |scF4 |scF5 |scF6 |scF7 | scF8 |scF9 | scTab |scEnd|sc<- |sc-> | scDn | scUp | | |scPrnt| | | | | | | | | |scBreak| | | | cPgDn| cPgUp| +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ |1Cx| LWin| Menu | | | | | | | | | F10 | F11 | F12 | Ins | MsDn | MsUp | | | sRWin| | | | | | | | | | | | | | | | +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ |1Dx| sLWin| sMenu| | | | | | | | | sF10 | sF11| sF12| sIns|sMsDn |sMsUp | | | RWin| | | | | | | | | | | | | | | | +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ |1Ex| cLWin| cMenu| | | | | | | | | cF10 | cF11| cF12| cIns|cMsDn |cMsUp | | |scRWin| | | | | | | | | | | | | | | | +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ |1Fx|scLWin|scMenu| | | | | | | | | scF10 |scF11|scF12|scIns|scMsDn|scMsUp| | | cRWin| | | | | | | | | | | | | | | | +---+------+------+-----+-----+-----+-----+-----+-----+------+-----+-------+-----+-----+-----+------+------+ Regular Keymap - OSBYTE 0 <>%000x0xxx, non-Acorn hardware default with *FX254,128 (b6=0) ======================================================================================== +===+=====+=====+===+===+===+===+====+====+=====+====+======+=====+====+====+=====+=====+ | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | +===+=====+=====+===+===+===+===+====+====+=====+====+======+=====+====+====+=====+=====+ |00x| | | | | | | | | BS | Tab| | | | Ret| | | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ |01x| | | | | | | | | | | | Esc | | | | | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ |07x| | | | | | | | | | | | | | | | Del | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ |18x| Prnt| F1 | F2| F3| F4| F5| F6 | F7 | F8 | F9 | F10 | F11 | F12| F13| F14 | F15 | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ |19x|sPrnt| sF1 |sF2|sF3|sF4|sF5| sF6| sF7| sF8 | sF9| sF10 | sF11|sF12|sF13|sF14 |sF15 | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ |1Ax|cPrnt| cF1 |cF2|cF3|cF4|cF5| cF6| cF7| cF8 | cF9| cF10 | cF11|cF12|cF13|cF14 |cF15 | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ |1Bx|aPrnt| aF1 |aF2|aF3|aF4|aF5| aF6| aF7| aF8 | aF9| aF10 | aF11|aF12|aF13|aF14 |aF15 | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ |1Cx| Win | Menu| | | | | Ins| Del| Home| End| PgDn | PgUp| <- | -> | Dn | Up | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ |1Dx|sWin |sMenu| | | | |sIns|sDel|sHome|sEnd|sPgDn |sPgUp| s<-| s->| sDn | sUp | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ |1Ex|cWin |cMenu| | | | |cIns|cDel|cHome|cEnd|cPgDn |cPgUp| c<-| c->| cDn | cUp | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ |1Fx|aWin |aMenu| | | | |aIns|aDel|aHome|aEnd|aPgDn |aPgUp| a<-| a->| aDn | aUp | +---+-----+-----+---+---+---+---+----+----+-----+----+------+-----+----+----+-----+-----+ MatrixBrandy-1.22.13/docs/raspi-gpio.txt0000664000175000017500000000416114156732602017131 0ustar soruksorukRaspberry Pi GPIO support ========================= In keeping with the BBC Micro style of I/O ports being memory-mapped, if Brandy is able to open /dev/gpiomem for read-write, then it'll mmap() it, and the following code can be used to test whether it's available, and if so, where. SYS "RaspberryPi_GPIOInfo" TO present%,gpiomem% If /dev/gpiomem is available and usable, present% will be set to 1, and gpiomem% set to the base of memory as addressed within Brandy. Otherwise, present% will be set to 0, and gpiomem% to &FFFFFFFF. This will happen every time Matrix Brandy is started. With the exception of the above SYS call, all the other GPIO calls report the error "Raspberry Pi GPIO not available" if present% is 0 (and it wasn't called as an X call). The remaining SYS calls all take the GPIO port number in R0 and the parameter, if required, in R1. Those that return a value do so in R0. The other GPIO calls are: RaspberryPi_GetGPIOPortMode: R0=port Returns a value from 0 to 7: 0: Input 1: Output 2: ALT5 3: ALT4 4: ALT0 5: ALT1 6: ALT2 7: ALT3 RaspberryPi_SetGPIOPortMode: R0=port, R1=mode (as above). RaspberryPi_SetGPIOPortPullUpDownMode: R0=port, R1=mode 0: Off 1: Down 2: Up RaspberryPi_ReadGPIOPort: R0=port. Value returned in R0. RaspberryPi_WriteGPIOPort: R0=port, R1=value As an alternative to the SYS calls, a slightly modified version of BBCSDL's gpiolib.bbc by Richard Russell should also work, with the following change: Replace FN_gpio_setup with the following: DEF FN_gpio_setup LOCAL present% SYS "RaspberryPi_GPIOInfo" TO present%,G% IF present%=0 THEN ERROR 0, "GPIO not present or usable" = G% Also - SOME SWIs from the RISC OS GPIO module are implemented. At this point, the following are: GPIO_GetBoard Returns board model code local to the module in R0, the board type string in R1 and additionally, local to Brandy, the 32-bit model code from /proc/cpuinfo into R2. GPIO_ReadMode: mapped to RaspberryPi_GetGPIOPortMode GPIO_WriteMode: mapped to RaspberryPi_SetGPIOPortMode GPIO_ReadData: mapped to RaspberryPi_ReadGPIOPort GPIO_WriteData: mapped to RaspberryPi_WriteGPIOPort MatrixBrandy-1.22.13/docs/networking.txt0000664000175000017500000000200314156732602017237 0ustar soruksorukNetworking has been added to Brandy BASIC as of version 1.21.6, significant bugs fixed for 1.21.7, and IPv6 capability added for 1.21.8. The interface is as such: Open a file handle using OPENUP, instead of a filename use "ip0:host:port", "ip4:host:port" or "ip6:host:port". When using "ip0" it'll use whichever is available, ip4 and ip6 request the connection to use only that protocol. PRINT# and INPUT# are NOT implemented for this, for a BBC BASIC internal format these are rather pointless for communicating with anything else. BGET# returns the next byte in the buffer, or -1 if no data waiting. (This is NOT an error condition, an interactive service like Telstar will not send data when it doesn't need to.) If the remote host has closed the connection, it will return -2 once the receive buffer is exhausted. GET$# returns a line of text up to the next newline. BPUT# allows bytes or strings to be sent. CLOSE# closes the network channel. This should be done even if the remote host has closed the connection. MatrixBrandy-1.22.13/docs/sys-calls.txt0000664000175000017500000003565314161721735017004 0ustar soruksorukSYS calls in Matrix Brandy ========================== On RISC OS builds, all host SWIs are available. Additionally, the Brandy-specific calls which are implemented by Matrix Brandy are also recognised and are available for use. A number of SYS calls are supported in Matrix Brandy, some of which are emulations of the equivalent RISC OS SWIs. Where a RISC OS SWI is emulated, the SWI number used is the same as that used by RISC OS, in order to allow code that uses the number rather than the name for performance reasons to run correctly. In this document, the parameters listed are labelled as ARM registers as if the SWI were called in RISC OS. Where a parameter returns a pointer to a string, it MUST be picked up with a string variable; picking it up with a numeric variable and attempting to access the buffer will not work. OS_xxx ====== OS_WriteC R0: Send (R0 AND &FF) to the VDU stream. Matrix Brandy extension: If R1 and R2 are both set to 42, the character is output to the controlling terminal on the stderr stream. OS_Write0: R0: Pointer to NULL-terminated string, to be sent to the VDU stream. Matrix Brandy extension: If R1 and R2 are both set to 42, the string is output to the controlling terminal on the stderr stream. OS_NewLine Sends \r\n (&0D, &0A) to the VDU stream. OS_ReadC Reads a character from the keyboard, returned in R0. OS_ReadLine and OS_ReadLine32 Returns a string input from the keyboard, pointed in R0. OS_Mouse Returns mouse state. OS_ReadPalette Read the colour palette. Only R1=16 supported. OS_ReadModeVariable Read a mode variable into R2. OS_ReadVduVariables Read VDU variables requested in block pointed in R0 into block pointed in R1. R0 and R1 may point to the same block. OS_ReadMonotonicTime Return centisecond timer in R0. Matrix Brandy extension: As the centisecond timer is centiseconds since the start of the instance, the offset from the raw value is returned in R1. OS_Plot Executes a PLOT function. Note that this bypasses the VDU driver so plotting this way will not be picked up by *SPOOL. OS_ScreenMode Only R0=0,1,7,8,9,10 are supported. OS_SWINumberToString Returns SWI string from number. On RISC OS this is NOT intercepted so it does not recognise Brandy-specific calls. OS_SWINumberFromString Returns SWI number from name. On RISC OS this call is intercepted so we can also recognise Brandy-specific calls. OS_WriteI block (SWIs 256-511). Call by number. Matrix Brandy extension: If R1 and R2 are both set to 42, the character is output to the controlling terminal on the stderr stream. OS_Byte R0, R1, R2 are A, X and Y. Calls the OSBYTE system call, see docs/osbyte.txt OS_Word R0 is A, R1 is the address of the data block. Only R0=9, 10, 139, 140 are supported. 139 and 140 are specific to Matrix Brandy and BBCSDL. Details in docs/Mode7.txt OS_File Calls 0, 6, 7, 8, 12, 14, 16, 19, 24 and 255 only. Calls 12, 14, 16 and 255 are identical (for now). Implementation is incomplete. ColourTrans_xxx =============== ColourTrans_SetGCOL ColourTrans_GCOLToColourNumber ColourTrans_ColourNumberToGCOL ColourTrans_SetTextColour BRANDY-SPECIFIC CALLS ===================== Brandy_xxx (SWI numbers start &140000) &140000 Brandy_Version Returns R0: Major version number R1: Minor version number R2: Patchlevel number R3: Git commit SHA (if available) R4: Pointer to host OS name string R5: 1 if SDL build, otherwise 0. R6: Returns a fixed 64-bit value on 64-bit hardware (truncated on 32-bit): &123456789ABCDEF0 R7: 1 if 64-bit build, otherwise 0. &140001 Brandy_Swap16Palette Returns nothing. In 16-colour modes, as Flash isn't supported, this swaps the dimmed colours at 8-15 with the standard brightness at 0-7. Calling again switches back. Some other BBC BASIC versions use 0-7 as dimmed colours. &140002 Brandy_GetVideoDriver Returns: R0: Pointer to SDL video driver name string R1: Length of string in R0 R2: Pointer to screen memory base R3: Size of screen memory. R4: Base of MODE 7 frame buffer R5: SDL surface handle (pointer) R6: Pointer to SDL_PixelFormat structure of the display surface. R7: OS-native window handle &140003 Brandy_SetFailoverMode R0: Set mode to be selected should chosen screen mode be unavailable (instead of returning "Screen mode is unavailable). Set to 255 to disable. &140004 Brandy_AccessVideoRAM If R0=0, return pixel value at pixel offset R1 into R2. If R0 non-zero, write R2 into pixel offset R1. R1 is pixel offset, so each step of 1 is the next pixel irrespective of screen mode. Note this writes directly to the 24bpp frame buffer so bypasses any screen mode palette or colour depth limit. The top 8 bits, which are ignored by SDL, are used to carry the logical colour number in paletted modes to support VDU19 palette changing. &140005 Brandy_INTusesFloat This enables a BB4W/BBCSDL extension that allows INT() to handle numbers > 2^31-1 by using a float if the number is out of range for a 32-bit signed integer. R0=1 to enable, 0 to disable. Default: disabled. &140006 Brandy_LegacyIntMaths This allows integer mathematics to be handled in the way BBC BASIC 1 to 4 on the Acorn 8-bit machines, and RISC OS ARM BBC BASIC V, including the rather questionable wrap-around on integers. RISC OS ARM BBC BASIC VI, BB4W and BBCSDL do not have this wrap-around issue and will promote to float when needed. R0=1 to enable, 0 to disable. Default: disabled. &140007 Brandy_Hex64 This controls whether Brandy renders and interprets Base 16 (Hexadecimal) values as 64-bit. R0=1 to enable, 0 to disable. Default: disabled. &140008 Brandy_DELisBS Toggles whether the DEL key functions as backspace (DELETE in old BBC terminology). R0=1 to enable, 0 to disable. Default: Enabled on UNIX text-mode builds, Disabled otherwise. &140009 Brandy_PseudovarsUnsigned Only effective on 32-bit hardware. Toggles whether memory pseudo-variables (e.g. PAGE, HIMEM etc) return large positive numbers above &7FFFFFFF. R0=1 to enable, 0 to disable. Default: disabled. &14000A Brandy_TekEnabled Only effective on the 'tbrandy' build, ignored without error on other builds. This switch enables Tektronix graphics to be generated for graphics operations, with particular reference to the Tek emulation in xterm. R0=1 to enable, 0 to disable. Default: disabled R1=simulated baud rate, 0 to run at full speed. &14000B Brandy_uSleep Calls the OS function usleep(R0). &14000C Brandy_dlopen Calls the OS function dlopen(R0,RTLD_NOW|RTLD_GLOBAL). Handle is returned in R0. &14000D Brandy_dlcall Locates the symbol in R0, and calls it with parameters from R1..R9. &14000E Brandy_MAlloc Allocates memory from system call malloc(R0). Pointer to base returned in R0. DEPRECATED, please use DIM HIMEM instead. &14000F Brandy_Free Frees memory pointed to in R0 from earlier malloc. Nothing returned. DEPRECATED, please use DIM HIMEM -1 instead. &140010 Brandy_BitShift64 This controls whether Brandy calculates bit shifts in 64-bit space. 32-bit space is used when disabled as per ARM BBC BASIC VI. R0=1 to enable, 0 to disable. Default: disabled. &140011 Brandy_Platform Similar to Brandy_Version, but more focused on the platform Brandy is running on. R0: Pointer to host OS name string R1: Pointer to CPU family string R2: 64-bit? (1 or 0) R3: SDL build? (1 or 0) R4: Machine type (as returned by OSBYTE 0) R5: "Legacy" INKEY-256 (e.g. &F9 for Linux) R6: The PID of the current process. R7: The Parent PID of the current process. Note: PPID not returned on Windows. &140012 Brandy_CascadedIFtweak Change behaviour of cascaded IF calls to try to match the behaviour of Richard Russell's BBC BASICs. Enabled by default, but can be disabled to match the Acorn behaviour. As this affects the parser and tokeniser, if the block of code has been seen before this call, then the behaviour won't be changed. If used, it is recommended this be called at the top of a program as it affects the way the tokeniser updates jumps as the program is scanned upon first execute.. &140013 Brandy_MouseEventExpire Sets the mouse event expiry time in centiseonds, 0 disables. With a zero event expiry time, a maximum event queue length is used (7 events) which mirrors RISC OS behaviour. &140014 Brandy_dlgetaddr Fetches the address of the library function call given in R0, and returns the address in R0. If the symbol isn't found and the X flag is set, R0 contains -1, else an error is raised. &140015 Brandy_dlcalladdr Similar to Brandy_dlcall (above), but takes the address of the symbol in R0 instead of the symbol name. RaspberryPi_xxx (SWI numbers start &140100) -- see also docs/raspi-gpio.txt &140100 RaspberryPi_GPIOInfo Returns: R0: 1 if available, 0 otherwise R1: If available, memory-mapped I/O base. &140101 RaspberryPi_GetGPIOPortMode R0 contains GPIO port number Returns: R0 contains GPIO port mode: 0: Input 1: Output 2: ALT5 3: ALT4 4: ALT0 5: ALT1 6: ALT2 7: ALT3 &140102 RaspberryPi_SetGPIOPortMode R0 contains GPIO port number R1 contains GPIO port mode (as above). &140103 RaspberryPi_SetGPIOPortPullUpDownMode R0 contains GPIO port number R1 contains GPIO Pull-Up/Pull-Down mode: 0: Off 1: Down 2: Up &140104 RaspberryPi_ReadGPIOPort R0 contains GPIO port number Returns: R0 contains GPIO port state &140105 RaspberryPi_WriteGPIOPort R0 contains GPIO port number R1 contains GPIO port state A few of the RISC OS GPIO module (SWI base &58F80) are also recognised: &58FBE GPIO_GetBoard Returns board model code local to the module in R0, the board type string in R1 and additionally, local to Brandy, the 32-bit model code from /proc/cpuinfo into R2. &58F80 GPIO_ReadData: mapped to RaspberryPi_ReadGPIOPort &58F81 GPIO_WriteData: mapped to RaspberryPi_WriteGPIOPort &58F8F GPIO_ReadMode: mapped to RaspberryPi_GetGPIOPortMode &58F90 GPIO_WriteMode: mapped to RaspberryPi_SetGPIOPortMode MatrixBrandy-1.22.13/docs/use.txt0000664000175000017500000015052614156732602015662 0ustar soruksorukBrandy ~~~~~~ Contents ~~~~~~~~ Introduction Copyright Disclaimer Using the Interpreter Running Programs Programs and Libraries Differences Between Brandy and RISC OS's Interpreter Identifying the Environment Under Which Brandy is Running I/O Redirection Using Basic as a Script Language Under NetBSD and Linux The SYS Statement The 'key' Command Performance Important Error Messages Known Problems Miscellaneous Comments Conclusion Contact Introduction ~~~~~~~~~~~~ Matrix Brandy is a BASIC V/VI interpreter. It is source code compatible with Acorn's BASIC V/VI interpreter and runs under a number of different operating systems. It currently works with NetBSD (arm32 and i386), Linux (x86, z86-64 and arm32) and Microsoft Windows. The aim of this project is to write a Basic interpreter that is compatible with the Acorn interpreter and that runs almost identically across all supported operating systems, emulating features of the RISC OS environment where necessary so that a program will run unchanged using the Acorn interpreter under RISC OS or this one under any other OS. No attempt has been made to support features of operating systems other than RISC OS, for example, it is not possible to make operating system calls from within a program except under RISC OS. The program is simply a Basic interpreter and that is all. These notes describe how to use the program and discuss differences between it and Acorn's interpreter. They also detail the extensions to Basic V/VI that have been implemented and finish with some miscellaneous remarks about the program and a list of the known bugs. Copyright ~~~~~~~~~ Brandy is copyright (C) 2000-2014 David Daniels. Matrix Brandy modifications are copyright (C) 2018-2021 Michael McConnell and contributors. The program is distributed under the terms of the GNU GPL. Brandy, and Matrix Brandy, is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. Matrix Brandy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Matrix Brandy; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Disclaimer ~~~~~~~~~~ The Matrix Brandy Basic interpreter is provided 'as is' and people using it do so entirely at their own risk. No liability whatsoever will be accepted for any loss or damage arising from the use of this software. Using the Interpreter ~~~~~~~~~~~~~~~~~~~~~ To invoke the interpreter, type: brandy [ ] [ ] where is the optional name of the program to load and is one or more of the following: -help Print a summary of these options. -size Set the size of the Basic workspace to bytes when starting the interpreter. The minimum size allowed is 16384 bytes and anything below this value will be set to it. The maximum size is 2147483644 bytes (4 bytes short of 2GB), The size may have a suffix of 'k' to denote that the size is in kilobytes or 'm' if it is in megabytes, for example, '-size 100k' will set the workspace size to 100 kilobytes (102400 bytes) and '-size 8m' will set it to eight megabytes (8388608 bytes). -lib Load Basic library when the interpreter starts. This option can be repeated as many times as required to load a number of libraries. This is equivalent to typing 'INSTALL ' at the interpreter's command line. The libraries are loaded in the order given on the command line. Note that the search order is the reverse of this. -load Load Basic program when the interpreter starts. -path This specifies a list of directories that the interpreter will search when looking for libraries and programs. The directory names are separated by commas. The pseudo-variable 'FILEPATH$' is set to this value. See the section below on FILEPATH$ for more details. -quit Load and run the Basic program . Leave the interpreter when the program has finished running. -chain Load and run the Basic program . Remain in the interpreter when the program has finished running. -ignore Ignore certain 'unsupported feature' errors. By default the interpreter reports an error whenever it comes across a BASIC V/VI feature that it does not support. This option allows some unsupported features that do not affect the basic running of the program to be ignored. -- Subsequent options are passed to the Basic program, rather than being considered as options to the interpreter. Load and run the Basic program . Remain in the interpreter when the program has finished running. -nostar Do not check commands issued via OSCLI to see if they are dealt with by Brandy. Pass all commands to the underlying operating system. The case of the names of the options is ignored. It depends on the operating system under which the interpreter is running as to whether the names of files are case sensitive or insensitive. Minimum Abbreviations --------------------- Options can be abbreviated. The interpreter only checks the first one or two characters of the option name to identify it. -chain -c -help -h -ignore -ig -lib -li -load -lo -path -p -quit -q -size -s -nostar -no Parameters for Basic Programs ----------------------------- The interpreter assumes that any unrecognised options are meant to be for the Basic program and ignores them. Running Programs ~~~~~~~~~~~~~~~~ The name of the program to run can be specified on the command line. If no name is given, the interpreter starts with a '>' prompt. Programs can be loaded, edited and run from here. Briefly, the commands to use are as follows: QUIT Leaves the interpreter. LOAD Load program into the Basic workspace. SAVE Save the program in the Basic workspace in file . RUN Run the program. LIST LIST LIST , The first version lists the entire program. The second one lists just the line supplied. The third lists lines with line numbers in the range given. EDIT This transfers the program in memory to a text editor where it can be more easily edited. The program is reloaded when the editor is quitted. EDIT This copies the line specified to the command line where it can be edited. DELETE DELETE , The first version of DELETE deletes a single line from the program, line . The second version is used to delete a block of lines. Note that it is not possible to recover any lines deleted. Leaving the start and end lines out is permissible, in this case lines from the start of the program and to the end of the program respectively will be deleted. Leaving both out (just specifying the ,) will delete the entire program. AUTO [[,]] This command generates line numbers for typing in a program. Where not specified, and both default to 10. RENUMBER Renumbers the lines of a program. NEW Discard the program in the Basic workspace. Editing Programs ---------------- Any Basic statement typed in without a line number is executed immediately. Basic statements typed in which start with a line number are either added to the program or replace the line if the line number duplicates ones already in the program. The 'EDIT' command can be used to transfer a program into a text editor where it can be edited more easily. The file 'basic' contains more details of these commands and others as well as information on BASIC V/VI. Programs and Libraries ~~~~~~~~~~~~~~~~~~~~~~ Loading and Saving Programs --------------------------- The interpreter can read Basic programs that have been saved as plain text or tokenised using Acorn Basic or Russell Basic tokens. It always stores them as plain text. The reasons for working with text files are that it is not a large overhead to tokenise and expand programs, it is more portable and it allows programs to be edited with any text editor. Line numbers can be left out when creating a program in a text editor. The interpreter will add them when it reads the program. The line numbers added start at 1 and go up by 1 so that the line numbers given in error messages match up with the lines of the program in a text editor. One feature of the interpreter is that it notes the name of the file on a 'LOAD' command and uses that name if the 'SAVE' command is used without specifying a filename. The interpreter also supports the case where the filename is supplied on the first line of the program. This take precedence over the name saved from the 'LOAD' command. Libraries --------- The interpreter supports libraries of procedures and functions that can be loaded using either the 'INSTALL' command or the 'LIBRARY' statement in a program. Those loaded via the 'INSTALL' command will be permanently loaded and are available until the run of the interpreter finishes. The command line option '-lib' can be used to specify libraries that will be 'INSTALL'ed when the interpreter starts. Libraries loaded by the 'LIBRARY' statement are read at the time the statement is encountered and will be discarded when a further RUN statement is issued, when NEW or CLEAR are used or when the program is edited. Effectively they are only available when a Basic program is running. Examples: INSTALL "catlib" LIBRARY "doglib" Libraries loaded using 'INSTALL' cannot be discarded. However the same library can be loaded via 'LIBRARY' and it will effectively take precedence as libraries loaded this way are searched first. Libraries can be held as plain text, with or without line numbers, or can be tokenised. Local Variables in Libraries ---------------------------- It is possible for libraries to have variables and arrays that are private to that library. This is an extension to BASIC V/VI. These are covered in more detail below. Differences Between Matrix Brandy and Acorn's Interpreter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Matrix Brandy is compatible with the Acorn interpreter and should produce the same results as the Acorn one. However perfect compatibility cannot be achieved for a number of reasons, for example, the lack of graphic commands in some versions of the program greatly limits which programs will work. There are also some enhancements that could lead to incompatibilites, for example, Brandy allows strings to be up to 65536 characters long compared to the Acorn interpreter's limit of 255. The list of differences are as follows: 1) The SDL build implemention supports a subset of the graphics commands and some sound. 2) Brandy has no support for machine code programs. It does not support either the 'CALL' statement nor the 'USR' function (except for a limited number of calls to BBC-style OS interfaces, notably OSBYTE). The built-in assembler has not been implemented. 3) The 'APPEND' command has not been implemented. 4) The 'OVERLAY' statement has not been implemented. 5) INKEY(-128) to INKEY(-255) are not implemented (and were only implemented on the original 6502 MOS). While INKEY(-1) to INKEY(-127) aim to match the Acorn keynumbers as closely as possible, there are inevitably a small handful of differences due to physical keyboard hardware differences. 6) Not all of the VDU commands have been implemented. 7) 'WIDTH' has not been implemented. 'PRINT' leaves something to be desired too. 8) The TRACE option 'TRACE STEP' has not been implemented yet. 9) Some 'LISTO' options have not been implemented yet. 10) The 'END=' version of the END statement is not supported. 11) Brandy behaves differently to the Acorn interpreter after an error when the program contains ON ERROR or ON ERROR LOCAL statements to trap errors. The following differences only apply on non-RISC OS builds: 12) Support of the 'SYS' statement is minimal. 13) Cursor editing is not available. A line editor is available in its place. The major omissions in the versions of the interpreter are some graphics and sound. The built-in assembler and support for machine code programs are missing too. Apart from that, the interpreter is essentially a full implementation of the Acorn interpreter. The interpreter has the following extensions: 1) Strings can be up to 65536 characters long. 2) Statements can be up to 1024 characters long. 3) Libraries can have their own private variables. 4) The OSCLI statement has been extended to allow the output from operating system commands to captured. 5) (Only if compiled with -DBRANDY_ALLOW_LOWERCASE_COMMANDS) The case of commands such as 'LIST' and 'RUN' is ignored, so 'LIST' could be entered as 'list' or 'List'. The downside is that variable names that are the lower case equivalents of commands will now be seen as commands, something that seems to happen all too frequently. 6) There is a new pseudo-variable 'FILEPATH$' that gives a list of directories to be searched when loading programs and libraries (see the section on this below). 7) There are two functions for dealing with command line parameters, 'ARGC' and 'ARGV$' (see the section below). 8) There are two new string functions, 'VERIFY' and 'XLATE$' (see the section below). 9) 'NEW' can be followed by a parameter, the new size of the Basic workspace. This allows it to be changed from the default of 640K (see section on this below). 10) The 'RUN' command can be followed by the name of a program to run. It behaves just like the statement 'CHAIN', as with Z80, 80x86 and PDP11 BASICs. 11) The 'RUN' command can also be followed by a line number to start program execution at that line. 12) There is an extra 'TRACE' option: 'TRACE GOTO'. This prints out the source and destination line numbers of any branches in the program. 13) 'TRACE PROC' shows returns from procedures and functions as well as when they are called. 14) Individual TRACE options may be turned off and on, for example, 'TRACE PROC OFF' will turn off the only the procedure trace and leave any other running. 15) There is an extra 'LISTO' option, 32. When this option is in effect, listing of a program pauses every twenty lines with the prompt '-- more --'. Press the space bar to show the next twenty lines, 'return' to print just the next line or the 'Escape' key to stop the command. 16) 'LISTO' can be used as a function to find out the current setting of 'listo'. 17) There are a couple of extra 'LIST' commands. 'LISTB' dumps memory in byte form between the two addresses specified. 'LISTW' is the same, but dumps memory as words. These were added for debugging but will probably be left in. 18) The 'EDIT' command on its own invokes a text editor to edit the program. Under Linux and NetBSD it calls 'vi' and currently does not work under Windows. 19) 'EDIT' followed by a line number allows that line to be edited using the built-in line editor. 20) When a program is loaded via a 'LOAD' command the name of the file is kept and saving the program using the 'SAVE' command with no argument will save the program using that name. 21) Programs are always saved as plain text. 22) The latest extended versions of COLOUR, GCOL, MODE and DIM are supported. VDU can also be used as a function to read RISC OS mode variables. COLOUR can also be used as a function to return a number that represents the closest match to the colour whose colour components were passed to the function. There is quite a list here but really apart from the longer maximum string and statement lengths, local variables in libraries and the change to 'new', most of these are really cosmetic changes. Local Variables in Libraries ---------------------------- Libraries can have their own private variables and arrays. The variables are only accessible in the library in which they were declared. The LIBRARY LOCAL statement is used to declare the variables. The syntax is as follows: LIBRARY LOCAL where is a list of variable and array names separated by commas, for example: LIBRARY LOCAL abc%, def%, ghi$, jkl(), mno(), pqr$() In the case of arrays, this merely defines that the array is local to the library. The dimensions of the array have to be declared using a DIM statement in the normal way, for example: LIBRARY LOCAL jkl(), pqr$() DIM jkl(100), pqr$(table_size%) There can be as many LIBRARY LOCAL and DIM statements as necessary but they have to be before the first DEF PROC or DEF FN statement in the library. They also have to be the first item on the line. The variables can only be referenced in the library. They are not visible outside it. This is different to the way in which local variables are dealt with in a procedure or function, where local varables can be accessed by any procedure of function called by the procedure in which they were declared. They can duplicate the names of variables in the Basic program or other libraries. When looking for a variable in a library, the interpreter first searches for it amongst the library's private variables and then in the Basic program's. The variables and arrays are created the first time the library is referenced. In practice this means that they are set up when the interpreter has to search the library for a procedure or function. Private variables in a library can further be used as local variables in a procedure or function. Note that they can only be accessed in the library, for example: LIBRARY LOCAL abc%, def, ghi$, jkl(), mno$() DIM jkl(100) DEF PROCaaa(abc%) LOCAL def, ghi$ ENDPROC DEF PROCbbb(def, jkl()) LOCAL mno$() DIM mno$(100) ENDPROC DEF PROCccc(xyz, abc%) ENDPROC Here, abc%, def, ghi$, jkl() and mno$() are all declared to be private to the library. The dimensions of jkl() are also defined. In PROCaaa, abc% is used as a formal parameter (effectively a local variable) and def and ghi$ declared to be local to the procedure. Any procedure or function *in the library* that PROCaaa calls that use def and ghi$ will use PROCaaa's local versions. Any procedure or function that PROCaaa calls that are *outside* the library *will not* see these variables. In PROCbbb, def and jkl() are used as formal parameters and mno$() is defined as a local array and its dimensions given. Note that this is the first place where the dimensions have been defined. In PROCccc, two variables are used as formal parameters, xyz and abc%. This case is more complex in that abc% is one of the library's private variables whereas xyz is not. xyz is one of the Basic program's variables. abc% can only be referenced in the library but xyz is visible anywhere. The rules for the scope of private library variables may sound complex but they are quite simple. The point to remember is that a private variable in *only* accessible in the library in which it was declared. If a variable is not declared on a LIBRARY LOCAL statement then it is visible anywhere. FILEPATH$ --------- This is an extra pseudo variable. It gives a list of directory names that the interpreter will search when looking for programs and libraries. The names are separated by commas with no intervening blanks or other white space characters, for example: FILEPATH$="/home/dave,/usr/local/basic/lib" The format of the directory names is operating system-dependent and the program assumes that they are correct. FILEPATH$ can be treated like any other string variable except that only the '=' assignment operator is allowed, thus: FILEPATH$="/usr/local/basic/lib" is fine but: FILEPATH$+=",/usr/local/lib" is not supported and will give an error. The interpreter first of all tries to find the program or library using the name as supplied. If it cannot find it and the name is just the name of a file, that is, it does not contain any directories, it then looks in each of the directories given by FILEPATH$ until either it finds the file or it reaches the end of the list. If the file can be found, the name of the file as far as the interpreter is concerned is the name as orginally supplied with the name of the directory in which it was found prepended to it, for example: load "earthworks" If this program was found in the directory '/home/dave' the name of the program would show up as '/home/dave/earthworks' in the output from 'help'. Saving the program without specifying a new file name would write to the file '/home/dave/earthworks'. As FILEPATH$ is a pseudo variable, its value is not affected by CLEAR or NEW. The initial value of FILEPATH$ can be set using the command line option '-path'. The main purpose of FILEPATH$ is to provide a search path for libraries but it is also used when looking for programs. It would be useful here for 'CHAIN'. Use of FILEPATH$ can effectively be disabled by setting it to the empty string, that is, by entering 'FILEPATH$=""'. ARGC and ARGV$ -------------- These functions return parameters from the command line used to start the interpreter. ARGC returns the number of parameters and ARGV$ the parameters themselves. ARGC ---- Returns the number of parameters, for example: count = ARGC ARGV$ ----- Returns parameters. The syntax is: ARGV$ where is a numeric value that identifies the parameter to return, for example: FOR N%=1 TO ARGC PRINT ARGV$ N% NEXT Parameter numbers are in the range 1 to the value returned by ARGC. ARGV$0 is the name of the Basic program if it was started from the command line otherwise it is an empty string. XLATE$ ------ This function is used to translate character strings. There are two forms of it as follows: XLATE$() XLATE$(, ) In the first version, the function returns the string converted to lower case. Note that only ASCII characters are converted. The second version is more powerful in that is converted according to the user-supplied translate table . This can be either a character string or a one dimensional string array. The effect is the same in both cases: each character in the original string is replaced by the corresponding character in the translate table. If the table is a string, the character at offset 1 replaces the character with ASCII code 0, the character at offset 2 replaces the one with ASCII code 1 and so forth. It is not necessary for the string to be 256 characters long: any character whose code would place it beyond the end of the string is left unchanged. The use of a string array is more convenient in that each character is replaced by the array entry corresponding to its ASCII code. Note that only the first character of the string in the array is used. If the array entry contains an empty string then the original character is left unchanged. As with the character string translate table, the array does not have to contain 256 elements: characters whose ASCII code place them beyond the end of the array are left unchanged. Examples: PRINT XLATE$("AbCdEfGh") DIM table$(255) FOR N%=ASC"0" TO ASC"9": table$(N%)="*": NEXT PRINT XLATE$("abc123def456", table$()) VERIFY ------ The format of this function is as follows: VERIFY(, [, ]) It returns the offset (from one) of the first character in string that is not in string . is an optional parameter that gives the offset at which to start the check. If all the characters in are present in the function returns zero; otherwise it returns the offset of the first bad character. Examples: X% = VERIFY(a$, "0123456789") REPEAT A$=GET$: UNTIL VERIFY(a$, "YNyn")=0 P%=1 REPEAT P%=VERIFY("...x..x..", ".", P%) IF P%<>0 THEN PRINT P% UNTIL P%=0 If is an empty string or the start position is greater than the string length then the function always returns zero. If is an empty string then the function always returns one or the value of (if this is supplied). ARM BBC BASIC 1.26 Extensions ----------------------------- The following statement types have been extended in this version of the interpreter: COLOUR DIM GCOL MODE VDU function COLOUR The new 'OF' and 'ON' parts are supported, for example: COLOUR OF 255,255,255 ON 0,0,0 DIM It is now possible for local byte arrays to be created in procedures and functions. The memory for the byte array is reclaimed when the procedure or function ends, for example: DIM pointer% LOCAL 1000 GCOL The new 'OF' and 'ON' parts are supported, for example: GCOL OF 0,0,0 ON 255,255,255 MODE The extended form of MODE where the screen size to be used is supplied is now supported. Example: MODE 800,600,8 MODE "X800 Y600 C256" VDU Function VDU can now be used as a function to return the values of mode variables. Example: PRINT "Width in characters is ";VDU 1 All of these extensions are described in the file 'basic'. COLOUR function This returns a value that represents the colour with the closest match in the current screen mode to the colour with the colour components passed to the function. The value is for use with the COLOUR OF and GCOL OF statements. Example: red = COLOUR(255, 0, 0) blue = COLOUR(0, 0, 255) COLOUR OF red ON blue This could also be written as: COLOUR OF 255, 0, 0 ON 0, 0, 255 or even: COLOUR OF COLOUR(255, 0, 0) ON COLOUR(0, 0, 255) The advantage of the new forms of GCOL and COLOUR are that they are mode independent. They are more flexible than the old versions of the statements and do away with the need for TINT. In addition, other extensions from BB4W, BBCSDL, Basalt have been implemented: GET(x,y) and GET$(x,y) These return the character at a particular point on the screen. Implemented for SDL builds and RISC OS. Following on from += and -= operators, Matrix Brandy also supports: DIV=, AND=, OR=, EOR= A Matrix Brandy-specific extension: OPENUP can be used to open a TCP network connection as a client. See docs/networking.txt for full details on this extension. Command Line Parameters ----------------------- The interpreter assumes that any unrecognised parameter on the command line is meant to be for the Basic program, for example: brandy aprog parm1 parm2 -xyz would be assumed to consist of the name of the program to run, aprog, and three parameters for the program, 'parm1', 'parm2' and '-xyz'. brandy aprog -size 256k parm1 parm2 -xyz would be interpreted in exactly the same way. '-size 256k' would be treated as an option for the interpreter itself. Beware of cases like: brandy aprog -size 256k parm1 -start Here, '-start' would be seen as '-size' by the program as it only checks for '-s' to identify '-size'. Capturing Command Output with OSCLI ----------------------------------- The OSCLI statement has been extended so that the output from operating system commands can be read by the program. The syntax of the statement is now: OSCLI [ TO [ , ] ] is a string expression that is the command to be issued. is an array that will be used to hold the output from the command. It is optional. If it is not present then the command output goes to the normal place. is set to the number of lines stored in . Again, it is optional. The existing contents of are discarded before the output from the command is stored in it. Elements of the array that are not used are set to the empty string. The first element of the array used is 1, so the output is found in elements 1 to . If there is more output than will fit in the array the excess is discarded. There is nothing to indicate that this has happened so it is up to the user to ensure that the array is large enough. Example: OSCLI "ex" TO array$(), lines% FOR N%=1 TO lines% IF LEFT$(array$(N%), 1)="a" THEN PRINT array$(N%) NEXT Note that there some problems still to be resolved with OSCLI ... TO. Errors (or to be more precise, messages written to stderr) are not caught in the DOS version of the program as DOS does not provide a way to redirect them. They are therefore missed out. The NEW Command --------------- The NEW command has been extended to allow the size of the Basic workspace to be changed. By default, Brandy allocates half a megabyte of memory to hold the program, variables, strings and so forth. This can be changed by means of the 'NEW' command as follows: NEW where is the new size of the workspace in bytes, for example: NEW 1000000 would set the workspace size to 1,000,000 bytes. Note that using this command will result in the loss of the current contents of the workspace, including any programs and libraries (except for libraries loaded by means of the 'INSTALL' command). The minimum size allowed is 16K bytes. The upper limit is whatever the operating system on which the interpreter is running allows, to a limit of 4 bytes short of 2GB. Note that the initial size of the Basic workspace can also be set using the command line option '-size'. SAVE ---- There are two versions of the 'SAVE' command used to save a program. 'SAVE' uses the current 'LISTO' setting to control the format of the program when it is written to disk. 'SAVEO' allows the format to be more precisely specified. The format of the SAVEO command is: SAVEO [,] where is a number that gives the 'listo' format to be used and is the name of the file. The name can be omitted, in which case the name defaults to either the name used on the last 'LOAD' command or the name given on the first line of the program. Example: SAVEO 10,"test" would save a program called "test" using 'listo' option 10 (omit line numbers and indent lines inside loops, block IF statements and so forth). OLD --- The OLD command is not supported. TRACE ----- Several changes have been made to the TRACE command. TRACE PROC ---------- This shows both when a procedure or function is entered and when it is exited. '==>PROCabcd' indicates that PROCabcd has been entered and 'PROCabcd-->' shows that it has been exited. TRACE GOTO ---------- The purpose of this option is to trace program flow. It logs all jumps in the code, showing the number of the line at which the branch occured and the line at which execution continues. It works not just for GOTO statements but anywhere where a branch can occur, for example, in IF statements. Example: consider the following code: 100 IF X%<10 THEN 110 PRINT"X% is less than ten" 120 flag%=TRUE 130 ELSE 140 PRINT"X% is greater than or equal to ten" 150 flag%=FALSE 160 ENDIF 170 PRINT flag% If X% was set to five, the branch trace would show the following entries: [100->110][130->170] and if X% was set to 25, it would look like: [100->140] (Note that the program output has been omitted for clarity here). In the first case, as X% is less that ten the condition is true and so the program branches to line 110. When it reaches the ELSE it branches from the ELSE to the line after the ENDIF. In the second case, as the condition is false the program flow passes from line 100 to the line after the ELSE. As there is no branch at the end of the ELSE part of the 'IF' and control runs straight through to line 170, there is no trace entry. FOR, WHILE and REPEAT loops, procedure and functions calls and returns, GOTO, GOSUB, ON GOTO, ON GOSUB, ON PROC and RETURN statements are all traced by this option. Note, however, that some of the trace entries are not intuitive, for example, the line number of the start of a WHILE loop will be that of the statement after the WHILE itself, for example: 200 X%=7 210 WHILE X%<10 220 X%+=1 230 ENDWHILE will produce the following trace: [230->220][230->220] The reason for this is tied up in the way WHILE loops work. It is considered that this trace cuts out much of the 'noise' that results from simply tracing line numbers. TRACE