JPS63268031A - Program execution control system - Google Patents

Program execution control system

Info

Publication number
JPS63268031A
JPS63268031A JP62102500A JP10250087A JPS63268031A JP S63268031 A JPS63268031 A JP S63268031A JP 62102500 A JP62102500 A JP 62102500A JP 10250087 A JP10250087 A JP 10250087A JP S63268031 A JPS63268031 A JP S63268031A
Authority
JP
Japan
Prior art keywords
module
program
program module
label
line
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.)
Pending
Application number
JP62102500A
Other languages
Japanese (ja)
Inventor
Isamu Haneda
勇 羽田
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.)
Sharp Corp
Original Assignee
Sharp Corp
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 Sharp Corp filed Critical Sharp Corp
Priority to JP62102500A priority Critical patent/JPS63268031A/en
Publication of JPS63268031A publication Critical patent/JPS63268031A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To realize the replacement of a part of an instruction sentence forming a module with another instruction sentence, by adding a proper lable to each program module and shifting the control to another program module in response to a shift instruction of the label. CONSTITUTION:A ROM 2 stores program to interpret and execute various programs and languages for control of a CPU 1. The line number added to the lines of program modules A-C can be used in common with the corresponding instruction sentences obtained before and after replacement. At the same time, a proper label is added to the first line of each module. When a shift instruction is produced during execution of the module A to shift the label showing the module A to the label showing the module B, it is decided whether a common line number corresponding to the module B is included in the module A or not. If so, the control is shifted to the module B and then returned to the original module A after execution of the module B. Thus a part of an instruction sentence forming the module A is replaced with the instruction sentence of the module B.

Description

【発明の詳細な説明】 〈産業上の利用分野〉 本発明は、既に完成されたプログラムモジュールを実行
する際にその一部のルーチンを他のプログラムモジュー
ルに自動的に切り換えて実行できるようにしたプログラ
ム実行制御方式に関する。
[Detailed Description of the Invention] <Industrial Application Field> The present invention enables execution of an already completed program module by automatically switching a part of the routine to another program module. Regarding program execution control methods.

〈従来技術〉 一般に、コンピュータシステムでは、既に完成した一つ
のプログラムに対して、そのプログラムの一部分だけを
異なるルーチンで実行させたい場合がある。
<Prior Art> Generally, in a computer system, there are cases where it is desired to execute only a part of an already completed program using a different routine.

これには、プログラム全体を改めて作り直せば対処でき
るが、新たに作成したプログラムが所望通り実行される
かを再度確認する必要があり、デバッグの手間がかかる
。また、既に完成したプログラムがアプリケーンヨンプ
ログラム等で、書き換えのできないROMから供給され
ている場合には、ルーチンを一つにすることができない
。また、アブリケーンヨンプログラムを一部書き直した
ちのをRA Mに記憶させる場合にはプロクラムステッ
プか同じたけ必要になるので、RA Mの記憶容量を圧
迫することになり、記憶容量に余裕のない場合には適切
でない。
Although this problem can be solved by re-creating the entire program, it is necessary to confirm again whether the newly created program will be executed as desired, which takes time and effort for debugging. Furthermore, if the already completed program is an application program or the like and is supplied from a ROM that cannot be rewritten, it is not possible to combine the routines into one. Also, if you want to rewrite a part of the original program and store it in RAM, the same number of program steps will be required, which will put pressure on the RAM storage capacity, so if you don't have enough storage capacity, is not appropriate.

〈目的〉 本発明は、既に完成したプログラムの一部を他のプログ
ラムで置換して実行させたい場合に、完成したプログラ
ムは変更せずにその内のルーチンの必要な一部分だけを
新たにプログラムすれば済むようにして、予め完成され
たプログラムの任意の行のアレンジを可能にし、完成さ
れたプログラムに汎用性をもたせてプログラム開発の手
間を省略化できるようにすることを目的とする。
<Purpose> The present invention provides a method for replacing a part of an already completed program with another program and reprogramming only a necessary part of the routine within the program without changing the completed program. To make it possible to arrange arbitrary lines of a pre-completed program, to give versatility to the completed program, and to omit the labor of program development.

〈実施例〉 第1図は本発明の一実施例のシステムブロック図である
。同図において、lはCP、 U (中央演算装置)、
2はROM(読み出し専用メモリ)であり、CPU I
の動作を制御する各種のプログラムや高級言語を解釈・
実行したりするプログラムが記憶されている。3はRA
M(読み書き可能なメモリ)で、CPtJlのワークエ
リア、高級言語用ワークエリア、高級言語の上で作られ
たアプリケーションプログラム実行上のデータ等がここ
に記憶される。4はアプリケーションプログラムが入る
拡張用RoM、5は表示用メモリで、ここに書かれた内
容に応じた情報が表示器6に表示される。7は人出力ボ
ート、8はキーボードである。そして、CPUIとRO
M 2、RAM3、拡張用ROM 4、表示用メモリ5
!3よび入出カポ−ドアはソステムバス9でつながって
おり、CPUIはデータの読み書きをシステムバス9を
介して各々に対して行なう。
<Embodiment> FIG. 1 is a system block diagram of an embodiment of the present invention. In the same figure, l is CP, U (central processing unit),
2 is a ROM (read-only memory), and the CPU I
Interprets and interprets various programs and high-level languages that control the operation of
Programs to be executed are stored. 3 is RA
M (readable/writable memory), in which the CPtJl work area, high-level language work area, data for execution of application programs created on the high-level language, etc. are stored. Reference numeral 4 represents an expansion RoM into which an application program is stored, and 5 represents a display memory. Information corresponding to the contents written here is displayed on a display 6. 7 is a human output boat, and 8 is a keyboard. And CPUI and RO
M 2, RAM 3, expansion ROM 4, display memory 5
! 3 and the input/output port are connected via a system bus 9, and the CPU reads and writes data to and from each via the system bus 9.

次に、上記構成のシステムを適用したプログラム実行制
御方式について、ベーンシフ言語のインクプリタブログ
ラム実行の場合を例にとって説明する。
Next, a program execution control method to which the system with the above configuration is applied will be described, taking as an example the case of executing an inscriptor program in the Böhnschiff language.

