80-Bus News

  

January–February 1984 · Volume 3 · Issue 1

Page 26 of 55
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    59

F189 CD90E6     CHEKFN: CALL    CHKSYN          ; Make sure FN follows
F18C A7                 DEFB    ZFN             ; "FN" token
F18D 3E80               LD      A,80H
F18F 32CB10             LD      (FORFLG),A      ; Flag FN name to find
F192 B6                 OR      (HL)            ; FN name has bit 7 set
F193 47                 LD      B,A             ; in first byte of name
F194 CD32EF             CALL    GTFNAM          ; Get FN name
F197 C344ED             JP      TSTNUM          ; Make sure numeric function

F19A CD44ED     STR:    CALL    TSTNUM          ; Make sure it's a number
F19D CDB8F9             CALL    NUMASC          ; Turn number into text
F1A0 CDCEF1             CALL    CRTST           ; Create string entry for it
F1A3 CD53F3             CALL    GSTRCU          ; Current string to pool
F1A6 01AEF3             LD      BC,TOPOOL       ; Save in string pool
F1A9 C5                 PUSH    BC              ; Save address on stack

F1AA 7E         SAVSTR: LD      A,(HL)          ; Get string length
F1AB 23                 INC     HL
F1AC 23                 INC     HL
F1AD E5                 PUSH    HL              ; Save pointer to string
F1AE CD29F2             CALL    TESTR           ; See if enough string space
F1B1 E1                 POP     HL              ; Restore pointer to string
F1B2 4E                 LD      C,(HL)          ; Get LSB of address
F1B3 23                 INC     HL
F1B4 46                 LD      B,(HL)          ; Get MSB of address
F1B5 CDC2F1             CALL    CRTMST          ; Create string entry
F1B8 E5                 PUSH    HL              ; Save pointer to MSB of addr
F1B9 6F                 LD      L,A             ; Length of string
F1BA CD46F3             CALL    TOSTRA          ; Move to string area
F1BD D1                 POP     DE              ; Restore pointer to MSB
F1BE C9                 RET

F1BF CD29F2     MKTMST: CALL    TESTR           ; See if enough string space
F1C2 21BF10     CRTMST: LD      HL,TMPSTR       ; Temporary string
F1C5 E5                 PUSH    HL              ; Save it
F1C6 77                 LD      (HL),A          ; Save length of string
F1C7 23                 INC     HL
F1C8 23         SVSTAD: INC     HL
F1C9 73                 LD      (HL),E          ; Save LSB of address
F1CA 23                 INC     HL
F1CB 72                 LD      (HL),D          ; Save MSB of address
F1CC E1                 POP     HL              ; Restore pointer
F1CD C9                 RET
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    60

F1CE 2B         CRTST:  DEC     HL              ; DEC - INCed after
F1CF 0622       QTSTR:  LD      B,'"'           ; Terminating quote
F1D1 50                 LD      D,B             ; Quote to D
F1D2 E5         DTSTR:  PUSH    HL              ; Save start
F1D3 0EFF               LD      C,-1            ; Set counter to -1
F1D5 23         QTSTLP: INC     HL              ; Move on
F1D6 7E                 LD      A,(HL)          ; Get byte
F1D7 0C                 INC     C               ; Count bytes
F1D8 B7                 OR      A               ; End of line?
F1D9 CAE4F1             JP      Z,CRTSTE        ; Yes - Create string entry
F1DC BA                 CP      D               ; Terminator D found?
F1DD CAE4F1             JP      Z,CRTSTE        ; Yes - Create string entry
F1E0 B8                 CP      B               ; Terminator B found?
F1E1 C2D5F1             JP      NZ,QTSTLP       ; No - Keep looking
F1E4 FE22       CRTSTE: CP      '"'             ; End with '"'?
F1E6 CC36E8             CALL    Z,GETCHR        ; Yes - Get next character
F1E9 E3                 EX      (SP),HL         ; Starting quote
F1EA 23                 INC     HL              ; First byte of string
F1EB EB                 EX      DE,HL           ; To DE
F1EC 79                 LD      A,C             ; Get length
F1ED CDC2F1             CALL    CRTMST          ; Create string entry
F1F0 11BF10     TSTOPL: LD      DE,TMPSTR       ; Temporary string
F1F3 2AB110             LD      HL,(TMSTPT)     ; Temporary string pool pointer
F1F6 22E410             LD      (FPREG),HL      ; Save address of string ptr
F1F9 3E01               LD      A,1
F1FB 32AD10             LD      (TYPE),A        ; Set type to string
F1FE CD6EF8             CALL    DETHL4          ; Move string to pool
F201 CD8AE6             CALL    CPDEHL          ; Out of string pool?
F204 22B110             LD      (TMSTPT),HL     ; Save new pointer
F207 E1                 POP     HL              ; Restore code string address
F208 7E                 LD      A,(HL)          ; Get next code byte
F209 C0                 RET     NZ              ; Return if pool OK
F20A 1E1E               LD      E,ST            ; ?ST Error
F20C C3C1E3             JP      ERROR           ; String pool overflow

F20F 23         PRNUMS: INC     HL              ; Skip leading space
F210 CDCEF1     PRS:    CALL    CRTST           ; Create string entry for it
F213 CD53F3     PRS1:   CALL    GSTRCU          ; Current string to pool
F216 CD62F8             CALL    LOADFP          ; Move string block to BCDE
F219 1C                 INC     E               ; Length + 1
F21A 1D         PRSLP:  DEC     E               ; Count characters
F21B C8                 RET     Z               ; End of string
F21C 0A                 LD      A,(BC)          ; Get byte to output
F21D CD9BE6             CALL    OUTC            ; Output character in A
F220 FE0D               CP      CR              ; Return?
F222 CC86EB             CALL    Z,DONULL        ; Yes - Do nulls
F225 03                 INC     BC              ; Next byte in string
F226 C31AF2             JP      PRSLP           ; More characters to output

NASCOM ROM BASIC dis-assembled is available in ASM and LST file format.

Page 26 of 55