80-Bus News

  

July–August 1983 · Volume 2 · Issue 4

Page 34 of 55
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    22

E5B8 216010     ENDBUF: LD      HL,BUFFER-1     ; Point to start of buffer
E5BB 12                 LD      (DE),A          ; Mark end of buffer (A = 00)
E5BC 13                 INC     DE
E5BD 12                 LD      (DE),A          ; A = 00
E5BE 13                 INC     DE
E5BF 12                 LD      (DE),A          ; A = 00
E5C0 C9                 RET

E5C1 3A4410     DODEL:  LD      A,(NULFLG)      ; Get null flag status
E5C4 B7                 OR      A               ; Is it zero?
E5C5 3E00               LD      A,0             ; Zero A - Leave flags
E5C7 324410             LD      (NULFLG),A      ; Zero null flag
E5CA C2D5E5             JP      NZ,ECHDEL       ; Set - Echo it
E5CD 05                 DEC     B               ; Decrement length
E5CE CAF2E5             JP      Z,GETLIN        ; Get line again if empty
E5D1 CD9BE6             CALL    OUTC            ; Output null character
E5D4 3E                 DEFB    (LD A,n)        ; Skip "DEC B"
E5D5 05         ECHDEL: DEC     B               ; Count bytes in buffer
E5D6 2B                 DEC     HL              ; Back space buffer
E5D7 CAE9E5             JP      Z,OTKLN         ; No buffer - Try again
E5DA 7E                 LD      A,(HL)          ; Get deleted byte
E5DB CD9BE6             CALL    OUTC            ; Echo it
E5DE C310E6             JP      MORINP          ; Get more input

E5E1 05         DELCHR: DEC     B               ; Count bytes in buffer
E5E2 2B                 DEC     HL              ; Back space buffer
E5E3 CD9BE6             CALL    OUTC            ; Output character in A
E5E6 C210E6             JP      NZ,MORINP       ; Not end - Get more
E5E9 CD9BE6     OTKLN:  CALL    OUTC            ; Output character in A
E5EC CD81EB     KILIN:  CALL    PRNTCR          ; Output CRLF
E5EF C307E6             JP      TTYLIN          ; Get line again

E5F2 CD6DFE     GETLIN: CALL    MONTST          ; Is it NAS-SYS?
E5F5 CA07E6             JP      Z,TTYLIN        ; No - Character input
E5F8 2A750C             LD      HL,(CIN)        ; Point to NAS-SYS input table
E5FB 7E                 LD      A,(HL)          ; Get input mode
E5FC FE74               CP      74H             ; Is it "X" mode?
E5FE CA07E6             JP      Z,TTYLIN        ; Yes - Teletype line input
E601 CDE8FE             CALL    INLINE          ; Get a line from NAS-SYS
E604 C386EB             JP      DONULL          ; POS(X)=0 and do nulls
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    23

E607 216110     TTYLIN: LD      HL,BUFFER       ; Get a line by character
E60A 0601               LD      B,1             ; Set buffer as empty
E60C AF                 XOR     A
E60D 324410             LD      (NULFLG),A      ; Clear null flag
E610 CDCCE6     MORINP: CALL    CLOTST          ; Get character and test ^O
E613 4F                 LD      C,A             ; Save character in C
E614 FE7F               CP      DEL             ; Delete character?
E616 CAC1E5             JP      Z,DODEL         ; Yes - Process it
E619 3A4410             LD      A,(NULFLG)      ; Get null flag
E61C B7                 OR      A               ; Test null flag status
E61D CA29E6             JP      Z,PROCES        ; Reset - Process character
E620 3E00               LD      A,0             ; Set a null
E622 CD9BE6             CALL    OUTC            ; Output null
E625 AF                 XOR     A               ; Clear A
E626 324410             LD      (NULFLG),A      ; Reset null flag
E629 79         PROCES: LD      A,C             ; Get character
E62A FE07               CP      CTRLG           ; Bell?
E62C CA6DE6             JP      Z,PUTCTL        ; Yes - Save it
E62F FE03               CP      CTRLC           ; Is it control "C"?
E631 CC81EB             CALL    Z,PRNTCR        ; Yes - Output CRLF
E634 37                 SCF                     ; Flag break
E635 C8                 RET     Z               ; Return if control "C"
E636 FE0D               CP      CR              ; Is it enter?
E638 CA7CEB             JP      Z,ENDINP        ; Yes - Terminate input
E63B FE15               CP      CTRLU           ; Is it control "U"?
E63D CAECE5             JP      Z,KILIN         ; Yes - Get another line
E640 FE40               CP      "@"             ; Is it "kill line"?
E642 CAE9E5             JP      Z,OTKLN         ; Yes - Kill line
E645 FE5F               CP      "_"             ; Is it delete?
E647 CAE1E5             JP      Z,DELCHR        ; Yes - Delete character
E64A FE08               CP      BKSP            ; Is it backspace?
E64C CAE1E5             JP      Z,DELCHR        ; Yes - Delete character
E64F FE12               CP      CTRLR           ; Is it control "R"?
E651 C268E6             JP      NZ,PUTBUF       ; No - Put in buffer
E654 C5                 PUSH    BC              ; Save buffer length
E655 D5                 PUSH    DE              ; Save DE
E656 E5                 PUSH    HL              ; Save buffer address
E657 3600               LD      (HL),0          ; Mark end of buffer
E659 CDF4FF             CALL    OUTNCR          ; Output and do CRLF
E65C 216110             LD      HL,BUFFER       ; Point to buffer start
E65F CD10F2             CALL    PRS             ; Output buffer
E662 E1                 POP     HL              ; Restore buffer address
E663 D1                 POP     DE              ; Restore DE
E664 C1                 POP     BC              ; Restore buffer length
E665 C310E6             JP      MORINP          ; Get another character

Go to part 3 of NASCOM ROM BASIC dis-assembled.

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

Page 34 of 55