第2図において、プログラムモジュールAはアプリケー
ションプログラムとして完成された一つのモジュールを
示し、たとえば拡張用ROM 2内に記憶されている。
In FIG. 2, program module A represents one module completed as an application program, and is stored in the expansion ROM 2, for example.

また、プログラムモジュールBおよびCは、プログラム
モジュールAを構成する命令文の一部を他の命令文に置
換するために新たに作成されたモジュールであり、プロ
グラム作成後にRAM3に記憶される。なお、置換用の
プログラムモジュールB、Cは、本例では説明の簡略化
のために2つ設けているが、これに限定されるものでは
ない。
Furthermore, program modules B and C are newly created modules to replace a part of the command sentences constituting program module A with other command sentences, and are stored in the RAM 3 after the programs are created. In this example, two replacement program modules B and C are provided for the purpose of simplifying the explanation, but the present invention is not limited to this.

プログラム実行に際しては、予めこれらの各プログラム
モジュールA、B、Cに対して行番号を付ける。行番号
は16進表記で0001−FEFFまでの数値の間でプ
ログラム実行順に太き(なるように設定する。また、各
プログラムモジュールA、B、Cの最初の行には、行番
号と別個に各プログラムモジュールを識別するためのラ
ベルをに付す。たとえば、プログラムモジュールASB
When executing a program, line numbers are assigned to each of these program modules A, B, and C in advance. The line number is set in hexadecimal notation between 0001 and FEFF in the order of program execution.Also, the first line of each program module A, B, and C has a line number and a separate line number. Attach a label to identify each program module.For example, program module ASB
.

Cの各先頭行にα、β、γ等の各ラベルを付けろ。Label each first line of C with α, β, γ, etc.

さらに、一つのプログラムモジュールの実行を他のプロ
グラムモジュールの実行に制御を移すために、置換前後
の対応する命令文の少なくとも一つの行番号を共通に指
定しておく。たとえば、本例において、第2図に示すよ
うに、プログラムモジュールAの行番号“30”にある
命令文の実行をプログラムモノニールB 1.:W換し
て実行させるとすれば、プログラムモジュールBの先頭
の行番号を“30”に指定する。さらに、プログラムモ
ジュールBの行番号“38”にある命令文の実行をプロ
グラムモジュールCに置換して実行させるとすれば、プ
ログラムモジュールCの先頭の行番号を“36”に指定
する。
Furthermore, in order to transfer control from the execution of one program module to the execution of another program module, at least one line number of the corresponding command statements before and after replacement is designated in common. For example, in this example, as shown in FIG. 2, the statement at line number "30" of program module A is executed by program monologue B1. :W and execute it, specify the first line number of program module B as "30". Furthermore, if the instruction statement at line number "38" of program module B is to be executed by replacing it with program module C, the first line number of program module C is designated as "36".

プログラム実行中に一つのプログラムモジュールから他
のプログラムモジュールに実行の制御を移すには、予め
図外のメインルーチンのプログラムにおいて専用・のベ
ーシック命令文を記入し、CPUIにその命令を与える
。ベーシック命令には次の4種類がある。
To transfer execution control from one program module to another during program execution, a dedicated basic command statement is written in advance in a main routine program (not shown) and the command is given to the CPUI. There are four types of basic instructions:

■C0NTR0LL“ラベル1”TO“ラベル2”ラベ
ルlをもつプログラムモジュールを実行する際、その実
行待と同じ行番号がラベル2をもつプログラムモジュー
ル内にあると、ラベル2をもつプログラムモジュールの
対応するその行に実行の制御を移し、らし同じ行番号が
ラベル2をちっプログラムモジュール内にないときには
ラベルlをもつプログラムモジュールを実行する。この
命令は、次の■の命令が実行されたときのみ有効である
。たとえば、プログラムモジュールAからプログラムモ
ジュールBに実行を移す場合には、C0NTR0LL“
α”To“β”という命令文を与えろ。
■C0NTR0LL "Label 1" TO "Label 2" When executing a program module with label l, if the same line number as the one waiting for execution is in the program module with label 2, the corresponding line number of the program module with label 2 will be executed. Execution control is transferred to that line, and if the same line number is not in a program module with label 2, the program module with label l is executed. This command is valid only when the next command (■) is executed. For example, when transferring execution from program module A to program module B, C0NTR0LL"
Give the imperative sentence α”To”β”.

■C0NTR0LL“ラベル1”ON この命令を実行すると、■の命令が有効になる。■C0NTR0LL “Label 1” ON When this command is executed, the command (■) becomes effective.

■CON T ROL L ”ラベルl″5TOPこの
命令を実行すると、■の命令は無効になるが■で宣言し
た内容は有効に存続し、再度■を実行すると■の命令は
有効になる。
■ CON T ROL L "Label l" 5 TOP When this command is executed, the command (■) becomes invalid, but the contents declared in (■) remain valid, and when (■) is executed again, the command (■) becomes valid.

■C0NTR0LL“ラベル1”OFF■および■をク
リアする。
■C0NTR0LL “Label 1” OFF Clear ■ and ■.

プログラムを実行する際は、最初に■の命令状態にあり
、■たけ命令しても■が命令されていなければプログラ
ムモジュール間の実行の移動はない。また、ラベル1及
びラベル2が存在しない場合や、ラベルIとラベル2が
同一の場合にはエラーである。
When a program is executed, it is first in the command state of ■, and even if ■ is commanded many times, if ■ is not commanded, execution will not move between program modules. Furthermore, it is an error if Label 1 and Label 2 do not exist or if Label I and Label 2 are the same.

第3図は、■〜■の命令を実行する場合に確保されるR
AMa内に確保されろワークエリアを示す説明図である
。図中、FONのエリアには■の命令が実行されノこ場
合にビットが立てられ、このとき対応するFOFFのエ
リアのビットがクリアされる。また、FOFFのエリア
には■の命令か実行された場合にビットが立てられ、こ
のとき対応するFONのエリアのビットがクリアされる
Figure 3 shows the R secured when executing the instructions from ■ to ■.
FIG. 2 is an explanatory diagram showing a work area secured within AMa. In the figure, a bit is set in the FON area when the instruction (3) is executed, and at this time, the corresponding bit in the FOFF area is cleared. Further, a bit is set in the FOFF area when the instruction (3) is executed, and at this time, the bit in the corresponding FON area is cleared.

TAIのエリアは、ラベルlがあるプログラムモジュー
ルの先頭行の先頭番地が入れられ、またTA2のエリア
にはラベル2があるプログラムモジュールの先頭行の先
頭番地が入れられる。また、■〜■の各命令か使える組
み合わせの最大数Nは予め決められており、プログラム
を走らせたときにすべてクリアされる。なお、FONと
FOFFの対のビットが共に立っているときはプログラ
ムモジュール間の実行の移動が行なわれたことを示す。
The TAI area contains the starting address of the first line of the program module with the label 1, and the TA2 area contains the starting address of the first line of the program module with the label 2. Further, the maximum number N of combinations that can be used for each of the instructions ① to ② is predetermined, and all of them are cleared when the program is run. Note that when both the FON and FOFF bits are set, it indicates that execution has been moved between program modules.

第5図は、メインルーチンのプログラムに■の命令文す
なわちC0NTR0LL“ラベルl″T。
FIG. 5 shows the main routine program with the command statement C0NTR0LL "label l"T.

“ラベル2”が記入されている場合に、これに従いCP
UIがRAM内にワークエリアを確保する等のめ備動作
を行なうためのフローヂャートである。
If “Label 2” is entered, CP
This is a flowchart for the UI to perform preparation operations such as securing a work area in the RAM.

■の命令があると、CPU Iはラベルlを検索しくス
テップ1)、ラベルIの有無を判別する(ステップ2)
。このラベルlの検索は、RAM3と拡張用ROM4に
記憶されたプログラムモジュールA1B、Cに対して行
なう。ラベル1が無ければエラーであり、ラベル1があ
れば、それがプログラムモノニールの先頭行にあるかど
うか判断する(ステップ3)。先頭行になければエラー
に進む。次いで、ラベルlが既に宣言されてるか否かを
判別ずろ(ステップ4)。ラベル1の宣言の有無は、ラ
ベル1か付されたプログラムモジュールの先頭行に対応
する先頭番地に一致するものが第3図のワークエリアの
TAI内に存在するかどうかを検索することにより行な
われる。そして、ラベルlが未宣言の場合には、第3図
のTAIで示すワークエリア内にプログラムモジュール
の先頭番地を書く余裕があるか否かを判断する(ステッ
プ5)。余裕がなければエラーであり、余裕があればワ
ークエリアTAlの未記入の最上部分(ここではTAl
のワークエリアの上から数えてm番目とする)のTA 
1mにラベル1のあるプログラムモジュールの先頭番地
を書<(ステップ7)。ステップ4において、ラベル1
が既に宣言されていた場合には、そのラベル1の書かれ
であるTAIのワークエリアをクリアしくステップ6)
、そのワークより後に宣言されている内容があれば前に
詰めて、未宣言エリアをクリアの状態した後、ステップ
7の動作を行なう。引き続いて、ラベル2を検索しくス
テップ8)、ラベル2の有無を判別する(ステップ9)
When there is an instruction (①), CPU I searches for label l (step 1) and determines whether label I exists (step 2).
. This search for label l is performed on program modules A1B and C stored in RAM3 and expansion ROM4. If label 1 does not exist, it is an error, and if label 1 does exist, it is determined whether it is in the first line of the program monologue (step 3). If it is not in the first line, proceed to an error. Next, it is determined whether label l has already been declared (step 4). The presence or absence of a declaration of label 1 is determined by searching whether there is a file in the TAI of the work area shown in Figure 3 that matches the first address corresponding to the first line of the program module labeled with label 1. . If the label l has not been declared, it is determined whether there is room to write the start address of the program module in the work area indicated by TAI in FIG. 3 (step 5). If there is no room, it is an error, and if there is space, the top part of the work area TAL that has not been filled out (here, TAL
TA of (mth work area counting from the top)
Write the start address of the program module with label 1 in 1m (Step 7). In step 4, label 1
If it has already been declared, clear the work area of TAI where label 1 is written (Step 6)
, if there is content declared after the work, it is moved to the front, and after clearing the undeclared area, the operation of step 7 is performed. Subsequently, search for label 2 (step 8), and determine the presence or absence of label 2 (step 9).
.

ラベル2が無ければエラーであり、ラベル2があればさ
らにラベル2がプログラムモジュールの先頭行にあるか
否かを判別する(ステップ10)。ラベル2がプログラ
ムモジュールの先頭行に無ければエラー、先頭にあれば
、更にラベルlとラベル2が同一かどうかを判断する(
ステップ11)。両ラベルが一致するか否かはラベル2
を検索した結果得られるプログラムモジュールの先頭番
地と第3図のワークエリアに占き込んだ最新の先頭番地
TA 1mの内容とを比較し、両者が一致しておれば同
一ラベルとなる。両ラベルが不一致ならばラベル2のあ
るプログラムモジュールの先頭番地をワークエリアのT
A 1mの対応位置TA2mに書く(ステップ+2)。
If label 2 does not exist, it is an error, and if label 2 exists, it is further determined whether label 2 is in the first line of the program module (step 10). If label 2 is not in the first line of the program module, it is an error; if it is in the first line, it is further determined whether label l and label 2 are the same (
Step 11). Label 2 determines whether both labels match or not.
The start address of the program module obtained as a result of the search is compared with the contents of the latest start address TA1m entered into the work area in FIG. 3, and if they match, they are the same label. If the two labels do not match, set the start address of the program module with label 2 to T in the work area.
Write at the corresponding position TA2m of A1m (step +2).

これで■の命令による亭備動作が終了する(ステップ1
3)。
This completes the maintenance operation according to the command (Step 1).
3).

