Mercurial > hg > index.cgi
comparison src/error.s @ 131:95f174bf459b
Add error handling for immediate mode loop
author | William Astle <lost@l-w.ca> |
---|---|
date | Sat, 18 May 2024 00:41:46 -0600 |
parents | 5d5472b11ccd |
children |
comparison
equal
deleted
inserted
replaced
130:9f23ddc5165f | 131:95f174bf459b |
---|---|
9 ; Note the error message lookup does not need to be efficient which is why the lookup just runs through the list | 9 ; Note the error message lookup does not need to be efficient which is why the lookup just runs through the list |
10 ; of error messages in sequence looking for NUL terminators. The specific handling of B (error number) below avoids | 10 ; of error messages in sequence looking for NUL terminators. The specific handling of B (error number) below avoids |
11 ; issues if there happen to be error codes above 128. | 11 ; issues if there happen to be error codes above 128. |
12 ERROR clr filenum ; reset display device to console | 12 ERROR clr filenum ; reset display device to console |
13 jsr writecondnl ; do a newline if needed (will preserve B) | 13 jsr writecondnl ; do a newline if needed (will preserve B) |
14 ldx #errormsg ; point to error message list | 14 bsr ERRORstr ; get the error message string |
15 incb ; account for decb below | |
16 bra ERROR1 ; go search for correct message | |
17 ERROR0 lda ,x+ ; end of message? | |
18 bne ERROR0 ; brif not end of message | |
19 ERROR1 decb ; at the correct one? | |
20 bne ERROR0 ; brif not - skip to next one | |
21 ERROR2 jsr writestrconduc ; output error message | 15 ERROR2 jsr writestrconduc ; output error message |
22 ldu curline ; are we in immediate mode? | 16 ldu curline ; are we in immediate mode? |
23 beq ERROR3 ; brif so | 17 beq ERROR3 ; brif so |
24 ldx #inmsg ; point to " in " | 18 ldx #inmsg ; point to " in " |
25 jsr writestrconduc ; output " in " | 19 jsr writestrconduc ; output " in " |
27 jsr print_uint16d ; display the line number | 21 jsr print_uint16d ; display the line number |
28 ERROR3 lds freetop ; reset the stack pointer (error routine could be called anywhere) | 22 ERROR3 lds freetop ; reset the stack pointer (error routine could be called anywhere) |
29 clr ,-s ; reset the call stack | 23 clr ,-s ; reset the call stack |
30 sts cstackptr | 24 sts cstackptr |
31 jmp immediate ; go back to immediate mode | 25 jmp immediate ; go back to immediate mode |
26 ERRORstr ldx #errormsg ; point to error messages | |
27 incb ; compensate for decb below | |
28 bra ERRORstr1 ; go find the right string | |
29 ERRORstr0 lda ,x+ ; end of string? | |
30 bne ERRORstr0 ; brif not | |
31 ERRORstr1 decb ; at the correct message? | |
32 bne ERRORstr0 ; brif not - skip a message | |
33 rts | |
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
33 ; Error messages | 35 ; Error messages |
34 ; | 36 ; |
35 ; Each error begins with a deferr macro invocation which will define a symbol err_slug with the next error number | 37 ; Each error begins with a deferr macro invocation which will define a symbol err_slug with the next error number |
36 ; | 38 ; |