APPENDIX B TO THE MADHACKER'S GUIDE TO NES POINTERS. WHERE POINTERS POINT TO Pointers as said point to lines of text. Well not all pointer tables point to every line of text. Some point to the first character after each line and section breaks and some point only to the first character after section breaks. One game for example is the NES game Star Wars Namco. The pointers for text block located at $1B585 point to the character after each section break. The pointer table location starts at $1B548 and ends at $1B584. Note the pointers use the SetOff 0000 system. POINTER TABLE LOCATIONS Also note that commonly pointer tables for NES games are located directly right above the text block. Star Wars Namco is one of them. Zelda 2 is not one of those games, if you read Jairs relative search doc you will see from his example. Also note that in rare cases you will find what is commonly referred to as Ballzy tables and in reality is control codes. And here is a example found in Uchuusen - Cosmo Carrier. The text block is located at $998 and right above the text at location $986 - $997 is NOT a pointer table but a string of control codes. These control codes at that location do indeed point to each line. They are used to shift the position of the text lines and you can move the text arround with these control codes however these control codes will not calculate as normal pointers do, however if there is pointers for this block you may still have to adjust the pointers if you move the strings out of position and you may have to adjust the control codes if you change the pointers. And there is a pointer table for this block of text. The pointer table is located at $974 - $985. The point to this is that you should not confuse the 2 types of tables incase that you run into this situation. The SetOff system to the actual pointer table is 7E00. Odd isnt it!!? OUT OF ORDER POINTERS You will sometimes find a pointer table where the pointers are not in order in the pointer table. And for instance you might find the pointer for the second line of text not in second position but maybe in the seventh position. For example I am going to use Star Wars Namco version yet again for this section. Note where the text block is that we are going to use. The location is at $1B585. Now the pointer table is at $1B54B - $1B584. There is a total of 29 pointers in this table and each pointer points to each character after the section break. For example of the order of the pointers, I am going to list them exactly how they are in the rom and they are not switched arround. And I have numbered them to show you what section of text they are pointing to. 1.)75B5 13.)9EB6 7.)DCB5 2.)8AB5 14.)C2B6 8.)F8B5 3.)9CB5 15.)E7B6 9.)22B6 4.)AFB5 16.)FAB6 10.)37B6 5.)B9B5 17.)24B7 11.)5DB6 6.)CBB5 18.)49B7 12.)7EB6 19.)5EB7 20.)65B7 21.)80B7 22.)99B7 24.)C5B7 25.)E0B7 27.)FAB7 28.)06B8 29.)2CB8 23.)ABB7 26.)E7B7 ASM RELATED CONCEPTS I am going to explain a few things about how pointers work ASM wise. First of all the ASM language used is the RP2A03G custom 6502 CPU modified by Nintendo. Also the example I am going to use was lifted nearly verbatim from ZeroSoul's Just Another Vision Studios NES Tutorial. As it was explained well I thought that I would use it. Also the following example is formatted for use with NESASM a NES assembler. However you cant just assemble the code. You will have to set up alot more code and other directives that I am not going to cover here. Also I am not going to cover too much about explaining how 6502 ASM works. Go learn it POINT.LO = $00 ;declare labels POINT.HI = $01 text_point: .dw text0,text1,text2,text3, . . . ;the pointer table text0: .db "1) Mein Herz brennt",0 ;string #0 text1: .db "2) Nebel",0 ;string #1 text2: .db "3) Sonne",0 ;string #2 text3: .db "4) Zwitter",0 ;string #3 do_text: asl a ;double the string # (see below) tay ;transfer to index lda text_point,y ;get low byte of pointer sta POINT.LO ;record to memory lda text_point+1,y ;get high byte of pointer sta POINT.HI ;record to memory jsr wait_vblank lda #$22 ;set VRAM address sta $2006 lda #0 sta $2006 tay ;reset indexer do2_text: lda (POINT.LO),y ;read text through pointer bne do3_text rts do3_text: sta $2007 jmp do2_text Ok here is the basics of how this routine works. First of all you have .zp or what is called Zero Page memory allocation. What I am going to do is list the lables for the allocation. POINT.LO = $00 ;declare labels POINT.HI = $01 In the code you can type in these lables and the assembler will read the code and assemble as laid out. However for the ease of reading we can use lables. POINT.LO is using zero page address $00 and POINT.HI is using zero page address $01. What these addresses are used for in this code is to store the set up memory allocation in the code and to set up the pointer table. text_point: .dw text0,text1,text2,text3, . . . ;the pointer table text0: .db "1) Mein Herz brennt",0 ;string #0 text1: .db "2) Nebel",0 ;string #1 text2: .db "3) Sonne",0 ;string #2 text3: .db "4) Zwitter",0 ;string #3 This is the next section of data tables. You notice you have the pointers right on top listed for the lable text_point: and then yes the pointers. .dw text0,text1,text2,text3 Ok you see the .dw directive well this is stating a word or 2 bytes. and so each lable here text0,text1,text2,text3 is 2 bytes as expected. text0: .db "1) Mein Herz brennt",0 ;string #0 text1: .db "2) Nebel",0 ;string #1 text2: .db "3) Sonne",0 ;string #2 text3: .db "4) Zwitter",0 ;string #3 And what we have here is the actual text table. .db is a directive that states are bytes. And so here is how it works. You have the pointer table lable listed as text_point and it has the lables that points to the 4 tables I just listed. And the code that is listed after- wards enables you to cycle through the table and read each pointer that points to each text lable. do_text: asl a ;ASL will do the math and change the number to what you desire tay ;transfer to the Y register lda text_point,y ;get low byte of pointer sta POINT.LO ; You see how it uses the lable for memory allocation lda text_point+1,y ;get high byte of pointer sta POINT.HI ;record to memory jsr wait_vblank ; you always wait before writing to VRAM or garbage displayed or worse lda #$22 sta $2006 ; What this does is set the position directly onscreen. what ; this write is called is a double write latch. hence the ; second write to $2006 comming up next. Thus you are setting the position onscreen ; to $2200 and that is about the middle of the screen I think. Yes is this writing to VRAM. lda #0 ; sta $2006 ; 2nd write setting position tay ;reset indexer do2_text: lda (POINT.LO),y ; everytime you branch back to do2_text: the byte in Zero Page ; address incremented by 1 and your using your Y register as a index and once again going ; through the rest of the pointers and the following text table. bne do3_text ; branch if not equal to do3_text. rts ; this returns to wait_vblank. could be potentialy harzardous. It may return to somewhere else if you had a ; jsr somewhere else and you havent returned yet. do3_text: sta $2007 ; this is what writes the text directly to the screen now that everything ; else is set up. jmp do2_text ; jump to the lable indicated This is pretty much it. I have also added much more comments to the routine to hopefully help explain how it all works. Also note that there is many other ways of programming and this is not the only way to make such a pointer table routine. And if you do use this routine you may have to rearrange it some in your own coding. blah blah blah. CREDITS Thanks to The Madhacker for making his doc for NES pointers, Jair for his many docs, And thanks to ZeroSoul for his NESDEV Tutorial. And thanks for all those who started hacking and 6502 programming long before I have. This concludes this appendix doc to THE MADHACKER'S GUIDE TO NES POINTERS. I hope that you understand this doc and if you have any questions or comments you can contact me at Gil_Galad75@hotmail.com Also constructive advice is much better recieved. NOTE:I have not been able to contact MADHACKER and so I have released this without him reviewing this doc. No rom requests and also this doc is not affiliated with Nintendo or any company that is affiliated with games that I have mentioned. And no grammer corrections!!