我在 pdp-11 上有这个代码
tks = 177560
tkb = 177562
tps = 177564
tpb = 177566
lcs = 177546
. = torg + 2000
main: mov #main, sp
mov #kb_int, @#60
mov #200, @#62
mov #101, @#tks
mov #clock, @#100
mov #300, @#102
mov #100, @#lcs
loop: mov @#tks,r2
aslb r2
bmi loop
halt
clock: tst bufferg
beq clk_end
mov #msg,-(sp)
jsr pc, print_str
tst (sp)+
clr bufferg
bic #100,@#tks
clr @#lcs
clk_end:rti
kb_int: mov r1,-(sp)
jsr pc, read_char
movb r1,@buff_ptr
inc buff_ptr
bis #1,@#tks
cmpb r1,#'q
bne next_if
mov #0, @#tks
next_if:cmpb r1,#32.
bne end_kb_int
clrb @buff_ptr
mov #buffer,-(sp)
jsr pc, print_str
tst (sp)+
mov #buffer,buff_ptr
end_kb_int:
mov (sp)+,r1
rti
;#############################
read_char:
tstb @#tks
bpl read_char
movb @#tkb, r1
rts pc
;#############################
print_char:
tstb @#tps
bpl print_char
movb r1, @#tpb
rts pc
;#############################
print_str:
mov r1,-(sp)
mov r2,-(sp)
mov 6(sp),r2
str_loop:
movb (r2)+,r1
beq pr_str_end
jsr pc, print_char
br str_loop
pr_str_end:
mov (sp)+,r2
mov (sp)+,r1
rts pc
. = torg + 3000
msg:.ascii<Something is wrong!>
.byte 0
.even
buff_ptr: .word buffer
buffer: .blkw 3
bufferg: .word 0
有人可以解释一下代码的哪一部分可以改变bufferg(最后一行)吗?提前致谢