Search found 42 matches

by CrowleyBluegrass
Sat Jan 18, 2020 9:08 am
Forum: Newbie Help Center
Topic: RPG Memory Organisation
Replies: 5
Views: 3692

RPG Memory Organisation

Hi all :) I'm thinking about very basic memory organisation for an rpg and was hoping to get some advice/tips. If I have enemy stats defined as a struct-of-arrays in rom like: enemy_hps = .db 01 02 03 04 ... enemy_strs = .db 01 02 03 04 ... the idea is that in battle, once the enemy index is known, ...
by CrowleyBluegrass
Mon Aug 12, 2019 2:50 pm
Forum: Newbie Help Center
Topic: Excessive operand length?
Replies: 12
Views: 5809

Re: Excessive operand length?

To be a bit more clear than my above colleagues: 6502 operands technically can only be 0 bytes (ex. nop ), 1 byte (ex. lda zp / lda $23 / bcc $e7 (which is PC-relative, so while that's sort of assembly + bytecode combined, that might be bcc $e230 or something like that), or 2 bytes (ex. jmp $800c )...
by CrowleyBluegrass
Mon Aug 12, 2019 12:42 am
Forum: Newbie Help Center
Topic: Excessive operand length?
Replies: 12
Views: 5809

Re: Excessive operand length?

I would think that whatever you're trying to do would be better done with macros. I'm just doing this as an exercise/project. It's a fairly regular syntax to parse, especially compared to the majority of languages. Edit: I think asm6 does do this?: if(opsize[type]==1) { if(!dependant) { if(val>255 ...
by CrowleyBluegrass
Sun Aug 11, 2019 11:23 pm
Forum: Newbie Help Center
Topic: Excessive operand length?
Replies: 12
Views: 5809

Excessive operand length?

Couldn't think how to phrase the title :/ I'm writing a generic parser for 6502 assembler. The assembler I'm most familiar with is asm6 so it's based on that as much as anything. Anyway, the question I'd like to ask is whether it ever makes sense to accept syntax like: LDA $42424242 that is, with th...
by CrowleyBluegrass
Sat Aug 03, 2019 7:34 am
Forum: Newbie Help Center
Topic: Do you/does it make sense to imitate function calls?
Replies: 17
Views: 9788

Do you/does it make sense to imitate function calls?

Hi there. I was curious whether many here "imitate" function calls using a calling convention in conjuction with the stack? I had the impression for the longest time that, for variables used in functions, fixed locations would be put aside for temporary variables and these would be used and overwrit...
by CrowleyBluegrass
Thu Apr 18, 2019 4:28 am
Forum: Newbie Help Center
Topic: Opcode decoding for disassembler
Replies: 18
Views: 11160

Re: Opcode decoding for disassembler

In all my years I've never seen someone use branch instructions and while using them "have to worry about if the ROM has enough room left for the branch". This doesn't really make any sense. Can you explain what exactly you're talking about here? Sorry if I'm causing confusion, I'm obviously missin...
by CrowleyBluegrass
Wed Apr 17, 2019 4:54 pm
Forum: Newbie Help Center
Topic: Opcode decoding for disassembler
Replies: 18
Views: 11160

Re: Opcode decoding for disassembler

(Apologies for the bump, but I didn't feel this was worth starting an entirely new thread.) In the event that an opcode is disassembled as a branch, but the location it is trying to branch to is outside a reasonable range, for example: ;;start of PRG LDA #$00 BEQ #$FB LDA #$23 If my two's-complement...
by CrowleyBluegrass
Fri Apr 12, 2019 11:32 pm
Forum: Newbie Help Center
Topic: Increasing x_pos by 4, but sprite can move outside of grid?
Replies: 12
Views: 6780

Re: Increasing x_pos by 4, but sprite can move outside of gr

I was also afraid of fixed point math at first but it turned out to be really simple. Doesn't matter what language you implement it in (I've tried it in C++ as well, easy as pie). Maybe you are mixing it up with floating point? You guessed it, I was... :oops: For fixed point, all you need to do is....
by CrowleyBluegrass
Fri Apr 12, 2019 10:01 am
Forum: Newbie Help Center
Topic: Increasing x_pos by 4, but sprite can move outside of grid?
Replies: 12
Views: 6780

Re: Increasing x_pos by 4, but sprite can move outside of gr

That looks OK, I think. Figuring out concise branch paths for the logic you need to implement is one of my favorite things to do in assembly, and I think your attempt is pretty good. Thanks! Just a few words of encouragement like that make a big difference :) Another thing to point out is that your...
by CrowleyBluegrass
Fri Apr 12, 2019 6:15 am
Forum: Newbie Help Center
Topic: Increasing x_pos by 4, but sprite can move outside of grid?
Replies: 12
Views: 6780

Re: Increasing x_pos by 4, but sprite can move outside of gr

Looks like you're not clearing the carry flag before the addition, so you could sometimes be adding 5 instead of 4, if the carry happens to be set. Oh boy, I really do feel silly! That was it, thanks Tokumaru. I really don't want to post another thread right away, so I hope you guys don't mind me a...
by CrowleyBluegrass
Fri Apr 12, 2019 5:48 am
Forum: Newbie Help Center
Topic: Increasing x_pos by 4, but sprite can move outside of grid?
Replies: 12
Views: 6780

Increasing x_pos by 4, but sprite can move outside of grid?

Okay, this is one I feel like I'm going to feel very silly about, but I just can't fathom it out. I initialise the first sprite in OAM to an x_pos of 8. In main, I just check to see if right is pressed, and if so, increase x_pos by 4. Why is it (visually, and in memory viewer) that the sprite can ta...
by CrowleyBluegrass
Wed Apr 10, 2019 9:10 pm
Forum: Newbie Help Center
Topic: Multiple NMI handlers for communicating with main
Replies: 9
Views: 4513

Re: Multiple NMI handlers for communicating with main

That's exactly the kind of information I needed for this to click! Thanks so much, that helps a lot.
by CrowleyBluegrass
Wed Apr 10, 2019 10:35 am
Forum: General Stuff
Topic: What have you learnt most from programming in assembly?
Replies: 28
Views: 20961

Re: What have you learnt most from programming in assembly?

One word of caution about trying to learn from assembly for 30+ year old CPUs is that what defines performance has radically changed on modern CPUs. Things that used to be expensive (floating point ops, a lot of math functions, etc) can on average run in a single CPU cycle or two now. On the other ...
by CrowleyBluegrass
Wed Apr 10, 2019 9:53 am
Forum: Newbie Help Center
Topic: Multiple NMI handlers for communicating with main
Replies: 9
Views: 4513

Re: Multiple NMI handlers for communicating with main

I used to work with multiple NMI handlers... My NMI vector just pointed to a JMP $XXXX) instruction in RAM, and I'd change the address as needed - temporarily changing the JMP ($4C) into an RTI ($40), to avoid crashes. Please, could you elaborate on this? I'm afraid it went over my head... Would yo...
by CrowleyBluegrass
Wed Apr 10, 2019 9:31 am
Forum: Newbie Help Center
Topic: Multiple NMI handlers for communicating with main
Replies: 9
Views: 4513

Multiple NMI handlers for communicating with main

I remember reading at some point about the possibility of having several NMI handlers for different situations. How many of you utilise this? Those of you who do/have, why did you decided to utilise them? Even just starting out, I'm starting to feel like this_flag and that_flag as a means of communi...