具体例として、第2図におけるプログラムモジュールA
、B、Cの行番号かメモリの番地に一致していると仮定
した場合に(以下の説明し同様)、C0NTR0LL“
α”TO“β”の命令文があれば、第3図のワークエリ
アのTAtには、プログラムモジュールAの先頭行の番
号“10”が、TA2にはプログラムモノニールBの先
頭行の番号“30”が記憶される。また、CON T 
ROL L“β”TO“γ”の命令文かあれば、第3図
のワークエリアのTAIには、プログラムモジュールB
の先頭行の番号“30”が、TA2にはプログラムモジ
ュールCの先頭行の番号“36”が記憶されろ。なお、
ステップ[1において、ラベル1とラベル2が同一なら
ば同じプロクラムモジュールを指定したことになるので
エラーとなるが(ステップ15)、その前にステップ7
においてワークエリアにTAImのデータを既に書き込
んだので、そのワークエリアをクリアする(ステップ1
4)。■の命令が宣言されているか否かはTAIの内容
で判断するので、実際はエラーであるのにそのワークエ
リアの一部TA Imにデータが残っていると誤動作を
起こすので、これを防ぐ必要があるためである。
As a specific example, program module A in FIG.
, B, and C match the memory address (as explained below), C0NTR0LL"
If there is an instruction statement α"TO"β", the number "10" of the first line of program module A is stored in TAt of the work area in FIG. 3, and the number "10" of the first line of program module A is stored in TA2. 30” is memorized. Also, CON T
If there is an instruction statement ROL L “β” TO “γ”, program module B will be placed in the TAI of the work area in Figure 3.
The number "30" of the first line of the program module C is stored in TA2, and the number "36" of the first line of the program module C is stored in TA2. In addition,
In step [1, if label 1 and label 2 are the same, it means that the same program module is specified and an error occurs (step 15), but before that, step 7
Since the TAIm data has already been written to the work area, clear that work area (step 1).
4). Whether or not the instruction in (2) has been declared is determined based on the contents of TAI, so if data remains in part of the work area TA Im even though it is actually an error, a malfunction will occur, so it is necessary to prevent this. This is because there is.

第6図はCON T ROL L“ラベル1”ONとい
う■の命令に対するCPUIの準備動作を示すフローチ
ャートである。この命令があると、まず、CPU Iは
、ラベル1を検索しくステップ16)、ラベルIの有無
を判別する(ステップ17)。ラベル1が無ければエラ
ーであり、ラベル1が有れば、次いで、ラベル1が■の
命令文で既に宣言されているかを判別する(ステップ1
8)。既に宣言されている否かは、ラベル1のある行の
先頭番地と第3図のワークエリアのTAIの内容と比較
し、一致すれば宣言されていることが分かる。ここでは
第3図のワークエリアのm番目と一致したとすると、F
ONmビットをセットし、FOFFmビットをリセット
して(ステップ19)、処理を終了する(ステップ20
)。ステップ18で一致しなければ、エラー処理ルーチ
ンへ移る(ステップ21)。
FIG. 6 is a flowchart showing the preparatory operation of the CPU for the command CONT ROL L "LABEL 1" ON. When this command is received, CPU I first searches for label 1 (step 16) and determines whether label I exists (step 17). If label 1 does not exist, it is an error; if label 1 exists, then it is determined whether label 1 has already been declared in the ■ command statement (step 1
8). To determine whether it has already been declared, compare the starting address of the line with label 1 with the contents of TAI in the work area of FIG. 3, and if they match, it can be determined that it has been declared. Here, if it matches the mth work area in Figure 3, then F
The ONm bit is set, the FOFFm bit is reset (step 19), and the process ends (step 20).
). If they do not match in step 18, the process moves to an error handling routine (step 21).

