Skip to content

Instantly share code, notes, and snippets.

@gnacu
Created April 25, 2024 20:15
Show Gist options
  • Save gnacu/3bda6c36986160a8000b503be41df48f to your computer and use it in GitHub Desktop.
Save gnacu/3bda6c36986160a8000b503be41df48f to your computer and use it in GitHub Desktop.
;-- Tab 1: Table Delegates ---
t1_sidx .byte 0 ;Selected Index
t1_ci ;Column Info
#stxy ptr
ldy #2 ;#tc_id ... where def'd?
lda (this),y
tax
lda #$00 ;Not Sorted
rts
t1_cc ;Column Clicked
sec ;No Change
rts
t1_ca ;Content @ Index
;Y -> row index
;X -> col index
cpy t1_sidx
beq *+3
clc
php ;Push Selected State
txa
jsr table_s
lda #0 ;PETSCII
plp ;Pull Selected State
rts
t1_cs ;Content Size
#ldxy 50 ;50 rows
rts
t1_kp ;Key Pressed
;A -> +1/-1
;A <- new index
cmp #0
bne *+4
sec ;Unsupported key, no change
rts
clc
adc t1_sidx
bpl *+6
;Minus! No change, return 0.
lda #0
sec
rts
cmp #50
bcc *+6
;>=50! No change, return 49
lda #49
sec
rts
sta t1_sidx
clc ;Selection changed.
rts
t1_ck ;Row Clicked
;X -> hit row index
stx t1_sidx
rts
t1_dk ;Row Double Clicked
jmp alert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment