mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 04:30:10 +00:00
Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@325 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
5126ae8f4c
commit
2e21552871
@ -4,10 +4,10 @@
|
|||||||
; CC65 runtime: switch statement with long selector
|
; CC65 runtime: switch statement with long selector
|
||||||
;
|
;
|
||||||
|
|
||||||
; Subroutine to handle a switch statement with an int selector. The table
|
; Subroutine to handle a switch statement with an long selector. The table
|
||||||
; is located at the return address from the function. It contains the negative
|
; is located at the return address from the function. It contains the negative
|
||||||
; of the case label count as first word, followed by three words for each case
|
; of the case label count as first word, followed by three words for each case
|
||||||
; label, the first two being the value, and the second one the label to jump
|
; label, the first two being the value, and the last one the label to jump
|
||||||
; to in case of a match. The default case is located at the end of the table.
|
; to in case of a match. The default case is located at the end of the table.
|
||||||
|
|
||||||
.export lswitch
|
.export lswitch
|
||||||
@ -31,7 +31,6 @@ lswitch:
|
|||||||
lda (ptr2),y
|
lda (ptr2),y
|
||||||
sta ptr3+1 ; Remember the count of labels
|
sta ptr3+1 ; Remember the count of labels
|
||||||
|
|
||||||
ldy #0
|
|
||||||
clc ; Skip the label count
|
clc ; Skip the label count
|
||||||
lda ptr2
|
lda ptr2
|
||||||
adc #2
|
adc #2
|
||||||
@ -42,7 +41,8 @@ lswitch:
|
|||||||
|
|
||||||
; Search for the label
|
; Search for the label
|
||||||
|
|
||||||
L0: lda (ptr2),y
|
L0: ldy #0
|
||||||
|
lda (ptr2),y
|
||||||
cmp ptr1
|
cmp ptr1
|
||||||
bne L1
|
bne L1
|
||||||
iny
|
iny
|
||||||
|
Loading…
Reference in New Issue
Block a user