home *** CD-ROM | disk | FTP | other *** search
- {@ME.FORMAT }
- $MACRO_FILE ASM;
- {******************************************************************************
- MULTI-EDIT MACRO FILE
-
- Name: ASM
-
- Description: Language support for Assembly language.
-
- ASM_IND - Smart Indenting
- PROC - Creates the shell of a procedure for 8086 assembly language.
- ASMFORM - Reformats 8086 assembly language source code.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
-
- $MACRO ASM_IND;
- {******************************************************************************
- MULTI-EDIT MACRO
-
- Name: ASM_IND
-
- Description: This macro will capitalize all characters on the current line
- up to the end of the line, or the ";" comment delimiter, whichever comes
- first. Then it will perform a carriage return. This coding style may not be
- to everyones liking, so if you don't like it, simply turn smart indent off.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(Temp_Integer);
- Def_Int( i_col );
- refresh := false;
- i_col := c_col;
- First_Word;
- set_indent_level;
- Temp_Integer := XPos(';',Get_Line,1);
- IF Not(Temp_Integer) THEN
- Temp_Integer := Length(Get_Line);
- END;
- IF (Temp_Integer) THEN
- Put_Line(Caps(Copy(Get_Line,1,Temp_Integer)) + Copy(Get_Line,Temp_Integer + 1,254));
- END;
- goto_col( i_col );
- refresh := true;
- Cr;
- END_MACRO;
-
- $MACRO PROC;
- {******************************************************************************
- MULTI-EDIT MACRO
-
- Name: PROC
-
- Description: Creates the shell of a procedure for 8086 assembly language.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
- def_str(tstr);
-
- Goto_Col(1);
- tstr := Get_Word('');
- text(' PROC FAR');
- Goto_Col(1);
- Undent;
- CR;
- UP;
- text('PUBLIC ' + tstr);
- down;
- down;
- goto_Col(1);
- indent;
- text('SAVE_BP');
- CR;
- CR;
- Text('RESTORE_BP');
- CR;
- TEXT('RET');
- CR;
- Goto_COL(1);
- Text(TSTR + ' ENDP');
- CR;
- UP;
- UP;
- UP;
- UP;
- GOTO_COL(1);
- INDENT;
-
- END_MACRO;
-
- $MACRO ASMFORM;
- {******************************************************************************
- MULTI-EDIT MACRO
-
- Name: ASMFORM
-
- Description: Reformats 8086 assembly language source code.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
- def_str( tstr[10] );
- def_int( space_found );
-
- working;
- refresh := false;
- mark_pos;
- if block_stat <> 1 then
- goto exit;
- end;
-
- goto_line(block_line1);
- while c_line <= block_line2 do
- first_word;
-
- if cur_char = ';' then {If first character is a ; then ignore line}
- goto do_loop;
- end;
-
- while c_col > 1 do {Delete all leading characters}
- back_space;
- end;
-
- while not(at_eol) and (xpos(cur_char,' |9:',1) = 0) do
- right;
- end;
-
- if cur_char = ':' then {If this is a label the go on}
- goto do_loop;
- end;
-
- if at_eol then
- goto do_indent;
- end;
-
- do_indent:
- goto_col(1);
- tab_right;
-
- space_found := false;
-
- find_comment:
- tstr := Get_Word('''"; |9');
- if (cur_char = '''') then
- right;
- tstr := get_word('''');
- right;
- goto find_comment;
- end;
- if (cur_char = '"') then
- right;
- tstr := get_word('"');
- right;
- goto find_comment;
- end;
- while xpos(cur_char,'|9 ',1) <> 0 do
- del_char;
- end;
- if not(at_eol) then
- if cur_char = ';' then
- while c_col < 41 do
- tab_right;
- end;
- goto do_loop;
- else
- if space_found = false then
- tab_right;
- space_found := true;
- else
- text(' ');
- end;
- goto find_comment;
- end;
- end;
-
- do_loop:
- down;
- end;
- exit:
- refresh := true;
- goto_mark;
- END_MACRO;