@@ -113,13 +113,20 @@ func (w *WordForth) AddToList(u *Ulp) error {
113113
114114func (w * WordForth ) BuildAssembly (u * Ulp ) (string , error ) {
115115 output := make ([]string , 1 )
116- output [0 ] = w .Entry .ulpName + ":"
116+ label := w .Entry .ulpName + ":"
117+ bodyLabel := w .Entry .BodyLabel () + ":"
118+ output [0 ] = label
117119 if w .Entry .Flag .Data { // data word
120+ output = append (output , bodyLabel )
118121 for _ , cell := range w .Cells {
119122 ref , err := cell .OutputReference (u )
120123 if err != nil {
121124 return "" , err
122125 }
126+ _ , ok := cell .(CellAddress )
127+ if ok {
128+ ref = "__body" + ref
129+ }
123130 val := ".int " + ref
124131 output = append (output , val )
125132 }
@@ -129,6 +136,7 @@ func (w *WordForth) BuildAssembly(u *Ulp) (string, error) {
129136 output = append (output , "jump __docol" )
130137 }
131138 }
139+ output = append (output , bodyLabel )
132140 for _ , cell := range w .Cells {
133141 asm , err := cell .BuildExecution (u )
134142 if err != nil {
@@ -207,7 +215,8 @@ func (w *WordPrimitive) AddToList(u *Ulp) error {
207215}
208216
209217func (w * WordPrimitive ) BuildAssembly (u * Ulp ) (string , error ) {
210- out := w .Entry .ulpName + ":" + "\r \n "
218+ label := w .Entry .ulpName + ":\r \n "
219+ bodyLabel := w .Entry .BodyLabel () + ":\r \n "
211220 asm := make ([]string , 0 )
212221 switch u .compileTarget {
213222 case UlpCompileTargetToken :
@@ -235,7 +244,8 @@ func (w *WordPrimitive) BuildAssembly(u *Ulp) (string, error) {
235244 default :
236245 return "" , fmt .Errorf ("Unknown compile target %d, please file a bug report" , u .compileTarget )
237246 }
238- out += strings .Join (asm , "\r \n " )
247+ asmStr := strings .Join (asm , "\r \n " )
248+ out := label + bodyLabel + asmStr
239249 return out , nil
240250}
241251
0 commit comments