2006/12/13

還有新功能

首先是兩個 patch:

If plain instructions and procedures are intermixed, procedures will be separated from the instructions. For example,

  add R1, R1, R2
  PROC p
  ; ...
  ENDPROC
  add R1, R1, R3
The instruction executed after "add R1, R1, R2" will be "add R1, R1, R3"; procedure p just get skipped.

Within a procedure, you cannot jump (by executing bp, bz, jr, jl) to labels outside the procedure. You cannot jump (by executing bp, bz, jr, jl) to a procedure label, either.

然後是 extension:

The six ALU instructions add, sub, and, xor, shl, shr may have one of RS and RT be a numeric literal less than or equal to FF. This is for convenient manipulation of RE. The instruction is translated to, for example,

add R1, R2, 3
  lda RF, 3
  add R1, R2, RF
  lda RF 1

The two instructions ldi, sti can also take a special form to simplify access to parameters and local variables.

ldi RX, RY + n    ; n is a non-negative integer
  lda RF, n
  add RF, RY, RF
  ldi RX, RF
  lda RF, 1

ldi RX, RY - n    ; n is a non-negative integer
  lda RF, n
  sub RF, RY, RF
  ldi RX, RF
  lda RF, 1

sti RX, RY + n    ; n is a non-negative integer
  lda RF, n
  add RF, RY, RF
  sti RX, RF
  lda RF, 1

sti RX, RY - n    ; n is a non-negative integer
  lda RF, n
  sub RF, RY, RF
  sti RX, RF
  lda RF, 1

期末 project 做這個好像太簡單了?XD

--
睡個覺,然後與高微最後決戰啦 XD。

Labels: ,

<< 回到主頁