Retro - 40 best procedures: Determination addresses BASIC string.

ZX Review #7-8-9-10
    8.3. Return address

         BASIC-line


  Length: 29

  Number of variables: 1

  Checksum: 2351

  Purpose: returns the address
the first symbol after the code in the REM
string.

  Variables:

     Name: line number

     Length: 2

     Cell: 23296

     Comment: The line number

  which shall include REM.

  Calling the program:

     LET A = USR address

  Error checking: If the given string does not exist or not
expression of REM, the program will return 0.

  Comment: This program can be used to find the address of a 
cell in which can be placed on the machine code.

After the program the variable A (can use any other variable) 
is set at or 0, If the error occurs.


  Do not enter more than line number
9999!


   LISTING machine code
Assembly label number to VVODA147.


       LD HL, (23296) 42 0 91

       LD A, H 124

       OR L 181

       JR Z, ERROR 40 5

       CALL 6510 205 110 1925

       JR Z, CONT 40 4
ERROR LD BC, 0 1 0 0

       RET 201
CONT INC HL 35

       INC HL 35

       INC HL 35

       INC HL 35
140.

       LD A, 234 62 234

       CP (HL) 190

       JR NZ, ERROR 32243

       INC HL 35

       LD B, H 68

       LD C, L 77

       RET 201
2

  How it works:

  In a pair of registers is entered HL
opsedelenny line number. If
this number is 0, a transition is made to ERROR, otherwise 
called ROM routine at 6510.

Upon returning from this procedure HL contains the address line.
If the zero flag is set, a transition is made to CONT. If the 
flag zero is not installed, this string

does not exist and the routine goes to ERROR, which in BC is 
loaded 0, and then going return to BASIC.


  If the program reaches tags CONT, HL increased by 4
to point to the first operator in that line. If this
the operator does not have a code 234,
transition to ERROR. If
as an operator of REM, HL increases, pointing to the next
symbol. HL value is then copied to the BC and the program 
returns to BASIC.