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

Author Topic: NES Golf (yes, that one) Course Modification  (Read 1359 times)

th60ftatomicman

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
NES Golf (yes, that one) Course Modification
« on: July 09, 2020, 02:30:11 pm »
Hello!
Needed a break from Kickle Cubicle level editor development. Wanted to START (but promise not to pursue further in hopes of keeping KC on my main burner) figuring out how golf courses in GOLF were built.
Here's what I got, posting what little I have to the internet so this can spread it wings possibly and fly!

ROM ADDRESSES OF NOTABLE INTEREST
1c2c - title "Golf" wording data
26d0 - Course 1 Data

RAM ADDRESSES OF NOTABLE INTEREST
300 - Where the level data is loaded? There seems to be like 3 or 4 spots that ALL have this data loaded to it.
AE0 - Possibly where the ROM data starts counting from  (see later parts of post)

PC's OF NOTABLE INTEREST
DD81 - putting breakpoint here is the start of the load data routine
DD8E - where we write our data into RAM
E6C0 - Where we grab Course 1 data from ROM

Tile Codes
9D = blank space Out of Bounds
B8 = Fairway all Green
AC and AD = Trees

Loading Routine Notes
Looks like we 9D (blank) the full 300 region in RAM before the level loads.
From there we do programming magic and populate the non-9D tiles.
This being said I don't know HOW the 9D tiling works? If I modify the first hex in our course data (which is a 9D) and set it to something like B8....I get fairway. see screenshot


It behaves as if it were in fact fairway (I can hit it and not get an out of bounds error)

If I modify second value in course data (b8) the entire middle section is cleared, that is to say the fairway completely modifies.

Modifying the 3 OF OF OF's do nothing.

Modifying the values AFTER the 3 OF's causes shifting indicating I screwed up some sort of counter?
Looking Below you can see the 05 is possibly a location marker? for Y value? The next 4 hexes until we hit 5 are IN the map.
Edit: Modifying to 4 makes it REALLY weird. Modifying it to 06 makes the map shift slighty right. Must be an X coord.


DOUBLE EDIT: OK. seems like our first three hexes define the fill in for 9D after our wipe.
B8 is our Fair? b9 is the placement of the green I think.
From there we start the following algorithm. If 0X, skip that many squares from left to right (repeating back around if at the 16th tile). anything else is something to write out!
Will tinker with this. This becomes evident when you see we have 3 blank lines, and 3 OF's in a row. than 05 == start on hex 6 in the next row and that's why we have that. Neat. All we gotta do now is figure out the tile codes i think.

Full ROM text for Course 1
Code: [Select]
9D B8 B9 0F 0F 0F 05 65 31 3C 3D 05 04 31 67 68 ,
3E 3F 05 03 36 37 11 40 41 05 04 4D 12 52 05 03 ,
30 31 12 3C 3D 04 03 32 33 12 3E 3F 04 03 34 35 ,
12 40 41 04 02 36 37 14 42 43 03 02 38 39 15 45 ,
03 02 3A 3B 14 46 47 03 03 48 49 13 42 43 03 03 ,
4A 4B 13 42 45 03 03 4C 4D 13 46 47 03 03 30 31 ,
14 3C 3D 02 03 32 33 14 3E 3F 02 03 34 35 14 40 ,
41 02 01 30 31 17 46 3C 3D 00 01 32 33 18 3E 3F ,
00 01 34 35 18 40 41 00 30 31 44 19 B1 B2 3C 32 ,
33 B2 19 B3 9E 3E 34 35 9E 19 B2 A1 44 B2 19 44 ,
9E A1 A0 9E B1 B2 10 56 9F 9F 9F 59 10 B1 A3 A1 ,
B3 9E B2 58 22 5A 44 B3 A3 A3 9E AA AF FF 55 28 ,
01 BF 02 28 B0 D0 B0 18 35 B0 09 71 B3 12 8C D4 ,
05 23 B0 FF

What we look like in RAM
Code: [Select]
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ,
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF , -- if we start at  AE0 (which makes our 5 more interseting!)
9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D , -- if we start at ROM 300
9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D ,
9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D 9D ,
9D 9D 9D 9D 9D 9D 65 31 3C 3D 9D 9D 9D 9D 9D 9D ,
9D 9D 9D 9D 9D 31 67 68 3E 3F 9D 9D 9D 9D 9D 9D ,
9D 9D 9D 9D 36 37 B8 B8 40 41 9D 9D 9D 9D 9D 9D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AB ,
AC AD AB AC 9E AD AB AC AD AB AC AD AB AC AD AB ,
AC AD AB AC AD AB AC AD AB AC AD AB AC AD AB AC , -- visually this is the bottom


