JP2909185B2 - Assembler processing method - Google Patents

Assembler processing method

Info

Publication number
JP2909185B2
JP2909185B2 JP2280321A JP28032190A JP2909185B2 JP 2909185 B2 JP2909185 B2 JP 2909185B2 JP 2280321 A JP2280321 A JP 2280321A JP 28032190 A JP28032190 A JP 28032190A JP 2909185 B2 JP2909185 B2 JP 2909185B2
Authority
JP
Japan
Prior art keywords
assembler
instruction
source program
sign
machine language
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP2280321A
Other languages
Japanese (ja)
Other versions
JPH04153833A (en
Inventor
理恵子 嶋津
悟 荒木
紀恵 室田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
PII EFU YUU KK
Original Assignee
PII EFU YUU KK
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by PII EFU YUU KK filed Critical PII EFU YUU KK
Priority to JP2280321A priority Critical patent/JP2909185B2/en
Publication of JPH04153833A publication Critical patent/JPH04153833A/en
Application granted granted Critical
Publication of JP2909185B2 publication Critical patent/JP2909185B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

【発明の詳細な説明】 [概要] 情報処理装置におけるアセンブラ処理方法に関し、 アセンブラの処理負担をあまり増加させることなく原
始プログラム中でサイン付きとサインなしの定数を混在
使用することを許容するアセンブラ処理方法を提供する
ことを目的とし、 定数の記述形式として、サイン記号を伴う数値とサイン
記号なしの数値を予め定めた特定の文字を使用すること
で表現するアセンブラ言語を用いて記述した原始プログ
ラムを対象として、該原始プログラムのアセンブラ処理
時に、上記原始プログラム中の定数の記述形式にサイン
記号を伴う数値表現があるか否かを判断し、当該定数を
使用する命令を、サイン付き数値を扱う機械語命令とサ
イン無し数値を扱う機械語命令のいずれか対応するもの
に変換する構成とした。
DETAILED DESCRIPTION OF THE INVENTION [Summary] Regarding an assembler processing method in an information processing apparatus, an assembler processing that allows mixed use of signed and unsigned constants in a source program without significantly increasing the processing load of the assembler In order to provide a method, as a description format of constants, a source program written using an assembler language that expresses a numerical value with a sign symbol and a numerical value without a sign symbol by using predetermined specific characters As an object, at the time of assembler processing of the source program, it is determined whether or not the description format of the constant in the source program includes a numerical expression accompanied by a sign, and an instruction using the constant is converted to a machine that handles a signed numerical value. It is configured to convert to a language instruction and a machine language instruction that handles unsigned numeric values.

〔産業上の利用分野〕 本発明は,情報処理装置におけるアセンブラ処理方法
に関するものであり,特に原始プログラム中でサイン付
きとサインなしの両方の定数表現を混在使用できるよう
にしたアセンブラ処理方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an assembler processing method in an information processing apparatus, and more particularly to an assembler processing method in which both signed and unsigned constant expressions can be mixedly used in a source program.

〔従来の技術〕[Conventional technology]

従来のアセンブラ言語プログラムでは,定数を記述す
る場合,サインなしの絶対値表現とし,たとえばアセン
ブラ内部で2バイトまで扱える場合, 0〜65535(X‘0000'〜X‘FFFF')とするか,ある
いは上位1ビットをサインビットとし,負数を2の補数
で表現し,たとえば上と同じ2バイトの場合, −32768〜+32768(−X‘80000'〜+X‘7FFF')と
するか,のいずれかの方法がとられていた。アセンブラ
は,原始プログラム中の命令を翻訳する際,その命令が
使用する定数を,予め定められている一方の記述形式に
よるものと解釈して,その定数の記述形式を扱う特定の
機械語命令に変換していた。これは原始プログラム中に
両方の記述形式を許した場合,長い演算式などでは各定
数のサインの管理が繁雑になり,また機械語命令の切り
分けがめんどうになるという理由による。
In a conventional assembler language program, when describing a constant, the absolute value expression without a sign is used. The upper one bit is a sign bit, and the negative number is represented by a two's complement. The way was being taken. When translating an instruction in a source program, the assembler interprets the constants used by the instruction as being in one of the predetermined description formats, and puts them into a specific machine language instruction that handles the description format of the constant. Had been converted. This is because if both description formats are allowed in the source program, the management of the signature of each constant becomes complicated in long arithmetic expressions and the like, and the separation of machine language instructions becomes troublesome.

〔発明が解決しようとする課題〕[Problems to be solved by the invention]

従来のアセンブラでは,アセンブラ処理の負担を軽減
するため,定数の記述形式がサインなしの絶対値表現か
負数を2の補数で表したサインビット付き表現か,いず
れか一方で動作するように定められており,原始プログ
ラム中に両方の定数表現を混在させて記述することを許
さなかった。そのため自由なプログラミングが阻害さ
れ,プログラムが冗長になるという問題があった。
In conventional assemblers, in order to reduce the burden of assembler processing, the description format of constants is defined to operate either as an absolute value expression without a sign or with a sign bit expressing a negative number as a 2's complement number. And did not allow both constant expressions to be mixed in the source program. Therefore, there is a problem that free programming is hindered and the program becomes redundant.

本発明は,アセンブラの処理負担をあまり増加させる
ことなく原始プログラム中でサイン付きとサインなしの
定数を混在使用することを許容するアセンブラ処理方法
を提供することを目的としている。
SUMMARY OF THE INVENTION It is an object of the present invention to provide an assembler processing method that allows mixed use of signed and unsigned constants in a source program without significantly increasing the processing load of the assembler.

〔課題を解決するための手段〕[Means for solving the problem]

本発明は,定数の記述形式として,サインなしの数値
表現の先頭に,特定の文字を用いたサイン記号を付加で
きるようにし,このサイン記号が数値に付加されている
か否かにより,サイン付き数値かサインなし数値かをア
センブラに識別させ,それに応じてサイン付きの処理を
行う命令とサインなしの処理を行う命令とに切り分けて
機械語命令に変換するようにしたものである。
According to the present invention, as a description format of a constant, a sign symbol using a specific character can be added to the head of a numerical expression without a sign, and a signed numerical value is determined by whether or not the sign symbol is added to the numerical value. The assembler discriminates between an unsigned numerical value and an unsigned numerical value, and separates the instruction into an instruction for performing signed processing and an instruction for performing unsigned processing, and converts the instruction into a machine language instruction.

第1図は本発明の原理説明図である。図示された例で
は,定数の数値に付加するサイン記号として‘S'が用い
られている。
FIG. 1 is a diagram illustrating the principle of the present invention. In the illustrated example, 'S' is used as a sign symbol added to the numerical value of the constant.

図において, 1は,原始プログラムであり,プログラム中の命令 MOVE1 AX,AREA1/SX‘FFFE'は,サイン付き数値(16進
数)SX‘FFFE'によりラベルAREA1の領域の値を除算した
結果を定数としてラベルAXの領域に格納する処理を行う
命令である。
In the figure, 1 is a source program, and the instruction MOVE1 AX, AREA1 / SX'FFFE 'in the program is a constant obtained by dividing the value of the area of label AREA1 by a signed numeric value (hexadecimal) SX'FFFE' Is an instruction for performing a process of storing in the area of the label AX.

