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

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Dec 29, 2018 7:20 pm 
Offline

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
 Profile  
 
PostPosted: Sat Dec 29, 2018 7:30 pm 
Offline
Formerly WheelInventor
User avatar

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
 Profile  
 
PostPosted: Sat Dec 29, 2018 8:03 pm 
Offline

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
 Profile  
 
PostPosted: Sat Dec 29, 2018 11:01 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7467
Location: Canada
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
 Profile  
 
PostPosted: Sun Dec 30, 2018 8:20 am 
Offline

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
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 8 guests


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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group