80-Bus News


November–December 1983, Volume 2, Issue 6

Page 38 of 67

Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    52

EF75 AF         NSCFOR: XOR     A               ; Simple variable
EF76 32CB10             LD      (FORFLG),A      ; Clear "FOR" flag
EF79 E5                 PUSH    HL              ; Save code string address
EF7A 50                 LD      D,B             ; DE = Variable name to find
EF7B 59                 LD      E,C
EF7C 2ADE10             LD      HL,(FNRGNM)     ; FN argument name
EF7F CD8AE6             CALL    CPDEHL          ; Is it the FN argument?
EF82 11E010             LD      DE,FNARG        ; Point to argument value
EF85 CA54F7             JP      Z,POPHRT        ; Yes - Return FN argument value
EF88 2AD810             LD      HL,(VAREND)     ; End of variables
EF8B EB                 EX      DE,HL           ; Address of end of search
EF8C 2AD610             LD      HL,(PROGND)     ; Start of variables address
EF8F CD8AE6     FNDVAR: CALL    CPDEHL          ; End of variable list table?
EF92 CAA8EF             JP      Z,CFEVAL        ; Yes - Called from EVAL?
EF95 79                 LD      A,C             ; Get second byte of name
EF96 96                 SUB     (HL)            ; Compare with name in list
EF97 23                 INC     HL              ; Move on to first byte
EF98 C29DEF             JP      NZ,FNTHR        ; Different - Find another
EF9B 78                 LD      A,B             ; Get first byte of name
EF9C 96                 SUB     (HL)            ; Compare with name in list
EF9D 23         FNTHR:  INC     HL              ; Move on to LSB of value
EF9E CADCEF             JP      Z,RETADR        ; Found - Return address
EFA1 23                 INC     HL              ; <- Skip
EFA2 23                 INC     HL              ; <- over
EFA3 23                 INC     HL              ; <- F.P.
EFA4 23                 INC     HL              ; <- value
EFA5 C38FEF             JP      FNDVAR          ; Keep looking

EFA8 E1         CFEVAL: POP     HL              ; Restore code string address
EFA9 E3                 EX      (SP),HL         ; Get return address
EFAA D5                 PUSH    DE              ; Save address of variable
EFAB 1125EE             LD      DE,FRMEVL       ; Return address in EVAL
EFAE CD8AE6             CALL    CPDEHL          ; Called from EVAL ?
EFB1 D1                 POP     DE              ; Restore address of variable
EFB2 CADFEF             JP      Z,RETNUL        ; Yes - Return null variable
EFB5 E3                 EX      (SP),HL         ; Put back return
EFB6 E5                 PUSH    HL              ; Save code string address
EFB7 C5                 PUSH    BC              ; Save variable name
EFB8 010600             LD      BC,6            ; 2 byte name plus 4 byte data
EFBB 2ADA10             LD      HL,(ARREND)     ; End of arrays
EFBE E5                 PUSH    HL              ; Save end of arrays
EFBF 09                 ADD     HL,BC           ; Move up 6 bytes
EFC0 C1                 POP     BC              ; Source address in BC
EFC1 E5                 PUSH    HL              ; Save new end address
EFC2 CD79E3             CALL    MOVUP           ; Move arrays up
EFC5 E1                 POP     HL              ; Restore new end address
EFC6 22DA10             LD      (ARREND),HL     ; Set new end address
EFC9 60                 LD      H,B             ; End of variables to HL
EFCA 69                 LD      L,C
EFCB 22D810             LD      (VAREND),HL     ; Set new end address
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    53

EFCE 2B         ZEROLP: DEC     HL              ; Back through to zero variable
EFCF 3600               LD      (HL),0          ; Zero byte in variable
EFD1 CD8AE6             CALL    CPDEHL          ; Done them all?
EFD4 C2CEEF             JP      NZ,ZEROLP       ; No - Keep on going
EFD7 D1                 POP     DE              ; Get variable name
EFD8 73                 LD      (HL),E          ; Store second character
EFD9 23                 INC     HL
EFDA 72                 LD      (HL),D          ; Store first character
EFDB 23                 INC     HL
EFDC EB         RETADR: EX      DE,HL           ; Address of variable in DE
EFDD E1                 POP     HL              ; Restore code string address
EFDE C9                 RET

EFDF 32E710     RETNUL: LD      (FPEXP),A       ; Set result to zero
EFE2 214AE3             LD      HL,ZERBYT       ; Also set a null string
EFE5 22E410             LD      (FPREG),HL      ; Save for EVAL
EFE8 E1                 POP     HL              ; Restore code string address
EFE9 C9                 RET

EFEA E5         SBSCPT: PUSH    HL              ; Save code string address
EFEB 2AAC10             LD      HL,(LCRFLG)     ; Locate/Create and Type
EFEE E3                 EX      (SP),HL         ; Save and get code string
EFEF 57                 LD      D,A             ; Zero number of dimensions
EFF0 D5         SCPTLP: PUSH    DE              ; Save number of dimensions
EFF1 C5                 PUSH    BC              ; Save array name
EFF2 CD7FE9             CALL    FPSINT          ; Get subscript (0-32767)
EFF5 C1                 POP     BC              ; Restore array name
EFF6 F1                 POP     AF              ; Get number of dimensions
EFF7 EB                 EX      DE,HL
EFF8 E3                 EX      (SP),HL         ; Save subscript value
EFF9 E5                 PUSH    HL              ; Save LCRFLG and TYPE
EFFA EB                 EX      DE,HL
EFFB 3C                 INC     A               ; Count dimensions
EFFC 57                 LD      D,A             ; Save in D
EFFD 7E                 LD      A,(HL)          ; Get next byte in code string
EFFE FE2C               CP      ","             ; Comma (more to come)?
F000 CAF0EF             JP      Z,SCPTLP        ; Yes - More subscripts
F003 CD90E6             CALL    CHKSYN          ; Make sure ")" follows
F006 29                 DEFB    ")"
F007 22D010             LD      (NXTOPR),HL     ; Save code string address
F00A E1                 POP     HL              ; Get LCRFLG and TYPE
F00B 22AC10             LD      (LCRFLG),HL     ; Restore Locate/create & type
F00E 1E00               LD      E,0             ; Flag not CSAVE* or CLOAD*
F010 D5                 PUSH    DE              ; Save number of dimensions (D)
F011 11                 DEFB    (LD DE,nn)      ; Skip "PUSH HL" and "PUSH AF'

Next part of NASCOM ROM BASIC.

NASCOM ROM BASIC source code is available in ASM and LST file format.

Page 38 of 67