また次の命令 MOVE1 AX,AREA1/X‘FFFE'は,サインなし数値X‘FFF
E'によりAREA1の値を除算した結果をAXに格納する命令
である。
The next instruction MOVE1 AX, AREA1 / X'FFFE 'is an unsigned numerical value X'FFF
This instruction stores the result of dividing the value of AREA1 by E 'in AX.

2は,アセンブラ処理であり,原始プログラム1の各
命令の文字列を順次読み取って解析し,機械語プログラ
ムに翻訳する。その際定数を検出した場合,先頭にサイ
ン記号Sが付加されているかどうかを識別し,その結果
により使用する機械語命令を選択する。
Reference numeral 2 denotes an assembler process which sequentially reads and analyzes a character string of each instruction of the source program 1 and translates it into a machine language program. At this time, if a constant is detected, it is determined whether or not a sign symbol S is added at the beginning, and a machine language instruction to be used is selected based on the result.

〔作用〕[Action]

第1図において,中の具体例を用いて本発明の作用を
説明する。
The operation of the present invention will be described with reference to FIG.

アセンブラ処理2では,原始プログラム1中の最初の
命令 MOVE1 AX,AREA1/SX‘FFFE'において,サイン記号‘S'
付きの数値SX‘FFFE'を検出すると,これを2の補数表
現の負数‘−2'と認識して,‘−2'でAREA1の値(100と
する)を除算する処理を行い,結果の値−50(X‘FFC
E')を得る。そしてこの値‘−50'をAXに格納する機械
語命令に変換する。
In assembler processing 2, the sign symbol 'S' is used in the first instruction MOVE1 AX, AREA1 / SX'FFFE 'in the source program 1.
When a numerical value SX'FFFE 'with a prefix is detected, it is recognized as a negative number' -2 'in a two's complement expression, and a process of dividing the value of AREA1 (assumed to be 100) by' -2 'is performed. Value -50 (X'FFC
E '). Then, the value “−50” is converted into a machine language instruction to be stored in AX.

さらにアセンブラ処理2では,原始プログラム1中の
次の命令 MOVE1 AX,AREA1/X‘FFFE'において,サイン記号‘S'
をもたない数値X‘FFFE'を検出すると,これをサイン
なし数値‘65534'と認識して,‘65534'でAREA1の値(1
00)を除算する処理を行い,結果の値0(X‘0000')
を得る。そしてこの値‘0'をAXに格納する機械語命令に
変換する。
Further, in assembler processing 2, the sign MOVE1 AX, AREA1 / X'FFFE 'in the source program 1 uses the sign symbol' S '.
When a numerical value X'FFFE 'having no sign is detected, it is recognized as an unsigned numerical value' 65534 ', and the value of AREA1 (1
00) is divided, and the resulting value is 0 (X'0000 ')
Get. Then, the value “0” is converted into a machine language instruction to be stored in AX.

このようにして,アセンブラ2は,原始プログラム1
の命令中に記述されている定数の値がサイン記号‘S'が
付いているかどうかによってサイン付き数値かサインな
し数値かに区別し,それぞれの種別の数値を扱う機械語
命令に変換する。
In this way, the assembler 2 executes the source program 1
Is distinguished between signed and unsigned numbers depending on whether or not the value of the constant described in this instruction has the sign symbol 'S', and is converted into a machine language instruction that handles each type of numerical value.

なお図示の例では,アセンブラ1自身も AREA1/SX‘FFFE'とAREA1/X‘FFFE'の定数演算を行
い,除算を実行して値‘50'と値‘0'をそれぞれ求めて
いるが,その際の除算命令の種類も,サイン記号‘S'の
有無によって選択している。
In the example shown in the figure, the assembler 1 itself also performs constant operations of AREA1 / SX'FFFE 'and AREA1 / X'FFFE', and executes division to obtain the values '50' and '0', respectively. The type of division instruction at that time is also selected according to the presence or absence of the sign symbol 'S'.

〔実施例〕〔Example〕

第2図にアセンブラの実施例を示す。図において1は
原始プログラム,2はアセンブラ処理,3はパス1処理,4は
パス2処理,5は擬以命令表,6は機械語命令表,7はロケー
ションカウンタ,8は記号表,9はリテラル表,10は機械語
プログラムである。
FIG. 2 shows an embodiment of the assembler. In the figure, 1 is a source program, 2 is assembler processing, 3 is pass 1 processing, 4 is pass 2 processing, 5 is a pseudo-instruction table, 6 is a machine language instruction table, 7 is a location counter, 8 is a symbol table, and 9 is a symbol table. Literal table 10 is a machine language program.

アセンブラ処理2の基本的な機能は従来知られている
ものと同じであり,パス1処理3で原始プログラム1の
行を順次読み込み,擬以命令表5および機械語命令表6
を検索してプログラム中の擬以命令と機械語命令とをそ
れぞれ検出する。擬以命令についてはアセンブラ処理の
制御やベースレジスタなどの実行環境の設定処理などを
行い,機械語命令については,機械語命令表から得た命
令サイズに基づいてロケーションカウンタ7を進め械語
命令の位置を決定する(擬以命令位置はカウントされな
い)。また命令に付されたラベルとの位置を記号表8に
設定し,また命令が定数領域の確保を要求するリテラル
を含むときはその処理を行い,リテラル表9にリテラル
とその位置を設定する。
The basic functions of the assembler process 2 are the same as those conventionally known. In the pass 1 process 3, the lines of the source program 1 are sequentially read, and the pseudo instruction table 5 and the machine instruction table 6 are read.
To detect pseudo-instructions and machine instructions in the program. For pseudo-instructions, control of assembler processing and processing for setting the execution environment, such as base registers, are performed. For machine instructions, the location counter 7 is advanced based on the instruction size obtained from the machine instruction table to advance the machine instructions. Determine position (pseudo-instruction positions are not counted). Also, the position of the label attached to the instruction is set in the symbol table 8, and if the instruction includes a literal requesting the reservation of a constant area, the processing is performed, and the literal and its position are set in the literal table 9.

続いてパス2処理4を実行し,再び原始プログラム1
を順次読み込んで記号表8およびリテラル表9を参照
し,ロケーションカウンタ7を更新しながら機械語命令
を順次生成する。
Subsequently, pass 2 processing 4 is executed, and the source program 1 is again executed.
Are sequentially read, and the machine language instructions are sequentially generated while updating the location counter 7 with reference to the symbol table 8 and the literal table 9.

本発明は,この機械語命令の生成処理において適用さ
れる。すなわち入力された原始プログラムの命令の記号
コードにより機械語命令表6を参照して,対応する機械
語コードと命令形式を知り,オペランドの各フィールド
を決定する。この機械語命令表6を参照する際,命令が
サイン記号付き定数を使用するかどうかで機械語命令の
機能を選択する。
The present invention is applied in the generation processing of the machine language instruction. That is, the corresponding machine language code and instruction format are known by referring to the machine language instruction table 6 based on the input symbol code of the source program instruction, and each field of the operand is determined. When referring to the machine language instruction table 6, the function of the machine language instruction is selected depending on whether the instruction uses a constant with a sign.

〔発明の効果〕〔The invention's effect〕

本発明によれば,利用者は,アセンブラ言語プログラ
ム中で定数記述にサイン記号を付加するかどうかの簡単
な指定を行うのみで,簡単にサイン付き数値とサインな
し数値とを混在使用することができ,またアセンブラ処
理時も,アセンブラは定数中のサイン記号の有無を検出
することにより簡単に定数の記述形式を認識して,対応
するアセンブラ処理を切り分けることができるので,プ
ログラミングとアセンブラ処理の効率化と迅速化とを図
ることができる。
According to the present invention, a user can simply use a simple specification of whether or not to add a sign symbol to a constant description in an assembler language program, and can easily use a mixture of signed and unsigned values. Also, during assembler processing, the assembler can easily recognize the description format of constants by detecting the presence or absence of a sign symbol in constants, and can separate the corresponding assembler processing, thereby improving the efficiency of programming and assembler processing. And speeding up.

【図面の簡単な説明】[Brief description of the drawings]

第1図は本発明の原理説明図,第2図は本発明実施例の
アセンブラ処理の説明図である。 第1図中, 1:原始プログラム 2:アセンブラ処理
FIG. 1 is an explanatory diagram of the principle of the present invention, and FIG. 2 is an explanatory diagram of assembler processing according to an embodiment of the present invention. In Fig. 1, 1: Source program 2: Assembler processing

───────────────────────────────────────────────────── フロントページの続き (58)調査した分野(Int.Cl.6,DB名) G06F 9/45 ──────────────────────────────────────────────────続 き Continued on front page (58) Field surveyed (Int.Cl. 6 , DB name) G06F 9/45

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】アセンブラ言語で記述された原始プログラ
ムを機械語プログラムに翻訳するアセンブラ処理方法に
おいて、 定数の記述形式として、サイン記号を伴う数値とサイン
記号なしの数値を、予め定めた特定の文字を使用するこ
とで表現するアセンブラ言語を用いて記述した原始プロ
グラムを対象として、該原始プログラムのアセンブラ処
理時に、上記原始プログラム中の定数の記述形式にサイ
ン記号を伴う数値表現があるか否かを判断し、当該定数
を使用する命令を、サイン付き数値を扱う機械語命令と
サイン無し数値を扱う機械語命令のいずれか対応するも
のに変換することを特徴とするアセンブラ処理方法。
1. An assembler processing method for translating a source program described in an assembler language into a machine language program, wherein a constant description format includes a numerical value with a sign symbol and a numerical value without a sign symbol in a predetermined specific character. For a source program described using an assembler language expressed by using, when assembling the source program, it is determined whether or not there is a numerical expression with a sign in the description format of the constants in the source program. An assembler processing method comprising: judging and converting an instruction using the constant into one corresponding to one of a machine language instruction handling a signed numeric value and a machine language instruction handling an unsigned numeric value.
JP2280321A 1990-10-18 1990-10-18 Assembler processing method Expired - Lifetime JP2909185B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2280321A JP2909185B2 (en) 1990-10-18 1990-10-18 Assembler processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2280321A JP2909185B2 (en) 1990-10-18 1990-10-18 Assembler processing method

Publications (2)

Publication Number Publication Date
JPH04153833A JPH04153833A (en) 1992-05-27
JP2909185B2 true JP2909185B2 (en) 1999-06-23

Family

ID=17623370

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2280321A Expired - Lifetime JP2909185B2 (en) 1990-10-18 1990-10-18 Assembler processing method

Country Status (1)

Country Link
JP (1) JP2909185B2 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63165928A (en) * 1986-12-27 1988-07-09 Canon Inc Program production system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63165928A (en) * 1986-12-27 1988-07-09 Canon Inc Program production system

Also Published As

Publication number Publication date
JPH04153833A (en) 1992-05-27

Similar Documents

Publication Publication Date Title
Cornell Core Java
US20160062738A1 (en) Methods and Apparatuses for Interactive Computer Programming
JP2909185B2 (en) Assembler processing method
JPH0252299B2 (en)
JPH04362738A (en) Variable control method
JP2753555B2 (en) Programmable controller
JPH0546373A (en) Flow chart generation processor
JPH04248624A (en) Program conversion processor
JP2587442B2 (en) Full screen prompting method
JPH042961B2 (en)
JPS62219005A (en) Sequence program processor
JP3304363B2 (en) Job separator output method
JPH03166642A (en) Method and device for inputting text
JP3332723B2 (en) Machine language conversion system with division support function
JP3105546B2 (en) Assembler symbol debug information processing method
JPH05181661A (en) General purpose menu system for each user
JPS6019231A (en) Document producing system
JPS62269238A (en) Compiling system
JPH03224035A (en) Data processor
JPH0383140A (en) Arithmetic formula expanding system
JPH0388061A (en) Japanese input device
JPH03137725A (en) Designation system for customized file in distributed editor
JPH05216822A (en) Command input system in computer
JPH05307475A (en) Process control processing method
JPH03186933A (en) Symbol processing system for language processing system