It is currently Sun May 26, 2019 2:07 am

 All times are UTC - 7 hours

 Page 1 of 1 [ 5 posts ]
 Print view Previous topic | Next topic
Author Message
 Posted: Sat Dec 29, 2018 7:20 pm

Joined: Tue Dec 04, 2018 2:28 pm
Posts: 44
01:E23E:9D D0 03 STA \$03D0,X @ \$03D0 = #\$00
01:E241:BD D8 03 LDA \$03D8,X @ \$03D8 = #\$00
01:E244:E9 00 SBC #\$00
01:E246:10 05 BPL \$E24D
01:E248:A9 00 LDA #\$00
01:E24A:9D D0 03 STA \$03D0,X @ \$03D0 = #\$00
01:E24D:9D D8 03 STA \$03D8,X @ \$03D8 = #\$00

01:E250:60 RTS -----------------------------------------

E246.. if the value is above 0, ignore E248 & E24A, and run E24D (correct? #1)
OR is it this...
E246.. if the value is above 0, run E248, E24A, & E24D (correct #2?)

These addresses has to do with the \ direction speed.. However, unless if there's something I'm overlooking this will not help with turbo only speed.. as at the moment when I mess with an of the addresses within E23E to E24D the ball usually moves on it's own.. and I'm only wanting it to do this when I hold the A button. (A button makes the ball go faster normally)

PS. Marble madness has two direction speeds \ & / (45% & 225% basically)

Top

 Posted: Sat Dec 29, 2018 7:30 pm
 Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 2019
Location: Gothenburg, Sweden
the branch will go to the specified address (\$E24D) if the value is between 0 and 127.

128-255 is considered the negative range for our purposes since the most significant bit is a negative sign in signed math operations, and any such value would set the S flag, which BPL and BMI checks for.

Article on signed binary numbers.

_________________
http://www.frankengraphics.com - personal NES blog

Top

 Posted: Sat Dec 29, 2018 8:03 pm

Joined: Tue Dec 04, 2018 2:28 pm
Posts: 44
E246.. if the value is above 0, ignore E248 & E24A, and run E24D (correct? #1)

^ so these lines won't run then?

Top

 Posted: Sat Dec 29, 2018 11:01 pm

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7467
Expanding the context just a couple of lines, this seems to be a subroutine at \$E236:
Code:
STA \$14
LDA \$03D0,X
SEC
SBC \$14
STA \$03D0,X
LDA \$03D8,X
SBC #\$00
BPL :+ ; \$E24D
LDA #\$00
STA \$03D0,X
: ; \$E24D
STA \$03D8,X
RTS

This code takes a parameter A (value to subtract), and X (index of value). The two arrays appear to be \$3D0, X for the low byte, and \$3D8, X for the high byte of a combined array of 16 bit values.

\$14 is used as a temporary value, but the parameter A (unsigned byte) is subtracted from a signed 16-bit value (at index X), and if there is a negative result it is replaced with 0, otherwise the result remains.

Note that first STA to \$3D0, X is storing the low byte of the result, but after calculating the high byte it might get overwritten with 0. The high byte of the result is temporarily in A, which is why that STA \$3D8, X can be shared by both branches here.

Top

 Posted: Sun Dec 30, 2018 8:20 am

Joined: Tue Feb 07, 2017 2:03 am
Posts: 711
to surmise what rainwarrior said its a 16bit signed - 8bit unsinged number that clamps to 0.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 5 posts ]

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: toggle switch and 7 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki