Deutsch   English   Français   Italiano  
<ce518e83c79f7d11ff79c3b4f4d771f7@www.novabbs.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!i2pn.org!rocksolid2!i2pn2.org!.POSTED!not-for-mail
From: mhx@iae.nl (mhx)
Newsgroups: comp.lang.forth
Subject: Re: FigForth MIX
Date: Mon, 3 Mar 2025 16:56:52 +0000
Organization: novaBBS
Message-ID: <ce518e83c79f7d11ff79c3b4f4d771f7@www.novabbs.com>
References: <vq4m3k$1cv3v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
	logging-data="2675626"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="J+nubxJRM7ncpF4l6KLO+OONWmFAYJHVJegfwQXJ8vc";
User-Agent: Rocksolid Light
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Rslight-Site: $2y$10$vPC/A.hlu8KUtGmnx1cHSuYDcQsXAjoh8TcDuFZ6dJgCODpl0KZNW
X-Rslight-Posting-User: 4e0dc1fdad1ead10b39e7eb5db19bf73d73e3ab3
Bytes: 2956
Lines: 111

A MIX language interpreter, debugger, and emulator in 1914 lines is
available in the iForth distribution.

-marcel

(* ************************************************************ *
 *								*
 *	      	    Find the date of EASTER			*
 *								*
 *	Knuth, Fundamental Algorithms, Exercise 1.3.2.14 	*
 *								*
 * ************************************************************ *)

\ View the output written to  ans  with "ans TO dumploc  start GO".

		MIXAL

		FWD 	eastx
		FWD	Y
		FWD	G
		FWD	N
		FWD	Xplus12
		FWD	Dplus3

		ORIG 	1000

| march		ALF MARCH
| april		ALF APRIL
| ans		ALF
| day		ALF DD   		\ Note the invisible 3 spaces here!
| month		ALF MMMMM
		ALF      		\ Note the invisible 3 spaces here!
| year		ALF YYYYY
		ORIG	* 20 +
| C		CON	0		\ C times byte size

| easter	STJ	eastx
		STX	Y
| G		ENTA	0		\ _E1._
		DIV	=19=
		INCX	1
		STX	G(0:2)
		LDA	Y		\ _E2._
		MUL	=1 100 // 1+=	\ see
		INCA	1		\  below
		STA	C(1:4)
		MUL	=3 4 // 1+=	\ _E3._
		STA	Xplus12(0:2)
					\ MIXAL:  LDA =8(1:1)=
		LDA	=8 /bits 4 ** LSHIFT=
		MUL	C		\ rA=8C
		INCA	680		\ 680=5+27*25
		MUL	=1 25 // 1+=	\ rA=Z+32
| Xplus12	DECA	0
		STA	1F(0:2)		\ Z+20-X
		LDA	Y		\ _E4._
		MUL	=1 4 // 1+=
		ADD	Y
		SUB	Xplus12(0:2)
		INCA	5
		STA	Dplus3
		ENTA	0		\ _E5._
		MUL	=11=
| 1H		INCX	0
		DIV	=30=
		JXNN	* 2+		\ See exercise 15
		INCX	30
		CMPX	=24=
		JE	1F
		CMPX	=25=
		JNE	2F
		LDA	G(0:2)
		DECA	11
		JANP	2F
| 1H		INCX	1
| 2H		DECX	20		\ _E6._ (24-N)
		CMPX	=3=
		JLE	* 2+
		DECX	30
		STX	N(0:2)
		LDAN	N(0:2)		\ _E7._
		ADD	Dplus3
		SRAX	5
		DIV	=7=
		SLAX	5
| N		INCA	0		\ 31-N
		JANN	1F
		CHAR
		LDA	april
		JMP	2F
| 1H		DECA	31
		CHAR
		LDA	march
| 2H		JBUS	*(18)
		STA	month
		STX	day(1:2)
		LDA	Y
		CHAR
		STX	year
		OUT	ans(18)		\ print
| eastx		JMP	*		\ Return to main program

| start		LDX	=1950=
		JMP	easter
		LDX	Y
		INCX	1
		CMPX	=2000=
		JLE	easter 1+	\ we already linked once :-)
		HLT
		END	start		\ wrap up assembly

			        (* End of File *)