pbfy0 / nspire-z80

TI-84 emulator for the TI-Nspire
18 stars 2 forks source link

Help #2

Open luca1s opened 6 years ago

luca1s commented 6 years ago

I have loaded a ti 84 plus se rom with extension .8rom and it works in an other emulator, however it just shows a white and gray square?

pbfy0 commented 6 years ago

Can you try with the new version that I just posted? Some roms won't start up on their own; you need to press the power button first.

fghsgh commented 6 years ago

Pressing the power button doesn't do anything, it stays on a white screen. As far as I can see, you are not checking for the [HOME] key (which is labeled ON) anywhere so I don't know how it should even work. The only occurrence of KEY_NSPIRE_HOME is in interrupt.c and that is commented out, and you know that the ON key can also be read on 84 from port 04 bit 3, right? Am I just being stupid and missing something here?

EDIT: I am using a TI-84+ non-SE rom and had to change the defines like you said in the other (closed) issue, but there was no mmap.c/o file, so I changed it in mmu_mmap.c, and that seemed to work. "That seemed to work" means: it doesn't freeze anymore on start and I can exit with ESC. Calc still doesn't turn on though.

EDIT2: I tried everything on version 0.10.2 (the one that was in releases)

EDIT3: one little question: does it map the nspire USB port to the 84 USB port? That would be useful as all my classmates have regular 84 plusses.

EDIT4: how about making a readme with some info like the default key mapping and a warning to change the FLASH_SIZE and BOOT_PAGE for non-SE?

EDIT5: if it's useful, I have a nspire cx HW-AB (and the 84+ of which I tried the rom)

luca1s commented 6 years ago

I have REV. AB as well

pbfy0 commented 6 years ago

@fghsgh I have not mapped the USB port. That's theoretically possible, but quite a lot of effort.

As it turns out, the On key is connected differently from all other keys, at least on my hardware. KEY_NSPIRE_HOME (or KEY_NSPIRE_ON) always reads false on my early hardware Nspire. I'm reading from the memory address described on hackspire.org (0x900B0028) to get the state of the nspire on key, and that works on my hardware. It's possible that that behavior changed in later hardware revisions. z_interrupt.c contains the code that reads the actual state of the On key.

I've never tested the emulator with non-SE roms; I don't own any calculators other than the Nspire. I'll do some tests with a base 84+ rom and see if it works; I could also throw together a test program to see whether my logic is able to detect the on key press on your calculator.

pbfy0 commented 6 years ago

Follow-up: I discovered that there were some extra macro definitions that were messing things up. I've added a better way to compile for different calculator types: run
make CALC_TYPE=type, where type is one of CALC_84PSE, CALC_84P, or CALC_84PCSE (broken). I'll go ahead and upload a 84+ and 84+SE version on the new release.

fghsgh commented 6 years ago

Okay, this time I could compile without having to change any #defines, but the calculator still won't start. Can I do something for you to help with the development? I'll try to find where the ON key is on my calc. I will maybe not succeed in that as I'm quite new to the Nspire world (literally have the calc for 9 days).

And nevermind about the USB port, but how can I put my programs on there? I currently have 100+ on my actual 84+ and my sister will have to borrow that one because she lost her own.

Actually, I see you have uploaded your own pre-compiled release, so just so you know: I tested with one I compiled myself.

pbfy0 commented 6 years ago

It would probably be easier to implement the link port than USB. Unfortunately, your only option for now for transferring files/programs/games is to load the ROM in an emulator in a computer that supports linking, transfer files over there, then use the updated rom file that it makes.

I'd be surprised if the ON key is actually the problem; the roms I've made start up immediately without pressing the button; however, I think all of my test roms use BootFree rather than actual TI boot code. I'll see if I can scrounge up a ROM with TI boot code and see if I'm emulating that correctly.

Edit: I tried a 2.41 84+SE rom with TI boot code; it booted up no problem (without pressing ON) in the emulator. However, I wasn't able to find a 84+ (non SE) rom with TI boot code, so I can't reproduce your exact situation.

