80-Bus News

  

January–February 1984, Volume 3, Issue 1











Page 31 of 55











Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    69

                ; << NO  REFERENCE  TO  THIS  SECTION  OF  CODE >>
                ; << Set up another program area (can be in ROM) >>

F495 2A5E10             LD      HL,(BASTXT)     ; Get start of program text
F498 22D610             LD      (PROGND),HL     ; Set more variable space
F49B 210080             LD      HL,8000H        ; Address of new program
F49E 5E                 LD      E,(HL)          ; Get LSB of new RAM end
F49F 23                 INC     HL
F4A0 56                 LD      D,(HL)          ; Get MSB of new RAM end
F4A1 23                 INC     HL
F4A2 23                 INC     HL              ; Null at start of program
F4A3 225E10             LD      (BASTXT),HL     ; New program text area 8003H
F4A6 EB                 EX      DE,HL           ; New RAM end to HL
F4A7 22AF10             LD      (LSTRAM),HL     ; Set new RAM end
F4AA 225A10             LD      (STRSPC),HL     ; Clear string space
F4AD 01F2E7             LD      BC,RUNCNT       ; Execution driver loop
F4B0 C5                 PUSH    BC              ; Save for return
F4B1 C3C5E4             JP      RUNFST          ; Clear variables and continue

F4B4 C356FD     RUART:  JP      GUART           ; Get a byte from UART

F4B7 CDBAF4     WUART2: CALL    WUART           ; Send 2 Bytes to UART
F4BA F5         WUART:  PUSH    AF              ; Save byte
F4BB C5                 PUSH    BC              ; Save BC
F4BC 4F                 LD      C,A             ; Byte to C
F4BD CD68FD             CALL    SUART           ; Send byte to UART
F4C0 C1                 POP     BC              ; Restore BC
F4C1 F1                 POP     AF              ; Restore byte
F4C2 C9                 RET

F4C3 0601       CSAVE:  LD      B,1             ; Flag "CSAVE"
F4C5 FEAE               CP      ZTIMES          ; "*" token? ("CSAVE*")
F4C7 CABBE8             JP      Z,ARRSV1        ; Yes - Array save
F4CA CD5AED             CALL    EVAL            ; Evaluate expression
F4CD E5                 PUSH    HL              ; Save code string address
F4CE CD95F3             CALL    GTFLNM          ; Get file name
F4D1 D5                 PUSH    DE              ; Save file name
F4D2 CDC8FC             CALL    CASFFW          ; Turn on motor and wait
F4D5 D1                 POP     DE              ; Restore file name
F4D6 3ED3               LD      A,11010011B     ; Header byte
F4D8 CDBAF4             CALL    WUART           ; Send byte to UART
F4DB CDB7F4             CALL    WUART2          ; Send byte twice more
F4DE 1A                 LD      A,(DE)          ; Get file name
F4DF CDBAF4             CALL    WUART           ; Send it to UART
F4E2 00                 NOP
F4E3 00                 NOP
F4E4 00                 NOP
F4E5 21D610             LD      HL,PROGND       ; Start of program information
F4E8 220C0C             LD      (ARG1),HL       ; Save for monitor save routine
F4EB 2AD610             LD      HL,(PROGND)     ; End of program information
F4EE 220E0C             LD      (ARG2),HL       ; Save for monitor save routine
F4F1 CD73FE             CALL    SAVE            ; Save program to tape
F4F4 CDD8FC             CALL    ARET            ; Not much there!
F4F7 E1                 POP     HL              ; Restore code string address
F4F8 C9                 RET
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    70

F4F9 7E         CLOAD:  LD      A,(HL)          ; Get byte after "CLOAD"
F4FA FEAE               CP      ZTIMES          ; "*" token? ("CLOAD*")
F4FC CAB9E8             JP      Z,ARRLD1        ; Yes - Array load
F4FF CDD1FF             CALL    SMOTOR          ; Start motor and get "?"
F502 D69E               SUB     ZPRINT          ; "?" ("PRINT" token) Verify?
F504 CA09F5             JP      Z,FLGVER        ; Yes - Flag "verify"
F507 AF                 XOR     A               ; Flag "load"
F508 01                 DEFB    (LD BC,nn)      ; Skip "CPL" and "INC HL"
F509 2F         FLGVER: CPL                     ; Flag "verify"
F50A 23                 INC     HL              ; Skip over "?"
F50B F5                 PUSH    AF              ; Save verify flag
F50C 2B                 DEC     HL              ; DEC 'cos GETCHR INCs
F50D CD36E8             CALL    GETCHR          ; Get next character
F510 3E00               LD      A,0             ; Any file will do
F512 CA1CF5             JP      Z,ANYNAM        ; No name given - Any will do
F515 CD5AED             CALL    EVAL            ; Evaluate expression
F518 CD95F3             CALL    GTFLNM          ; Get file name
F51B 1A                 LD      A,(DE)          ; Get first byte of name
F51C 6F         ANYNAM: LD      L,A             ; Save name to find
F51D F1                 POP     AF              ; Get verify flag
F51E F5                 PUSH    AF              ; And re-save
F51F B7                 OR      A               ; Verify of load?
F520 67                 LD      H,A
F521 22E410             LD      (FPREG),HL      ; Save nam of file to find
F524 CCBAE4             CALL    Z,CLRPTR        ; Load - Clear pointers
F527 2AE410             LD      HL,(FPREG)      ; Get name of program to find
F52A EB                 EX      DE,HL           ; Name to DE
F52B 0603       CLOAD1: LD      B,3             ; 3 Header bytes
F52D CDB4F4     CLOAD2: CALL    RUART           ; Get a byte from UART
F530 D6D3               SUB     11010011B       ; Header byte?
F532 C22BF5             JP      NZ,CLOAD1       ; Look for header
F535 05                 DEC     B               ; Count header bytes
F536 C22DF5             JP      NZ,CLOAD2       ; More to find?
F539 CDB4F4             CALL    RUART           ; Get name of file
F53C CD74F5             CALL    FILFND          ; Display "file X found"
F53F 1C                 INC     E               ; Any file name given?
F540 1D                 DEC     E
F541 CA48F5             JP      Z,THSFIL        ; No - This file will do
F544 BB                 CP      E               ; Has file been found?
F545 C22BF5             JP      NZ,CLOAD1       ; No - Look for another
F548 00         THSFIL: NOP
F549 00                 NOP
F54A 00                 NOP
F54B F1                 POP     AF              ; Get verify flag
F54C B7                 OR      A               ; Load or verify?
F54D C25CF5             JP      NZ,CLOADV       ; Verify program
F550 CD88FE             CALL    MONLD           ; Use monitor to load program
F553 2AD610             LD      HL,(PROGND)     ; Get end of program
F556 CD93E3             CALL    ENFMEM          ; See if enough memory
F559 C35FF5             JP      CLOADE          ; "Ok" and set up pointers

F55C CDAAFE     CLOADV: CALL    MONVE           ; Use monitor to verify program
F55F 214BE3     CLOADE: LD      HL,OKMSG        ; "Ok" message
F562 CD10F2             CALL    PRS             ; Output string
F565 CDD8FC             CALL    ARET            ; Not a lot there!
F568 C37CE4             JP      SETPTR          ; Set up line pointers

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

NASCOM ROM BASIC source code is available in ASM and LST file format.











Page 31 of 55