2
0
Эх сурвалжийг харах

Improvements for course system construction
Introduced label operands of the form [label], e.g. used as
LDR R0, [offset]
...
offset: DW ....

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7381 8c9fc860-2736-0410-a75d-ab315db34111

felixf 7 жил өмнө
parent
commit
0b0212cf44

+ 19 - 2
source/FoxARMAssembler.Mod

@@ -261,7 +261,24 @@ TYPE
 									END
 								END
 							END
-
+						ELSIF GetPlainValue(offsetImmediateValue) THEN
+							(* pc label of the form [labelName], translated to [PC, #labelName - $ - 8] *)
+							registerNumber := InstructionSet.PC;
+							isImmediateOffset := TRUE;
+							DEC(offsetImmediateValue, 8); 
+							DEC(offsetImmediateValue, code.pc); 
+							IF ABS(offsetImmediateValue) < InstructionSet.Bits12 THEN
+								IF offsetImmediateValue >= 0 THEN
+									INCL(indexingMode, InstructionSet.Increment)
+								ELSE
+									INCL(indexingMode, InstructionSet.Decrement)
+								END;
+								offsetImmediateValue := ABS(offsetImmediateValue)
+							ELSE
+								Error(errorPosition, "immediate offset is out of range")
+							END;
+							IF ExpectToken(Scanner.RightBracket) THEN
+							END;
 						ELSE
 							Error(errorPosition, "register expected")
 						END;
@@ -398,5 +415,5 @@ TYPE
 
 END FoxARMAssembler.
 
-SystemTools.Free FoxARMAssembler FoxARMInstructionSet ~
+SystemTools.FreeDownTo  FoxARMInstructionSet ~
 Alwazs

+ 1 - 1
source/FoxAssembler.Mod

@@ -161,7 +161,7 @@ TYPE
 		scanner: Scanner.AssemblerScanner;
 		orgOffset: LONGINT;
 		section-: IntermediateCode.Section;
-		code: BinaryCode.Section;
+		code-: BinaryCode.Section;
 		labels: NamedLabelList;
 		results: NamedResultList;
 		scope: SyntaxTree.Scope;

+ 20 - 4
source/StdIOShell.Mod

@@ -2,9 +2,14 @@ MODULE StdIOShell; (** AUTHOR "Felix Friedrich"; PURPOSE "Command shell for stan
 
 IMPORT StdIO, Commands, Modules, Trace;
 
+CONST Verbose = FALSE;
+
 PROCEDURE Activate(context: Commands.Context; CONST cmd: ARRAY OF CHAR): BOOLEAN;
 VAR msg: ARRAY 256 OF CHAR;  res: LONGINT; 
 BEGIN
+	IF Verbose THEN 
+		Trace.String("StdIOShell: Activate Command "); Trace.String(cmd); Trace.Ln; 
+	END;
 	Commands.Activate(cmd, context, {Commands.Wait}, res, msg);
 	IF res # 0 THEN context.error.String(msg); context.error.Ln; RETURN FALSE END;
 	RETURN TRUE;
@@ -44,7 +49,9 @@ TYPE
 	BEGIN{ACTIVE}
 		Execute(StdIO.env);
 	FINALLY
-		Trace.String("Closing Shell"); Trace.Ln;
+		IF Verbose THEN
+			Trace.String("StdIOShell: Exit"); Trace.Ln;
+		END;
 		Modules.Shutdown(Modules.PowerDown);
 		done := TRUE
 	END Executor;
@@ -60,10 +67,19 @@ END StdIOShell.
 Linking a command line shell:
 
 Command line shell: (Windows):
-StaticLinker.Link  --fileFormat=PE32CUI --fileName=oberon.exe --extension=GofW --displacement=401000H Runtime Trace Kernel32 Machine Heaps Modules Objects Kernel KernelLog Streams Commands Files  WinFS Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker Reflection GenericLoader WinTrace StdIO  Traps RelativeFileSystem WMDefaultFont SystemTools StdIOShell ~
+StaticLinker.Link  --fileFormat=PE32CUI --fileName=oberon.exe --extension=GofW --displacement=401000H Runtime Trace Kernel32 Machine Heaps Modules Objects Kernel KernelLog Streams Commands Files  WinFS Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker Reflection GenericLoader WinTrace StdIO  Traps RelativeFileSystem WMDefaultFont SystemTools Shell StdIOShell ~
 
-Command line shell: (Linux):
-StaticLinker.Link -p=Linux32G Runtime Trace Glue Unix Machine Heaps Modules Objects Kernel KernelLog  Streams Commands Pipes StdIO TrapWriters Reflection Traps Files UnixFiles Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker   GenericLoader  Shell SystemTools StdIOShell ~
+Command line shell including compiler (and linker)
+StaticLinker.Link  --fileFormat=PE32CUI --fileName=oberon.exe --extension=GofW --displacement=401000H Runtime Trace Kernel32 Machine Heaps Modules Objects Kernel KernelLog Streams Commands Files  WinFS Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker Reflection GenericLoader WinTrace StdIO  Traps RelativeFileSystem WMDefaultFont SystemTools StdIOShell 
+Shell StaticLinker Compiler FoxOberonFrontend FoxARMBackend FoxAMDBackend
+~
 
 
+Command line shell: (Linux):
+StaticLinker.Link -p=Linux32G Runtime Trace Glue Unix Machine Heaps Modules Objects Kernel KernelLog  Streams Commands Pipes StdIO TrapWriters Reflection Traps Files UnixFiles Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker   GenericLoader Shell SystemTools StdIOShell ~
+
+Command line shell including compiler (and linker)
+StaticLinker.Link -p=Linux32G Runtime Trace Glue Unix Machine Heaps Modules Objects Kernel KernelLog  Streams Commands Pipes StdIO TrapWriters Reflection Traps Files UnixFiles Clock Dates Reals Strings Diagnostics BitSets StringPool ObjectFile GenericLinker   GenericLoader Shell SystemTools StdIOShell 
+StaticLinker Compiler FoxOberonFrontend FoxARMBackend FoxAMDBackend
+~