9.4. FIG6502

Ze začátku souboru FIG6502.ASX

;
;                       Through the courtesy of
;
;                        FORTH INTEREST GROUP
;                           P.O. BOX  2154
;                        OAKLAND, CALIFORNIA
;                               94621
;
;
;
;                            Release 1.k0010
;
;                       with compiler security
;                                 and
;                       variable length names
;
;    Further dstribution need not include this notice
;    The FIG installation Manual is required as it contains
;    the model of FORTH and glossary of the system.
;    Might be available from FIG at the above address for $95.00 postpaid.
;
;    Translated from FIG model by W.F. Ragsdale with input-
;    output given for Rockwell System-65. Transportation to
;    other systems requires only the alteration of :
;                 XEMIT, XKEY, XQTER, XCR, AND RSWL
;

;    Equates giving memory assignments, machine
;    registers, and disk parameters.
;
SSIZE     EQU 128           ; sector size in bytes
NBUF      EQU 8             ; number of buffers desired in RAM
;                             (SSIZE*NBUF >= 1024 bytes)
SECTR     EQU 800           ; sector per drive
;                             forcing high drive to zero
SECTL     EQU 1600          ; sector limit for two drives
;                             of 800 per drive.
BMAG      EQU 1056          ; total buffer magnitude, in bytes
;                             expressed by (SSIZE+4)*NBUF
;
BOS       EQU $20           ; bottom of data stack, in zero-page.
TOS       EQU $9E           ; top of data stack, in zero-page.
N         EQU TOS+8         ; scratch workspace
IP        EQU N+8           ; interpretive pointer
W         EQU IP+3          ; code field pointer
UP        EQU W+2           ; user area pointer            (1)
XSAVE     EQU UP+2          ; temporary for X register.
;
TIBX      EQU $0100         ; terminal input buffer of 84 bytes.
ORIG      EQU $0200         ; origin of FORTH's Dictionary.
MEM       EQU $4000         ; top of assigned memory+1 byte.
UAREA     EQU MEM-128       ; 128 bytes of user area
DAREA     EQU UAREA-BMAG    ; disk buffer space.
;
;         Monitor calls for terminal support
;
OUTCH     EQU $D2C1         ; output one ASCII char. to term.
INCH      EQU $D1DC         ; input one ASCII char. to term.
TCR       EQU $D0F1         ; terminal return and line feed.
;
;    From DAREA downward to the top of the dictionary is free
;    space where the user's applications are compiled.
1

Terminal Input Buffer

;
;    Boot up parameters. This area provides jump vectors
;    to Boot up  code, and parameters describing the system.
;
;
          ORG   ORIG
;
                         ; User cold entry point
ENTER     NOP            ; Vector to COLD entry
          JMP COLD+2     ;
REENTR    NOP            ; User Warm entry point
          JMP WARM       ; Vector to WARM entry
          .WORD $0004    ; 6502 in radix-36
          .WORD $5ED2    ;
          .WORD NTOP     ; Name address of MON
          .WORD $7F      ; Backspace Character
          .WORD UAREA    ; Initial User Area
          .WORD TOS      ; Initial Top of Stack
          .WORD $1FF     ; Initial Top of Return Stack
          .WORD TIBX     ; Initial terminal input buffer
;
;
          .WORD 31       ; Initial name field width
          .WORD 0        ; 0=no disk, 1=disk
          .WORD TOP      ; Initial fence address
          .WORD TOP      ; Initial top of dictionary
          .WORD VL0      ; Initial Vocabulary link ptr.

;
;    NEXT is the address interpreter that moves from machine
;    level word to word.
;
NEXT      LDY #1
          LDA (IP),Y     ; Fetch code field address pointed
          STA W+1        ; to by IP
          DEY
          LDA (IP),Y
          STA W
          JSR TRACE      ; Remove this when all is well
          CLC            ; Increment IP by two.
          LDA IP
          ADC #2
          STA IP
          BCC L54
          INC IP+1
L54       JMP W-1        ; Jump to an indirect jump (W) which
;                          vectors to code pointed to by a code
;                          field.