bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

suggestion for as


From: Andrew Patterson
Subject: suggestion for as
Date: Wed, 30 May 2012 04:27:53 -0500

Hello.
 
Sorry this got so long. But I thought it best to explain my background a bit. I
am not a newbe to assembly language. I actually programed in machine 
language on an LGP-30. Debug/patched easycoder programs on the H200.
No symbolic debuger in thoes days.
 
I would considered myself an experienced assembler language programmer sense I
started programming in 1964 on an LGP-30 and a Honeywell H200 at Cerritos
Collage. I worked there from 1967 to 1971. During that time we obtained a Dec-
System-10, a KA10. All programming projects I worked on were in assembly
language. I programed on a KI10 at Ramada Inns and later a KL10 at CDEC. I was a
Software Specilist for Digital Equipment Corporation. I worked on TOPS-10 for
many years at those jobs. All work was in MACRO10 and edited in TECO. I have
also programed 80x86, 6502, M68000 (AMIGA), PDP-11 and others. I am just
learning the ARM instructions. I am planning on using the STM32F103ZET6 and
the ARM7DMI-S. Sorry if I didn't get my examples exactly right.
 
I designed a wrote along with Break Auten a real time OS for 80x86 processors
based on TOPS-10 task scheduling algorithm and AmigaDos messaging. I also wrote
the C interface library for that OS. In assembly. That was a version of that OS that set over
DOS and provided resident to be multi-threaded. It was used in implementing Here
& There, a remote control program Published by Fifth Generation.

I was the manager of the Language Development Kontron Electronics.
Kontron produced In Circuit Emulators at Irvine Calif. Until they moved North.
The biggest seller was the 6502. Many went to game developers.
 
The only high level programming languages I have used that I haven't wrote a
compiler for is C++ and BLISS10. I have coded in FORTRAN, COBOL, Pascal and
SLIC.  SLIC is a compiler compiler that produces binary output code for any
target machine. It is a context sensitive syntax directed compiler similar to
META2 or CWIC. Very much like CWIC except it produced PSEUDO code instead of 360
machine code. The PSEUDO instruction were like a macro using the target machine
instruction set. The target machines instruction was defined by the machine
operation language. The machine operation defamation language provided the
definition of the instruction Opcodes and operand types(syntax) Taking the
instruction and output bit fields into a bit addressable memory space. The
machine operation also defined the assembly output (Pseudo assembly as the
assembly list option was produced directly by SLIC) No actual assembly program
used. A compiler writ en in SLIC was actually executable code. Not tables. Using
the vectored entry form a .MACHOP defined a set of instruction having like
operands. I designed SLIC though the syntax and generator languages are
close to CWIC.
 
 
.MACHOP #OP1 +INCRS ADDRS(INDEXS),+INCRD ADDRD(INDEXD) ->
  .MORG 16: H(16): $/8                                 ;align to a word boundary Location
                                                                  ;field is 16 bit hex format $/8
  +H(4): OP1                                               ;4 bit opcode field. Listing output
    (2):  .IF INCRD .EQ 1 .THEN 3                   ;is in hex. The hex output is
            .ELSE .IF ADDRD .REGISTER .THEN 0  ;16 bits combining these several
            .ELSE .IF ADDRD .THEN 2                   ;fields
            .ELSE 1;
    (4):  .IF ADDRD .REGISTER .THEN ADDRD .ELSE INDEXD;
    (2):  .IF INCRS .EQ 1 .THEN 3
           .ELSE .IF ADDRS .REGISTER .THEN 0
           .ELSE .IF ADDRS .THEN 2
           .ELSE 1;
    (4):  .IF ADDRS .REGISTER .THEN ADDRS .ELSE INDEXS;
 
 .IF ADDRS .AND ADDRS .NOT .REGISTER .THEN
  +H(16): .IF ADDRS .SYMBOL .THEN (LOC_ATTR:(ADDRS))/8 .ELSE ADDRS;
 
 .IF ADDRD .AND ADDRD .NOT .REGISTER .THEN
  +H(16): .IF ADDRD .SYMBOL .THEN (LOC_ATTR:(ADDRD))/8 .ELSE ADDRD;
 
        #A           .HA;
        #AB         .HB;
        #S           .H6;
        #SB         .H7;
        #C          .H8;
        #CB        .H9;
        #MOV     .HC;
        #MOVB   .HD;
        #SOC     .HE;
        #SOCB   .HF;
        #SZC     .H4;
        #SZCB   .H5;
 
 
 
Anyway I have a suggestion for your assemblers. It is something the MACRO-10 did.
I haven't seen in other assemblers other then those from DEC and Kontron.
It is basically the ability to redefine a macro. This is probably something that
you have not seen unless you worked on the TOPS-10 internals or it's device
configuration macros.
 
What it does is provide a nifty way of generating corresponding tables at
assembly time. The way it was used is a MACRO was defined containing simply an
inner macro list. The inner macro generally had many arguments. See code example
following. A macro could redefine it's self as well. A friend of mine used this
to generate a balanced binary linked search tree. He write a program that would
find the outer macro by name and then sort the inner macro lines by any field
combinations. Required before assembly to get an ordered inner list. That said
EQU symbols could be redefined as well. Used that to count the table entries
using technique as follows This feature/change could be made to be a warning to
redefine and go ahead and do it. Command line switch to disable winning or an
assembly directive. That is if you find it worthwhile. I can get around not
having this feature using an additional parameter to direct the inner macros
expansion. And I have done so in the past. But it is not as understandable
having a complex conditional macro expansion.
Oh. I think you might have a minor bug. The redefinition of the macro error only
goes to stdout. Other errors are going to both the listing file and stdout.
 
 
 .macro x
  y name1,12,fun1
  y name2,45.fun2
  y name3,21,fun3
  y name4,56,fun4
  y name5,18,fun5
 .endm
 
number_of_entries .equ 0

 .macro y name,code,function
 number_of_entries .equ number_of_entries + 1
 .endm
 
 .macro y name,code,function
 \name_str:
  .asciiz "\namestr"
  .endm
 
  x             /* generate addressed name strings */
 
.macro y namestr,code,function
  .long \name_str
  .endm
 
name_table: x    /* generate name string pointer table */
 
 .macro y namestr,code,function
  .long code
  .endm
 
code_table: x  /* generate table of codes */
 
 .macro y namestr,code,function
  .long \function
  .endm
 
function_table: x  /* generate function pointer table */
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]