Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2011-07-10 06:39:05

Sherkel
Member
From: U.S. of A.
Registered: 2011-01-08
Post 34/43

Font data in RBY?

I want to change the font from 1BPP to 2BPP. Is this possible? I think the pointer to the fonts is either at $36A7 or $3695 because they both begin with 80 5A. Does anybody know which byte determines how the fonts are read?


Formerly known as Tombstoner

Offline

#2 2011-07-10 10:40:35

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 791/3,503

Re: Font data in RBY?

Never tried in RBY. If it was GS I could tell you though. Maybe Sawakita knows though

Offline

#3 2011-07-10 11:13:12

Sawakita
Administrator
Registered: 2010-10-16
Post 157/364

Re: Font data in RBY?

The font-loading routine starts at $3680, and uses a function that directly converts and writes the font to VRAM. It's build so that it actually choses between two different sub-routines, depending on whether the LCD is on or off.

ROM0:3680 f0 40            ld   a,(ff00+40)
ROM0:3682 cb 7f            bit 7,a
ROM0:3684 20 0e            jr   nz,3694
ROM0:3686 21 80 5a         ld   hl,5a80
ROM0:3689 11 00 88         ld   de,8800
ROM0:368c 01 00 04         ld   bc,0400
ROM0:368f 3e 04            ld   a,04
ROM0:3691 c3 2b 18         jp   182b
ROM0:3694 11 80 5a         ld   de,5a80
ROM0:3697 21 00 88         ld   hl,8800
ROM0:369a 01 80 04         ld   bc,0480
ROM0:369d c3 86 18         jp   1886

$182b loads 1BPP graphics when LCD is OFF:
hl  = source data
  a = bank for source data
de = destination
bc = length of data (number of bytes, 1BPP format)

$1886 loads 1BPP graphics when LCD is ON:
de = source of data
hl  = destination
  b = bank of source data
  c = number of tiles

A good replacement for those two routine should be respectively:

- $17f7 (when LCD is OFF):
     hl  = source of data
       a = bank for source data
     de = destination
     bc = length of data (number of bytes, 2BPP format. Notice that length of data would be twice than 1BPP)

- $1848 (when LCD is ON):
    de = source of data
    hl  = destination
     b = bank of source data
     c = number of tiles

Offline

#4 2011-07-10 22:52:04

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 794/3,503

Re: Font data in RBY?

Sawakita never fails!

Offline

#5 2011-07-12 14:43:38

Sawakita
Administrator
Registered: 2010-10-16
Post 159/364

Re: Font data in RBY?

ahah, thank you! I wish it were true, I wouldn't have to spend time fixing my own errors!

Offline

Board footer

Powered by FluxBB