Oh yeah, I know that))) I've spoiled HGM's MicroMax concept with my ugly and dirty implementationRebel wrote: ↑Tue Jun 14, 2022 8:47 am Nice to see the good old 6502 code.
One thing
One nice thing of the 6502 is after a load into memory the Zero Flag and Negative Flag are automatically set, meaning you can skip the CMP #$00 instruction.Code: Select all
LDA BOARD,Y ; occupied by pieces CMP #$00 ; BNE SCR ;
I did put those CMP where the flag has already been set elsewhere as well - it was just easier to make sure I
do compare (because unfortunately still thinking in high level languages).
You know, before I wrote this program I thought it's impossible to write ugly code in 6502 assembly,
well, I was so wrong about that)))
Can you please tell me was there a better way to manage local variables on the stack in a way other then:
TSX
TXA
CLC
ADC SOME_VALUE
TAX
LDA $0100,X
or just incrementing X register a few times if the variable is not that far?
May I should've used indirect addressing and create some shortcuts for the
stack variables in the zero page?
And one more thing - I feel like there's a ton of work to be done to improve the code
look and size, I believe it can be stripped down to 512 bytes (Oscar Toledo did chess in 352 bytes or something in x86!)
It won't make engine play better obviously but just as an exercise... ummm... I don't even know how to ask it probably...
There's no practical sense for doing that but it's kind of tempting, do you know that feeling?
