简体   繁体   中英

JSRR won't go to outside program in LC3

I seem to be having a problem with LC3 assembly.

I'm trying to jump to a subroutine (in another program, otherwise I'd just use JSR), but instead it just goes through to the next command.

I've tried:

    LD R0, Subpgm
    JSRR R0

and at the bottom, This line to define Subpgm.

    Subpgm .FILL x4000

I expected this to jump to PC x4000, but instead the PC is just incremented by the normal 1.

Any help would be super appreciated!

Here's an example program using the JSRR instruction.

       .ORIG X3000
       LD R0, Subpgm  ; => R0=X4000
       JSRR R0        ; => R7=X3002 PC=X4000
Done   HALT           ; This is at X3002
Subpgm .FILL X4000    ; Address of the 'external' program
       .BLKW X0FFC    ; Fill up the gap between programs
       RET            ; This is at X4000
       .END

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM