8048: make DBF a context register

See GH #2423

The SEL MB0/MB1 opcodes set a DBF register but this had no effect, therefore JMP and CALL
destinations didn't take into account DBF.
This is essentially @esaulenka 's patch from
3756e1bcee

but separated from the DFB->DBF typo change, and sets the width of the new
context register to be 1 bit (doesn't need to be 2 bits)

This greatly improves analysis. The only downside is that to manually
override DBF on a single instruction, it needs to be cleared first, then
disassembled again after setting the desired DBF.
This commit is contained in:
fenugrec 2022-12-10 22:29:43 -05:00 committed by ghidorahrex
parent 7c2b8ca27d
commit 3fbf16b056

View File

@ -28,8 +28,12 @@ define register offset=0x00 size=1 [ A SP ];
define register offset=0x10 size=1 [ R0 R1 R2 R3 R4 R5 R6 R7 ];
@endif
define register offset=0x20 size=2 [ PC ];
define register offset=0x30 size=1 [ C AC F0 F1 BS DBF ]; # single bit
define register offset=0x30 size=1 [ C AC F0 F1 BS ]; # single bit
define register offset=0x80 size=4 bankreg;
define context bankreg
DBF=(0,0)
;
################################################################
# Tokens
@ -510,9 +514,9 @@ RniI: Imm is Imm {
:RRC A is ophi=6 & oplo=7 & A {
rotc(A&1, (A>>1)|(C<<7));
}
:SEL dbf is (ophi=14 | ophi=15) & oplo=5 & dbf {
DBF = dbf;
}
:SEL dbf is (ophi=14 | ophi=15) & oplo=5 & dbf
[ DBF=dbf; globalset(inst_next,DBF); ]
{}
:SEL bs is (ophi=12 | ophi=13) & oplo=5 & bs {
setbank(bs);
}