第7図は■のC0NTR0LL“ラベル1”STOPの
命令文に応したCPIJlの動作を示すフローチャート
、第8図は■のC0NTR0LL“ラベル1”OFFの
命令文に応したCPUIの動作のフローチャートである
。第6図と異なるのは、ステップ19に対してステップ
25と31があることである。第7図のステップ25で
はワークエリアのFOFFmヒントをセットし、FON
mビットをリセットする。一方、第8図のステップ31
では、TAIのm番目のラベル1に書かれであるエリア
をクリアし、それ以降に宣言されであるものがあればこ
れを而に詰め、未宣言エリアはすべてクリアする。それ
以外の動作は、第6図の場合と同様であるので、説明を
省略する。
Figure 7 is a flowchart showing the operation of the CPIJl in response to the C0NTR0LL "label 1" STOP command in ■. Figure 8 is a flowchart showing the operation of the CPU in response to the C0NTR0LL "label 1" OFF command in ■. . The difference from FIG. 6 is that there are steps 25 and 31 in place of step 19. In step 25 of Figure 7, set the FOFFm hint in the work area and
Reset the m bit. On the other hand, step 31 in FIG.
Now, clear the area written in the m-th label 1 of TAI, fill in any declared items after that, and clear all undeclared areas. The other operations are the same as in the case of FIG. 6, so the explanation will be omitted.

次に、プログラムモノコール間の実行の自動的切り換え
移動を説明する。
Next, automatic switching and movement of execution between program monocalls will be explained.

RAMa内には、第4図(a)に示すように、現在実行
中の行番号に対応する番地、その実行中のプログラムモ
ジュールの先頭行に対応する番地、さらに、実行が他の
プログラムモジュールに移動した場合の戻り先の実行行
の番地をそれぞれ記憶しておくための専用のワークエリ
アが確保されている。さらに、プログラムモジュールの
切り換えはラベルを指定して実行を移すので、RAMa
内には、第4図(b)に示すように、実行移動(自動割
り込み)後のプログラムモノニールの先頭行の番地を記
憶しておくためのスタックら別途確保されている。この
スタックは段数がN段あり、プログラムの実行開始によ
りクリアされる。このスタックは2つの情報を1組とし
てlスタック分占める。
As shown in Figure 4(a), RAMa contains the address corresponding to the line number currently being executed, the address corresponding to the first line of the program module being executed, and the address corresponding to the first line of the program module being executed. A dedicated work area is reserved for storing the address of the execution line to return to when moved. Furthermore, since program module switching is executed by specifying a label, RAM
Inside, as shown in FIG. 4(b), a stack is separately reserved for storing the address of the first line of the program monologue after execution movement (automatic interrupt). This stack has N stages and is cleared when the program starts executing. This stack occupies l stacks with two pieces of information as one set.

