News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Text overwriting previous line in menus (WS)  (Read 663 times)


  • Full Member
  • ***
  • Posts: 237
  • Obviously Outdated
    • View Profile
Text overwriting previous line in menus (WS)
« on: September 16, 2018, 09:14:25 am »
Hello! I'm currently working on Digimon: Tag Tamers for WonderSwan.

I've got an issue with new text overwriting the previous line in several sections of the menu. Here's a quick example from the Maps:

In all cases, it *does* write out the full line (which is good), but anything past 10 characters is replaced by letters from the line below it (unless there's nothing below it in the menu).
I'm not quite sure how that works - maybe it allocates the number of characters for each line as it loads them, and then draws everything at once based on what's in memory at the end?

Any thoughts on how I could figure this out and fix it? I assume I'd need to set a read breakpoint at the second map name's pointer (16317C, 4 bytes) and see where it takes me, but if anyone's seen this pattern before and has advice, it'd be appreciated.


  • Sr. Member
  • ****
  • Posts: 420
  • Whore
    • View Profile
Re: Text overwriting previous line in menus (WS)
« Reply #1 on: September 16, 2018, 10:02:06 am »
Looks like it uses/reserves 10 tiles for each item, because the next item name will start writing at position 11.

There's probably not much you can do, except printing less items per screen, because I would imagine that there won't be more room left in VRAM if you try to increase this limit.
There has to be a better life.


  • Full Member
  • ***
  • Posts: 237
  • Obviously Outdated
    • View Profile
Re: Text overwriting previous line in menus (WS)
« Reply #2 on: September 16, 2018, 10:31:05 am »
mz: That's possible and it would be unfortunate, but I'm not 100% certain of that yet.

In certain sections of the menu, the cut-off is 4 characters before over-write (E.g. the status/type field for each Digimon), and in other parts it's 16 letters (Names on the Trade Menu).

I would guess that means there's a data block of some kind per menu that defines what the cut off is for each attribute - if so, I could try raising those values and see if I can fit everything in. The original Japanese had a maximum Digimon name length of 10 characters, so I'm hoping it's less a hardware restriction than just hardcoding the maximum value possible.

...But currently, I'm having a hard time just getting a breakpoint to trip in Mednafen. :) If anyone's familiar with it, here's my process:

Press Alt-D to open the debugger
Press Shift-R to open the Read Breakpoint entry
Type 16317C for the pointer
Press Alt-D again to get back to the game
Open the Map menu

In theory it should freeze gameplay when it reads the map name in, but I can't gotten it to stop yet.


  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6749
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Text overwriting previous line in menus (WS)
« Reply #3 on: September 16, 2018, 11:57:58 am »
Do you know the CPU address? I think that might be your problem.
I only vaguely remember the WS memory map from when I briefly looked at it many years ago.
I do believe it used a X86-clone CPU, with a 1MB ($FFFFF max) memory. Wasn't it something like $2xxxx-3xxxx mapped to the beginning of ROM and each $10000 bytes after was a mappable bank.
I'm thinking it used memory-mapped I/O. I don't even remember if X86 uses port-based I/O (like Z80. But maybe it does, since I read Z80 was a branch of early X86 CPUs?)

Then again, might it also need X86's segment:address notation as well? Or would the debugger support using standard notation for the CPU address?
(I only recall that as looking at Last Armageddon many years ago on PC-98 and being stopped by the way that there were literally 4,096 ways each CPU address could be notated. And I thought it was bad with SNES debugging where breakpoints would only work in Geiger's Tracer if you got the bank correct as well for mirrored data such as the first 8KB of WRAM.)
« Last Edit: September 16, 2018, 12:03:25 pm by KingMike »
"My watch says 30 chickens" Google, 2018