I know how to write in asm when I decide where to store variables etc.
Now I examples of asm code for modular programming using relocatable code.
for instance I need examples howto define hidden and exported variables in .data and .bss segments, I also want to have example of pointer to struct.
In other words I am very interested in examples of howto hide and export variables
encapsulated in .o relocatable. And how to use (import) that variables from another relocatable.
May be it will be easier for someone just translate the following oberon source to xa65 or ca65 asm syntax so I could understand
Code: Select all
MODULE M1;
VAR a*,b,e- : SHORTINT; (* signed byte*)
(* note that a is exported and could be seen rw from other module *)
(* b is hidden*)
(* e is exported read only*)
PROCEDURE p*; (*this procedure is exported*)
(*it could be called from other module *)
VAR a, f : INTEGER; (* signed int *)
BEGIN
a := 5; (*assigning to local variable*)
b := 7;
END p;
PROCEDURE p1; (* hidden procedure, cannot be called from outside *)
BEGIN
END;
BEGIN
a := 7;
e := 9;
END M1.
------------------------------
MODULE M2;
IMPORT M1;
VAR a : INTEGER;
BEGIN
a := M1.a;
M1.p;
END M2