Development history of SamForth disassembled

Description of the page content

Development history of the SamForth disassembling project

Tags:

2012-12-22

Version A-00 of SamForth2z80dasm. First tries to automatically create the data files needed by the disassembler. Symbols for word headers.

2012-12-23

Versions A-01 and A-02 of SamForth2z80dasm. New better method. Symbols for word headers. Symbols for system variables.

2012-12-26

Version A-03 of SamForth2z80dasm. Symbols for RST addresses and their vectors. Symbol for some discovered routines.

2012-12-27

The original code is STC (Subroutine Threaded Code), not DTC (Direct Threaded Code) as I wrote at first.

The following commands from the definition of VLIST reveal that six bits are used for the word name length:

  ld c,(hl)  ;15ba
  res 7,c    ;15bb
  res 6,c    ;15bd

That means SamForth words can be 63 characters long.

2012-12-28

The dissasambled code was assembled back by the first time, with pyz80 and Pasmo. In the first case, the hexadecimal numbers format must be changed first (from the "h" suffix to the "&" prefix). The resulting code run perfectly.

New discoverings:

At 00C0h there is a jump table that holds many ROM addresses.

RST 8 calls ROM's RST 10: prints char in A to current stream.

RST 10 pushes HL.

RST 18 pops HL.

RST 20 pushes HL and DE.

RST 28 pops HL and DE.

RST 30 reports the error whose number is in A; the error messages are in stored in the zone 10E1H - 117BH.

The routine at l117ch does the init.

The routine at sub_1085h prints a string (start in HL, count in BC).

The routine at l0e9dh accepts keyboard input.

The routine at sub_1525h gets the next word from the input stream; it's used by variable, create, :, builds, constant...

The routine at sub_11a9h saves HERE and LATEST variables; It's used by ;, and at the end of create, c,, ,, allot, ;code, variable, constant.

The routine at sub_11b6h restores HERE and LATEST variables, sets STATE to 0. This is the last routine before the dictionary.

In jr nz,l11c7h ;115f ret nz can be used instead. There are several minor improvementes like this one.

Words with the precedence bit (7th bit of the name length byte) set: :, ;, ;code, code:, cold, ascii.

Words with the 8th bit of the name length byte set: do, +loop, loop, .", begin, until, if, else, endif, then, builds, does, while, repeat. That means the 8th bit is the "compile-state-only" bit!

The value of STATE is 0 or 80h, as the following piece of code shows (there are more examples):

code_colon_cfa:
  ld a,080h       ;16ab
  ld (STATE),a    ;16ad

2012-12-29

Version A-04 of SamForth2z80dasm, with support for SamForth-B. SamForth-B disassembled.

2013-01-01

Start and exit routines disassembled. They are poked at 50000 and 50020 by the the BASIC loaders. Also the routine loaded by SamForth-A at 50040 has been disassembled.

2013-01-04

SamForth2z80dasm improved:

z80dasm2tidySamForth improved:

2013-01-05

SamForth2z80dasm improved:

z80dasm2tidySamForth improved:

2013-01-06

SamForth2z80dasm improved:

z80dasm2tidySamForth improved:

2013-01-07

SamForth2z80dasm improved:

z80dasm2tidySamForth improved:

2013-01-08

SamForth2z80dasm improved:

z80dasm2tidySamForth improved:

2013-01-20/23

Several improvements, mainly new routines understood and labelled while working on ForthCoupe.

2013-01-20

z80dasm2tidySamForth improved:

2013-01-21

SamForth2z80dasm improved:

z80dasm2tidySamForth improved:

2013-01-22

SamForth2z80dasm improved:

New: block zones for all 0branch.

z80dasm2tidySamForth improved:

2013-01-23

SamForth2z80dasm improved:

New names for unknown symbols: toggle_caps_lock, toggle_insert_mode.

Related pages

SamForth disassembled
Disassembling of SamForth.
SamForth documentation
Edited documentation of SamForth, a Forth system for the SAM Coupé computer.
SamForth2z80dasm
Tool program to disassemble SamForth.