JPH054043Y2 - - Google Patents
Info
- Publication number
- JPH054043Y2 JPH054043Y2 JP1985030917U JP3091785U JPH054043Y2 JP H054043 Y2 JPH054043 Y2 JP H054043Y2 JP 1985030917 U JP1985030917 U JP 1985030917U JP 3091785 U JP3091785 U JP 3091785U JP H054043 Y2 JPH054043 Y2 JP H054043Y2
- Authority
- JP
- Japan
- Prior art keywords
- program
- operator
- data
- address
- error
- 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
Links
Landscapes
- Calculators And Similar Devices (AREA)
- Input From Keyboards Or The Like (AREA)
- Debugging And Monitoring (AREA)
Description
〔考案の技術分野〕
この考案はプログラム計算機に関する。
〔従来技術〕
従来、プログラム計算機により、例えば
PO:√ (1−2)
というような数式エラーを起すプログラムを実行
した場合(なお、POはプログラム番号を示す)、
使用者がエラーの発生に気づいて、カーソルキー
などを操作してエラー個所を表示させようとする
と、本来のエラー個所「√ 」に替つてエラー個
所ではない「)」の個所が点滅表示するようにな
つていた。
これは現在の実行ポインタの内容によつてエラ
ー個所を指示するためであり、即ち、括弧内の1
−2の演算を先に実行してその後√ 計算を行う
ため、実行ポインタは閉じ括弧「)」の位置にき
ているためである。
〔従来技術の問題点〕
そのため、本来のエラー個所が表示されないか
ら複雑な計算式の場合にはエラー個所を探すため
に余計な時間がかかるという問題がある。
〔考案の目的〕
この考案は、プログラム実行時に発生したエラ
ー個所の演算子を指示表示でき、プログラムのデ
パツク等が速かに行えるようにしたプログラム計
算機を提供することを目的とする。
〔考案の要点〕
この考案の要点は演算子をスタツクすると共
に、その演算子のプログラム内におけるアドレス
を演算子とペアにしてスタツクし、スタツクされ
た演算子による計算によつてエラーが生じた場合
には、その演算子とペアで記憶されたアドレスに
基づいて、計算式中の当該演算子を特殊態様で表
示させるようにしたことである。
〔実施例〕
以下、図面を参照して一実施例を説明する。第
1図において、キー入力部1にはテンキー1A、
小数点キー1B、イコールキー1C、+、−、×、÷
の四則演算キー1D、クリアキー1E、オールク
リアキー1F、右括弧キー1G、左括弧キー1
H、√ キー1I、エラー解除キー、演算実行の
RUNキー1K1J等が設けられている。そして
各キーの出力は制御部2に入力して処理される。
この制御部2はこの計算機全体の動作を制御す
る制御プログラムを記憶し、回路内の各部に制御
命令を与える。なお、演算部6がジヤツジ演算を
実行したときの結果データDATAは制御部2に
送られて次の制御命令の読出しに利用される。
キー入力部1から入力された数値データは制御
部2を介しXレジスタ3、Yレジスタ4、Zレジ
スタ5のうちのXレジスタ3に書込まれ、更に演
算部6に送られ、演算に利用される。そして演算
にエラーが発生すれば演算部6は制御部2にエラ
ー信号を送る。また表示データがセツトされるX
レジスタ3のその表示データは表示制御部7を介
し表示部8に送られて表示される。
また、図中9はプログラムRAM(ランダムア
クセスメモリ)であり、制御部2がインクリメン
ト動作させるプログラムカウンタ10によりアド
レスされて数式計算のためのプログラムデータが
キー入力部1のキー操作等によつて書込まれる。
そしてこのプログラムデータは演算部6に送られ
て実行されるが、その実行時にそのプログラム中
の演算子と、その演算子の上記プログラム中のア
ドレスがペアにして夫々、フアンクシヨンスタツ
ク(FS)11、ポインタスタツク(PS)12に
夫々セツトされる。また上記プログラムの実行時
にエラーが発生するとそのエラーを起した演算子
のアドレスがエラーポインタ(EP)13にセツ
トされる。そしてエラー解除キー1Jを操作する
とプログラムRAM9内のプログラムデータが表
示部8に転送されて表示されると共に、エラーポ
インタ13内のアドレスにもとづいて表示部8に
エラーを起した演算子の下にカーソルが点滅表示
される。
また上記ペアになつているフアンクシヨンスタ
ツク11とポインタスタツク12とは、制御部2
によつて1づつインクリメント(プラス、マイナ
ス)されるスタツクカウント(SC)14によつ
てアドレス指定される。
次に第2図ないし第6図を参照して動作を説明
する。
先ず、キー入力部1のキー操作によつてプログ
ラムデータをRAM9に書込む。この場合、
RAM9は制御部2によつてインクリメントされ
るプログラムカウンタ10によつてアドレスさ
れ、上記プログラムデータを書込むまれるが、こ
の書込み中、このプログラムデータは表示部8に
も送られて表示される。そしていま、第4図に示
すようなエラーを含んだプログラム
√ (1−2)
をプログラムナンバ″0″のプログラムPOとして書
込んだものと仮定する。そしてRANキー1Kを
操作すると、第2図A,Bのフローチヤートに示
す処理がスタートし、演算が実行される。なお、
第4図に示すように、上記プログラムはRAM9
の0〜5番地までに書込まれたものとする。
演算が開始されると、先ずステツプA1の処理
によりSC14、RC10がクリアされる。次にス
テツプAではRAM9の0番地のデータ「√ 」
がZレジスタ5に転送される。そしてその内容が
数値か、演算子か、コードなし(データなし)か
が判断され(ステツプA3)、そしてこの場合演算
子であるからステツプA5に進み、演算の優先順
次(括弧内は優先)が判断される。この場合は優
先ではないからステツプA6に進んでFS11の0
番地に演算子「√ 」がセツトされる(第6図
1,2の状態)。
次にステツプA7によりPC10のデータ「0」
がPS12の0番地にセツトされ、次いでステツ
プA8によりSC14が+1されて「01」となり、
またステツプA13によつてPC10も+1されて
「1」となり、ステツプA2に戻る。
次にRAM9の1番地のデータ「(」がZレジ
スタ5にセツトされ、ステツプA3,A5を介しス
テツプA6に進んで第6図3の状態になる。
次にステツプA7、A8,A13によりS12にデー
タ「01」、SC14に「02」、PC10に「02」が
夫々セツトされ、ステツプA2に戻る。
そしてZレジスタ5にRAM9の2番地のデー
タ「1」がセツトされ、ステツプA3からステツ
プA4に進んで演算部6において演算処理が実行
され、ステツプA13に進んでPC10に「03」とな
り、ステツプA2に戻る。そしてZレジスタ5に
RAM9の3番地のデータ「−」がセツトされ、
ステツプA3,A5からA6に進み、FS11の2番地
にデータ「−」がセツトされ、またステツプA7,
A8,A13によりPS12の2番地にデータ「03」
が、SC14に「03」が、PC10に「04」が夫々
セツトされ、第6図4の状態になつてステツプ
A2に戻る。
次にステツプA2によりZレジスタ5にRAM9
の4番地のデータ「2」がセツトされ、更にステ
ツプA3,A4,A13が実行されてPC10は「05」
となり、ステツプA2に戻る。
次にステツプA2ではZレジスタ5にRAM9の
5番地のデータ「)」がセツトされ、ステツプ
A3,A5,A6によりFS11の3番地にデータ「)」
がセツトされる。更にステツプA7,A8,A13によ
りPS12の3番地にデータ「05」が、SC14に
「04」、PC10に「06」が夫々セツトされ、ステ
ツプA2に戻る。
次にステツプA2ではZレジスタ5にデータ
「0」(コードなし)がセツトされ、したがつてス
テツプA3後はステツプA15に進み、SC14が−
1されて「03」となり、次にステツプA16ではZ
レジスタ5にFS11の3番地のデータ「)」がセ
ツトされ、ステツプA17を介しステツプA18に進
んでEP13にPS12の3番地のデータ「04」が
セツトされる。そしてステツプA19に進むがいま
は「)」だけなので演算は行わず、ステツプA15
に戻る。
そこでSC14が−1されて「02」となり、ス
テツプA16ではZレジスタにデータ「−」がセツ
トされる。そのためステツプA17,A18,A19では
EP13にデータ「03」がセツトされ、ステツプ
A15に戻り、SC14が「01」となる。
次にステツプA16ではZレジスタ5にデータ
「(」がセツトされ、ステツプA17,A18,A19の実
行により「1−2」の演算が実行され、結果デー
タ「−1」がXレジスタ3にセツトされる。ま
た、EP13には「01」がセツトされ、ステツプ
A15に戻り、SC13は「00」となる。
次にステツプA16では、Zレジスタ5にデータ
「√ 」がセツトされ、ステツプA17を介しステ
ツプA18に進むと、EP13にデータ「00」がセツ
トされ、次いでステツプA19では√ −1の演算
が実行されるためエラーとなつてステツプA21に
進み、表示部8にエラー表示(例えば「E」の表
示)がなされ、終了する。
そこでエラー解除キー1Jを操作すると、第3
図のフローチヤートに示す処理がスタートし、ス
テツプB1によりRAM9の0〜5番地内の数式デ
ータが続出されて表示部8に送られ、表示され
る。次いでEP13のデータ「00」にもとづき、
0桁目のデータ「√ 」の下にカーソルが第5図
に示すように点滅され、エラーを起した演算子が
表示される。
第2図A,B中のステツプA9〜A12,A20は説
明しなかつたが、これはエラーを発生しない計算
式であつて例えば、
1×2+3=5
というような、先に順位の高い×のような演算子
がスタツクされている場合に実行される。そし
て、この考案の要旨は直接関係しないので、簡単
にその動作をZレジスタ5にセツトされるデー
タ、SC14,PC10の内容の変化を次に示す
と、
[Technical field of invention] This invention relates to a program computer. [Prior Art] Conventionally, when a program calculator runs a program that causes a mathematical error such as PO:√ (1-2) (where PO indicates the program number),
When the user notices that an error has occurred and tries to display the error location by operating the cursor keys, a non-error location ")" will be displayed blinking instead of the original error location "√". I was getting used to it. This is to indicate the error location by the contents of the current execution pointer, that is, the 1 in parentheses.
This is because the -2 operation is performed first and then the √ calculation is performed, so the execution pointer is at the closing parenthesis ")". [Problems with the Prior Art] Therefore, since the actual error location is not displayed, there is a problem in that it takes extra time to search for the error location in the case of a complicated calculation formula. [Purpose of the invention] The object of this invention is to provide a program computer that can indicate the operator at the location of an error that has occurred during program execution, and can quickly unpack the program. [Key Points of the Invention] The key point of this invention is to stack operators, pair the address of the operator in the program with the operator, and stack the operators, so that if an error occurs in a calculation using the stacked operators, Specifically, the operator in the calculation formula is displayed in a special manner based on the address stored in pair with the operator. [Example] An example will be described below with reference to the drawings. In FIG. 1, the key input section 1 includes a numeric keypad 1A,
Decimal point key 1B, equal key 1C, +, -, ×, ÷
Four arithmetic operation keys 1D, clear key 1E, all clear key 1F, right parenthesis key 1G, left parenthesis key 1
H, √ key 1I, error release key, calculation execution
RUN keys 1K1J, etc. are provided. The output of each key is then input to the control unit 2 and processed. This control section 2 stores a control program for controlling the operation of the entire computer, and gives control instructions to each section within the circuit. Note that the result data DATA obtained when the calculation section 6 executes the difference calculation is sent to the control section 2 and used for reading the next control command. Numerical data input from the key input unit 1 is written to the X register 3 of the X register 3, Y register 4, and Z register 5 via the control unit 2, and is further sent to the calculation unit 6 where it is used for calculations. Ru. If an error occurs in the calculation, the calculation section 6 sends an error signal to the control section 2. Also, the display data is set
The display data in the register 3 is sent to the display section 8 via the display control section 7 and displayed. 9 in the figure is a program RAM (random access memory), which is addressed by a program counter 10 that is incremented by the control unit 2, and program data for formula calculation is written by key operations on the key input unit 1. be included.
This program data is then sent to the arithmetic unit 6 and executed, but at the time of execution, the operator in the program and the address of that operator in the program are paired and stored in the function stack (FS). 11 and pointer stack (PS) 12, respectively. Further, if an error occurs during execution of the above program, the address of the operator that caused the error is set in the error pointer (EP) 13. When the error release key 1J is operated, the program data in the program RAM 9 is transferred to the display section 8 and displayed, and the cursor is placed under the operator that caused the error on the display section 8 based on the address in the error pointer 13. is displayed blinking. The function stack 11 and pointer stack 12, which are paired together, are connected to the control unit 2.
It is addressed by a stack count (SC) 14 which is incremented (plus, minus) by one. Next, the operation will be explained with reference to FIGS. 2 to 6. First, program data is written into the RAM 9 by operating the keys on the key input section 1. in this case,
The RAM 9 is addressed by a program counter 10 which is incremented by the control section 2, and the program data is written therein. During this writing, this program data is also sent to the display section 8 and displayed. Assume now that a program √ (1-2) containing an error as shown in FIG. 4 is written as a program PO with program number "0". When the RAN key 1K is operated, the processing shown in the flowcharts of FIGS. 2A and 2B starts and calculations are executed. In addition,
As shown in Figure 4, the above program runs on RAM9.
It is assumed that the data is written to addresses 0 to 5 of . When the calculation is started, first, SC14 and RC10 are cleared by the process of step A1 . Next, in step A, data “√” at address 0 of RAM9
is transferred to Z register 5. Then, it is determined whether the content is a numeric value, an operator, or no code (no data) (step A 3 ), and since it is an operator in this case, the process proceeds to step A 5 , in order of priority of operations (the numbers in parentheses are ) is determined. In this case, it is not a priority, so proceed to step A 6 and 0 in FS11.
The operator "√" is set at the address (states 1 and 2 in FIG. 6). Next, in step A7 , the data on PC10 is set to “0”.
is set to address 0 of PS12, and then SC14 is incremented by +1 in step A8 to become "01".
Further, in step A13 , PC10 is also incremented by +1 to become "1", and the process returns to step A2 . Next, data "(" at address 1 of RAM 9 is set in Z register 5, and the process proceeds to step A6 via steps A3 and A5 , resulting in the state shown in FIG. 6.3.Next, steps A7 and A8 , A13 sets data "01" in S12, "02" in SC14, and "02" in PC10, and returns to step A2.Then, data " 1 " at address 2 of RAM9 is set in Z register 5. , the process proceeds from step A 3 to step A 4 where arithmetic processing is executed in the arithmetic unit 6, proceeds to step A 13 , where "03" is written to the PC 10, and the process returns to step A 2. Then, the Z register 5 is
Data “-” at address 3 of RAM9 is set,
Proceeding from steps A3 and A5 to A6 , data "-" is set at address 2 of FS11, and step A7 ,
Data “03” is placed at address 2 of PS12 by A 8 and A 13 .
However, "03" is set to SC14, "04" is set to PC10, and the state shown in Fig. 6-4 is reached.
Return to A2 . Next, in step A2 , RAM9 is stored in Z register 5.
The data “2” at address 4 is set, and steps A 3 , A 4 , and A 13 are executed, and the PC 10 becomes “05”.
Then, return to step A2 . Next, in step A2 , data ")" at address 5 of RAM9 is set in Z register 5, and step
Data ")" is placed at address 3 of FS11 by A 3 , A 5 , and A 6
is set. Further, in steps A7 , A8 , and A13 , data "05" is set in address 3 of the PS 12, "04" in the SC14, and "06" in the PC 10, respectively, and the process returns to step A2 . Next, in step A2 , data "0" (no code) is set in the Z register 5, so after step A3 , the process advances to step A15 , and SC14 is -
1 and becomes "03", then step A 16 becomes Z
Data ")" at address 3 of FS11 is set in register 5, and the process advances to step A18 via step A17 , where data "04" at address 3 of PS12 is set in EP13. Then proceed to step A 19 , but since there is only ")", no calculation is performed, and step A 15
Return to Then, SC14 is incremented by 1 to become "02", and in step A16 , data "-" is set in the Z register. Therefore, in steps A 17 , A 18 , and A 19
Data “03” is set in EP13, and the step
Return to A 15 and SC14 becomes "01". Next, in step A16 , the data "(" is set in the Z register 5, and the operation "1-2" is executed by executing steps A17 , A18 , and A19 , and the resultant data "-1" is stored in the X register. It is set to 3. Also, “01” is set to EP13, and the step
Returns to A 15 , and SC13 becomes "00". Next, in step A16 , data "√" is set in the Z register 5, and when the process proceeds to step A18 via step A17 , data "00" is set in EP13, and then in step A19 , the data "√" is set in the Z register 5. Since the calculation is executed, an error occurs and the process proceeds to step A21 , where an error display (for example, "E") is displayed on the display section 8, and the process ends. Then, if you operate the error release key 1J, the third
The process shown in the flowchart of the figure starts, and in step B1 , the mathematical formula data in addresses 0 to 5 of the RAM 9 are successively output and sent to the display section 8, where they are displayed. Next, based on the data “00” of EP13,
The cursor blinks under the 0th digit data "√" as shown in FIG. 5, and the operator that caused the error is displayed. I have not explained steps A 9 to A 12 and A 20 in Figures 2A and B, but this is a calculation formula that does not cause an error. Executed when operators such as high x are stacked. Since it is not directly related to the gist of this invention, the operation will be briefly described below with changes in the data set in the Z register 5 and the contents of SC14 and PC10.
この考案は以上説明したように、プログラム実
行の際に演算子をスタツクすると共に、その演算
子のプログラム内におけるアドレスを演算子とペ
アにしてスタツクし、スタツクされた演算子によ
る計算でエラーを生じた場合には、演算子ととも
に記憶されたアドレスによつて当該演算子を特殊
態様で表示するようにしたプログラム計算機であ
るから、プログラムの実行時にエラーを起した演
算子が簡単に分かり、プログラムのデパツク等が
速やかに行える利点がある。
As explained above, this idea stacks operators when executing a program, pairs the address of the operator in the program with the operator, and stacks the operators, causing errors in calculations using the stacked operators. If a program error occurs, the program computer is designed to display the operator in a special manner based on the address stored with the operator, so it is easy to identify the operator that caused the error when the program was executed, and to correct the program. There is an advantage that depacking can be done quickly.
第1図はこの考案の一実施例のプログラム計算
機の回路図、第2図A,B、第3図はフローチヤ
ートの図、第4図はプログラムRAM9に書込ま
れた数式例を示す図、第5図はエラーを起したと
きの表示例を示す図、第6図は各部の状態変化を
示す図である。
1……キー入力部、1J……エラー解除キー、
1K……RANキー、2……制御部、3,4,5
……レジスタ、8……表示部、9……プログラム
RAM、10……プログラムカウンタ、11……
フアンクシヨンスタツク、12……ポインタスタ
ツク、14……スタツクカウンタ。
FIG. 1 is a circuit diagram of a program computer according to an embodiment of this invention, FIGS. 2A and B, and 3 are flowcharts, and FIG. 4 is a diagram showing an example of a mathematical formula written in the program RAM 9. FIG. 5 is a diagram showing an example of a display when an error occurs, and FIG. 6 is a diagram showing changes in the status of each part. 1...Key input section, 1J...Error release key,
1K...RAN key, 2...Control unit, 3, 4, 5
...Register, 8...Display section, 9...Program
RAM, 10...Program counter, 11...
Function stack, 12... pointer stack, 14... stack counter.
Claims (1)
次アドレスするプログラムカウンタを有し、上記
プログラムメモリに記憶された計算式を表わすキ
ーデータをプログラムカウンタに従つて順次読出
し、キーデータに基づいて計算を行うプログラム
計算機において、 演算子と演算子のアドレスを記憶するスタツク
メモリと、 上記読出されたキーデータが演算子である場合
に、優先順位を判断したうえで、演算子と当該演
算子のプログラムメモリ中におけるアドレスとを
上記スタツクメモリに記憶させる書込手段と、 上記スタツクメモリに記憶された演算子を用い
た計算によりエラーが発生した場合、上記計算式
を表示するとともに上記スタツクメモリに記憶さ
れた当該演算子のアドレスに基づいてエラーが発
生した演算子を特殊態様で表示させるエラー表示
手段と を具備したことを特徴とするプログラム計算
機。[Claims for Utility Model Registration] It has a program memory and a program counter that sequentially addresses the program memory, and reads key data representing a calculation formula stored in the program memory sequentially according to the program counter, In a program calculator that performs calculations, there is a stack memory that stores operators and the addresses of the operators, and if the key data read above is an operator, the operator and the operator are stored after determining the priority order. a writing means for storing an address in the program memory in the stack memory; and if an error occurs in calculation using the operators stored in the stack memory, displaying the calculation formula and displaying the corresponding address stored in the stack memory; A program calculator comprising: error display means for displaying an operator in which an error has occurred based on the address of the operator in a special manner.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP1985030917U JPH054043Y2 (en) | 1985-03-06 | 1985-03-06 |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP1985030917U JPH054043Y2 (en) | 1985-03-06 | 1985-03-06 |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS61147451U JPS61147451U (en) | 1986-09-11 |
| JPH054043Y2 true JPH054043Y2 (en) | 1993-02-01 |
Family
ID=30531044
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP1985030917U Expired - Lifetime JPH054043Y2 (en) | 1985-03-06 | 1985-03-06 |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH054043Y2 (en) |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS5676830A (en) * | 1979-11-29 | 1981-06-24 | Canon Inc | Electronic computer |
-
1985
- 1985-03-06 JP JP1985030917U patent/JPH054043Y2/ja not_active Expired - Lifetime
Also Published As
| Publication number | Publication date |
|---|---|
| JPS61147451U (en) | 1986-09-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JPS60262204A (en) | Programmable controller | |
| JPS60237535A (en) | Command input control system | |
| US5886910A (en) | Computer with a check function | |
| JPS6145268B2 (en) | ||
| JP2985965B2 (en) | Factorization device | |
| JPS59214907A (en) | Programmable controller | |
| JPH0155496B2 (en) | ||
| JP3567576B2 (en) | Electronic computer | |
| JPS6145550Y2 (en) | ||
| JPH0578056B2 (en) | ||
| JPH063468Y2 (en) | Small electronic calculator | |
| JP2605664B2 (en) | Small electronic calculator | |
| JPH0426919Y2 (en) | ||
| JPH021627Y2 (en) | ||
| JP2561130Y2 (en) | Distributed control system | |
| JP2526181Y2 (en) | Small electronic calculator | |
| JPH0610433Y2 (en) | Small electronic calculator | |
| JPS6113623B2 (en) | ||
| JPS594351Y2 (en) | cash register machine | |
| JPH0555245U (en) | Small electronic calculator | |
| JPS6113269B2 (en) | ||
| JPS6216715Y2 (en) | ||
| JPS63268025A (en) | Operation guidance display method | |
| JPH0555244U (en) | Small electronic calculator | |
| JPS6314370B2 (en) |