Quest For The Lower-Case Text Plugin

Bucket Mouse

Active member
IMPORTANT NOTE: The quest is over. Go to this post to find out how to use lower and upper case text at once:
http://www.nesmakers.com/viewtopic.php?f=36&t=3988&p=21762#p21762


Meeting up with Joe Granato at Portland Retro Gaming Expo, I got the confirmation: there are absolutely no plans to add lower-case text support to NESMaker 5.0, or possibly ever. This is something I really need in my text-heavy games, and I have told him this many times. But he insists my need is in the minority, and thus no time will ever be spent on it officially.

Noticing the look of despair on my face, he threw me a bone: he suggested the feature could be added through a plug-in, much like the sprite HUD was added through a plug-in. The problem with that is, I can't make plug-ins. I don't even know what language NESMaker is written in, let alone how to code plug-ins for it. So I'm hoping at least one of you readers do know, and would like to help me make this plug-in happen.

I'm thinking it would work the same way as the text form that's currently in the program now, it'd just draw from a wider area of the graphics bank, like two extra rows above normal. Better: the extra characters could be stored and pulled from the Path tiles, since I never use them.

Are any of you out there willing to help me make this plug-in happen? Please say yes; you're my only hope.
 

Vonwoah

New member
Mugi just mentioned using lowercase in his game here: http://nesmakers.com/viewtopic.php?f=51&t=1820&start=330
 

Bucket Mouse

Active member
Mugi is using a completely different engine at this point; it's doubtful his solution would function outside of it.
 

Mugi

Member
our engine at this point in time is also specifically meant for creating cutscenes, as such, the textbox it has will not function during gameplay without significant modifications.
IE: it has no function to print text over a gameplay screen and then restore it.
 

Bucket Mouse

Active member
This is what Joe Granato suggested:

Use your “special characters” not to draw characters at all, but to act as a shift key. So make a variable called caps, make it zero at the start of the game.

When the text read script is happening, if it comes across that special character, it sets caps to 1 and increases index (not actually drawing anything).

Then on your text write, read caps. If it zero, draw from position offset A0 (the third path row) - where you’ll put your lowercase letters). If it is one, draw from position c0 like it does now.

You’ll lose 2 rows of paths to do it.

You won’t see caps and lowercase in the text editor but you’ll see your *shift* characters, so it should still be easy enough to construct and read.

It’ll also take up rom space of a byte for each *shift*.

So I feel I've written this. In HandleTextBox.asm, there's a part that says " ;; this is where we determine if this is a special character or a normal letter/number to update." Directly below that line, I inserted this:
Code:
	CMP #$CA
	BNE notchar1
	INC caps
notchar1:
	CMP #$CB
	BNE notchar2
	DEC caps
notchar2:
#$CA and #$CB being the addresses I assigned Special Characters 1 and 2 to.

Then where it says " ;;;;; The look up was a normal letter, number, or other hud value." I added below:

Code:
	LDA caps
	CMP #$01
	BNE skipCaps

	CLC
	ADC #$A0
	JMP capsOn

skipCaps:
	CLC 
	ADC #$C0
capsOn:
	STA updateHUD_fire_Tile

To me, this should work, but it doesn't -- it just results in a blank text box. What am I doing wrong?
 

dale_coop

Moderator
Staff member
Be careful... if you do a LDA caps in the second part of your script, you corrupt the A register... the CLC ADC that come after that doesn’t work correctly because the A register value is no more what it should be.

You should check later... and subtract #40 to updateHUD_fire_Tile if/when caps is set.
 

Bucket Mouse

Active member
dale_coop said:
Be careful... if you do a LDA caps in the second part of your script, you corrupt the A register... the CLC ADC that come after that doesn’t work correctly because the A register value is no more what it should be.

You should check later... and subtract #40 to updateHUD_fire_Tile if/when caps is set.

I did catch that, and I changed it to an LDX because I didn't see X being used in the immediate vicinity.

I don't know why I would need to subtract 40 though. The new tests seem to be working so far.
 

