0

I'm trying to do a program for the 68k processor using assembly. And I'm using Easy68k

The main Idea of the program is that a message appears when the reset button is hit along with change in the seven segment.

And another message appears when the level 7 button is hit.

The reset message appears and works perfect, but hitting the level 7 interrupt button doesn't seem to do anything.

Can you please help me find the problem?

Here's the code:

 ORG    $0
    DC.L $00FFFFF0
    DC.L $00000500
    
    ORG $07C
    DC.L $2000
    
    ORG $500
    MOVEA.L #$E00000, A3
    MOVE.L #0, D1
    LEA SEVEN_SEG_CODE, A2
    
    MOVE #13, D0
    LEA START_TEXT, A1
    TRAP #15
    
    BRA START
    
    
    ORG $2000
LEVEL_7_INTERRUPT:
    MOVE    #13, D0
    LEA TEXT1, A1
    TRAP #15
    MOVE #3, D0
    TRAP #15
    BSR DELAY
    MOVE #13, D0
    LEA TEXT2, A1
    TRAP #15
    BSR DELAY
    MOVE.B $E00012, $E00010
    MOVE.B (A2, D1), (A3)
    ADDA.L #2, A3
    BSR DELAY
    ADD.L #1, D1
    RTE
    
    
DELAY:  MOVE.L #1000000, D5
LOOP2:  SUB.L #1, D5
        BNE LOOP2
        RTS
       
       
START_TEXT: DC.B 'WELCOME HARDWARE RESET',$0D,$0A, 0
TEXT1: DC.B 'WELCOME TL7',$0A,$0D, 0
TEXT2: DC.B 'ANOTHER WELCOME TL7',$0A,$0A, 0
SEVEN_SEG_CODE: DC.B %00000000, %11111111, %00000000, %11111111, %00000000, %11111111, %00000000, %11111111, %00000000, %11111111

        ORG $1000

START:                  ; first instruction of program

* Put program code here
        MOVE.L #0, D6
LOOP:   ADD.L #1, D6
        BSR DELAY
        BRA LOOP
    SIMHALT             ; halt simulator

* Put variables and constants here

    END    START        ; last line of source
4

1 回答 1

1

您的程序似乎(有点)正确并且在我的安装中运行良好,至少对于前几个 7 级中断。

您是否在“选项”->“启用异常”中启用了异常处理?

您不应该在 ISR 中做任何耗时的事情——这在中断服务例程中被认为是不好的做法。尤其是“JSR DELAY”调用似乎很危险。通常的做法是在 ISR 中设置一个变量并在主循环中对其进行操作。

于 2022-01-18T22:12:22.813 回答