MEGA65 / mega65-core

MEGA65 FPGA core
Other
244 stars 88 forks source link

($nn,SP),Y is broken #497

Closed gardners closed 2 years ago

gardners commented 2 years ago

It adds the BP register to the address on the stack that is being referenced, which really borks things up when BP != 0.

This breaks Jim Nicholl's nice code that uses this opcode to fix another bug in the MEGA65 hypervisor.

lydon42 commented 2 years ago

Todo: unittest

lydon42 commented 2 years ago

Checked with small test asm, and behaves as expected. But hyppo still throws me in a boot loop. Replacing dgfd2: sta ($01,sp),y with dgfd2: sta dos_file_descriptors,y makes it work again (checked with two full core builds on nexys4ddr). Save last commit in hwsc is d24175d.

lydon42 commented 2 years ago

At least the opcode fix should be ported to the development branch. I will do that in the next days, together with the unittest for verification.

lydon42 commented 2 years ago

Unit test added to mega65-tools. Checks ok with latest development.