80-Bus News

  

November–December 1983 · Volume 2 · Issue 6

Page 32 of 67
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    40

EB7C 3600       ENDINP: LD      (HL),0          ; Mark end of buffer
EB7E 216010             LD      HL,BUFFER-1     ; Point to buffer
EB81 3E0D       PRNTCR: LD      A,CR            ; Load a CR
EB83 CD9BE6             CALL    OUTC            ; Output character
EB86 AF         DONULL: XOR     A               ; Set to position 0
EB87 32AB10             LD      (CURPOS),A      ; Store it
EB8A 3A4110             LD      A,(NULLS)       ; Get number of nulls
EB8D 3D         NULLP:  DEC     A               ; Count them
EB8E C8                 RET     Z               ; Return if done
EB8F F5                 PUSH    AF              ; Save count
EB90 AF                 XOR     A               ; Load a null
EB91 CD9BE6             CALL    OUTC            ; Output it
EB94 F1                 POP     AF              ; Restore count
EB95 C38DEB             JP      NULLP           ; Keep counting

EB98 3A4310     DOCOM:  LD      A,(COMMAN)      ; Get comma width
EB9B 47                 LD      B,A             ; Save in B
EB9C 3AAB10             LD      A,(CURPOS)      ; Get current position
EB9F B8                 CP      B               ; Within the limit?
EBA0 D481EB             CALL    NC,PRNTCR       ; No - output CRLF
EBA3 D2D2EB             JP      NC,NEXITM       ; Get next item
EBA6 D60E       ZONELP: SUB     14              ; Next zone of 14 characters
EBA8 D2A6EB             JP      NC,ZONELP       ; Repeat if more zones
EBAB 2F                 CPL                     ; Number of spaces to output
EBAC C3C7EB             JP      ASPCS           ; Output them

EBAF F5         DOTAB:  PUSH    AF              ; Save token
EBB0 CD81F4             CALL    FNDNUM          ; Evaluate expression
EBB3 CD90E6             CALL    CHKSYN          ; Make sure ")" follows
EBB6 29                 DEFB    ")"
EBB7 2B                 DEC     HL              ; Back space on to ")"
EBB8 F1                 POP     AF              ; Restore token
EBB9 D6A8               SUB     ZSPC            ; Was it "SPC(" ?
EBBB E5                 PUSH    HL              ; Save code string address
EBBC CAC2EB             JP      Z,DOSPC         ; Yes - Do "E" spaces
EBBF 3AAB10             LD      A,(CURPOS)      ; Get current position
EBC2 2F         DOSPC:  CPL                     ; Number of spaces to print to
EBC3 83                 ADD     A,E             ; Total number to print
EBC4 D2D2EB             JP      NC,NEXITM       ; TAB < Current POS(X)
EBC7 3C         ASPCS:  INC     A               ; Output A spaces
EBC8 47                 LD      B,A             ; Save number to print
EBC9 3E20               LD      A," "           ; Space
EBCB CD9BE6     SPCLP:  CALL    OUTC            ; Output character in A
EBCE 05                 DEC     B               ; Count them
EBCF C2CBEB             JP      NZ,SPCLP        ; Repeat if more
EBD2 E1         NEXITM: POP     HL              ; Restore code string address
EBD3 CD36E8             CALL    GETCHR          ; Get next character
EBD6 C326EB             JP      PRNTLP          ; More to print
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    41

EBD9 3F526564   REDO:   DEFB    "?Redo from start",CR,LF,0

EBEC 3ACD10     BADINP: LD      A,(READFG)      ; READ or INPUT?
EBEF B7                 OR      A
EBF0 C2A7E3             JP      NZ,DATSNR       ; READ - ?SN Error
EBF3 C1                 POP     BC              ; Throw away code string addr
EBF4 21D9EB             LD      HL,REDO         ; "Redo from start" message
EBF7 CD10F2             CALL    PRS             ; Output string
EBFA C3F8E4             JP      DOAGN           ; Do last INPUT again

EBFD CD7BF1     INPUT:  CALL    IDTEST          ; Test for illegal direct
EC00 7E                 LD      A,(HL)          ; Get character after "INPUT"
EC01 FE22               CP      '"'             ; Is there a prompt string?
EC03 3E00               LD      A,0             ; Clear A and leave flags
EC05 324510             LD      (CTLOFG),A      ; Enable output
EC08 C217EC             JP      NZ,NOPMPT       ; No prompt - get input
EC0B CDCFF1             CALL    QTSTR           ; Get string terminated by '"'
EC0E CD90E6             CALL    CHKSYN          ; Check for ";" after prompt
EC11 3B                 DEFB    ";"
EC12 E5                 PUSH    HL              ; Save code string address
EC13 CD13F2             CALL    PRS1            ; Output prompt string
EC16 3E                 DEFB    (LD A,n)        ; Skip "PUSH HL"
EC17 E5         NOPMPT: PUSH    HL              ; Save code string address
EC18 CDFCE4             CALL    PROMPT          ; Get input with "? " prompt
EC1B C1                 POP     BC              ; Restore code string address
EC1C DA77E8             JP      C,INPBRK        ; Break pressed - Exit
EC1F 23                 INC     HL              ; Next byte
EC20 7E                 LD      A,(HL)          ; Get it
EC21 B7                 OR      A               ; End of line?
EC22 2B                 DEC     HL              ; Back again
EC23 C5                 PUSH    BC              ; Re-save code string address
EC24 CA6FEA             JP      Z,NXTDTA        ; Yes - Find next DATA stmt
EC27 362C               LD      (HL),","        ; Store comma as separator
EC29 C331EC             JP      NXTITM          ; Get next item

EC2C E5         READ:   PUSH    HL              ; Save code string address
EC2D 2ADC10             LD      HL,(NXTDAT)     ; Next DATA statement
EC30 F6                 DEFB    (OR n)          ; Flag "READ"
EC31 AF         NXTITM: XOR     A               ; Flag "INPUT"
EC32 32CD10             LD      (READFG),A      ; Save "READ"/"INPUT" flag
EC35 E3                 EX      (SP),HL         ; Get code str' , Save pointer
EC36 C33DEC             JP      GTVLUS          ; Get values

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

Page 32 of 67