24 users online: Abdu, Akumajou,  AmperSam, andrew_078, AnEvilGhost, Blaagon, Cal-of-Gearva, Children's Digest 1950-2009, crocodileman94, gui, Hiro-sofT, JezJitzu,  MarioFanGamer, MarioTeam, metronia, OhMuramatsu, Romano338,  Sayuri, sergio_HelloKittyFan, SF - The Dark Warrior, SubconsciousEye, TheJank, TheJavabrew, TheKazooBloccGosh - Guests: 135 - Bots: 271 Users: 55,596 (2,452 active)
Latest user: MarioTeam
Not logged in.
Posts by Flamesofshadow
Flamesofshadow's Profile - Posts by Flamesofshadow
Pages: « 1 2 3 4 »
I got to Part 5: Advanced sprite creation. Section 5.1 Extra whatever

is about Extra Property Bytes, Extra Bytes and the Extra Bit.


this area is not the most explanatory in terms of how to use the different Bytes and Bits, also the linked source code is actually unavailable.


the current question is, Which of those would I need for a sprite which has three sizes (small, medium, large)? my thought is extra bytes as the cfg editor shows options for up to 12 and as I would need 3 it is the type i would need.

extra bit would be if I want the sprite moving left or right when spawned (0/not set is left, 1/set is right)
(restricted)
would I need multiple AND to branch to the different code for each of the 3 sizes? from my understanding this looks right but i want to make sure.

Code
LDA $AB40
AND #$01
BEQ !define1 ;small
AND#$02
BEQ !define2 ;Medium
AND#$03
BEQ !define3 ;Large
Originally posted by thomas
Code
LDA !extra_byte_1,x	; you can use this built-in PIXI define instead of the address
	BEQ Small
	CMP #$01
	BEQ Medium
	CMP #$02
	BEQ Large
	; code if not 00/01/02

Small:
	RTS

Medium:
	RTS

Large:
	RTS



I've been trying out a few things the past few days when I'm actually able to focus, had partial but very glitchy success with one method but I don't like the results and it's unplayable with the glitchiness of the sprite.


Where is the best place to put that code? I'm trying it in different places and methods, but due to some of the routines being so long, the branches can't reach (mostly the routines for the large grrrol) and that's a hassle.






I've also been going over the tutorial to try to retain what information i know and figure out what i don't, section Part 4.2.5: Complicated graphics routine mentions some stuff that i want to clarify for myself.

