Skip to content

Commit 6db2284

Browse files
Update from development backup 201505312256
1 parent 43a3c37 commit 6db2284

12 files changed

+244
-147
lines changed

Diff for: Makefile

+2-10
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@ MAKEFLAGS = --no-print-directory
4646
################################################################
4747
# Main
4848

49-
.PHONY: all
5049
all: \
5150
abersoft_forth.rebuilt.tap
5251

53-
.PHONY: tools
5452
tools: \
5553
abersoftforth2z80dasmblocks \
5654
abersoftforth2nfa4vim \
@@ -150,7 +148,6 @@ tidy_name_fields.vim: \
150148
tidy_branches.vim:
151149
vim -e -c "set fileformat=unix|wq" tidy_branches.vim
152150

153-
.PHONY: tidy
154151
tidy: \
155152
tidy_name_fields.vim \
156153
tidy_branches.vim \
@@ -195,7 +192,7 @@ abersoft_forth.rebuilt.bin.tap: abersoft_forth.disassembled.z80s
195192
abersoft_forth.rebuilt.tap: \
196193
abersoft_forth_loader.tap \
197194
abersoft_forth.rebuilt.bin.tap
198-
cat abersoft_forth_loader.bas.tap abersoft_forth.rebuilt.bin.tap > \
195+
cat abersoft_forth_loader.tap abersoft_forth.rebuilt.bin.tap > \
199196
abersoft_forth.rebuilt.tap \
200197

201198
################################################################
@@ -204,7 +201,6 @@ abersoft_forth.rebuilt.tap: \
204201
%.tap: %.fsb
205202
fsb2abersoft16k $<
206203

207-
.PHONY: abersoftforth2z80dasmblocks
208204
abersoftforth2z80dasmblocks: abersoftforth2z80dasmblocks_compiling.tap
209205

210206
abersoftforth2z80dasmblocks_compiling.tap: \
@@ -238,7 +234,6 @@ abersoftforth2z80dasmblocks_compiling.tap: \
238234
> abersoftforth2z80dasmblocks_compiling.tap ; \
239235
rm -f abersoftforth2z80dasmblocks.tap
240236

241-
.PHONY: abersoftforth2nfa4vim
242237
abersoftforth2nfa4vim: abersoftforth2nfa4vim_compiling.tap
243238

244239
abersoftforth2nfa4vim_compiling.tap: abersoftforth2nfa4vim.tap
@@ -272,7 +267,6 @@ abersoftforth2nfa4vim_compiling.tap: abersoftforth2nfa4vim.tap
272267
> abersoftforth2nfa4vim_compiling.tap ; \
273268
rm -f abersoftforth2nfa4vim.tap
274269

275-
.PHONY: abersoftforth2branches
276270
abersoftforth2branches: abersoftforth2branches_compiling.tap
277271

278272
abersoftforth2branches_compiling.tap: \
@@ -310,6 +304,7 @@ abersoftforth2branches_compiling.tap: \
310304
################################################################
311305
# Backup
312306