ここに、スタックに積まれる[実行中のモジュールの先
頭番地]とは、プログラムモジュールの実行を一方側か
ら他方側に移す際の移動直前に実行しているプログラム
モジュールの先頭行の先頭番地をいい、また、「移動対
象モジュールの先頭番地」とは、移動先のプログラムモ
ジュールの先頭行の先頭番地をいうものとする。さらに
、ここではGOTO文、GOSUB等のベーシック命令
文により一つの行からある行に実行がジャンプしたか否
かを判別するために“JFLAG”を用いる。
Here, the [start address of the module being executed] loaded on the stack refers to the start address of the first line of the program module being executed immediately before the execution of the program module is moved from one side to the other. Furthermore, the term "start address of the module to be moved" refers to the start address of the first line of the program module to be moved. Furthermore, "JFLAG" is used here to determine whether execution has jumped from one line to another line by a basic command statement such as a GOTO statement or GOSUB.

この“JFLAG”はジャンプしたときにセットされ、
それ以外は1つの行末の次に新しい行に移るときにリセ
ットされる。
This "JFLAG" is set when jumping,
Otherwise, it is reset when moving to a new line after the end of one line.

第9図は、■のCON T ROL L“ラベル1”T
O“ラベル2”の命令および■のC0NTR0LL“ラ
ベル1”ONの命令が共に宣言された場合において、1
つの行の実行を終了して次の行を実行するときにプログ
ラムモジュール間で実行を切り換えるための制御動作を
示すフローチャートである。
Figure 9 shows ■ CON T ROL L “Label 1” T
When the O “label 2” instruction and the ■ C0NTR0LL “label 1” ON instruction are both declared, 1
12 is a flowchart showing a control operation for switching execution between program modules when the execution of one line is finished and the next line is executed.

このフローチャートの入口では、一つの命令の実行を終
了して次の行に実行か移るときJFLAGがリセットさ
れる(ステップ33)。続いて、次の行番号を求める(
ステップ34)。さらに、行番号の第1バイト目がFF
コードかどうか判定する(ステップ35)。FFコード
があるとステップ36に進んで他のプログラムモジュー
ルに実行を移した状態で強制的に実行が終了することに
なる。
At the entrance of this flowchart, JFLAG is reset when execution of one instruction is completed and execution moves to the next line (step 33). Next, find the next line number (
Step 34). Furthermore, the first byte of the line number is FF.
It is determined whether it is a code (step 35). If there is an FF code, the process advances to step 36, where execution is forcibly terminated with execution transferred to another program module.

したがって、プログラムモジュール間で実行の制御移動
が起こった場合に、元のプログラムモジュールに実行を
戻したい場合には、各プログラムモジュールの末尾に戻
り番地の行番号よりも大きな値の行番号を予め付けてお
く。ただし、J FLAG=1のときにはジャンプ先に
指定行が無いので、エラー情報をもってリターンする。
Therefore, when execution control transfer occurs between program modules, if you want to return execution to the original program module, assign a line number with a value greater than the line number of the return address to the end of each program module in advance. I'll keep it. However, when J FLAG=1, there is no specified line to jump to, so the process returns with error information.

ステップ35において、FF”コードが無い場合には、
現在実行中のプログラムモジュールが他のプログラムモ
ジュールから実行が移動してきたかどうかを判断するた
めに、スタック段数(割り込み段数)が“0”が否か知
る(ステップ37)。スタック段数が“0”のときは、
プログラムモジュール間での実行の移動が起こっていな
いのでステップ39に進む。スタック段数が“0”でな
い場合には、既にプログラムモジュール間で実行の移動
が起こっているので、次に、第4図(a)の現在実行中
のプログラムモジュールの先頭番地と第4図(b)に示
すスタックに最新に積まれた移動対象モジュールの先頭
番地とを比較する(ステップ38)。これは、GOTO
文等のジャンプ命令の有無を判別するためである。両先
頭番地が不一致ならばジャンプが起こっているので、ス
テップ39に進む。両者が一致すれば、現在はプログラ
ムモジュール間の実行移動だけが起こっている。たとえ
′ば、プログラムモジュールAからプログラムモジュー
ルBに既に実行の制御が移っている場合には、第4図(
a)に示す現在実行中のモジュールの先頭番地は′30
”、第4図(b)に示すスタックに積まれた最新の移動
対象モジュールの先頭番地も“30”てあり、両者は一
致する。
In step 35, if there is no FF” code,
In order to determine whether the execution of the currently executing program module has been transferred from another program module, it is determined whether the stack stage number (interrupt stage number) is "0" or not (step 37). When the stack level is “0”,
Since execution is not moved between program modules, the process advances to step 39. If the number of stack levels is not "0", execution has already been moved between program modules, so next, the start address of the program module currently being executed in Figure 4(a) and Figure 4(b) ) is compared with the first address of the module to be moved that has been most recently placed on the stack (step 38). This is GOTO
This is to determine whether there is a jump command such as a sentence. If the two leading addresses do not match, a jump has occurred, and the process advances to step 39. If the two match, only execution movement between program modules is currently occurring. For example, if execution control has already been transferred from program module A to program module B,
The starting address of the currently executing module shown in a) is '30
", and the starting address of the latest module to be moved on the stack shown in FIG. 4(b) is also "30", and both match.

ステップ39では、現在実行中のプログラムモジュール
が■と■の命令実行の対象となるか否かを判別する。こ
れには、第4図(a)に記憶されている現在実行中のプ
ログラムモジュールの先頭番地に一致するものが第3図
のワークエリアのTAI内に存在するか否かを調べるこ
とで判別される。
In step 39, it is determined whether the program module currently being executed is to be executed by the instructions ① and ②. This is determined by checking whether there is a program module in the TAI of the work area in FIG. 3 that matches the start address of the currently executing program module stored in FIG. 4(a). Ru.

