RosettaCodeData/Task/Empty-string/6502-Assembly/empty-string-2.6502

17 lines
386 B
Plaintext

lda #<EmptyString ;address of string we wish to check
sta $00
lda #>EmptyString
sta $01 ;the empty string has been assigned to zero page pair $00 and $01
ldy #0
ldx #0
getStringLength:
lda ($00),y
beq Terminated
iny
jmp getStringLength
Terminated:
cpy #0
beq StringIsEmpty ;if this branch is taken, the string is empty
;otherwise, the string is not empty