80-Bus News

  

September–October 1983 · Volume 2 · Issue 5

Page 33 of 67
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    27

E733 E5         SETLIN: PUSH    HL              ; Set up LINES counter
E734 2A4810             LD      HL,(LINESN)     ; Get LINES number
E737 224610             LD      (LINESC),HL     ; Save in LINES counter
E73A E1                 POP     HL
E73B C9                 RET

E73C 21DEFE     LDNMI1: LD      HL,BREAK        ; Break routine
E73F 227E0C             LD      (NMI),HL        ; NMI forces break
E742 C3F8E3             JP      PRNTOK          ; Go to command mode

E745 FE                 DEFB    (CP n)          ; <<< NO REFERENCE TO HERE >>>

E746 E5         COUNT:  PUSH    HL              ; Save code string address
E747 D5                 PUSH    DE
E748 2A4610             LD      HL,(LINESC)     ; Get LINES counter
E74B 11FFFF             LD      DE,-1
E74E ED5A               ADC     HL,DE           ; Decrement
E750 224610             LD      (LINESC),HL     ; Put it back
E753 D1                 POP     DE
E754 E1                 POP     HL              ; Restore code string address
E755 F0                 RET     P               ; Return if more lines to go
E756 E5                 PUSH    HL              ; Save code string address
E757 2A4810             LD      HL,(LINESN)     ; Get LINES number
E75A 224610             LD      (LINESC),HL     ; Reset LINES counter
E75D 3A4C10             LD      A,(NMIFLG)      ; Break by NMI?
E760 B7                 OR      A
E761 C2E5FE             JP      NZ,ARETN        ; Yes - "RETN"
E764 CD05FD             CALL    GETINP          ; Get input character
E767 FE03               CP      CTRLC           ; Is it control "C"?
E769 CA70E7             JP      Z,RSLNBK        ; Yes - Reset LINES an break
E76C E1                 POP     HL              ; Restore code string address
E76D C346E7             JP      COUNT           ; Keep on counting

E770 2A4810     RSLNBK: LD      HL,(LINESN)     ; Get LINES number
E773 224610             LD      (LINESC),HL     ; Reset LINES counter
E776 C3B1E0             JP      BRKRET          ; Go and output "Break"
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    28

E779 3E64       FOR:    LD      A,64H           ; Flag "FOR" assignment
E77B 32CB10             LD      (FORFLG),A      ; Save "FOR" flag
E77E CD87EA             CALL    LET             ; Set up initial index
E781 C1                 POP     BC              ; Drop RETurn address
E782 E5                 PUSH    HL              ; Save code string address
E783 CD70EA             CALL    DATA            ; Get next statement address
E786 22C710             LD      (LOOPST),HL     ; Save it for start of lo6p
E789 210200             LD      HL,2            ; Offset for "FOR" block
E78C 39                 ADD     HL,SP           ; Point to it
E78D CD5AE3     FORSLP: CALL    LOKFOR          ; Look for existing "FOR" block
E790 D1                 POP     DE              ; Get code string address
E791 C2A9E7             JP      NZ,FORFND       ; No nesting found
E794 09                 ADD     HL,BC           ; Move into "FOR" block
E795 D5                 PUSH    DE              ; Save code string address
E796 2B                 DEC     HL
E797 56                 LD      D,(HL)          ; Get MSB of loop statement
E798 2B                 DEC     HL
E799 5E                 LD      E,(HL)          ; Get LSB of loop statement
E79A 23                 INC     HL
E79B 23                 INC     HL
E79C E5                 PUSH    HL              ; Save block address
E79D 2AC710             LD      HL,(LOOPST)     ; Get address of loop statement
E7A0 CD8AE6             CALL    CPDEHL          ; Compare the FOR loops
E7A3 E1                 POP     HL              ; Restore block address
E7A4 C28DE7             JP      NZ,FORSLP       ; Different FORs - Find another
E7A7 D1                 POP     DE              ; Restore code string address
E7A8 F9                 LD      SP,HL           ; Remove all nested loops

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

Page 33 of 67