80-Bus News


January-February 1984, Volume 3, Issue 1

Page 24 of 55

Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    55

F04A 110400     CREARY: LD      DE,4            ; 4 Bytes per entry
F04D F1                 POP     AF              ; Array to save or 0 dim'ns?
F04E CAA0E9             JP      Z,FCERR         ; Yes - ?FC Error
F051 71                 LD      (HL),C          ; Save second byte of name
F052 23                 INC     HL
F053 70                 LD      (HL),B          ; Save first byte of name
F054 23                 INC     HL
F055 4F                 LD      C,A             ; Number of dimensions to C
F056 CD8AE3             CALL    CHKSTK          ; Check if enough memory
F059 23                 INC     HL              ; Point to number of dimensions
F05A 23                 INC     HL
F05B 22C510             LD      (CUROPR),HL     ; Save address of pointer
F05E 71                 LD      (HL),C          ; Set number of dimensions
F05F 23                 INC     HL
F060 3AAC10             LD      A,(LCRFLG)      ; Locate of Create?
F063 17                 RLA                     ; Carry set = Create
F064 79                 LD      A,C             ; Get number of dimensions
F065 010B00     CRARLP: LD      BC,10+1         ; Default dimension size 10
F068 D26DF0             JP      NC,DEFSIZ       ; Locate - Set default size
F06B C1                 POP     BC              ; Get specified dimension size
F06C 03                 INC     BC              ; Include zero element
F06D 71         DEFSIZ: LD      (HL),C          ; Save LSB of dimension size
F06E 23                 INC     HL
F06F 70                 LD      (HL),B          ; Save MSB of dimension size
F070 23                 INC     HL
F071 F5                 PUSH    AF              ; Save num' of dim'ns an status
F072 E5                 PUSH    HL              ; Save address of dim'n size
F073 CDFFF8             CALL    MLDEBC          ; Multiply DE by BC to find
F076 EB                 EX      DE,HL           ; amount of mem needed (to DE)
F077 E1                 POP     HL              ; Restore address of dimension
F078 F1                 POP     AF              ; Restore number of dimensions
F079 3D                 DEC     A               ; Count them
F07A C265F0             JP      NZ,CRARLP       ; Do next dimension if more
F07D F5                 PUSH    AF              ; Save locate/create flag
F07E 42                 LD      B,D             ; MSB of memory needed
F07F 4B                 LD      C,E             ; LSB of memory needed
F080 EB                 EX      DE,HL
F081 19                 ADD     HL,DE           ; Add bytes to array start
F082 DAA2E3             JP      C,OMERR         ; Too big - Error
F085 CD93E3             CALL    ENFMEM          ; See if enough memory
F088 22DA10             LD      (ARREND),HL     ; Save new end of array

Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    56

F08B 2B         ZERARY: DEC     HL              ; Back through array data
F08C 3600               LD      (HL),0          ; Set array element to zero
F08E CD8AE6             CALL    CPDEHL          ; All elements zeroed?
F091 C28BF0             JP      NZ,ZERARY       ; No - Keep on going
F094 03                 INC     BC              ; Number of bytes + 1
F095 57                 LD      D,A             ; A=0
F096 2AC510             LD      HL,(CUROPR)     ; Get address of array
F099 5E                 LD      E,(HL)          ; Number of dimensions
F09A EB                 EX      DE,HL           ; To HL
F09B 29                 ADD     HL,HL           ; Two bytes per dimension size
F09C 09                 ADD     HL,BC           ; Add number of bytes
F09D EB                 EX      DE,HL           ; Bytes needed to DE
F09E 2B                 DEC     HL
F09F 2B                 DEC     HL
F0A0 73                 LD      (HL),E          ; Save LSB of bytes needed
F0A1 23                 INC     HL
F0A2 72                 LD      (HL),D          ; Save MSB of bytes needed
F0A3 23                 INC     HL
F0A4 F1                 POP     AF              ; Locate / Create?
F0A5 DACCF0             JP      C,ENDDIM        ; A is 0 , End if create
F0A8 47         FINDEL: LD      B,A             ; Find array element
F0A9 4F                 LD      C,A
F0AA 7E                 LD      A,(HL)          ; Number of dimensions
F0AB 23                 INC     HL
F0AC 16                 DEFB    (LD D,n)        ; Skip "POP HL"
F0AD E1         FNDELP: POP     HL              ; Address of next dim' size
F0AE 5E                 LD      E,(HL)          ; Get LSB of dim'n size
F0AF 23                 INC     HL
F0B0 56                 LD      D,(HL)          ; Get MSB of dim'n size
F0B1 23                 INC     HL
F0B2 E3                 EX      (SP),HL         ; Save address - Get index
F0B3 F5                 PUSH    AF              ; Save number of dim'ns
F0B4 CD8AE6             CALL    CPDEHL          ; Dimension too large?
F0B7 D245F0             JP      NC,BSERR        ; Yes - ?BS Error
F0BA E5                 PUSH    HL              ; Save index
F0BB CDFFF8             CALL    MLDEBC          ; Multiply previous by size
F0BE D1                 POP     DE              ; Index supplied to DE
F0BF 19                 ADD     HL,DE           ; Add index to pointer
F0C0 F1                 POP     AF              ; Number of dimensions
F0C1 3D                 DEC     A               ; Count them
F0C2 44                 LD      B,H             ; MSB of pointer
F0C3 4D                 LD      C,L             ; LSB of pointer
F0C4 C2ADF0             JP      NZ,FNDELP       ; More - Keep going
F0C7 29                 ADD     HL,HL           ; 4 Bytes per element
F0C8 29                 ADD     HL,HL
F0C9 C1                 POP     BC              ; Start of array
F0CA 09                 ADD     HL,BC           ; Point to element
F0CB EB                 EX      DE,HL           ; Address of element to DE
F0CC 2AD010     ENDDIM: LD      HL,(NXTOPR)     ; Got code string address
F0CF C9                 RET

This is an OCR’d version of the scanned page and likely contains recognition errors.

Page 24 of 55