5.5. WORKING WITH TABLES 63
org $2100
ldx #preamble
jsr outstrg
mainloop
jsr inchar
ldx #vowels
ldab #nvowels
jsr lookup
bcs isvowel
ldx #nostr
jsr outstrgo
bra mainloop
isvowel ldx #yesstr
jsr outstrgo
bra mainloop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; lookup: Function to lookup a value in a table
; Checks if the value in A register is in the table
;
; Entry: Starting address in X, size in B, value in A
; Exit: Carry set if the value in A is in the table;
; cleared if not in the table
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
lookup
lkploop
tstb
beq notthere *this is the basic counting loop
cmpa 0,x
beq foundit
inx
decb
bra lkploop
notthere
clc
rts
foundit
sec
rts
Comentarios a estos manuales