1

有人可以帮助解释以下代码。我正在尝试向以下 SIC/XE 程序添加注释,该程序解释了该程序如何计算从 3 开始的前 20 个数字的斐波那契数列。

FIB     START  0
First   LDT    #3       ;start at number 3
        LDS    #20      ;calculate up to 20
        +JSUB  RDREC        ;call read subroutine
        +JSUB  WRREC        ;call write subroutine
LENGTH  RESW   1
.
. SUBROUTINE RDREC
.
RDREC   CLEAR  A        ;set A to zero
LOOP1   TD     INPUT        ;Test input device
        JEQ    LOOP1        ;Loop if device is busy
        RD     INPUT        ;read one byte into register A
        COMPR  A,T      ;Test for end
        JLT    LOOP1        ;jump to loop until end
        COMPR  A,S      ;
        JGT    LOOP1
        STA    LENGTH
        RSUB
INPUT   BYTE   X'F1'
.
.SUBROUTINE WDREC
.
WRREC   LDX    #0
        LDS    #1
        LDA    #0
        LDT    LENGTH
LOOP2   TD     OUTPUT
        JEQ    LOOP2
        WD     OUTPUT
        ADDR   S,A
        STA    VALUE1
        STS    VALUE2
        LDA    VALUE2
        LDS    VALUE1
        TIXR   T 
        JLT    LOOP2
OUTPUT  BYTE   X'05'
VALUE1  RESW   1
VALUE2  RESW   1
        END    FIRST
4

0 回答 0