----- UPDATE!!
OOOH BOY did the stars align on this one. I have figured out a rather LARGE chunk of how level data works.
hopefully these notes help with understand.
It appears the first 3 slots are macro slots that can be multi defined (so if you say 04, its put 5 instances of slot 0. 10 is 1 instance of slot 1.)
After that its just defining tiles from topleft down.
All that is left for me is to figure out what is up with A hexes (they seem like macros as well but just for trees)
and if that leftover data is in fact the putting green.

better explaination on course 1 with notes
Code: [Select]
9D B8 B9  ---- these later become 0#, 1#, 2#
0F -- put in 16 9D's
0F
0F
05 65 31 3C 3D 05 ---put in 6 9d's, 65 ,31 ,3c ,3d, 6 more 9d's
04 31 67 68 3E 3F 05
03 36 37 11 40 41 05
04 4D 12 52 05
03 30 31 12 3C 3D 04 -- this is the call to put in 3 b8's (10 is 1 b8, 11 is 2, etc)
03 32 33 12 3E 3F 04
03 34 35 12 40 41 04
02 36 37 14 42 43 03
02 38 39 15 45 03
02 3A 3B 14 46 47 03
03 48 49 13 42 43 03
03 4A 4B 13 42 45 03
03 4C 4D 13 46 47 03
03 30 31 14 3C 3D 02
03 32 33 14 3E 3F 02
03 34 35 14 40 41 02
01 30 31 17 46 3C 3D 00
01 32 33 18 3E 3F 00
01 34 35 18 40 41 00
30 31 44 19 B1 B2 3C
32 33 B2 19 B3 9E 3E
34 35 9E 19 B2 A1 -- A3's fill out trees? must be diff patterns based on the second digits
44 B2 19 44 9E A1
A0 9E B1 B2 10 56 9F 9F 9F 59 10 B1 A3
A1 B3 9E B2 58 22 5A 44 B3 A3 -- 22 in this line is our tee, or b9!
A3 9E AA
AF -- Divider?
FF 55 -- ?? these make lotsa weird water and sandbar things appear? Not positive... it was bizarre
28 -- this is the Y of the pin.(left digit)( right does nothing?)
01 -- Flag Color
BF -- this is the X of the pin
02 -- shape of the green. these are pre-defined.(left digit)( right does nothing?)
28 -- Y coordinate putting green(left digit)( right does nothing?)
B0 -- X coordinate putting green(left digit)( right does nothing?)
D0 -- Y coordinate tee pins(left digit)( right does nothing?)
B0 -- X coordinate tee pins(left digit)( right does nothing?)
18 -- Pre-defined sandtrap shape
35 -- Y coordinate location of sandtrap defined previous(left digit)( right does nothing?)
B0 -- x coordinate location of the sandtrap defined previous (left digit)( right does nothing?)
09 -- Pre-defined sandtrap shape
71 -- Y coordinate location of sandtrap defined previous(left digit)( right does nothing?)
B3 -- x coordinate location of the sandtrap defined previous (left digit)( right does nothing?)
12 -- Pre-defined sandtrap shape
8C -- Y coordinate location of sandtrap defined previous(left digit)( right does nothing?)
D4 -- x coordinate location of the sandtrap defined previous (left digit)( right does nothing?)
05 -- Pre-defined sandtrap shape
23 -- Y coordinate location of sandtrap defined previous(left digit)( right does nothing?)
B0 -- x coordinate location of the sandtrap defined previous (left digit)( right does nothing?)
FF -- indicates the end of the course. (tested, was a true assertion!)

« Last Edit: July 13, 2020, 10:35:49 am by th60ftatomicman »

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7001
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: NES Golf (yes, that one) Course Modification
« Reply #1 on: July 10, 2020, 11:58:42 pm »
RAM ADDRESSES OF NOTABLE INTEREST
300 - Where the level data is loaded? There seems to be like 3 or 4 spots that ALL have this data loaded to it.
AE0 - Possibly where the ROM data starts counting from  (see later parts of post)

The latter would be 2E0. NES RAM is only 2KB (0000-07FF) which is then mirrored 4x.
"My watch says 30 chickens" Google, 2018