Bucket Mouse

Active member
Okay, I've figured it out at last. It hasn't gone through testing yet, but it definitely works for me. It feels very freeing to finally be able to put emphasis on certain words and have the text read the way it's supposed to. Special thanks to Joe Granato who pointed me in the direction of this solution.

There is a sacrifice, but I consider it worth it. It will cost you half your space for paths and three-fourths of your special characters. We're going to use the special characters as capslock and shift keys, and the upper four rows of paths as an extra set of text characters.

Step 1: Create two new user variables: "capslock" and "shift".

Step 2: Take what you currently have in HudTiles.bmp, and copy-paste it into the first four rows of every Paths image. Find or make a separate lowercase set of letters. Take those letters and paste them over the letters in HudTiles.bmp.

Alternate Step 2: If you're using a HUD and you don't want all the letters in it to be in lowercase, then leave HudTiles.bmp alone and paste your lowercase letters into Paths. If you do this you'll have to interpret the final step a little differently.

Step 3: Find HandleTextBox.asm in your System folder for the game you're working on. Open it up and go to line 261 (the first line shown below). Then add this stuff:

Code:
	;; this is where we determine if this is a special character or a normal letter/number to update.

	;; THIS IS THE PART WE ADD TO CHECK THE CHARACTERS TO TURN ON CAPS
	CMP #_USER_0
	BNE notchar1
	INC textboxOffsetHold
	INC capslock
	JMP doneTextUpdate
notchar1:
	CMP #_USER_1
	BNE notchar2
	INC textboxOffsetHold
	DEC capslock
	JMP doneTextUpdate
notchar2:
	CMP #_USER_2
	BNE notchar3
	INC textboxOffsetHold
	INC shift
	JMP doneTextUpdate
notchar3:
	;; END OF ADDED MATERIAL

Scroll down a little further and find the notation "NORMAL VALUE". Paste in this stuff (after that, check to make sure that the last line, STA updateHUD_fire_Tile, isn't reproduced twice).

Code:
;;;; NORMAL VALUE
		;;;;; The look up was a normal letter, number, or other hud value.
		
;;;;;;;;;;;; MORE CAPS MATERIAL STARTS HERE
	LDX capslock   ;; checks for capslock symbol
	CPX #$01
	BEQ capshappens  ;; if it's on, it branches to caps letter bank
	LDX shift ;; if there's no capslock symbol, it checks for the shift symbol
	CPX #$01
	BNE skipCaps ;; if it's not on, it branches to the lowercase letter bank

capshappens:
	CLC
	ADC #$80
	LDX #$00 ;; this line and the one below it resets the caps flag
	STX capslock
	JMP capsOn

skipCaps:
	CLC 
	ADC #$C0
capsOn:
	STA updateHUD_fire_Tile

Step 4: Enter your text as desired. @ is your Capslock symbol; it switches to all caps. # turns off the Capslock and switches to lowercase again. $ is Shift and it capitalizes the letter that appears after it. None of these symbols will show up in your text box, but they WILL count toward your 256 character limit, which is why I had to go through the extra trouble of figuring out how to Shift -- otherwise you'd have to waste two characters instead of one.

Alternate Step 4 if you wanted a capitalized HUD: Symbols will do the reverse in your situation. @ turns OFF your caps -- in this case you don't even need Shift since it's unlikely you'll need to make one letter lowercase. Just put @ after the capitalized letter.


yougettodothis.jpg
 

dale_coop

Moderator
Staff member
Great work!
Note: you could also save some special characters, using only 1 special character for that (during my tests last week, I did it with only one), when you have the special character, you switch to "caps on" for the next letter, and after that letter written, switchback to "caps off".
For example, using @ as my special character (but of course you can use any characters of the "hud tiles" tab)
So, if you want to display "this is MY TEST", you just need write it like "this is @M@Y @T@E@S@T".
And if you want "This Is My Test", just write "@This @Is @My @Test".
 
Top Bottom