开发者

clock on pdp-11

I'm a little bit confused about simple program which I wrote, can You please explain why it quits after printing only one character, I expected it will print me character every 5 seconds, thanks in advance

tks = 177560
tkb = 177562
tps = 177564
tpb = 177566
lcs = 177546
. = torg + 2000

main:   mov #main, sp

开发者_运维百科        mov #clock, @#100  ; vector interrupt of the clock 100-102
        mov #300, @#102    ; 

        mov #100, @#lcs    ; here I enable interrupt-enable of the clock

prog:   clr r0             ; here endless loop
        beq prog
        halt

clock:  inc count
        cmp count, timeout
        bne clk_end
        clr count
        mov #'*, @#tpb
clk_end:rti

. = torg + 3000
timeout: .word 300000
count: .word 0


This is surely a simulator-related problem, since I tried to run you code, and it works fine!

Are you by chance a student at the Technion?


I'm not familiar with the PDP-11, but I have written interrupt code for other processors. On other processors, the behavior you describe could occur if the flags register isn't saved by the interrupt routine. If an interrupt occurred between the two instructions clr r0 and beq prog, and the interrupt handler cleared the equal bit in the flags register, it would cause the behavior that you describe.

Again, I'm not familiar with PDP-11 assembler, but you might try saving the state of the flags register when you enter the interrupt routine, and restoring it just before the rti instruction. Perhaps using the PDP-11 equivalent of the 80x86 push instruction.


I think the mode for the clock should not be 0 but 1, Load it with 110 instead of 100. See KW11-P programmable real time clock manual.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