th60ftatomicman

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: NES Golf (yes, that one) Course Modification
« Reply #2 on: July 13, 2020, 10:12:27 am »
EDIT: I compiled this whole thread into yet another github readme.
https://github.com/the60ftatomicman/NES_Golf_Guide
This is FAR easier to read. I am considering myself done for the moment on this, need to get back to other projects!


Learning a ton as I go here, made a name table
Code: [Select]
00=0
01=1
02=2
03=3
04=4
05=5
06=6
07=7
08=8
09=9
0A=A
0B=B
0C=C
0D=D
0E=E
0F=?(was image)
10=G
11=H
12=I
13=?(was image)
14=K
15=L
16=M
17=N
18=O
19=P
1A=?(was image)
1B=R
1C=S
1D=T
1E=U
1F=?(was image)
20=W
21=?(was image)
22=Y
23=Z
24=FC(Was space, but read this is how you represent that)
25=c(actually copyright)
26=.
27=?(Was tile)
28=.,(is both in a single symbol)
29=i(WIERD SIDE i)

Obviously remove the weird things that are not needed! but after 29 it was all just tiles for the fairway.
Did FURTHER research and found *almost* all of the important memory allocations for the fairway and green. The following is what is left to discover.

1) Need to find out HOW they move the holes on the green (if at all). I was able to kinda do it once when shifting the memory for the (d9 value that is always loaded prior to the green showing..see 2555f)

2) I see HOW greens work. There are only a few predefined, and the arrows are just modified. They all share the same "macro" slots (this term refers to 3 pre-defined hex spots found in all course descriptions; usually at the beginning) and shuffle between 3 courses. the hole is just moved and the arrows rotated to whatever direction given BUT I cannot find how the fairways determine which green to use.


Posting notes in case anyone else is interested (per usual for me)

Code: [Select]
Values corresponding to directions referring to green's arrows
directions =
00=up,
01=up-right,
02=right,
03=down-right,
04=down,
05=down-left,
06=left,
07=up-left,
rest are like...fairway spacess)
------------
Mapping Locations
Course Number, Fairway Start, Fairway End,Green Arrow Spacing,Green Arrow Direction,Green Set to Use ,Green Start, Green End
1            , 26D0         ,27a3        ,2562               ,2574                 ,2586             ,25e9       ,2636
2            , 2a9d         ,2b99        ,2563               ,2575                 ,2587             ,25e9       ,2636
3            , 32dd         ,33c8        ,2564               ,2576                 ,2588             ,25e9       ,2636
4            , 34b3         ,35be        ,2565               ,2577                 ,2589             ,259e       ,25e8
5            , 297d         ,2a9b        ,2566               ,2578                 ,258a             ,2637       ,268f
6            , 2ee4         ,2fd4        ,2567               ,2579                 ,258b             ,259e       ,25e8
7            , 30b8         ,31dd        ,2568               ,257a                 ,258c             ,25e9       ,2636
8            , 37b6         ,3900        ,2569               ,257b                 ,258d             ,2637       ,268f
9            , 36b3         ,37b5        ,256a               ,257c                 ,258e             ,25e9       ,2636
10           , 2fd5         ,30b7        ,256b               ,257d                 ,258f             ,259e       ,25e8
11           , 2ddc         ,2ee3        ,256c               ,257e                 ,2590             ,25e9       ,2636
12           , 2cf8         ,2ddb        ,256d               ,257f                 ,2591             ,25e9       ,2636
13           , 27a4         ,28b9        ,256e               ,2580                 ,2592             ,2637       ,268f
14           , 28ba         ,297c        ,256f               ,2581                 ,2593             ,259e       ,25e8
15           , 33c9         ,34b2        ,2570               ,2582                 ,2594             ,25e9       ,2636
16           , 2b9a         ,2cf7        ,2571               ,2583                 ,2595             ,25e9       ,2636
17           , 35bf         ,36b2        ,2572               ,2584                 ,2596             ,25e9       ,2636
18           , 31de         ,32dc        ,2573               ,2585                 ,2597             ,2637       ,268f

Neat Notes
21c5 in rom is where some of our text is!
3fa3 in rom is where our finish text is (bogey and what not)
5f12 in rom is "L.LALA"
1d1c in rom is title text
255f in rom is macro tiles for the green. From here you see the beginning of the rom map for the "green"




« Last Edit: July 14, 2020, 09:27:38 am by th60ftatomicman »