I'm working on a port of dosbox on wii (I know, it was already done, but it's for a school project).
To make it go faster, I'm writing a dynrec for powerpc, but I have some trouble with it :
I can make it draw the prompt but I'm unable to write anything with the keyboard, neither mount drive.
I was trying to find out where the problem was, I think the reason is because some callback like 0xd have never been called.
I wonder if someone could help me, I need some information about how key event is triggered (I was unable to find how it works with CBind).
So it works with core=normal but not with core=dynamic, right?
Just disable a bunch of instructions in decoder.h (they'll be handled by
the normal core then) until it works, then see if there's something special
about the instruction that causes trouble.
1gen_mov_word_to_reg (dest_reg=HOST_GPR3, data=0x900038e9, dword=false) 2 at /home/wisk/Projects/dosboxwii/trunk/dosbox/src/cpu/core_dynrec/risc_ppc750.h:225 3225 CACHED(LIS_RT_SI(FC_TMP_REG1, (Bit32u)data >> 16)); 4(gdb) x/x data 50x900038e9: 0x[b]0004[/b]bb40
Am I supposed to do the convertion myself or there is something missing at this line ?
1// fetch a word, val points to the code location if possible, 2// otherwise val contains the current value read from the position 3static bool decode_fetchw_imm(Bitu & val) { 4 if (decode.page.index<4095) { 5 HostPt tlb_addr=get_tlb_read(decode.code); 6 // see if position is directly accessible 7 if (tlb_addr) { 8 [b]val=(Bitu)(tlb_addr+decode.code);[/b] 9 decode_increase_wmapmask(2); 10 decode.code+=2; 11 decode.page.index+=2; 12 return true; 13 } 14 } 15 // not directly accessible, just fetch the value 16 val=decode_fetchw(); 17 return false; 18}
Alright, now dosbox is able to call DOS_21Handler.
This function calls DOS_Execute which returns true so it's OK, but it still doesn't work, for instance : if I execute "INTRO" command, nothing happens.
It works only if dosbox doesn't use dyn_mov_byte_imm and dyn_mov_word_imm (in other word, if I comment 0xb[0-9a-f] cases in decoder.h).
I wonder how dosbox reachs the entrypoint of a program.
BTW Have you a trick to set a breakpoint at the entrypoint of a program (I'm using gdb) ?
BTW Have you a trick to set a breakpoint at the entrypoint of a program (I'm using gdb) ?
What exactly do you want to do, like do you have a debugger-enabled build
that you can run on the wii and you want to put a breakpoint on the target
of int21/4b (program start) for the recompiled code?
If you're using the dosbox debugger along with a recompiling core, be sure
to change
1block=CreateCacheBlock(chandler,ip_point,32);
the 32->1 so breakpoints can be reached at instruction boundaries and not
block boundaries.
What exactly do you want to do, like do you have a debugger-enabled build
that you can run on the wii and you want to put a breakpoint on the target
of int21/4b (program start) for the recompiled code?
That's it.
I set breakpoints at DOS_21Handler and DOS_Execute and PROGRAMS_Handler .
DOS_21Handler is called twice, one time for execution and one time for termination.
DOS_Execute is called with good parameters.
But PROGRAMS_Handler is never called, that's why DOSBox can't mount any drive.
I guess it never set core_dynrec.callback= 6, and I wonder why.
Can you trace this with the dosbox debugger? Like put a bpint at 21 for ah=4b,
then type mount and trace into the call. There should be an sti, the callback
and the iret.
Log the BlockReturn value that you get from runcode, that should have the
Callback type and core_dynrec.callback contains the actual number of the
callback.
Can you trace this with the dosbox debugger? Like put a bpint at 21 for ah=4b,
then type mount and trace into the call. There sh […] Show full quote
Can you trace this with the dosbox debugger? Like put a bpint at 21 for ah=4b,
then type mount and trace into the call. There should be an sti, the callback
and the iret.
Log the BlockReturn value that you get from runcode, that should have the
Callback type and core_dynrec.callback contains the actual number of the
callback.
Because of termcaps, I can't compile DOSBox with debug feather, however I can use gdb.
By "sti" you mean CPU_STI function ?
I set the bp
(gdb) b DOS_21Handler if reg_ah == 0x4b […] Show full quote
I set the bp
(gdb) b DOS_21Handler if reg_ah == 0x4b
Continue
(gdb) c
breakpoint is reached because of mount presents in autoexec.bat
Breakpoint 2, DOS_21Handler () at /home/wisk/Projects/dosboxwii/trunk/dosbox/src/dos/dos.cpp:65
65 if (((reg_ah != 0x50) && (reg_ah != 0x51) && (reg_ah != 0x62) && (reg_ah != 0x64)) && (reg_ah<0x6c)) {
Current language: auto; currently c++
ah is egal to 4b
(gdb) p/x reg_ah
$2 = 0x4b
(gdb) n
Until a exit the function
...
Now we call runcode
we find a call to CPU_RET
Alright, so if I comment all mov (0xb?) in decoder.h, dosbox calls CPU_Interrupt, CPU_STI, PROGRAMS_Handle(the callback), CPU_IRET.
It looks like dyn_mov_byte_imm and dyn_mov_word_imm are broken, do you have an idea about where the problem is ?
Hi,
I tried to build DOSBox for Wii with this file, but if setting cpu to dynamic, dosbox crashes immediately after start. normal mode works.
At first i couldn't compile, because SPR_LE and SPR_CTR are undefined so i #defined it to HOST_GPR11 and 12.
i additionally set the endianess to big endian and made the change mentioned above in decoder_basic.h, but it does not work.
wd, did you already look into the file?
what did i wrong?
wisk, can you give me the whole source code?