Jump to content

xX_pokeman2003_Xx

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

xX_pokeman2003_Xx's Achievements

Combat Commando

Combat Commando (1/9)

0

Reputation

  1. Okay, thank you so much! I'm definitely coming away from this with a much better understanding of what I'm doing. The TIA register is intentionally cleared because I like to make sure every variable is accounted for. Have a good day sir!
  2. Gee, what gave away the fact I have literally no clue what I'm doing here? Oh, okay, that makes more sense. That explains the CLEAN_START macro's usage of TXS. That also explains how the RAM is cleared too on the macro, though I don't understand how the stack pointer remains at $FF if you're pushing a decrementing X register to it and then never put $FF in it again. This is incredibly useful information! Thank you so much!
  3. Firstly, thanks for the quick response. A little too late, I did end up looking at macro.h just to see what it did and noticed the stack clear. I had tried other methods in the past to no avail, so I figured that it just was always initialized, until I saw the stack clearing loop. Do you happen to have some good material that I can read into about how the 6502 handles the stack? I'm a complete beginner at assembly, and barely understand any of it. I've found sources in the past, but they all assumed I was already experienced at other assembly languages, or told me things like "the stack is hardcoded to memory values of $0100-$01FF," which is obviously not the case.
  4. Okay, I just realized my folly. I haven't been trying to clear the stack. In my defense, a program which looked like below worked just fine. LOOP1: ; The first loop. ; Doing NOTHING actually works when compiled. jsr LOOP2 ; Just jump to the logic when everything else is done. jmp LOOP1 ; And the loop begins anew LOOP2: rts ; Okay, this loop's done! Return! I wish that Stella had some way to view the stack.
  5. Solution:I'm an idiot and forgot to clear the stack. Here's my new start where I clear the stack, if anyone else needs it. ; Modified start of the original program. START: ; The start of the program. ldx #$FF ; "Clear" X. This gets set to 0 later, right now this is the end point of the RAM and register clearing. lda #0 ; Clear accumulator. Gets cleared again later. CLEAR1: ; Clear all RAM, EXCEPT X-bytes from last! sta 0, x ; Store accumulator at 0-page, at RAM address X. dex ; Decrement X. bne CLEAR1 ; If X is not 0, loop to CLEAR1. ldx #$FF ; Setup for stack clear. CLEAR2: ; Clear the stack. dex ; Decrement X. txs ; Put X to the current stack pointer? That's weird. I don't understand why you'd do that. ; Commenting out above seemed to work, but I wouldn't recommend it just in case. macro.h uses things I'm not apparently not aware about. pha ; Push accumulator to stack, incrementing the stackpointer presumably. bne CLEAR2 ; If we're not done clearing the stack, loop back to CLEAR2. Original post: Hi all! I hate to ask, but I'm currently facing a pretty big problem. I have a 2K rom that looks like this in assembly. .include "atari.i" ; Atari register positions ported to WLA-DX. ; ROM info setup. ; This is for a 2K non-banked rom. .ROMBANKMAP BANKSTOTAL 1 BANKSIZE $0800 BANKS 1 .ENDRO .MEMORYMAP DEFAULTSLOT 0 SLOTSIZE $0800 SLOT 0 $f000 .ENDME .BANK 0 SLOT 0 START: ; The start of the program. ldx #$FF ; "Clear" X. This gets set to 0 later, right now this is the end point of the RAM and register clearing. lda #0 ; Clear accumulator. Gets cleared again later. CLEAR: ; Clear all RAM, EXCEPT the last byte! sta 0, x ; Store accumulator at 0-page, at RAM address X. dex ; Decrement X. bne CLEAR ; If X is not 0, loop to CLEAR. SETUP: ; Final preparations. ldx #0 ldy #0 lda #0 LOOP1: ; The first loop. ; Do some random things. adc #10 adc $EF jsr LOOP2 ; Just jump to the draw logic when everything else is done. CONT: sta $8e lda #33 adc #64 adc #$01 adc inpt5 sta $84 ldx inpt4 stx $EF jmp LOOP1 ; And the loop begins anew LOOP2: adc #30 adc $84 rts ; Okay, this loop's done! Return! ; Set the interrupts. Don't forget to do this! Final address-6! .ORGA $F7FA .dw START ; NMI .dw START ; RESET .dw START ; IRQ The ROM loads up fine, but when I JSR to LOOP2, things get interesting. This is because RTS does NOT return to where CONT: is(compiled to $F016,) but rather an address in the $2XXX range. It's not consistent exactly where it's jumping, it's just somewhere in the $2XXX range. My only guess is that it's a problem with the stack being given junk data shortly after the JSR, but none of these commands should be transferring to the stack. Does anyone have an idea of what's going sideways here? I've attached a copy of the compiled ROM for examination, incase you don't want to fiddle with WLA-DX. rom.a26
×
×
  • Create New...