Skip to content

Instantly share code, notes, and snippets.

@les-peters
Created December 19, 2022 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save les-peters/14ecc69cba42cdc102f60b654cff24ab to your computer and use it in GitHub Desktop.
Save les-peters/14ecc69cba42cdc102f60b654cff24ab to your computer and use it in GitHub Desktop.
Capital after Vowel, ASM version
START: LDY #00 ; start loop at 0
LOOP: LDA $0800,Y ; load Y-th character
BEQ _END ; stop loop if NULL found
TRY_A: CMP #61 ; compare to 'a'
BNE _TRY_E
JSR _VOWEL ; found a vowel
INY ; next character
JMP _LOOP
TRY_E: CMP #65 ; compare to 'e'
BNE _TRY_I
JSR _VOWEL
INY
JMP _LOOP
TRY_I: CMP #69 ; compare to 'i'
BNE _TRY_O
JSR _VOWEL
INY
JMP _LOOP
TRY_O: CMP #70 ; compare to 'o'
BNE _TRY_U
JSR _VOWEL
INY
JMP _LOOP
TRY_U: CMP #75 ; compare to 'u'
BNE _SKIP
JSR _VOWEL
INY
JMP _LOOP
SKIP: CMP #20 ; compare to ' '
BNE _CONST
INY
JMP _LOOP
CONST: CPX #00 ; compare Y to False
BEQ _PRINT ; skip over...
SBC #20 ; reduce A by 32
JSR _RESET ; reset X
PRINT: JSR $FFD2 ; 6502 print routine location
INY
JMP _LOOP
END: BRK
VOWEL: LDX #01 ; set X to True
RTS ; return
RESET: LDX #00 ; set X to False
RTS ; return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment