home *** CD-ROM | disk | FTP | other *** search
- \*
- * ZEN 1.10 Macros and internals
- * C 1990 by Martin Tracy
- * Last modified 1.1.90
- *\
-
- TRUE EQU LOX? \ Include locals?
- TRUE EQU MUX? \ Include multitasking?
- TRUE EQU VOX? \ Include vocabularies?
-
- ASSEMBLER
-
- TRUTH EQU 0FFFFh ; Boolean value for true
-
- CSDummy LABEL WORD ; used like: lods cs:CSDummy
-
- NEXT MACRO
- lods cs:CSDummy
- jmp ax
- ENDM
-
- ISCOLON MACRO
- call DoColon
- ENDM
-
- ISCONSTANT MACRO
- jmp NEAR PTR DoConstant
- ENDM
-
- ISVARIABLE MACRO
- jmp NEAR PTR DoVariable
- ENDM
-
- ISCREATE MACRO
- jmp NEAR PTR DoCreate
- ENDM
-
- ISVALUE MACRO
- jmp NEAR PTR DoValue
- jmp NEAR PTR DoValTo
- ENDM
- ;
- ; Code fields
- ;
- ; Colon definition code field
- DoColon PROC
- xchg bp,sp
- push si
- xchg bp,sp
- pop si
- NEXT
- DoColon ENDP
-
-
- ; DOES> code field
- DoDoes PROC
- xchg bp,sp
- push si
- xchg bp,sp
- pop si
- push bx
- add ax,3
- xchg ax,bx
- mov bx,cs:[bx]
- NEXT
- DoDoes ENDP
-
-
- ; CONSTANT VARIABLE and CREATE code fields
- DoConstant PROC ; ( - w)
- DoVariable:
- DoCreate:
- push bx
- add ax,3
- xchg ax,bx
- mov bx,cs:[bx]
- NEXT
- DoConstant ENDP
-
- ; VALUE 1st code field
- DoValue PROC ; ( - w)
- push bx
- add ax,6
- xchg ax,bx
- mov bx,cs:[bx]
- mov bx,[bx]
- NEXT
- DoValue ENDP
-
- ; VALUE 2nd code field
- DoValTo PROC ; ( w)
- add ax,3
- xchg ax,di
- mov di,cs:[di]
- mov [di],bx
- pop bx
- NEXT
- DoValTo ENDP
- ;
- ; In-liners
- ;
- ; Push following in-line cell onto stack
- Lit: ; ( - w)
- Tic: lods cs:CSDummy
- push bx
- mov bx,ax
- NEXT
-
- ; String primitive
- SLit: ; ( - addr u)
- lods cs:CSDummy
- push bx
- mov bx,ax
- inc ax
- mov bl,[bx]
- sub bh,bh
- push ax
- NEXT
- END-CODE
-
-
- \ L O C A L s
-
- LOX? \*IF
- ASSEMBLER
- ; Colon definition with local stack frame
- DoFrame PROC
- xchg bp,sp
- push si
- push [LXv]
- sub sp,16
- mov ax,OFFSET DWClean
- push ax
- mov [LXv],bp
- xchg bp,sp
- pop si
- NEXT
- DoFrame ENDP
-
- ; DOES> with local stack frame
- DoFramD PROC
- xchg bp,sp
- push si
- push [LXv]
- sub sp,16
- mov ax,OFFSET DWClean
- push ax
- mov [LXv],bp
- xchg bp,sp
- pop si
- push bx
- add ax,3
- xchg ax,bx
- mov bx,cs:[bx]
- NEXT
- DoFramD ENDP
-
- ; Discard local stack frame. Previous EXIT increments bp by 2.
- DWClean dw OFFSET DoClean
- DoClean PROC
- xchg bp,sp
- add sp,16
- pop [LXv]
- pop si
- xchg bp,sp
- NEXT
- DoClean ENDP
-
- ; Create a local and its procedure.
- ISLOCAL MACRO n
- Loc&n& PROC
- jmp Lcl&n&
- jmp Lcl&n&t
- Loc&n& ENDP
- ENDM
-
- ISLOCN MACRO n
- Lcl&n& PROC ; Local 1st code field.
- push bx
- mov di,[LXv]
- mov bx,ss:[di+(n*2)+4]
- NEXT
- Lcl&n& ENDP
-
- Lcl&n&t PROC ; Local 2nd code field.
- mov di,[LXv]
- mov ss:[di+(n*2)+4],bx
- pop bx
- NEXT
- Lcl&n&t ENDP
- ENDM
-
- ISLOCN 0
- ISLOCN 1
- ISLOCN 2
- ISLOCN 3
- ISLOCN 4
- ISLOCN 5
- ISLOCN 6
- ISLOCN 7
- END-CODE
- *\