fghsgh commented 6 years ago

It's illegal to share ROMs, right? Otherwise I would send you mine.

pbfy0 commented 6 years ago

Unfortunately, it is. When you recompiled after downloading the new version, did you run make clean first? It's possible that old versions of object files stuck around because make didn't recognize mmu_mmap.c as changed. I'd recommend trying my precompiled version, because I have verified that that works with at least some 84+ rooms. Download nspire-z80-84p.tns and rename it to nspire-z80.tns before transferring it over.

fghsgh commented 6 years ago

I actually re-downloaded the source and compiled like that, so I think it should work. I don't have my calculator here so I can't try it like that. Will keep you up-to-date.

fghsgh commented 6 years ago

I tried it on my calc and it still didn't work. Running it in an emulator (HW-W) gave: TI_PM_DIM_disable: Stop dim Timer. main = 0x123edc88 begin mmu_base 0x11330000 section_base=0x12055400 section_base_l=0x12055000 cr1=0005107f cr3=00000003 flash = 0x12424000, ram = 0x12524000 mmu_init done is_hww=1 lcd, cpu, io done flash=0x12424000 end boot So the error is not because it's HW-AB but something is still wrong. When I pressed esc to exit, I had to keep it pressed for several seconds before anything happened on my real calc, but it exited immediately in the emulator and it wrote: PC=e0009c51, rel=00009c51 Uses high ram The PC value on the second to last line was not always the same. Does this mean the Z80's PC got into the RAM (where there are NOPs) and continued?

pbfy0 commented 6 years ago

All that line is telling you is the location of the Z80 PC when the emulator stops. The "uses hi ram" print is unrelated. Can you try to use an 84+ rom generated by WabbitEmu, just to verify that your emulator is acting basically the same as mine? Also, did the emulator show any data aborts? Normally the calculator tries to write to flash during boot, leading to harmless data aborts.

Edit: In addition, the delay is likely due to the real Nspire's flash being slower than it is in the emulator.

fghsgh commented 6 years ago

I think getting a rom from WabbitEmu will be tricky, as I have Linux and AFAIK, WabbitEmu only runs on Windows and Mac. I don't even have a Windows license to use in Virtualbox. What I wrote above is all the program outputted. Is the real flash that much slower? Couldn't you then load the rom to ram? Edit: I found a SE rom on the internet and it worked. It says PROD #: 0A-1-01-01. It made the emulator run really slowly (14-47%) and you could see text being drawn on the screen character-by-character. Then I pressed a key and the emulator froze (the nspire emulator). Edit: It's not frozen. Edit: It is.

pbfy0 commented 6 years ago

nspire-emu/Firebird are very slow if the code has to repeatedly clear cache, which nspire-z80 does. It would run much faster on real hardware; it's not an indication that there's something wrong with the rom or the emulator. The fact that an SE rom works correctly suggests that you're using the wrong version of nspire-z80 for your non-SE rom. My emulator does load the emulator ROM into nspire ram. However, it has to write out the ram and changed parts of rom when it exits, resulting more of a delay on the real calculator than in the emulator.

fghsgh commented 6 years ago

I have double-checked the version I used for the non-SE and it seemed ok. I also noticed that it said Warning (1244a410): Bad read_word: 900b0010 in the debugger of the emulator. Plus, the speed didn't change so no caches are being cleared. Hackspire says: 900B0010 (R/W): ON interrupt mask (1-bit). 1 if ON interrupt should be serviced or 0 if not.

I actually had some problems with some other programs on the HW-AB calc with speed. It checked the keys only every few seconds so I had to keep them pressed for a long time before they got registered. It could be compared with plugging headphones into a 84 in the OS, which makes the interrupt run extremely slowly. I think there are some differences between HW-W and HW-AB which break everything.

Another difference is the fact that the OS version of the SE rom was 2.41. My calculator has 2.55.

If there is any other way I can help you I will happily help.