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

Author Topic: [Technical] [NES] Virus and Tiny Toon Adventures  (Read 6186 times)

bogaabogaa

  • Full Member
  • ***
  • Posts: 210
    • View Profile
Re: [Technical] [NES] Virus and Tiny Toon Adventures
« Reply #40 on: November 20, 2020, 01:55:51 pm »
True assembly is bare metal coding it can be/is confusing specially if you don't understand the hardware it is build on. At the same time the MOS CPUs have a very simple instruction set. On the NES they did really cut down costs where the chip has no functional decimal mode at all beside some more extra flags it does nothing. What makes it even harder to code some stuff. The PPU with his name table arrangement can be a pain to learn too. Also how to access it and when. But once you know what a NMI does and you wrote some lines of code you know why people call it simple.

CHR Bank switching is indeed not code heavy.

Odie in the main game is that junk of code that is documented out. I did cut the assembly to the size so it could be done without extra amounts of work.

I been not able to communicate. Yes. As I said it is not a project I am interested in and I move to other things. Fare wall my friend. Was a good journey where I did learn some stuff myself and how to communicate things better in the future.

A other idea instead going after cosmetics in a game would be to give a puzzle game new elements. Like a super virus that can move so you need block him to give it his medicine. Sure there are simpler and probably better things to go after. For me it feels it is to hard to make good combos in the game. Since they feel good. I am much more of a tertris guy.
CV ROM DiscordServer
https://discord.gg/PvFgxRg

pangenttech

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: [Technical] [NES] Virus and Tiny Toon Adventures
« Reply #41 on: November 20, 2020, 04:21:44 pm »
  Aside from uncommenting it I don't really know how to enable Odie Animation Main Game either. I assume it needs to be a subroutine called from somewhere as JSR, with an RTS at the end.

 "Removing one RTS before pause screen" perhaps. Bogaa said that earlier and that was my best guess for how to handle this as well.

  UPDATE: Yes, removing one RTS before the pause screen (from the displaying Nurse) seems to work.

  Odie is functional during 1P gameplay now. I'm still working on aesthetics since he now has color issues. This has required some new/tweaked graphics and metasprite assembly. I'm using up the remaining blank sprite tiles for some variations on Odie, and will change his assembly during Pause also.

  I'm still low on background tiles. I need about five tiles for this and there are no blanks left. I've stolen some tiles from the nurse scene and tweaked the nametable. It won't look that different.

  To free up some tiles I would like to change the CHR banks used in 2P mode.

UPDATE:  Didn't do the bankswitching, but did get Odie working, with minor visual compromises that don't spoil the effect.

Odie loss frame is not yet implemented, or left-facing Odie, and music stops after every round in 2P mode.

The HDPacks Music ASM is now not working again, as it's overwriting the wrong code. I'll have to look into that again.

UPDATE: Yeah, once again I don't know how to fix this music code. It breaks everything.

UPDATE: I think I finally got the HDPack music working again. Will redo the HDPack graphics and this should be releasable. Hope I didn't break the code.

Hm, spoke too soon, something odd with the Music code. It's reacting to every button press on the menu, whether it's music related or not. It's not impossible to choose your music, if it's the last thing you do, or if you choose one behind, but it's more fiddly than it should be.

Will try again.
« Last Edit: November 29, 2020, 09:08:47 pm by pangenttech »

bogaabogaa

  • Full Member
  • ***
  • Posts: 210
    • View Profile
Re: [Technical] [NES] Virus and Tiny Toon Adventures
« Reply #42 on: November 20, 2020, 08:59:50 pm »
Yes the Odie in Main game can be run with "NewAnimationsDog:" Subroutine it works well for me like this.

I been here since I discovered a bug in the new HDpack ASM that does only overwrite stuff to mute music. I pulled the stuck in the wrong order what messed up the main game. I fixed that and it should work fine now.

For bank switching you don't need to mess with the PPU. PPU register info: https://wiki.nesdev.com/w/index.php/PPU_registers
would not recommend to start with that when new to coding.

I commented where some of the Bankswap routines are in the hijack section. At the end I made a example how this routine looks like. There are more info about it in the mapper document in the resource folder. (The mapper handle PRG and CHR banks. If the CHR bank is RAM you can write to it too..)

JSR $9F63           //Jump Register Routine.    //9f3b,9f4f=BG tiles?,9f63,9f77 Routines ??
Here I only documented CPU offsets of different routines that do things with the mapper register. Like CHR swapping.


Repost of DropboxLink:
https://www.dropbox.com/s/gnnbzqmp76h40s1/VirusHack%20DrGarfildPlus.zip?dl=0
« Last Edit: November 20, 2020, 10:52:37 pm by bogaabogaa »
CV ROM DiscordServer
https://discord.gg/PvFgxRg

pangenttech

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: [Technical] [NES] Virus and Tiny Toon Adventures
« Reply #43 on: November 22, 2020, 11:01:30 pm »
Submitted version 18 to RHDN, which contains Odie during gameplay and some expansions to the HDPacks.

Pics:
https://imgur.com/a/lAPdsWc

