Implementing 8x16 font in FF2US. ================================ First Released 27/02/2541 (1998) Last Updated 11/03/2541 (1998) Joke. jmeam@geocities.com This document describes how to implement 8x16 font in FF2US for dialog and town name box. Introduction ------------ In FF2US, each line in dialog consist of two 8x8 lines. Upper line is always blank. Lower line is for display text. After some researched, I found the way to display 8x16 font. I use upper blank line as upper part of character and lower line as lower part of character. This modification require a lot of free tiles. For latin-origin languages such as English, this is not a problem. There are about 100 unused tiles in FF2US. However, for Thai, this is insufficient. Fortunately enough, I could find out how to saperate font usage. I use original font for all other display except for dialog and town name which will use new 8x16 font. (Includes scroll in title screen and Mysidia legend.) Finally, new font set need 8kB of contineous free space. There is no such long free space. I then expanded the ROM size to 1.25MB (10Mbit) The code I added works together with DTE in FF2US. Files ----- FF2BIG.TXT - This file 8X16.IPS - Patch file for make big font in FF2US (All chars - Thanks Albert) Usage ----- Just apply 8X16.IPS to FF2US ROM file. Then, look for them in *dialog box*. Direction --------- Note. All ROM position mentioned in this document include 200h byte SMC header. 1. Design the new 8x16 font. Upper and lower part of each character can use any tile. It does not need to be place in contineous. Moreover, each part of font can be shared by other character. For example, one tile can be use for upper part of 'P' and 'R'. 1.1 (Optional) If you want to use other font table. Just add 256kB of '0' to the ROM. Now start working with the font starting at 100200h. (You can copy the old font.) You also have to change the font pointer and ROM size information. Change as follow. Address 00066Bh: Font pointer Old 86 45 A9 0A 85 3C A2 00 F0 86 3D New 86 45 A9 20 85 3C A2 00 80 86 3D Address 0081D7h: ROM size information Old 0A New 0B Remember, this new font is use for dialog and Town name box only. 2. Create lower/upper convertion table at 00E200h. This is free space. The table size is 512 bytes. The table will map character to lower/upper tile. For example, the letter 'A' in the patch will use 8Ah as upper part and 8Bh as lower part. You may notice, two or more character can share upper or lower part via this table. The table is simple. First two byte point to upper and lower part of first character and so forth. (Total of 512 byte for 256 characters.) The real position for 00E200h is 01E000h. (This will be used in 3.4.) If you add new font, you can use next 512 byte for ease of use. (like me.) And the real position is 209000h. 3. Now, it's time for programming. I've only did full test this code with my FF4T. However, after I apply it to original FF2US, it works. But I did't test it much. It should also work with any patch base on FF2US. The code is looked somewhat stupid. I have *NEVER* worked with 65816 assembly before. So I just look into mnemonic and try to compare it with my 80x86 assembly knowledge. You know, it work! However, if somebody can optimize these code, I will appriciate a lot. Note. In this section, All position is real position. 3.1 Town name 00/b6ce 4c 40 fe jmp $fe40 00/fe40 a2 00 00 ldx #$0000 bd 74 07 @a lda $0774,x da phx 20 c0 fd jsr $fdc0 fa plx 9d 74 07 sta $0774,x eb xba 8d 18 21 sta $2118 a9 20 lda #$20 8d 19 21 sta $2119 e8 inx e0 16 00 cpx #$0016 d0 e6 bne @a 4c e1 b6 jmp $b6e1 3.2 Dialog box 00/b589 4c 00 fe jmp $fe00 00/fe00 a6 14 ldx $14 a0 00 00 ldy #$0000 bd 00 00 @a lda $0000,x da phx 20 c0 fd jsr $fdc0 fa plx 9d 00 00 sta $0000,x eb xba 99 44 08 sta $0844,y e8 inx c8 iny c0 1a 00 cpy #$001a d0 ea bne @a a2 44 08 ldx #$0844 8e 02 43 stx $4302 4c 8f b5 jmp $b58f This code will convert the font while displaying instead of pre-converting. I think this is the cause of flashing. (I've tried to pre-convert the font like in 3.3 below but the game get wired! People go go through the wall, invisible people appear, etc.) 3.3 Use item (The box displayed when you have to use something such as give carrot to big chocobo.) 3.3.1 Data prepareation 00/b041 4c 80 fe jmp $fe80 00/fe80 bf 00 80 0f @a lda $0f8000,x da phx 20 c0 fd jsr $fdc0 fa plx 99 74 07 sta $0774,y eb xba 99 44 08 sta $0844,y c8 inx e8 iny c6 08 dec $08 d0 ec bne @a 4c 4e b0 jmp $b04e 3.3.2 Display 00/af92 4c c0 fe jmp $fec0 00/fec0 18 clc a5 14 lda $14 69 d0 adc $d0 85 14 sta $14 a5 15 lda $15 69 00 adc $00 85 15 sta $15 a6 14 ldx $14 8e 02 43 stx $4302 38 sec a5 14 lda $14 e9 d0 sbc $d0 85 14 sta $14 a5 15 lda $15 e9 00 sbc $00 85 15 sta $15 4c 98 af jmp $af98 This code can be looked more intelligent if I can find 2 unused byte in RAM. 3.4 Upper/lower font lookup 00/fdc0 eb xba a9 00 lda #$00 eb xba 0a asl b0 0c bcs @a aa tax bf 00 e0 01 lda $01E000,x eb xba bf 01 e0 01 lda $01E001,x eb xba 60 rts aa @a tax bf 00 e1 01 lda $01E100,x eb xba bf 01 e1 01 lda $01E101,x eb xba 60 rts You must use your real font position for $01E000, $01E001, $01E100 and $01E101. Acknowledgement --------------- Albert PM for the font. Conclusion ---------- I took only few hour to write this document. Some subject may not be clearly explained. If you don't understand which section, please look at the patch first. And, then, of cause, you can ask me! But don't ask me to implementing this such thing in other game. My FF4T project is very late. And, as I said before, I'm very amateurish in 65816 assembly. Finally. I do not guarantee that this code will work with you. I just hope it will! :-) ---------------------------------------- Joke (jmeam@geocities.com)