そして、両者が一致すれば、引き続いてその一致したT
AIに対応する位置のFONがl5FOFFか0になっ
ているか否かを確認する。その条件が満たされておれば
、実行中のプログラムモジュールが■と■の命令実行の
対象となっていることが分かったので、続いて、移動対
象モジュールに次行の行番号と同じ行番号があるか否か
を判別する。たとえば、プログラムモジュールAの行番
号“10”の実行終了時、次の行番号“20”と同じ行
番号はプログラムモジュールB内に存在しないので、そ
の場合はプログラムモジュールBへの自動切換は行なわ
れずステップ53に進み次の行番号“20”の命令を実
行する。一方、プログラムモジュールAの行番号“20
”の実行終了時は、次の行番号“30”と同じ行番号が
プログラムモジュールB内に存在するので、その場合は
プログラムモジュールBに実行の制御を移す争備をステ
ップ41以降で行なう。すなわち、まず、第4図(b)
に示すスタックが余裕があるか判定する(ステップ41
)。
If both match, the matched T
Check whether the FON at the position corresponding to AI is 15FOFF or 0. If that condition is met, we know that the program module being executed is the target of the commands ■ and ■, and then the module to be moved has the same line number as the next line. Determine whether it exists or not. For example, when the execution of line number "10" in program module A ends, there is no line with the same line number as the next line number "20" in program module B, so in that case automatic switching to program module B will not occur. Proceeding to step 53, the instruction of the next line number "20" is executed. On the other hand, line number “20” of program module A
”, the same line number as the next line number “30” exists in program module B, so in that case, a plan is made to transfer execution control to program module B from step 41 onwards. That is, , First, Fig. 4(b)
It is determined whether the stack shown in (step 41) has enough room.
).

余裕がなければエラーであり(ステップ54)、JFL
AGが立っておればエラー情報をもってリターンする。
If there is no margin, it is an error (step 54) and JFL
If AG is set, return with error information.

一方、スタックに余裕があれば、第4図(b)に示すよ
うに、スタックに実行中のモジュールの先頭番地と実行
の切り換わり先の対象モジュールの先頭番地とを積む(
ステップ42.43)。
On the other hand, if there is room on the stack, the start address of the module currently being executed and the start address of the target module to which execution is to be switched are placed on the stack, as shown in Figure 4(b).
Step 42.43).

そして、スタックポインターを1つプラスする(ステッ
プ44)。ざらに、ステップ39て一致した先頭番地に
対応する位置にあるFONおよびFOFFフラグを共に
セットして現在移動実行中(割り込みを受付は中)であ
ることを示す。次いで、第4図(a)のワークエリアに
対して、ステップ40で求めた移動先のプログラムモジ
ュールの先頭番地を実行番地として、また、移動先のプ
ログラムモジュールの先頭番地を実行中のモジュールの
先頭番地としてそれぞれ代入し、また、戻り先の実行行
の番地を記憶した後、ステシブ34に戻る。
Then, the stack pointer is incremented by one (step 44). Briefly, in step 39, both the FON and FOFF flags located at the positions corresponding to the matched start addresses are set to indicate that movement is currently being executed (interrupts are currently being accepted). Next, for the work area of FIG. 4(a), set the start address of the destination program module obtained in step 40 as the execution address, and set the start address of the destination program module as the start address of the module being executed. After assigning each as an address and storing the address of the execution line to return to, the process returns to the progressive 34.

たとえば、プログラムモノニールAの行番号“30”か
らプログラムモジュールBに実行が切り換わる場合には
、第4図(b)のスタックに実行中のモジュールの先頭
番地として“IO”、移動対象モノニールの先頭番地と
して“30”の情報を積む。
For example, when execution switches from line number "30" of program monoyl A to program module B, "IO" is placed in the stack of FIG. Information of "30" is loaded as the first address.

また、第4図(a)のワークエリアに移動先のプログラ
ムモジュールBの先頭番地“30”を実行番地であり、
かつ、先頭番地としてそれぞれ代入し、さらに、戻り先
のプログラムモジュールAの実行行の番地“40”を記
憶する。
In addition, the start address "30" of the program module B to be moved to the work area of FIG. 4(a) is the execution address,
Then, they are assigned as the start address, and the address "40" of the execution line of the program module A to which the return destination is returned is stored.

ステップ38において、プログラムモジュール間の移動
が起こって割り込みのプログラムモジュールの実行中で
あると判断した場合は、J FLAGを見て、JFLA
G=Oの場合には、現在実行を終了した行の次の行番号
(これはステップ34で既に得られている)が戻り先の
行番号を越えたかどうかを判別する(ステップ48)。
In step 38, if it is determined that movement between program modules has occurred and the interrupt program module is being executed, check J FLAG and check JFLA
If G=O, it is determined whether the next line number of the currently executed line (which has already been obtained in step 34) exceeds the return destination line number (step 48).

たとえば、プログラムモジュールBの行番号“38”の
実行を終了した段階で次の行番号が“100“であれば
、戻り先のプログラムモジュールAの行番号“40”を
越えるので、その場合には割り込み制御が終了したと判
断してステップ49以降で元のプログラムモジュールに
戻る孕備を行なう。また、ステップ48でJPLAG=
1のときは、ジャンプ先の同じ行番号があるかどうか捜
す。もし、なければステップ53に進む。
For example, if the next line number is "100" after completing the execution of line number "38" in program module B, it will exceed line number "40" of program module A to return to, so in that case, It is determined that the interrupt control has ended, and preparations are made to return to the original program module from step 49 onwards. Also, in step 48, JPLAG=
If it is 1, search for the same line number to jump to. If not, proceed to step 53.

