Development history of Couplement Forth

Description of the page content

Development history of Couplement Forth, a subroutine-threaded Forth for the ZX Spectrum

Tags:

2014-12-30

Forked from the ForthCoupe project.

2015-01-01

First changes: the SAM Coupé specific code is removed or commented out to be adapted later.

2015-01-03

Couplement Forth

More changes. No SAM Coupé code is left. First successful compilation and execution.

2015-01-04

2015-01-09

2015-01-10

2015-01-11

2015-01-12

Couplement Forth

A snasphot with the new temporary look, the Geneva Mono font from Andrew Owen's OpenSE BASIC.

2015-01-21

Fixed the labels of >r and r>.

2015-01-22

Fix: rdrop.

2015-01-23

First changes to implement the disk interface, using BASIC.

; Interface to BASIC

filename_length equ 10

drive:
  db 1
filename.0: ; main filename buffer
  ds filename_length
filename.1: ; secondary filename buffer
  ds filename_length
file_address:
  dw 0
file_length:
  dw 0

include fn_dpeek.z80s
include fn_peeks.z80s

basic_line_of_cat     equ 100
basic_line_of_load    equ 110
basic_line_of_save    equ 120
basic_line_of_erase   equ 130
basic_line_of_rename  equ 140

This is the idea, for DISCiPLE or Plus D:

  10 REM This file is part of Couplement Forth
  20 REM Author: Marcos Cruz (programandala.net)
  30 :
  40 CLEAR VAL "24999": LET o=VAL "25e3"
  60 LOAD ""CODE o : REM XXX TMP tape
  70 GO TO USR o: REM cold
  80 GO TO USR (o+INT PI) : REM warm
  90:
 100 CAT PEEK (o+VAL "6"): GO TO 80
 110 GO TO 80: REM load
 120 GO TO 80: REM save
 130 GO TO 80: REM erase
 140 GO TO 80: REM rename
 170:
 180 SAVE d*"Autoload" LINE 10

The implementation of cat is:

  ;.............................................................
  ;:
  ;: cat   ( n -- )   sf

  header cat_,"cat",0

  call pop_hl
  ld a,l
  ld (drive),a
  ld bc,basic_line_of_cat
  jp return.bc

In order to pass 16-bit values and strings to BASIC, two functions from DEFFNder will be used. First, the new dloaded (disk load) requires a word to move the filename to the buffer BASIC will read it from, filename!:

  ;.............................................................
  ;:
  ;: filename!  ( ca len n -- )
  ;:
  ;: Copy a filename to a filename buffer.
  ;:
  ;: ca len = filename
  ;: n      = filename buffer (0 or 1)

  header filename_store_,"filename!",0

  call pop_hl
  ld a,l
  ld de,filename.0
  and a ; filename buffer 0?
  jr z,filename_store.move
  ld de,filename.1
filename_store.move
  ; de = filename buffer address
  push de
  call pop_hl_de
  ld b,d
  ld c,e
  pop de
  ; hl = filename address
  ; de = filename buffer address
  ; bc = filename length
  ldir
  ret

  ;.............................................................
  ;:
  ;: dloaded   ( a ca len -- )   sf
  ;:
  ;: Load a code file into memory.
  ;: ca len = filename
  ;: a      = memory address

  header dload_,"dloaded",0

  call pop_hl
  ld (file_address),hl
  ld bc,basic_line_of_load
  jp return.bc
  ret

But's there's a problem to solve first: There's no s" word to create strings.

2016-03-12

Created a Git repository from the development backups, with a temporary README file.

2016-03-16

Couplement Forth

Created a TO-DO file from source notes. New more permisive license. Changed the version number to 0.1.0, after Semantic Versioning. Removed the word license, simplified the boot message. Did some changes in the source format.

Removed @execute; renamed @?execute to perform.

Removed the font. Fixed the printing of free memory in the boot message.

Uploaded the repository to GitHub.