Skip to content

jump tables? documentation? #18

@MellowYellow7777

Description

@MellowYellow7777

i have

moveTypes:
  ;   0, 1, 2, 3, 4, 5, 6, 7
  dcb 0, 0, 0, 1, 0, 0, 2, 0
  ;   8, 9, a, b, c, d, e, f
  dcb 0, 0, 0, 0, 3, 0, 0, 4

i want to do

ldy $30
lda moveTypes,y
asl
tax
lda moveTable,x
sta $00
inx
lda moveTable,x
sta $01
jmp ($0000)

moveType0:
; ...
rts
moveType1:
; ...
rts
moveType2:
; ...
rts
moveType3:
; ...
rts
moveType4:
; ...
rts

moveTable:
    .dw moveType0  ; case for %0000
    .dw moveType1  ; case for %0011
    .dw moveType2  ; case for %0110
    .dw moveType3  ; case for %1100
    .dw moveType4  ; case for %1111

or something like that. this is the first time ive found some kind of use and reason to learn how to do jump tables but i have no idea how im supposed to do that with this assembler. do i really have to figure out where the labels point to and hard code to addresses? thats very inconvenient... im hoping theres been some thought put into this? also where can i find some kind of documentation? and if this is just a dead project then i would love to hear some suggestions for somewhere else i can practice and write 6502 assembly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions