• 沒有找到結果。

Use ASCII code

N/A
N/A
Protected

Academic year: 2022

Share "Use ASCII code"

Copied!
52
0
0

加載中.... (立即查看全文)

全文

(1)

SIC Assembler 與 Simulator軟 體使用教學

(2)

軟體介紹

„

sicasm

„ SIC assembler

„ sic language program -> object program

„

sicsim

„ SIC simulator

„ 執行object program

(3)

sicasm – SIC assembler

(4)

sicasm – SIC assembler

„

支援SIC

„ 不支援STSW這個指令

„

Use ASCII code

„

External files:

„ Input file: SRCFILE

„ Output file: OBJECT、INTFILE、LISFILE

(5)

sicasm – SIC assembler

--檔案與assembler關係圖

(6)

sicasm – SIC assembler

„ SRCFILE – 攥寫SIC program處

„ Source format(請務必依照此格式寫)

„ Bytes

„ 1-8 label

„ 9 blank

„ 10-15 operation code (or assembler directive)

„ 16-17 blank

„ 18-35 operand

„ 36-66 comment

„ Blank不可以用tab取代,兩者的ASCII code是不同

(7)

sicasm – SIC assembler

„ SRCFILE英文字母為大寫英文字母

(8)

sicasm – SIC assembler

„

OBJFILE –組譯(執行sicasm)後,此處會

產生object program

(9)

sicasm – SIC assembler

„

LISFILE – 列出組譯狀況

(10)

sicasm – SIC assembler

„

當成是有錯,LISFILE會出現錯誤訊息

„ 由於沒有宣告ZERO變數,所以出現找不到 operand的錯誤訊息

(11)

sicasm – SIC assembler

„

INTFILE – 這個檔案列出組譯器組譯過程

中產生的中間處理過程

(12)

sicsim – SIC simulator

(13)

sicsim – SIC simulator

„

支援SIC 和 SIC/XE

„

Main memory size 最大為2FFF(可更改)

„

Use ASCII code

„

External files:

„ Input file: DEV00、DEVF1、DEVF2、

DEVF3

„ Output file: DEV04、DEV05、DEV06、LOG

(14)

sicsim – SIC simulator

--檔案與simulator關係圖

(15)

sicsim – SIC simulator --處理過程

(16)

sicsim – SIC simulator --處理過程

(17)

sicsim – SIC simulator --處理過程

(18)

sicsim – SIC simulator --處理過程

(19)

sicsim – SIC simulator --處理過程

(20)

sicsim – SIC simulator --Input file

„

DEV00: object program of bootstrap

„ 當電腦開機或是重新啟動時,會執行 bootstrap

„ bootstrap的功能為:載入第一個在電腦執行 的程式

„ 通常第一個在電腦執行的程式為OS

„ 而這個simulator處理的工作較為簡單,所以此處 指的是loader

(21)

sicsim – SIC simulator --Input file

„

DEV00: object program of bootstrap

„ 請勿更改內容

(22)

sicsim – SIC simulator --Input file

„

DEVF1: object program of loader

„ loader的功能為:

„ 把要執行的object program載入到memory中

„ 載入完畢後,跳到指定的位址,開始執行載入的 程式

„ 指定的位址通常指程式的起始位址

„ ex.下列範例的起始位址1000

(23)

sicsim – SIC simulator --Input file

„

DEVF1: object program of loader

„ 請勿更改內容

(24)

sicsim – SIC simulator --Input file

„

DEVF2: OBJFILE

„ 攥寫程式經過sicasm.exe組譯出來的object program

(25)

sicsim – SIC simulator --Input file

„

DEVF3:Input device

„ 要輸入程式的input data

(26)

sicsim – SIC simulator --Output file

„

DEV04、DEV05、DEV06:output device

„ 程式要寫出的output data

(27)

sicsim – SIC simulator --Output file

„

LOG: 執行sicsim的過程

(28)

sicsim – SIC simulator

--

執行步驟

„

將OBJFILE內容複製到DEVF2執行 sicsim,出現輸入指令提示

„ 輸入英文字母為大寫英文字母

(29)

sicsim – SIC simulator --執行指令

„

DUMP

„ 顯示register和memory的內容

„ ‘D R’

„ 顯示register

„ ‘D startaddr-endaddr’

„ 顯示memory,位址算法請看下一張

„ startaddr為起始位址

„ endaddr為結束位址

„ Memory顯示範圍最大320bytes

„ ‘D R, startaddr-endaddr ’

(30)

位址算法

(31)

sicsim – SIC simulator

--

執行步驟

„ D R,0-9F

„

顯示register和0000~009F的memory