ステップ49では、スタックに積んである実行中のモノ
ニールの先頭番地を第4図(a)のワークエリアにセッ
トする(ステップ49)。さらに、第4図(a)のワー
クエリアにステップ48で求めた戻り先の行番号の番地
を実行番地に入れる(ステップ50)。たとえば、プロ
グラムモノニールBからAに実行を戻す場合には、現在
実行中のプログラムモジュールの先頭番地として“lO
”、実行行の番地として“40”をそれぞれ代入する。
In step 49, the starting address of the monoyl currently being executed on the stack is set in the work area shown in FIG. 4(a) (step 49). Furthermore, the address of the return destination row number obtained in step 48 is entered as the execution address in the work area of FIG. 4(a) (step 50). For example, when returning execution from program monologue B to A, the start address of the program module currently being executed is set to “lO
”, and “40” is assigned as the address of the execution line.

続いて、ステップ4つで戻した実行中のプログラムモジ
ュールの先頭番地(上記の例ではlO”)と同じTAl
があれば、それに対応する位置にあるPONをセット、
FoFFをリセットする(ステップ51)。
Next, enter the TAL that is the same as the start address of the program module being executed (lO” in the above example) returned in step 4.
If there is, set the PON in the corresponding position,
FoFF is reset (step 51).

これは割り込み処理中に■の命令でクリアされている場
合もあり、この場合には対応するTAIは存在しないの
でフラグの設定はされない。次いで、スタックの段数を
1つ戻した後、ステ・ツブ34に進む。
This may be cleared by the instruction (■) during interrupt processing, and in this case, the corresponding TAI does not exist, so the flag is not set. Next, after returning the number of stack levels by one, the process advances to step 34.

ステップ53において、JFLAG=Oのときには、次
の命令の実行を行ない、Jr’LAG=1のときには後
述の指定行サーチサブルーチンなのでリターンする。
In step 53, when JFLAG=O, the next instruction is executed, and when Jr'LAG=1, it is a specified line search subroutine to be described later, so the process returns.

次にベーシック用命令文(G OT 0文、GO9UB
等)で他の行やモジュールの行にジャンプする場合の指
定行サーチサブルーチンを第11図に示す。
Next, the command statement for basic (GOT 0 statement, GO9UB
FIG. 11 shows a specified line search subroutine when jumping to another line or module line.

ジャンプ命令等があった場合には、まず、現在実行中の
情報の内、実行番地と実行中のモジュールの先頭番地を
一時退避させ(ステップ54)、JFLAGを立てる(
ステップ55)。次に、指定された行番号を検索する(
ステップ56)。この検索は、行番号がラベルで指定さ
れているときにはメモリの先頭から検索し、1つのプロ
グラムモジュールに存在しなければ次の他のプログラム
モジューを検索する。一方、指定が行番号のときには、
現在実行中のプログラムモジュールの先頭行より検索す
る。次に、指定行がなければステップ60のエラーに進
み、エラー情報を6ってリターンする。指定行が見付か
った場合には、その指定行があるプログラムモノニール
の先頭番地を実行中のモジュールの先頭番地へ移しくス
テップ58)、さらに、指定行の先頭番地を実行番地に
移す(ステップ59)。この準備が終わった後、第9図
に示したステップ34からステップ54までの制御プロ
グラム全体をサブルーチンとしてコールする(ステップ
60)。第9図のフローチャートの実行中にエラーが発
生した場合には(ステップ61)、ステップ62に進ん
でエラー情報をもってリターンする。エラー発生が無い
場合には、ステップ6゜で求めたプログラムモジュール
の実行番地ならびにその先頭番地を第4図(a)のワー
クエリアに入れろ(ステップ63)。そして、ステップ
54て一時退避させた情報を元に戻す(ステップ64)
When there is a jump instruction, etc., first, among the information currently being executed, the execution address and the start address of the module being executed are temporarily saved (step 54), and JFLAG is set (
Step 55). Then search for the specified line number (
Step 56). This search starts from the beginning of the memory when the line number is specified by a label, and if it does not exist in one program module, searches for the next other program module. On the other hand, when the specification is a line number,
Search from the first line of the program module currently being executed. Next, if there is no specified line, the process proceeds to step 60, where the error information is returned as 6. If the specified line is found, the starting address of the program monologue containing the specified line is moved to the starting address of the module being executed (step 58), and the starting address of the specified line is moved to the execution address (step 59). ). After this preparation is completed, the entire control program from step 34 to step 54 shown in FIG. 9 is called as a subroutine (step 60). If an error occurs during execution of the flowchart in FIG. 9 (step 61), the process advances to step 62 and returns with error information. If no error has occurred, enter the execution address of the program module obtained in step 6.degree. and its start address into the work area shown in FIG. 4(a) (step 63). Then, restore the information temporarily saved in step 54 (step 64)
.

なお、ベーシック命令文の内、RUN文のように行指定
が無くてもよい場合には、ステップ56の行番号の検索
において、これから実行しようとするプログラムモノニ
ールの先頭行が検索対象となる。
Note that among basic command statements, when a line specification is not required, such as in a RUN statement, the first line of the program monologue to be executed from now on is the search target in the line number search in step 56.

く効果〉 このように本発明によれば、予め完成されているアプリ
ケーノヨンプログラムのルーチンの一部を任意に修正し
て実行させることができるので、プログラムに汎用性を
もたせることができ、しかも、プログラムの作成が簡単
になる。さらに、RAMに記憶させる記憶容量も少なく
て済むのでメモリの節約がてきる利点がある。
Effects> As described above, according to the present invention, a part of the routine of an application program that has been completed in advance can be arbitrarily modified and executed, so that the program can be made versatile, and furthermore, Creating programs becomes easier. Furthermore, since the storage capacity required to be stored in the RAM is small, there is an advantage that memory can be saved.

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

