Correct useage of USR ?

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
User avatar
stefano
Posts: 407
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Correct useage of USR ?

Post by stefano » Wed Nov 20, 2013 11:16 am

Good to know, so.. the interpreter will switch to the next BASIC line, correct ?

User avatar
siggi
Posts: 885
Joined: Thu May 08, 2008 9:30 am
Location: Dauernheim, Germany
Contact:

Re: Correct useage of USR ?

Post by siggi » Wed Nov 20, 2013 11:33 am

Yes.
I often use such code:

PRINT USR xxx, <params>
IF PEEK <ERRNO> THEN GOTO ERRORHANDLER

where ERRNO is a byte in the system variable area, which is set by the USR routine to its return code: 0 for no error and > 0 to indicate an error (like in C ;-)

Siggi
My ZX81 web-server: online since 2007
http://zx81-siggi.endoftheinternet.org/index.html

Post Reply