;-================================================================;
;- Copyright (C) 2000 H-Peter Recktenwald, Berlin <phpr@snafu.de>
;- Read LICENSE file for full copyright information (GNU GPL)
;-
;-  file  	: f8.asm
;-  created	: 18-jul-00
;-  modified	:
;-  version	; 0.01, "lib4th" 0.0.34+ (re "version.inc")
%include "version.inc"
;-  assembler	: nasm 0.98-3e (patched & bugs fixed 0.98)
;-  description	: stand-alone commandline upn calculator,
;-		: i/o by stdin,stdout,stderr; no libraries
;-  author	: H-Peter Recktenwald, Berlin <phpr@snafu.de>
;-  comment	: "f8", in fact is a minimal forth system
;-		: - and one more preliminary study for F8/QOX.
;-  source	: (me, and ansi)
;-  requires	: running:
;-		:	no prerequisites other than those
;-		:	implied by the program concerned
;-		: programming:
;-		:	knowledge of "lib4th" glossary, and 4th!
;-		: kernel programming:
;-		: 	thorough knowledge of assembly & forth,
;-		:	currently programming with "lib4th" is
;-		:	greatly simplified assembly programming
;-		:	mainly by Forth based subroutines, re
;-		:	<typetest> example, below, others in lib.
;-		: compiling prerequisites:
;-		:	asmutils 0.09, nasm-0.98-3e (patched 0.98)
;-  switches	:
;-		: for proper section alignment assemble only with
;-		: 	-D__OPTIMIZE__=__O_SPEED__
;-		: for conditional assembly (yet unused) define:
;- 		: 	-D__F8
;-		: those switches cannot be effectively %define-d
;-		: in assembly source but should be set in Makefile
;-================================================================;
;-

;%define __DBG	; enable debugging macroes & subroutines, further, 
;		; __MK_DBG required set for those being activated
;
%undef  __LIB4TH; this mustn't be defined unless in library source!
;-
;-
; ------------- ;
%include "system.inc"
%ifndef termbitsinc
%include "termbits.inc"	;
%endif
%ifndef fcntlinc
%include "fcntl.inc"	; i/o mode
%endif
%ifndef vtinc
%include "vt.inc"	; vt struc's
%endif
%ifndef relocinc
%include "reloc.inc"	; for <kernref>
%endif
%ifndef constantsinc
%include "constants.inc"
%endif
%ifndef lib4thinc
%include "lib4th.mac"
%endif
%ifndef errnoinc
%include "errno.inc"	; error messages
%endif
%ifndef pushpopinc
%include "pushpop.mac"	; (sic)
%endif
%ifndef ascictrlinc
%include "ascictrl.inc"
%endif
%ifndef debuginc
%include "debug.inc"	; debugging macros
%endif

%ifndef __MK_DBG
%undef __DBG
%endif
;

;-================================================================
    section .text
;- kernel code & constant data
;- CODESEG macro modified to 256 bytes aligning .text & .bss
;- was required to enabling "nasm" aligning .bss properly...
;    CODESEG
;-
;- Q
;-	1st address in .text
Q:equ $$

;
;-================================================================
;- debugging
;-

%ifdef __DBG
;- dbg		beginning of debugging routines
dbg:
	mdump
	perrm
	perrs
	perrn
	dbmrg
%define __DBCONS
	dbcons
	pbits	; flagbits/binary
	psbits	; eflags symbols
%endif;__DBG

; ================================================================

    extern Vroot,Croot,Lroot,roottop,toplink,topref,vocref
    extern Vforth,Cforth,Lforth,

;-
;- debugging routines end
;-================================================================
;-

;-
; text constants
;-
;-================================================================
;- (ref's to) signals constants and error messages, jumptables
;- by macros <ertstg>, <ertdsp>, <sigstg>, <sigdsp>
;-
	a
    ertstg 1	; compiles just the 'extern' refs, valid also for <ertdsp>
	a
    ertdsp
	a
    sigstg 1	; compiles just the 'extern' refs, valid also for <sigdsp>
	a
    sigdsp
;-
;-================================================================
;- execution entry
;-
START4TH kend,continue,vquit,{10,"This is 'lib4th-",.vers,"' Test Program #1"};:ok:
iniquit:
    jmpx quit
;-
    a
vquit:
    dd iniquit-Q,iniquit-Q
Vref:
    dd kend,kend
;-
;-================================================================
;- end of program area, <kend> is final label
END4TH
;-
;-
;-================================================================
;- f8.asm <eof>
