This is instructions set give in the standard text of System program ( Leland L Beck )for transferring data 5 from accumulator to memory
As you all know SIC is a hypothetical machine
LDA FIVE Load character 5 into register A
STA ALPHA Store in Alpha
LDCH CHARZ Load Character Z into A
STCH C1 Store in character variable C1
.
.
.
ALPHA RESW 1 One Word Variable
FIVE WORD 5 One-Word Constant
CHAR BYTE C 'Z' One Byte Constant
C1 RESB 1 One Byte Variable
I am confused in the statement on how this instruction
ALPHA RESW 1
is being handle
Can you explain to me or give a detailed reference or answer to help me understand how RESW is processed by the assembler and how does it get reflected while converting this mnemonic codes to object code and how they gets loaded ..and linked and all ..
and how it is being process at the micro instruction level of the processor
I am an amateur in this system programming domain and any answer would be highly appreciable with great respect
Your question is too broad to give great detail to every topic of going from textual programming language to running program with memory, so here's a brief overview.
All programming languages need to be able to support data declarations, for global variables, for string literals, floating point constants, etc.., however, only the assembler/compiler reads data declarations, the processor doesn't read data declarations.
The assembler reads each data declaration and reserves some space in the executable program file for that declaration (modulo .bss
, wherein only a count is increased within the program file). The data declarations will later become memory in the process of the running program.
Each data declarations has one or more memory addresses, and the associated label, when present, is equated with the lowest of those addresses.
Each time an instruction or data declaration is read by the assembler, it accumulates a machine code instruction or data item, appending to the associated section of current content in the object or executable file (which could be shared code & data or separated code & data). As it does that, it increments an internal location counter that tells it what the next available memory address will be. On some systems it knows the absolute address of things it is placing in memory, and on other systems it knows only an offset from the beginning.
On systems that use a linker, it will combine like sections of object code together, and also resolve cross references, with the final output being an executable program file.
how this instruction
ALPHA RESW 1
is being handle
For all practical purposes this specific instruction is the same as ALPHA WORD 0
. The difference with RESW
is a value larger than 1 can be used as an easy way to create an initially zero buffer or array.
A label can be referred to by other data declarations and by processor instructions.
The assembler will translate a reference to a label within a processor instruction into an addressing mode, which is an encoding of how the processor can reach/access that address at runtime. An addressing mode will usually specify some immediate value to identify the desired memory location. When the processor executes such an instruction, it will perform the address calculation according to the addressing mode in order to read or write the memory at the label (or capture the address of the label, or branch to the label).
When the executable program file gets loaded into memory, the machine code instructions are loaded into memory, as is the space and initial values for the declared data, and this is how the actual storage comes into being.