• R/O
  • HTTP
  • SSH
  • HTTPS

fig-forth-68000: Commit

Source code for fig-forth-68000


Commit MetaInfo

Revision76d17802ed2e9e50678923494b13339e84fba961 (tree)
Time2023-07-01 21:32:56
AuthorJoel Matthew Rees <joel.rees@gmai...>
CommiterJoel Matthew Rees

Log Message

backing away from the FIG68KSB.S subroutine call version

Change Summary

Incremental Difference

--- a/FIG68KSB.S
+++ b/FIG68KSB.S
@@ -11,6 +11,52 @@
1111 * AND VARIABLE LENGTH NAMES
1212 * Try again with literal subroutine substitution mode, one step at a time.
1313 *
14+* If I require a 68020 or better, I could use BSR.L for all calls to characteristic code.
15+* But without BSR.L, the synthetic load offset followed by JSR PC-relative
16+* is more than I want to do for constants and such.
17+*
18+* Using an address register as a base for the kernel (per BIF-6809's use of DP)
19+* does not completely solve this,
20+* since even that has only 16-bit constant offset in plain 68000.
21+* New defining definitions would be required to exist within the reach of the 16-bit offset,
22+* unless the synthetic long version of the base-offset JSR is also recognized by the kernel.
23+*
24+* Either way, three steps are wanted:
25+* The first is to get the subroutine call version working within the 16-bit offset range.
26+* The second is to add enough of the assembler to the kernel to compile new defining definitions.
27+* The third is to flatten all definitions, stripping out the inner interpreter when done.
28+*
29+* If I am brave enough, I could simply flatten everything up front,
30+* requiring me to add the basic parts of the assembler before I can actual compile anything at all.
31+*
32+* BUT!
33+*
34+* That would require me to plan far enough ahead to,
35+* among other things, clear all variable objects out of the symbol table.
36+* And that requires defining a global variable space separate from the dictionary.
37+*
38+* But that's not really what should be done,
39+* because all global variables should be managed --
40+* meaning that they should be managed by the code for the modules that define them,
41+* meaning that there are no real global variables.
42+*
43+* Meaning that I have to plan ahead and lay out the structures
44+* and define the interface mechanisms of modules.
45+*
46+* Which is a huge jump past fig-Forth.
47+* Which kind of means leaving fig-Forth behind,
48+* and picking BIF back up, and cleaning BIF up and adapting it for the 68000,
49+* and then laying out the intermodule call mechanisms.
50+*
51+* Backing off of that idea, I could go back and use the synthetic far call
52+* to call all the characteristic code, even though it's inefficient.
53+*
54+* But I've really never liked the idea of variables physically adjacent to code.
55+* Constants, sure. Variables, no.
56+*
57+* Maybe I should back up a step and flatten the definitions of the native return version,
58+* see where that leads.
59+*
1460 * Adapted by Joel Matthew Rees
1561 * from fig-FORTH for 6800 (via buggy fig-FORTH for 6809) by Dave Lion, et. al.
1662
@@ -4125,6 +4171,15 @@ IDDOT BSR.W DOCOL
41254171 *ZERO MOVE.L #DOCON-(ZERO+2),A0 ; 6 bytes, overwrite offset in long word following opcode
41264172 * JSR ZERO+2(PC,A0.L) ; 4 bytes. DOCON, as it currently is written, expects either this or BSR.
41274173 * DC.L 00000000 ; Making these uniform will make things easier for the debugging.
4174+*NOVAR MOVE.L #DOVAR-(ZERO+2),A0 ; 6 bytes, overwrite offset in long word following opcode
4175+* JSR NOVAR+2(PC,A0.L) ; 4 bytes. DOCON, as it currently is written, expects either this or BSR.
4176+* DC.L INITIALV ; Making these uniform will make things easier for the debugging.
4177+*SZERO MOVE.L #DOUSER-(ZERO+2),A0 ; 6 bytes, overwrite offset in long word following opcode
4178+* JSR SZERO+2(PC,A0.L) ; 4 bytes. DOCON, as it currently is written, expects either this or BSR.
4179+* DC.L XSPZER ; Making these uniform will make things easier for the debugging.
4180+*FORTH MOVE.L #DODOES-(ZERO+2),A0 ; 6 bytes, overwrite offset in long word following opcode
4181+* JSR FORTH+2(PC,A0.L) ; 4 bytes. DOCON, as it currently is written, expects either this or BSR.
4182+* DC.L DOVOC,VOCFLG,TASK-5-NATWID ; Making these uniform will make things easier for the debugging.
41284183 *
41294184 * Or do I copy the characteristic code right into the parameter field, leaving the CONSTANT (et. al.)
41304185 * sitting after the code, like this for CONSTANTs:
@@ -4135,13 +4190,15 @@ IDDOT BSR.W DOCOL
41354190 *NOVAR LEA NOVARV(PC),A0 ; 4 bytes, relative (*+8), the code can just be copied in.
41364191 * MOVE.L A0,-(PSP) ; 2 bytes, again, the code can just be copied in.
41374192 * RTS ; 2 bytes, actual variable is after the RTS, still easy to find.
4138-*NOVARV DC.L 00000000 ; However, the debugger needs to be aware of this code.
4193+*NOVARV DC.L INITIALV ; However, the debugger needs to be aware of this code.
41394194 * ; For USER variables (allowing large, greater than 32K, USER variable tables),
41404195 *SZERO MOVE.L SZEROC(PC),D0 ; 4 bytes, relative (*+10), the code can just be copied in.
41414196 * LEA (UP,D0.L),A0 ; 2 bytes, again, the code can just be copied in
41424197 * MOVE.L A0,-(PSP) ; 2 bytes, again, the code can just be copied in.
41434198 * RTS ; 2 bytes, actual offset is after the RTS, still easy to find.
4144-*SZEROC DC.L $00000018 ; Again, the debugger must be aware of this code.
4199+*SZEROC DC.L XSPZER ; Again, the debugger must be aware of this code.
4200+*
4201+*Have to define DODOES to figure out what goes here.
41454202 *
41464203 * Or, do I go ahead and optimize DOCON and DOUSER?
41474204 *ZERO MOVE.L #00000000,-(PSP) ; 6 bytes, CONSTANT compiler needs to know the instruction format.
@@ -4155,6 +4212,8 @@ IDDOT BSR.W DOCOL
41554212 * MOVE.L A0,-(PSP) ; 2 bytes, can be copied as is.
41564213 * RTS ; 2 bytes, 12 total, including offset. And debugger needs to be more intelligent.
41574214 *
4215+*Have to define DODOES to figure out what goes here.
4216+*
41584217 * Leave the name SMUDGEd.
41594218 EVEN
41604219 DC.B 0
Show on old repository browser