dschmenk / PLASMA

Proto Language AsSeMbler for All (formerly Apple)
MIT License
189 stars 26 forks source link

DINTRP opt? #55

Closed JohnMBrooks closed 4 years ago

JohnMBrooks commented 4 years ago

Could this:

DINTRP PLA CLC ADC #$01 STA IPL PLA ADC #$00 STA IPH LDY #$00 JMP FETCHOP

be replaced with:

DINTRP PLA STA IPL PLA STA IPH LDY #$01 JMP FETCHOP

dschmenk commented 4 years ago

Hi John-

Huh, look at that. Looks good to me! Thanks for spending time looking at this, I haven't done anything with this in months. Time to blow the dust off.

Thanks again, Dave...

JohnMBrooks commented 4 years ago

I was just watching this: https://youtu.be/zdJnz6-d060

then then browsing the source in Github, then comparing to PLASMA...

dschmenk commented 4 years ago

I've been following along at 6502.org: http://forum.6502.org/viewtopic.php?f=1&t=2236

I haven't watched the video yet, so thanks for the link. A more traditional register based CPU-like VM. Easy to write direct code with, but will probably require a somewhat more intelligent compiler than the brain-dead PLASMA compiler.

What's even funnier is that I did this exact optimization in the CALL opcode (for version 1).

dschmenk commented 4 years ago

Just as a reminder to myself: Y register needs to be zero at any of the xxINTRP entry points. The ENTER opcode depends on this for it's own optimization. Since DINTRP is seldom called compared to IINTRP, it's best to leave DINTRP as-is.