One of my concerns right now is making some assembly language subroutines which needs to be called from a C program in order to CountRoutes, FindRoutes or DisplayRoutes on a LCD Screen. For example this is the code in which i have the route addresses saved and for the first subroutine, CountRoutes it should count how many routes do i have in memory before it finds -1 and stops counting.
This is what i've done so far and it's not working. The thing that i need to change is: ignore the .byte null line (jump to the two strings below), verify if you're at the end of the strin (meets 0) and jump again ti'll you find another .word 6 or -1.
.word 4
.byte null
.asciz "Dee Bridge"
.asciz ""
.word 5
.byte 'x
.asciz "Echt Terminus"
.asciz "Express"
.word -1 ; route 0xffff terminates the data set
.area text
_RouteCount::
pshx
tfr d,y ;
ldx #0 ; Clear index
Loop: ldab 1,y+ ; Fetch next character; inc Y
bmi Done ; If -1 is found, exit loop
bra Loop ; Repeat loop
ldx #1 ; Store no match flag in X
beq
bra Loop
Done: tfr Y,D ; Transfer index in D
pulx
rts