図面は本発明の実施例を示し、第1図は本発明の実施例
のプログラム実行制御方式を行なうためのンステムブロ
ック図、第2図はプログラムモジュールの説明図、第3
図および第4図はRAM内のワークエリアを模式的に示
す説明図、第5図ないし第8図はプログラム実行制御の
命令に応じたCPUの準備動作のフローチャート、第9
図はプログラムモジュール間で実行を移すための制御動
作を示すフローチャート、第1O図はベーシック命令文
で他の行番号にジャンプする場合の指定行の検索ルーチ
ンを示すフローチャートである。 !・・・CPU、2・・・ROM、3・・・RAM、4
・・・拡張用ROM0 第1図 (実施イ列の)077図) 第2図 (プログラムモジュ−ルの318図) 第3図 (RAM内のワーフエリアのS先明図)第4図 (RAM内の曳行中の41多色とスタックホ′イゾのワ
ーフエリアの説明図)第10図 第6図 (命令文■の70−+ヤード) 第7図 (命令文■のフローチャート) 第8図 (命令文■のフローチャート)
The drawings show an embodiment of the present invention, and FIG. 1 is a system block diagram for carrying out a program execution control method according to the embodiment of the present invention, FIG. 2 is an explanatory diagram of a program module, and FIG.
5 and 4 are explanatory diagrams schematically showing the work area in the RAM, FIGS. 5 to 8 are flowcharts of the preparation operation of the CPU in response to instructions for program execution control, and FIG.
This figure is a flowchart showing a control operation for transferring execution between program modules, and FIG. 1O is a flowchart showing a search routine for a designated line when jumping to another line number with a basic statement. ! ...CPU, 2...ROM, 3...RAM, 4
...Expansion ROM 0 Figure 1 (Figure 077 of implementation column) Figure 2 (Figure 318 of program module) Figure 3 (S front diagram of the wharf area in RAM) Figure 4 (RAM Figure 10 Figure 6 (70-+ yards of command statement ■) Figure 7 (Flowchart of command statement ■) Figure 8 (Command statement ■) Sentence ■ flowchart)

Claims (1)

【特許請求の範囲】[Claims] (1)行番号のある高級言語において、完成された一つ
のプログラムモジュールに対して、そのモジュールを構
成する命令文の一部を他の命令文に置換するためのプロ
グラムモジュールを別個に作成し、これらの各プログラ
ムモジュールに対して固有のラベルを付すとともに、置
換前後の対応する命令文の少なくとも一つの行番号を共
通に指定しておき、 プログラム実行時に一方のラベルから他方のラベルへの
移動命令がある際にソフト割り込みをかけて、置換前の
プログラムモジュール内に置換後のプログラムモジュー
ルに該当する共通の行番号が存在するか否かを判別し、
該当する行番号が存在するときに当該置換用のプログラ
ムモジュールに制御を引き渡し、そのプログラムモジュ
ールの実行後に元のプログラムモジュールに制御を戻す
ことを特徴とするプログラム実行制御方式。
(1) In a high-level language with line numbers, for one completed program module, create a separate program module for replacing part of the imperative statements that make up that module with other imperative statements, A unique label is attached to each of these program modules, and at least one line number of the corresponding statement before and after replacement is commonly specified, and a movement instruction from one label to the other label is used when the program is executed. When a program module is replaced, a soft interrupt is generated to determine whether or not there is a common line number corresponding to the program module after replacement in the program module before replacement.
A program execution control method characterized by passing control to a replacement program module when a corresponding line number exists, and returning control to the original program module after the program module is executed.
JP62102500A 1987-04-24 1987-04-24 Program execution control system Pending JPS63268031A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP62102500A JPS63268031A (en) 1987-04-24 1987-04-24 Program execution control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP62102500A JPS63268031A (en) 1987-04-24 1987-04-24 Program execution control system

Publications (1)

Publication Number Publication Date
JPS63268031A true JPS63268031A (en) 1988-11-04

Family

ID=14329127

Family Applications (1)

Application Number Title Priority Date Filing Date
JP62102500A Pending JPS63268031A (en) 1987-04-24 1987-04-24 Program execution control system

Country Status (1)

Country Link
JP (1) JPS63268031A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002501269A (en) * 1998-01-22 2002-01-15 モンデックス インターナショナル リミテッド Codelet
WO2007114513A1 (en) * 2006-03-31 2007-10-11 Canon Kabushiki Kaisha Information processing apparatus and data output managing system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS57751A (en) * 1980-05-30 1982-01-05 Sharp Corp Computer with program editing function

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS57751A (en) * 1980-05-30 1982-01-05 Sharp Corp Computer with program editing function

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002501269A (en) * 1998-01-22 2002-01-15 モンデックス インターナショナル リミテッド Codelet
WO2007114513A1 (en) * 2006-03-31 2007-10-11 Canon Kabushiki Kaisha Information processing apparatus and data output managing system
JP2007272763A (en) * 2006-03-31 2007-10-18 Canon Inc Module installation method and device
US8627343B2 (en) 2006-03-31 2014-01-07 Canon Kabushiki Kaisha Information processing apparatus and data output managing system

Similar Documents

Publication Publication Date Title
US4712189A (en) Table driven translator
EP0324308A2 (en) Method and system for decoding plural incompatible format instructions
CN101730881A (en) System comprising a plurality of processors and methods of operating the same
EP0333612A2 (en) Multi-language program
JPS63268031A (en) Program execution control system
US5136698A (en) Method for selective back-tracking in a hierarchical system containing a flag which indicates the validity of a choice-point
US6546332B2 (en) Vehicle-mounted navigation apparatus
EP0361434A2 (en) Display emulating system
US4008461A (en) Apparatus for correcting and adding data to that taken from a mechanical data carrier
US6311266B1 (en) Instruction look-ahead system and hardware
JPS59114602A (en) Programmable controller
JP3328686B2 (en) Programmable controller
JPS63288357A (en) Data editing system
JPS6126695B2 (en)
JPS6356728A (en) Execution system for program correction
JPH0344328B2 (en)
JPH04233006A (en) Programmable controller
JP2570959B2 (en) Data processing device
JP2506591B2 (en) Auxiliary processor
JPH03142775A (en) Stack controlling apparatus and method
JPS6325372B2 (en)
JPS61216039A (en) System for generating and controlling program
JPS6365541A (en) Automatic display system for program in fault
JPS63214806A (en) Programmable controller
JPH0695868A (en) Software management system