* it should be primarily used for study, practice, and research.\r
*********\r
\r
+* Some processor-specific stuff:\r
NATWID EQU 4 ; bytes per natural integer/pointer\r
+* The assembler ought to have defined these, but I don't see them in the manual:\r
+* User program condition codes:\r
+F_CARY EQU $0001\r
+F_OVER EQU $0002\r
+F_ZERO EQU $0004\r
+F_NEG EQU $0008\r
+F_EXT EQU $0010\r
+* System status flags (68000/68010/CPU32):\r
+F_SYS EQU $2000\r
+F_TRAC EQU $8000\r
+* Ignoring the interrupt flags for now\r
+*\r
* The original version was developed on an AMI EVK 300 PROTO\r
* system using an ACIA for the I/O.\r
* This version is developed targeting the Atar ST.\r
CMP.B (YPA0)+,D1 ; Compare "last" characters.\r
BEQ.S FOUND ; Matches even if dictionary actual length is shorter.\r
PFNDLN MOVE.L (XPD),XPD ; Get previous link in vocabulary. (auto-inc in 6809 probable error, no inc in 6800)\r
+ MOVE.L XPD,D0 ; On 68K, flags not in effect for MOVEA, TST not available.\r
BNE.S PFNDLP ; Continue if link not=0\r
*\r
* not found :\r
* Using the bit divide to reduce testing burden, working in registers.\r
USLASH:\r
DC.L *+NATWID\r
- MOVEM.L (PSP),D0/D1/D2 ; D1:D2 by D0 (40~)\r
- MOVE.W #33,D3 ; bit ct (8~)\r
+ MOVEM.L (PSP),D0/D1/D2 ; D1:D2 by D0 (40~ ignore attempts to count cycles)\r
+ MOVE.W #32,D3 ; bit ct for DBcc (8~)\r
USLDIV:\r
CMP.L D0,D1 ; divisor (6~)\r
- BHS.S USLSUB (10/12~)\r
- AND #~8,CCR ; X-carry clear (20~)\r
+ BHS.S USLSUB (8/10~)\r
+ AND #~F_EXT,CCR ; X-carry clear (20~)\r
BRA.S USLBIT (10~)\r
USLSUB:\r
SUB.L D0,D1 (6~)\r
- OR #8,CCR ; quotient, (X-carry set) (20~)\r
+ OR #F_EXT,CCR ; quotient, (X-carry set) (20~)\r
USLBIT:\r
ROXL.L #1,D2 ; save it (8~)\r
- SUBQ.W #1,D3 ; more bits? (4~)\r
- BEQ.S USLR (10/12~)\r
- ROXL.L #1,D1 ; remainder (8~)\r
- BCC.S USLDIV (10/12~)\r
- BRA.S USLSUB (10~) (~90*32=~2880+entry+exit, about 800 μS at 4 MHz)\r
+ DBF D3,USLMOR ; more bits? Don't mess with CCR ((12/14)/10~)\r
USLR:\r
LEA NATWID(PSP),PSP (8~)\r
MOVE.L D1,NATWID(PSP) (16~)\r
MOVE.L D2,(PSP) (12~)\r
BRA.W NEXT\r
+USLMOR\r
+ ROXL.L #1,D1 ; remainder (8~)\r
+ BCC.S USLDIV (8/10~)\r
+ BRA.S USLSUB (10~) (~90*32=~2880+entry+exit, about 800 μS at 4 MHz)\r
\r
* The following is not yet functional, only here to help me remember:\r
* cUSLASH DC.L *+NATWID\r
* B0USLDIV:\r
* CMP.L (PSP),D2 ; divisor\r
* BHS.S B0USLSUB\r
-* AND #~8,CCR ; X-carry clear\r
+* AND #~F_EXT,CCR ; X-carry clear\r
* BRA.S B0USLBIT\r
* B0USLSUB:\r
* SUB.L (PSP),D2\r
-* OR #8,CCR ; quotient, (X-carry set)\r
+* OR #F_EXT,CCR ; quotient, (X-carry set)\r
* B0USLBIT:\r
* ROXL.W 2*NATWID+NATWID/2(PSP) ; save it\r
* ROXL.W 2*NATWID(PSP) ; in memory has only 16-bit by 1 bit form\r
DC.W $D ; ( carriage return )\r
DC.L EQUAL,ZBRAN\r
DC.L EXPEC4-*-NATWID\r
- DC.L BREAK ; dbg\r
+* DC.L BREAK ; dbg\r
DC.L LEAVE,DROP,BL,ZERO,BRAN ; I think this is the NUL terminator.\r
DC.L EXPEC5-*-NATWID\r
EXPEC4 DC.L DUP\r
- DC.L BREAK ; dbg\r
+* DC.L BREAK ; dbg\r
EXPEC5 DC.L I,CSTORE,ZERO,I,ONEP,CSTORE,ZERO,I,TWOP,CSTORE ; save two NULs to make sure address is even\r
EXPEC6 DC.L EMIT,XLOOP\r
DC.L EXPEC2-*-NATWID\r
DC.B ')'|$80\r
DC.L WORD-5-NATWID\r
PNUMB DC.L DOCOL\r
+* DC.L BREAK ; DBG *****\r
PNUMB2 DC.L ONEP,DUP,TOR,CAT,BASE,AT,DIGIT,ZBRAN\r
DC.L PNUMB4-*-NATWID\r
DC.L SWAP,BASE,AT,USTAR,DROP,ROT,BASE\r
PNUMB3 DC.L FROMR,BRAN\r
DC.L PNUMB2-*-NATWID\r
PNUMB4 DC.L FROMR\r
+* DC.L BREAK ; DBG *****\r
DC.L SEMIS\r
*\r
* ======>> 140 <<\r
DC.B '.'|$80\r
DC.L IDFLAT-7-NATWID\r
IDDOT DC.L DOCOL,PAD\r
-* DC.L BREAK\r
+* DC.L BREAK ; DBG *****\r
DC.L LIT16\r
DC.W MAXNML ; Why did I hard code this?\r
* DC.L WIDTH,ONEP ; Because WIDTH is a (USER) variable.\r
DC.L DLITER,BRAN\r
DC.L INTER7-*-NATWID\r
INTER6 DC.L DROP,LITER\r
-INTER7 DC.L QSTACK,BRAN\r
+*INTER7 DC.L QSTACK,BRAN\r
+INTER7 DC.L BREAK,QSTACK,BRAN ; DBG\r
DC.L INTER2-*-NATWID\r
* DC.L SEMIS never executed\r
\r
* which gets a line of input, does it, prints " OK"\r
* then repeats :\r
QUIT2 DC.L RPSTOR,CR,QUERY\r
- DC.L BREAK\r
+* DC.L BREAK ; DBG *****\r
DC.L INTERP,STATE,AT,ZEQU\r
DC.L ZBRAN\r
DC.L QUIT3-*-NATWID\r