內容

(32)

sicsim – SIC simulator

--

執行畫面

„ 此時還沒啟動,memory中沒有內容(都還是 預設值F)

(33)

sicsim – SIC simulator --執行指令

„

START

„ 輸入‘S’

„ 將DEV00的bootstrap讀入memory中

(34)

sicsim – SIC simulator

--

執行步驟

„ S

„ D R,0-9F

(35)

sicsim – SIC simulator

--

執行畫面

(36)

sicsim – SIC simulator --執行指令

„

HCOUNT

„ 設定一次執行多少個指令

„ ‘H n’

„ n 為要設定的指令個數

„ Ex. H 50 --> 一次執行50個指令

„ n 值為1~4個十進位的數字

„ 最大值為9999

„ n 預設值為1000

(37)

sicsim – SIC simulator

--

執行步驟

„ H 5000

„ 設定一次執行5000個指令

(38)

sicsim – SIC simulator --執行指令

„

BKPT

„ 設定breakpoint控制指令執行

„ ‘B address’

„ ‘H 5000’ 設定一次執行5000個指令;但執行時可能會 超過所要執行的範圍

„ Ex. 只要執行2000個指令

„ 所以可以設定breakpoint,當執行到breakpoint時,會 暫停執行,出現‘ BREAKPOINT REACHED’訊息

„ 之後繼續按R還是會執行下一個指令,所以可以設 定breakpoint作為debug工具

(39)

sicsim – SIC simulator

--

執行步驟

„ B 00E2

„ 設定00E2是因為,loader做完object program (DEVF2)全部載入memory的停止點

„ 換言之,當遇到第一次的breakpoint就代表已 經把程式全部載入memory中

„ 下一個執行的指令,就開始執行攥寫的程式

(40)

sicsim – SIC simulator --執行指令

„

RUN

„ ‘R’

„ 執行

„ ’R address’

„ 設定下一個要執行的指令起始位址

„ Ex. ‘R 1015’

(41)

sicsim – SIC simulator

--

執行畫面

(42)

sicsim – SIC simulator

--

執行步驟

„ R

„ D R,80-10F

(43)

sicsim – SIC simulator --執行畫面

(44)

sicsim – SIC simulator --執行指令

„

ENTER

„ 輸入register和memory的值

„ ‘E Rn xxxxxx’

„ 輸入值到register;Rn為register identifier (RA, RX, RL, etc.)

„ Register 為3bytes,3bytes的值都要輸入

„ ‘E address xxxx…’

„ 輸入值到memory中,從起始位址開始輸入

„ 不規定要輸入幾個bytes

(45)

sicsim – SIC simulator

--

執行畫面

(46)

sicsim – SIC simulator

--

執行步驟

„ E RA 123456

„

將register A的內容改為123456

„ D R,80-8F

(47)

sicsim – SIC simulator

--

執行畫面

(48)

sicsim – SIC simulator

--

執行步驟

„ E 80 12345678

„

從起始位址80開始輸入值12345678

„ D R,80-8F

(49)

sicsim – SIC simulator

--

執行畫面

(50)

sicsim – SIC simulator --執行指令

„

QUIT

„ 結束使用simulation

„ ‘Q’

(51)

Debug的小方法

„

利用breakpoint

„ Ex.在位址1020,會將register A的值加1,

總共加10次

„ 方法:breakpoint設為1020,觀察每次是否都 將register A的內容加1

(52)

Debug的小方法

„

利用h n

„ 可將n設為1

„ 每次執行1個指令,看register和memory的 變化,是否與程式設定相同

參考文獻

相關文件

Enhancing Creative Use of Language and Promoting Values Education through Reading across the Curriculum (RaC) in the Primary English Classroom (KS2). Project

Incorporated Management Committees should comply with the terms in this Code of Aid and abide by such requirements as promulgated in circulars and instructions issued by the

(b) The Incorporated Management Committee may approve leave of various kinds to teaching and non-teaching staff employed under the Salaries Grant, paid or no-pay, in

(ii) “The dismissal of any teacher who is employed in the school – (a) to occupy a teacher post in the establishment of staff provided for in the code of aid for primary

(ii) “The dismissal of any teacher who is employed in the school – (a) to occupy a teacher post in the establishment of staff provided for in the code of aid for primary

Let us suppose that the source information is in the form of strings of length k, over the input alphabet I of size r and that the r-ary block code C consist of codewords of

➢The input code determines the generator output. ➢Understand the meaning of each dimension to control

• A function is a piece of program code that accepts input arguments from the caller, and then returns output arguments to the caller.. • In MATLAB, the syntax of functions is