MADS Relocatable Binaries .RELOC [.byte / .word] BLK UPDATE ADDRESS HEADER BLOCK Header is 16 bytes long: HEADER .WORD = $FFFF START_ADDRESS .WORD = $0000 END_ADDRESS .WORD = FILE_LENGTH-1 MADS_RELOC_HEADER .WORD = $524D UNUSED .BYTE = $00 CONFIG .BYTE (bit0) @STACK_POINTER .WORD @STACK_ADDRESS .WORD @PROC_VARS_ADR .WORD MADS_RELOC_HEADER is always $524D ('MR'). FILE_LENGTH excludes 16 byte header. CONFIG: only bit 0 is used: 0 = relocate from $0000, 1 = relocate from %0100. The last six bytes contain information required for use of the software stack. If the stack is not used, these values are zero. Values must be identical in all files linked together. EXTERNAL SYMBOLS label EXT type label .EXTRN type .EXTRN label1,label2,label3... type Below is the header format in a file with external symbols. B=Byte, W=Word, L=Long, D=Dword. This information is generated by: BLK UPDATE EXTERNAL External symbols are not only defined value type (.BYTE .WORD .LONG .DWORD), eg: name EXT. BYTE LABEL_NAME EXT .WORD .EXTRN LABEL_NAME .WORD wait EXT .PROC (.BYTE delay) Header format: HEADER .WORD ($FFEE) TYPE .CHAR (B, W, L, D, <,>) DATA_LENGTH .WORD (# addresses in relocation list) LABEL_LENGTH .WORD LABEL_NAME .ATASCII DATA WORD .. .. .. (list of words) HEADER always = $FFEE TYPE data type is stored in the 0th bits of this byte .6 and specifies the type of modified addresses (?) DATA_LENGTH is the number of 2-byte data (addresses) to modify LABEL_LENGTH a symbol name length in bytes LABEL_NAME is the name of the symbol in ATASCII DATA proper sequence data for modification of the main block relokowalnego. At the address indicated here should read the value of TYPE and then modify it under the new symbol value. PUBLIC SYMBOLS Declaring public symbols: .PUBLIC label [, ,...] Label2 .GLOBAL label [, ,...] Label2 .GLOBL label [, ,...] Label2 Directives .GLOBAL and .GLOBL have been added in view of compatibility with other assemblers, and their meaning is identical to the Directive .PUBLIC. Update public symbols: BLK UPDATE PUBLIC Below is the format of information generated by BLK UPDATE PUBLIC: HEADER .WORD ($FFED) LENGTH .WORD TYPE .BYTE (B, W, L, D) LABEL_TYPE .CHAR (C=Constant, V=Variable, P=Procedure, A=Array, S=Struct) LABEL_LENGTH .WORD LABEL_NAME ATASCII ADDRESS .WORD MADS automatically selects the appropriate type for public labels: C=Constant label, uncontrolled relocation V=Variable label, uncontrolled relocation P=Procedure declared by the procedure .PROC, subject to relocation A=Array declared with .ARRAY, subject to relocation S=Struct declared with .STRUCT, is NOT subject to relocation If the symbol relates to a structure (.STRUCT), additional information (field type structure, the name of the field structure, the number of repetitions of the structure) is saved: STRUCT_LABEL_TYPE .CHAR (B, W, L, D) STRUCT_LABEL_LENGTH .WORD STRUCT_LABEL_NAME ATASCII STRUCT_LABEL_REPEAT .WORD If the symbol relates to an array (.ARRAY), additional information is saved (the maximum declared array index, an array of fields declared type): ARRAY_MAX_INDEX .WORD ARRAY_TYPE .CHAR (B, W, L, D) If the symbol refers to a procedure (.PROC), additional information is recorded, regardless of whether the procedure declares parameters: PROC_CPU_REG .BYTE (bits 00 = Accumulator, 01 = X Register, 10 = Y Register) PROC_TYPE .BYTE (D=Default, R=Register, V=Variable) PARAM_COUNT .WORD For the symbols on the procedures (.REG) are saved now only types of these parameters in the amount of PARAM_COUNT: PARAM_TYPE .CHAR (B, W, L, D) ... ... For the symbols on the procedures (.VAR) parameter types are saved and their names. PARAM_COUNT specifies the total length of the data: PARAM_TYPE .CHAR (B, W, L, D) PARAM_LENGTH .WORD PARAM_NAME ATASCII ... ... HEADER always = $FFED LENGTH is the number of symbols stored in the block update TYPE symbolizes the type (B, W, L, D) LABEL_TYPE symbol type: (C=Constant, V=Variable, P=Procedure, A=Array, S=Struct) For P-type, additional information: PROC_CPU_REG, PROC_TYPE, PARAM_COUNT, PARAM_TYPE For type A, additional information: ARRAY_MAX_INDEX, ARRAY_TYPE For S-type, additional information: STRUCT_LABEL_TYPE, STRUCT_LABEL_LENGTH, STRUCT_LABEL_NAME, STRUCT_LABEL_REPEAT LABEL_LENGTH public symbol label length in bytes LABEL_NAME public symbol codes stored in ATASCII ADDRESS address assigned to the symbol in the block relokowalnym. Reloc. This value is subject to relocation by adding to its current assembly address. PROC_CPU_REG information about the order of use of CPU registers for procedure type (.REG) PROC_TYPE type of procedure: D=Default default type to pass parameters using a software stack and the MADS- R=Register parameters for the procedure are reported by the CPU registers (.REG) V=Variable parameters for the procedure are reported by the variables (.VAR) PARAM_COUNT information on the number of parameters in the procedure (.REG) or total length of data containing information about the type of parameters and their names (.VAR) PARAM_TYPE type parameters stored with the characters 'B', 'W', 'L', 'D' PARAM_LENGTH name length parameter (.VAR) PARAM_NAME parameter name in the code ATASCII (.VAR)