307+
.PHONY: backup
313308
backup:
314309
tar -czf backups/$$(date +%Y%m%d%H%M)_abersoft_forth_disassembled.tgz \
315310
Makefile \
@@ -321,9 +316,6 @@ backup:
321316
z80dasm_symbols.z80s \
322317
tidy_z80.vim \
323318
word_labels.*.vim \
324-
sys/*.bas \
325-
_drafts/* \
326-
_tests/*.fsb \
327319
_ex/*
328320

329321
################################################################

Diff for: TO-DO.adoc

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
= Abersoft Forth disassembled TO-DO
22
:author: Marcos Cruz (programandala.net)
3-
:revdate: 2015-05-30
3+
:revdate: 2015-05-31
44

55

6-
.2015-05-29:
6+
.2015-05-31:
77

8-
Document `implementation_attributes`, using Z80 fig-Forth 1.1.g
8+
Strange problem with <abersoftforth2branches.fsb>: one instance is not
9+
found. Others are not translated later.
910

10-
.2015-05-30:
11+
Document `cold_start`, `COLD`, `warm_start` and `WARM`.
1112

12-
Finish <abersoftforth2branches.fsb> (notes inside).
13-
14-
Convert its printout <tidy_branches.vim> to Unix file format, in Makefile, with Vim.
13+
Make the automatic blocks unlabeled?
1514

15+
Tidy the strings.

Diff for: abersoftforth2branches.boot.symbols-output.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/sh
2+
# abersoftforth2branches.boot.symbols-output.sh
23
# 2015-05-30
34

45
rm -f ./z80dasm_symbols.branches.vim

Diff for: abersoftforth2branches.boot.vim-output.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/sh
2+
# abersoftforth2branches.boot.vim-output.sh
23
# 2015-05-30
34

45
rm -f ./tidy_branches.vim

Diff for: abersoftforth2branches.fsb

+34-28
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,33 @@
3636

3737
\ 2015-05-30: Start, with code extrated from the deprecated
3838
\ tool `dis`.
39+
\
40+
\ 2015-05-31: Fix: `editor` is immediate! It needed a
41+
\ `[compile]`.
3942

4043
\ -----------------------------------------------------------
4144

42-
forth definitions -->
45+
forth
46+
47+
\ <------------------------------>
48+
128k? dup ?\ ." ERROR: this program needs a" cr
49+
?\ ." ZX Spectrum 128 or later." cr quit
50+
51+
definitions -->
4352

4453
( Boot )
4554

46-
vocabulary print-voc print-voc definitions hex
55+
vocabulary print-voc immediate print-voc definitions hex
4756

4857
: printer-width ( b -- ) 5B64 ! ; \ ZX Spectrum 128 only
4958
: program-name ( -- ) ." AbersoftForth2branches" ;
5059

51-
\ <------------------------------>
52-
128k? dup ?\ ." ERROR: this program needs a" cr
53-
?\ ." ZX Spectrum 128 or later." cr quit
60+
0 variable current-pfa
61+
62+
0 variable mode
63+
\ Print mode:
64+
\ 0 for Vim command to convert branches
65+
\ 1 for destination branch symbols
5466

5567
03 0A thru cls program-name cr cr usage
5668

@@ -97,6 +109,10 @@ vocabulary print-voc print-voc definitions hex
97109

98110
: cfa-label ( cfa -- ) cfa-label$ type ;
99111

112+
: ~ ( -- )
113+
\ Start a comment line of the output file.
114+
cr mode @ if [char] ; else [char] " then emit space ;
115+
100116
( branch-symbol vim-command )
101117

102118
: destination ( pfa+n1 -- pfa+n2 )
@@ -118,28 +134,21 @@ vocabulary print-voc print-voc definitions hex
118134
\ in the Z80 source.
119135
\ pfa+n = address of a branch word
120136
\ pfa+n+2 = address of its relative jump literal
121-
\ XXX TODO -- use `call search()` instead, in order to
122-
\ convert only the first match!
123137

124-
[char] " emit space ." Branch word at " dup hexa. cr
138+
~ ." Branch word at " dup hexa.
139+
." in " current-pfa @ nfa id.
125140

126-
." if search('defw " dup @ dup >r cfa-label ." \s;\s"
141+
cr ." if search('defw " dup @ dup >r cfa-label ." \s;\s"
127142
dup hexa. 2+ ." \n\s\+defw " dup @ hexa. ." $','wc')"
128143

129144
cr ." silent s`\(defw " r> cfa-label
130145
." \)\s;\s0x[A-F0-9]\{4}\n\s\+defw \(" dup @ hexa.
131146
." \)$`\1,\2 ; to " dup destination branch-label ." `" cr
132147

133-
." else" cr ." echoerr 'Branch not found'" cr
134-
." wq" cr
148+
." else" cr ." echoerr 'Branch not found'" cr ." wq" cr
135149
." endif" cr ;
136150

137-
( mode print-branch colon-end? )
138-
139-
0 variable mode
140-
\ Print mode:
141-
\ 0 for Vim command to convert branches
142-
\ 1 for destination branch symbols
151+
( print-branch colon-end? )
143152

144153
: print-branch ( pfa+n -- pfn+n+2 )
145154
\ pfa+n = address of a branch word
@@ -178,9 +187,9 @@ vocabulary print-voc print-voc definitions hex
178187

179188
: print-colon ( pfa --- )
180189
\ Print branches of a colon definition.
181-
begin dup colon-end? 0=
182-
while (print-colon) 2+
183-
repeat drop ;
190+
dup current-pfa ! begin dup colon-end? 0=
191+
while (print-colon) 2+
192+
repeat drop ;
184193

185194
( print-pfa )
186195

@@ -190,9 +199,10 @@ vocabulary print-voc print-voc definitions hex
190199
\ Print branches of a word.
191200
dup colon? if print-colon exit then drop ;
192201

202+
: print-pfa ( pfa -- )
193203
\ Print a word, if it belongs to the original system.
194-
: print-pfa ( pfa -- ) dup [ ' udg 1+ ] literal u<
195-
if (print-pfa) else drop then ;
204+
dup [ ' udg 1+ ] literal u<
205+
if (print-pfa) else drop then ;
196206

197207
: print-from-nfa ( nfa -- )
198208
\ Print branches of words starting from a word.
@@ -222,23 +232,19 @@ vocabulary print-voc print-voc definitions hex
222232

223233
( run )
224234

225-
: ~ ( -- )
226-
\ Start a comment line of the output file.
227-
cr mode @ if [char] ; else [char] " then emit space ;
228-
229235
: file-header ( -- )
230236
~ ." This file was automatically created by " program-name
231237
~ ." This file is part of Abersoft Forth disassembled"
232238
~ ." By Marcos Cruz (programandala.net), 2015-05"
233239
~ ." http://programandala.net/en.program.abersoft_forth.html"
234-
cr cr mode @ 0= if ." call cursor(1,1)" cr then ;
240+
cr cr ;
235241

236242
: run ( n -- )
237243
\ n = 0: Print out Vim commands to convert branches.
238244
\ 1: Print out destination branch symbols.
239245
mode !
240246
hex FF printer-width 1 link file-header
241-
editor print-context
247+
[compile] editor print-context [compile] print-voc
242248
0 link decimal cr done ;
243249

244250
: vim ( -- ) 0 run ;

Diff for: abersoftforth2nfa4vim.boot.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
# abersoftforth2nfa4vim.boot.sh
3+
# 2015-05-31
4+
5+
rm -f ./abersoftforth2nfa4vim_printout.txt
6+
fuse \
7+
--machine 128 \
8+
--no-divide \
9+
--tape ./abersoftforth2nfa4vim_compiling.tap \
10+
--printer \
11+
--textfile ./abersoftforth2nfa4vim_printout.txt \
12+
$* \
13+
&
14+

Diff for: abersoftforth2nfa4vim.fsb

+19-15
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,28 @@
4242
\
4343
\ 2015-05-30: The 48 K model is detected and an error is
4444
\ given. Improved instructions.
45+
\
46+
\ 2015-05-31: Fix: `editor` is immediate! It needed a
47+
\ `[compile]`.
4548

4649
\ -----------------------------------------------------------
4750

48-
-->
51+
forth
4952

50-
( Boot )
53+
\ <------------------------------>
54+
128k? dup ?\ ." ERROR: this program needs a" cr
55+
?\ ." ZX Spectrum 128 or later." cr quit
5156

52-
forth definitions
57+
definitions -->
5358

54-
vocabulary print-voc print-voc definitions hex
59+
( Boot )
60+
61+
vocabulary print-voc immediate print-voc definitions hex
5562

5663
: printer-width ( b -- ) 5B64 ! ; \ ZX Spectrum 128 only
5764
: program-name ( -- ) ." AbersoftForth2nfa4Vim" ;
5865

59-
\ <------------------------------>
60-
128k? dup ?\ ." ERROR: this program needs a" cr
61-
?\ ." ZX Spectrum 128 or later." cr quit
62-
63-
3 7 thru cls greeting cr cr program-name cr cr usage
66+
3 9 thru cls greeting cr cr program-name cr cr usage
6467

6568
( usage )
6669

@@ -209,7 +212,7 @@ char " constant quote
209212

210213
\ If the given word belongs to the original system and is not
211214
\ a dummy, print a Vim command that will substitute the
212-
\ disassembled name field of the that word with a new one,
215+
\ disassembled name field of the word with a new one,
213216
\ using a more legible format.
214217

215218
dup dummy? if drop exit then
@@ -218,13 +221,14 @@ char " constant quote
218221
( Done )
219222

220223
: done ( -- )
224+
cls
221225
\ <------------------------------>
222-
." Done." cr
226+
." Done." cr cr
223227
." If you have not launched this" cr
224228
." program with the provided" cr
225229
." boot shell file for Fuse, copy" cr
226-
." copy the printout of your" cr
227-
." emulator to the file "
230+
." the printout of your emulator" cr
231+
." to the file "
228232
." <abersoftforth2nfa4vim_printout."
229233
." txt>." cr cr
230234
." Then close the emulator and use" cr
@@ -247,14 +251,14 @@ char " constant quote
247251
: file-header ( -- )
248252
" ." This file was automatically created by " program-name
249253
" ." This file is part of Abersoft Forth disassembled"
250-
~ ." By Marcos Cruz (programandala.net), 2015-05"
254+
" ." By Marcos Cruz (programandala.net), 2015-05"
251255
" ." http://programandala.net/en.program.abersoft_forth.html"
252256
cr cr ;
253257

254258
: run ( -- )
255259
\ Print out all original words of the Forth system.
256260
hex FF printer-width 1 link file-header
257-
editor print-context
261+
[compile] editor print-context [compile] print-voc
258262
0 link decimal cr done ;
259263

260264
\ vim: filetype=abersoftforthafera

Diff for: abersoftforth2z80dasmblocks.boot.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/sh
2+
# abersoftforth2z80dasmblocks.boot.sh
23
# 2015-05-30
34

45
rm -f ./abersoftforth2z80dasmblocks_printout.txt

0 commit comments

Comments
 (0)