As noted, I kind of got the HDPacks version working but there is some missing code compared to version 17 (that there doesn't seem to be room for). That version is now very wonky when selecting music on the menu screen. It basically has to be done last, since the code responds to each button press, even the not music related ones. So the music is always jumping forward by one on non-music line items, or taking two button presses to register on the music line. It's odd.

UPDATE: I went back to an older, more complete version of Dr Garfield's code by Bogaa, made some changes and compiled it. I think it worked this time, for what I want with the HDPack music.

It'll need fixes but I think I got the music stuff working again.

I'm still not sure about adding (theoretical) bankswitching to different CHR background banks in 2P mode, though at least that's not necessary for the thing to function. The HDPack does simulate this already by including more characters in the backgrounds.


A Dr. Mario AI which would almost certainly have to be rewritten to work with this ROM.
https://meatfighter.com/drmarioai/

Dr. Mario virus placement discussion here:
https://tetrisconcept.net/threads/dr-mario-virus-placement.2037/page-1


UPDATE: Made some further minor fixes. Music menu works correctly again, some fixes to Odie, etc. Submitted as version 19.

Did not figure out how to implement different BG bankswitching in 2P mode, though I see the code that does it.

Hardware tests.

https://twitter.com/pangenttech/status/1331095746385330179
« Last Edit: November 24, 2020, 10:08:21 am by pangenttech »

bogaabogaa

  • Full Member
  • ***
  • Posts: 210
    • View Profile
Re: [Technical] [NES] Virus and Tiny Toon Adventures
« Reply #44 on: November 24, 2020, 11:05:31 pm »
Would be interesting to hear where you got suck when implementing CHR switching in 2P mode.
RAM Offset $727 will keep track what mode is selected. You can change it while playing to see and guess what code is running. When you have a breakpoint on read on it. Then you could be able to figure out where to hijack. Not sure on your progress on coding but could be a good field to experiment.

If you look for some coding practice and you like to learn about branches. IIRC The menu only checks if a button is pressed and runs everything music related (only hihjack to add music lunching in the first place). A extra check if a music options is selected would make it feel properly coded. This would require you to find the value that keeps track of the options and will need you to add the code that will skip to the end when the desired option is not selected.
CV ROM DiscordServer
https://discord.gg/PvFgxRg

pangenttech

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: [Technical] [NES] Virus and Tiny Toon Adventures
« Reply #45 on: November 27, 2020, 03:03:51 pm »
 If anyone is reading this:

 The backgrounds in 1P and 2P mode bankswitch between the 0 and 1 CHR registers.

 For 2P mode, I would like to switch between the 8 and 9 registers, so I can do more with the background.

 I can about halfway understand what the code is doing, but not enough to make this happen easily.

 (Searching for 9F63 leads to the associated code, I believe.)

bogaabogaa

  • Full Member
  • ***
  • Posts: 210
    • View Profile
Re: [Technical] [NES] Virus and Tiny Toon Adventures
« Reply #46 on: November 29, 2020, 08:37:50 pm »
9f63 is the CPU offset of the CHR switch routine. When you like to search for it you would search for $20 $63 $9f since pointers are read as little endian.

When you experimented you should be aware that the two modes share a lot of routines. The bank switching is the very first routine I documented in my ASM file.


You can use it to put your hijack there and write your code in the free space section. The RAM value you need to branch on is mentioned above. I did see you know how to expand CHR banks so the task should be clear (Since your ROM was expanded a bit). You should also know the resources to consult to learn the needed thing to do this task. Good luck.

To visualize binary numbers in hex this might help to understand what I mean with "takes nipple 4"
« Last Edit: November 29, 2020, 08:48:58 pm by bogaabogaa »
CV ROM DiscordServer
https://discord.gg/PvFgxRg

pangenttech

  • Jr. Member
  • **
  • Posts: 33
    • View Profile
Re: [Technical] [NES] Virus and Tiny Toon Adventures
« Reply #47 on: November 29, 2020, 08:53:11 pm »
  I've been reading your code for awhile so I'm aware of that section, yes. I've also looked at the associated sections of the ROM at length in Mesen's Debugger. But I don't really know what I'm looking at.

  I don't know what you're talking about, or what exactly to do to get my desired result, sorry.

  I don't understand "Take nipple 4 Drop the others," although I now see you've edited your post to about halfway explain it. (Fourth 1 or 0 in the Binary?) That may be where I was stuck, some sort of math that was eluding me, rather than listing the bank numbers directly. That would seem to tally with the three LSR commands.

  (A sprite bankswitch you coded for the title screen handles things differently, listing the desired sprite banks directly.)

  Your partial explanations don't really tell me anything. I think you think you're being a lot clearer than you are.

  Expanding the actual ROM shouldn't be a problem. It requires updating the header in some way, and there are applications for it.
« Last Edit: November 30, 2020, 12:47:09 pm by pangenttech »

bogaabogaa

  • Full Member
  • ***
  • Posts: 210
    • View Profile
Re: [Technical] [NES] Virus and Tiny Toon Adventures
« Reply #48 on: November 30, 2020, 04:06:37 am »
Yes there are thing coming to my mind when I am done guessing where your problem is and then I type it after.. or post a gif that might help..

You been looking for this routine in your question. If I had answered with Nes Rom offset $6e6 then you would probably edit that with some hex editor. What seems way harder. Her you see the things you need to learn directly. Also I give hints to the task so you can learn. Next step is to tell you to change JSR $9f63 to a JSR 2PlayerSwitching. Then make a "2PlayerSwitching:" where you have free space. If you desire to do that in a hex editor you can calculate (read) where it should go and type the new offset directly after the value $20. Then write the routine and translate that into hex values what seems way more vulnerable to have mistakes.

Taking 4 nipple.. yes you see it will alternate every 8 frame. If you don't know what the opcode is. You can hover over it in Mesen debugger and have a brief description. Or  look it up be here maybe..
http://6502.org/tutorials/6502opcodes.html#AND

There are many pages and also tutorials about it. I am sure you know how to look for them.

If you don't know what a AND does look up a true table for logic gates.
https://www.elprocus.com/basic-logic-gates-with-truth-tables/

You can design your routine different when you write a value to Ram and count it down or something. This is just one way of doing it.
CV ROM DiscordServer
https://discord.gg/PvFgxRg