various array creation bugfixes

This commit is contained in:
FeralChild64 committed 2020-07-27 21:41:37 +02:00
1 parent 68ea3eb314
commit 8abaa6f735
2 files changed
+12 -4

No files matched your search

+4 -2
View File
@@ -46,7 +46,9 @@ array_create_fetch_dims_loop:
// Check if the stack has reasonable space free // Check if the stack has reasonable space free
phx_trash_a
jsr check_stack_space jsr check_stack_space
plx_trash_a
// Fetch the dimension, increment it by 1, and put it on the stack; // Fetch the dimension, increment it by 1, and put it on the stack;
// confirmed with original ROM, that it also stores dimensions in the reverse order // confirmed with original ROM, that it also stores dimensions in the reverse order
@@ -172,8 +174,8 @@ array_create_store_loop:
array_create_store_dims_done: array_create_store_dims_done:
// Restore FOUR6, calculate number of bytes needed for storage // Restore FOUR6, calculate number of bytes needed for storage
.break
pha pla
sta FOUR6 // XXX do we need to store this value in FOUR6? is it still needed? sta FOUR6 // XXX do we need to store this value in FOUR6? is it still needed?
sta __FAC1+3 sta __FAC1+3
stx __FAC1+4 // .X is 0 at this point stx __FAC1+4 // .X is 0 at this point
+8 -2
View File
@@ -12,10 +12,16 @@
mul_FAC2_FAC1_8x8: mul_FAC2_FAC1_8x8:
// Special case (optimization) - handle 0 in INDEX+2 // Special cases - handle multiplication by 0
beq mul_FAC2_FAC1_8x8_zero
sta INDEX+2
lda INDEX+3
beq mul_FAC2_FAC1_8x8_zero beq mul_FAC2_FAC1_8x8_zero
sta INDEX+2 // Multiply INDEX+2 * INDEX+3
lda #$00 lda #$00
dec INDEX+3 // decrement because we will be adding with carry set for speed (an extra one) dec INDEX+3 // decrement because we will be adding with carry set for speed (an extra one)