Retro - 40 best procedures: Determination of the length of BASIC programs.

ZX Review #7-8-9-10
     8.2. Determination of the length

        BASIC program


  Length: 13

  Number of variables: 0

  Checksum: 1544

  Purpose: BEYSIKprogrammy gives the length in bytes.

  Calling the program:

     PRINT USR address

  Error Check: No

  Comments: none


   LISTING machine code
Assembly label number to VVODA147.


       LD HL, (23627) 42 75 92

       LD DE, (23635) 237 91 83 92

       AND A 167

       SBC HL, DE 237 82

       LD B, H 68

       LD C, L 77

       RET 201
2

  How it works:

  In a couple of registers HL loaded address of the variables, 
and DE loads the address of BASIC programs. DE is subtracted 
from the HL, to get the length of the program.

HL is copied to the BC and the program
returns to BASIC.