据我所知,这是您的原始代码:
.org 9D95h
nop
nop
nop
nop
ld c, 09h ; ???
ld a, 0 ; ???
rst 28h ; \
.db 5Dh ; > DispTail, destroys AF, BC, DE, HL, aka
.db 49H ; / undefined behaviour in this case (we don't
; know what A contains)
ld b, 80h ; B <- 0x80
xor b ; A <- A XOR B
bit 0, a ; A[0] == 0, Z is set, if so
loop: rrc a ; rotate right A, C <- A[0]
jp z, 9D95h ; Jump to 9D95, if Z set
djnz loop ; Decrease B, jump if not zero to loop
ret ; After 128 jumps, returns
所以总而言之,他们的关键代码检查部分从一开始就是不正确的(调用错误的 ROM 调用并且过于复杂)。这似乎有效:
.org 9D95h
rst 28h ; \
.db 72h ; > Call GetKey, A <- key code
.db 49h ; /
cp 80h ; Compare A with immediate value 0x80 (subtract),
; key code for [+] is 0x80
jp nz, 9D95h ; Jump if Z is not set (was not 0x80)
ret ; return
或十六进制:
EF 72 49 FE 80 C2 95 9D C9