1. it mentions using scratch RAM for drawing tiles in a loop, in the source code for that section https://media.smwcentral.net/MarioFanGamer/SpriteCreationTut/tut9.asm the scratch ram is $04 which i think is 7E0004 because 7E0000 is scratch ram? what are the value limits for scratch ram if it is 7E0000.
ill test out that code and see what i can do with it. as for my broken glitchy code, i didn't post it because i know its badly done, and I'm sure the issue is OAM or just the sheer amount of tiles, if Mario looks right he and the sprite vanish, if he looks left the sprite appears and is reading the wrong tiles so yea its just messed up but i didn't expect it to work, just tested it to find if my branches could reach
How to give skilled coders an aneurysm. so I have this issue so far (which is a branching issue, I used thomas' extra byte code):

https://i.imgur.com/QXk6Srq.png



and here is a link to the asm because it's too big to post here and yes it's most likely not proper or right but ill adjust it as I test it. but yea I wanna fix the branching issue first.

https://docs.google.com/document/d/1nrqNnZEEebsb5MB37H9H3XjWlEhsDPttgHIuEhFHlGI/edit?usp=sharing


I am pretty sure I did not actually use the extra byte code correctly, I edited the code to fix the branching (code shown below), pixi accepted it, but crashes in LM when testing internally, gives technical information 879, and 967. not sure of the issue (don't see a log) but my guess is OAM as the code which is mostly copied from the tutorial then edited likely has typos I didn't catch.

Code
print "MAIN ",pc
PHB : PHK : PLB
	
    LDA !extra_byte_1,x	; you can use this built-in PIXI define instead of the address
	BNE Continue
	JML	MainCodeS
	CMP #$01
	BNE Continue
	JML MainCodeM
	CMP #$02
	BNE Continue
	JML MainCodeL ; code if not 00/01/02
Continue:	
	PLB
RTL
logfile from bsnes I have no idea what it's telling me. https://www.dropbox.com/s/oxbozxzmnnzgbbw/CodingTest-trace.log?dl=0
its showing multiple instances of this as red.
Code
CMP $2140
BNE $8082




here is the current ASM, with MFG's JSR code https://www.dropbox.com/s/9svfx6sptiu82kx/Grrrol.asm?dl=0
would this be correct?
Code
TXY
LDA !extra_byte_1,x
AND #$02
ASL
TAX
JSR (CodePtrs,x)
; Other stuff
PLB
RTL

CodePtrs:
dw MainCodeS
dw MainCodeM
dw MainCodeL


MainCodeS:
TYX
...

MainCodeM:
TYX
...

MainCodeL:
TYX
...




Originally posted by spooonsss
here's where the code runs off the rails:

Code
V: 60 H: 222 F:34
90cd45 rts                    A:2500 X:0007 Y:0007 S:01ef D:0000 DB:90 nvMXdiZc
V: 60 H: 244 F:34
90cd01 ora [$cd]     [c0bb00] A:2500 X:0007 Y:0007 S:01f1 D:0000 DB:90 nvMXdiZc
V: 60 H: 286 F:34
90cd03 lda ($cd,s),y [900007] A:25dd X:0007 Y:0007 S:01f1 D:0000 DB:90 NvMXdizc
V: 60 H: 334 F:34


rts returns to CodePtrs:
dw MainCodeS
dw MainCodeM
which shouldn't be directly executed as code


My assumption is it needs to return to print "MAIN ",PC or is that wrong? how do i get it to do that? I'm thinking RTL but that doesn't sound right
ive changed the code to include the TYX where needed, I tried changing the various RTS to RTL to see the result, it still total blackscreens in bsnes, here is the updated log as maybe its useful, i cant read it.

https://www.dropbox.com/s/az1vliqmvguvc57/CodingTest-trace.log?dl=0
how do i know if the debugger is reading the sprite code? I'm running it on the level when it starts and after the crash. i can't read the debug information so i don't know what its doing/reading, the most recent one i linked was done the same way the first one was.
which command line do you refer to? i only know of CMD and pixi.exe -d doesn't do anything
so i ran CMD, did pixi got the code, used it in bsnes and it stopped on 90CCF4 (the code cmd gave me).

specifically it states "Breakpoint 0 hit (1).
90ccf4 phb A:9008 X:0007 Y:0030 S:01f2 D:0000 DB:01 nvMXdizc V: 42 H: 826 F: 9"

I'm not seeing the issue with the PHB section of the code.

i see a lot of red in the debugger when the break occurs but I'm unsure what needs to be changed for them



i would take the log of the data but i cant figure out how to save it.
I managed to go through the debugger and even copied the steps to notepad to keep track of.

I would assume the red would be problematic, and green is good? there is a lot of red.

I still face the issue of not knowing what the issue is, even though the debugger shows the code, it doesn't specify what is bad and why, as far as i can tell reading back on the tutorial it should be working.


just in case it needs to be viewed to assist my unskilled brain
https://drive.google.com/file/d/18tPxqwu-cEeiKRFQ7II7W3PmNH43Hgry/view?usp=sharing
what would these be?

from the code itself the first seems to be the JSR GraphicsS while the second seems to be JSL $01802A but these values don't match in the debugger and the code.

Code
TYX ;I know this one its the very first TYX in the debug log, followed immediately by these two
jsr $cd4b     [90cd4b] 
jsl $9091bd   [9091bd]
I changed the RTLs in the graphics routines to RTS, tested in bsnes and still crashes in the same way, ran debugger and I cannot exactly tell what the issue might be as of now, also struggling to even find the information for the Large graphics routine in the debugger.


For now I will post these two links in case someone gets time to test or debug this thing and can guide me further to fixing it as i intend to figure this thing out and fix it but its frying my brain.

https://www.dropbox.com/s/9svfx6sptiu82kx/Grrrol.asm?dl=0
https://www.dropbox.com/s/gmos4rx8xc2yn17/Grrrol.json?dl=0
(restricted)
(restricted)
(restricted)
Ive decided to refine the code, and make it cleaner instead of having multiple copies of MainCode for each variation of the sprite i also modified the graphics to now only need two frames for each size of grrrol and save ExGFX space (hence the now 4 graphics listed). I want to join this code:

Code
TXY
	LDA !extra_byte_1,x
	AND #$03
	ASL
	TAX
	JSR (CodePtrs,x)
	; Other stuff
	PLB
	RTL

    CodePtrs:
    dw Graphics16x16
    dw Graphics32x32
    dw Graphics48x48
    dw Graphics64x64


Into this code

Code
MainCode:
        TYX
	LDA #$00
	%SubOffScreen()	; Check if offscreen

	LDA $14C8,x
	CMP #$08		; Only run when sprite is living
	BNE Return
	LDA $9D			; And if nothing is frozen
	BNE Return

	LDY $157C,x		; Set speed and flip by direction
	LDA Speed,y
	STA $B6,x

	JSL $01802A		; Set movement with gravity and ground contact
	JSL $01A7DC		; Check for player contact
	JSL $018032		; Check for sprite contact

	LDA $1588,x		; Check if it touches a wall
	AND #$03
	BEQ Return
	LDA $157C,x		; Flip direction...
	EOR #$01
	STA $157C,x
	LDA $B6,x		; And speed
	EOR #$FF : INC
	STA $B6,x
Return:
RTS


so that each version of the Grrrol will use the same MainCode, but separate Graphics routines (unless there is a way to use one routine for 4 sizes of sprite).
Pages: « 1 2 3 4 »
Flamesofshadow's Profile - Posts by Flamesofshadow