SamForth-A

Description of the page content

SamForth-A disassembled.

Tags:

This page contains the SamForth-A specific information, as part of the SamForth disassembled project. SamForth(-A) was written by John A. Avis in 1991. SamForth(-A) is freeware but unfortunately its source is lost.

RST calls

SamForth-A is paged at 0000h, so RST instructions call SamForth addresses. The calls are described in the documentation.

The following RST calls have been already marked with symbols in the disassembled code, and their vectors too:

Memory map

Start End Content/Description
215B 3FFF Free space for the dictionary, pointed by the HERE variable
11C8 2156 Dictionary space already ocuppied (grows up)
10E1 117B Error messages (every message is finished with 8Dh
05D6 10E0 Code
0502 05D5 Empty space
0502 Return stack start, pointed at the start by the RSTACK variable
0403 0502 Return stack (grows down); its pointer is backup in the RSTACK variable
0402 Data stack start, pointed by the STACK variable
0302 0402 Data stack (grows down)
0302 Data stack end, pointed by the STKEND variable
0282 0301 PAD
0202 0281 TIB
0190 0200 SamForth variables
0038 RST 38's routine
0030 Jump to RST 30's routine
0028 Jump to RST 28's routine
0020 Jump to RST 20's routine
0018 Jump to RST 18's routine
0010 Jump to RST 10's routine
0008 Jump to RST 8's routine
0000 Jump to init

Screenshot

Start screen of SamForth(-A), showing a list of its words:

SamForth-ASamForth-A

Source code

The SamForth-A's BASIC loader loads a routine at 50040 from the disk, then pokes a routine at 50000 (0c350h) and another routine an 50020 (c364h)

BASIC loader

The only change in the original loader is the name of the code files.

   10 FORMAT "d3:DFORTH",2,40
   15 PAPER 9
      BORDER 9
      CLS 
   20 LOAD "sf-a_code"CODE 65536
   30 LOAD "sf-a_page"CODE 
   40 DEF KEYCODE 209,"goto warm"
   41 setkeys
   50 POKE &5A44,1 
      POKE &5C6A,0
   60 CLS 
      PRINT AT 0,0; " FORTH  J.A. Avis 1991"
   70 LABEL cold
      ON ERROR GO TO 380
   75 POKE &5ABA,1
      POKE &5A34,0
      DPOKE &5C7D,16384
   80 GO TO 310
   90 LABEL warm
      ON ERROR GO TO 380
      POKE &5A34,0
      POKE &5C6A,0
  100 GO TO 330
  110 IF PEEK &101de=1 THEN fsave
        GO TO 90
  120 IF PEEK &101dE=2 THEN fload
        GO TO 90
  130 IF PEEK &101dE=3 THEN dr1
        GO TO 90
  140 IF PEEK &101dE=4 THEN GO TO 90
  141 IF PEEK &101dE=11 THEN bload
        GO TO 90
  142 IF PEEK &101dE=12 THEN bsave
        GO TO 90
  143 IF PEEK &101dE=14 THEN dsave
        GO TO 90
  144 IF PEEK &101dE=13 THEN dload
        GO TO 90
  150 ON ERROR STOP 
  160 STOP 
  170 DEF PROC dr1
  180   SCROLL RESTORE 
        DIR PEEK &5A07 "*.F*"
  190 END PROC 
  200 DEF PROC fload
  210   LET b$=MEM$(&10282 TO &1028f)
  220   LET a$=TRUNC$ b$ + ".FS"
  235   LET b=(PEEK &101b9 -1)*16384+DPEEK &101e4
  240   LOAD A$ CODE b 
  245   LET a=(PEEK 19314*16384)+(DPEEK 19315-32768)
        DPOKE &101e0,a
  250 END PROC 
  260 DEF PROC fsave
  270   LET b$=MEM$(&10282 TO &1028f)
        LET a=(PEEK &101B9-1)*16384+DPEEK &101e4
        LET b=DPEEK &101e0
  280   LET a$=TRUNC$ b$ + ".FS"
  290   SAVE A$ CODE a,b 
  300 END PROC 
  310 POKE 50000,&ed,&73,0,&f0,62,35,211,250,199
  320 GO TO 340
  330 POKE 50000,&ed,&73,0,&f0,62,35,211,250,195,&57,0
  340 POKE 50020,&ed,&7b,0,&f0,62,31,211,250,205,&66,1,201
  350 POKE SVAR 520,0
  360 CALL 50000
  365 POKE &101a2,0
  370 GO TO 110
  380 LET A= PEEK &5C3A
      POKE &101A2,a
      IF A>83 THEN PRINT "DOS error ";A
      ELSE PRINT "SAM error ";a 
  390 GO TO 90
  400 DEF PROC bload
  410   LET b$=MEM$(&10282 TO &1028f)
  430   LET a$=TRUNC$ b$ + ".FC"
  435   LET b=65536+DPEEK &101e4
  436   IF DPEEK &101e4 >=32768 THEN LET b= (PEEK &101EA-1)*16384+DPEEK &101e4
  440   LOAD a$ CODE b 
  450 END PROC 
  460 DEF PROC bsave
  470   LET b$=MEM$(&10282 TO &1028f)
        LET a=65536+DPEEK &101e4
        LET b=DPEEK &101e0
  471   IF DPEEK &101e4 >=32768 THEN LET a= (PEEK &101EA-1)*16384+DPEEK &101e4
  480   LET a$=TRUNC$ b$ + ".FC"
  490   SAVE a$ CODE a,b 
  500 END PROC 
  510 DEF PROC dload
  515   LET b$=MEM$(&10282 TO &1028f)
  520   LET a$=TRUNC$ b$ + ".FD"
  530   LET b=65536+DPEEK &101E4
  540   LOAD A$ CODE b 
  550 END PROC 
  560 DEF PROC dsave
  570   LET b$=MEM$(&10282 TO &1028F)
        LET a=65536+DPEEK &101E4
        LET b=DPEEK &101E0
  580   LET a$=TRUNC$ b$+ ".FD"
  590   SAVE A$ CODE a,b 
  600 END PROC 
  610 DEF PROC setkeys
  620   KEY 24,33
        REM f7
  630   KEY 15,64
        REM f8
  640   KEY 6,47
        REM f9
  650   KEY 25,42
        REM f4
  660   KEY 16,60
        REM f5
  670   KEY 7,62
        REM f6
  675   DEF KEYCODE 207,  "goto warm"
  680 END PROC 
  685 DEF PROC s
        SAVE OVER "sf-a_orig" LINE 1
      END PROC 
      

Routine at 50000 (0c350h)

This routine pages the proper RAM page in and starts SamForth. It's called from BASIC.

; z80dasm 1.1.3
; command line: z80dasm --origin=50000 --output=samforth-a_50000.z80s samforth-a_50000.bin

  org 0c350h

  ld (0f000h),sp ; save SP
  ld a,023h      ; bits 0-4: RAM page 3; bit 5: RAM0
  out (0fah),a   ; allocate pages 3 & 4 to section A
  rst 0          ; start SamForth-A

Routine at 50020 (0c364h)

This routine is identical in both SamForth variants. It is called by SamForth only once, as part of the quit process.

  org 0c364h

  ld sp,(0f000h)  ; restore SP
  ld a,01fh       ; RAM page 1
  out (0fah),a    ; allocate pages 1 & 2 to section A
  call 00166h     ; JKBFLUSH, flush keyboard buffer
  ret

Routine at 50040 (0c378h)

This routine is the longest one, Its goal is to manage the memory pages and ROM calls. It has several entry points for different tasks.

; z80dasm 1.1.3
; command line: z80dasm --address --origin=50040 --labels --source --output=samforth-a_50040.z80s samforth-a_50040.bin

	org	0c378h

	ld (0c34eh),sp		;c378	ed 73 4e c3 	. s N . 
	ld sp,0ea60h		;c37c	31 60 ea 	1 ` . 
	ld (lc38fh),iy		;c37f	fd 22 8f c3 	. " . . 
	ld a,01fh		;c383	3e 1f 	> . 
	out (0fah),a		;c385	d3 fa 	. . 
	ld sp,(0c34ch)		;c387	ed 7b 4c c3 	. { L . 
	ex af,af'			;c38b	08 	. 
	call 00103h		;c38c	cd 03 01 	. . . 
lc38fh:
	nop			;c38f	00 	. 
	nop			;c390	00 	. 
	ld (0c34ch),sp		;c391	ed 73 4c c3 	. s L . 
	ld sp,0ea60h		;c395	31 60 ea 	1 ` . 
	ld b,a			;c398	47 	G 
	ld a,023h		;c399	3e 23 	> # 
	out (0fah),a		;c39b	d3 fa 	. . 
	ld sp,(0c34eh)		;c39d	ed 7b 4e c3 	. { N . 
	ld iy,00190h		;c3a1	fd 21 90 01 	. ! . . 
	ei			;c3a5	fb 	. 
	jp 000cch		;c3a6	c3 cc 00 	. . . 
	nop			;c3a9	00 	. 
	nop			;c3aa	00 	. 
	nop			;c3ab	00 	. 
	nop			;c3ac	00 	. 
	nop			;c3ad	00 	. 
	nop			;c3ae	00 	. 
	nop			;c3af	00 	. 
	nop			;c3b0	00 	. 
	nop			;c3b1	00 	. 
	nop			;c3b2	00 	. 
	nop			;c3b3	00 	. 
	ld (0c34eh),sp		;c3b4	ed 73 4e c3 	. s N . 
	ld sp,0ea60h		;c3b8	31 60 ea 	1 ` . 
	ld a,01fh		;c3bb	3e 1f 	> . 
	out (0fah),a		;c3bd	d3 fa 	. . 
	ld sp,(0c34ch)		;c3bf	ed 7b 4c c3 	. { L . 
lc3c3h:
	call 00103h		;c3c3	cd 03 01 	. . . 
	ld l,h			;c3c6	6c 	l 
	ld bc,0083ah		;c3c7	01 3a 08 	. : . 
	ld e,h			;c3ca	5c 	\ 
	cp 000h		;c3cb	fe 00 	. . 
	ld (0c34bh),a		;c3cd	32 4b c3 	2 K . 
	jr z,lc3c3h		;c3d0	28 f1 	( . 
	ld a,000h		;c3d2	3e 00 	> . 
	ld (05c08h),a		;c3d4	32 08 5c 	2 . \ 
	ld (05c6ah),a		;c3d7	32 6a 5c 	2 j \ 
	ld a,(05c3bh)		;c3da	3a 3b 5c 	: ; \ 
	and 0dfh		;c3dd	e6 df 	. . 
	ld (05c3bh),a		;c3df	32 3b 5c 	2 ; \ 
	ld (0c34ch),sp		;c3e2	ed 73 4c c3 	. s L . 
	ld sp,0ea60h		;c3e6	31 60 ea 	1 ` . 
	ld a,023h		;c3e9	3e 23 	> # 
	out (0fah),a		;c3eb	d3 fa 	. . 
	ld sp,(0c34eh)		;c3ed	ed 7b 4e c3 	. { N . 
	ld iy,00190h		;c3f1	fd 21 90 01 	. ! . . 
	ld a,(0c34bh)		;c3f5	3a 4b c3 	: K . 
	ld (00191h),a		;c3f8	32 91 01 	2 . . 
	jp 000cch		;c3fb	c3 cc 00 	. . . 
	nop			;c3fe	00 	. 
	nop			;c3ff	00 	. 
	nop			;c400	00 	. 
	nop			;c401	00 	. 
	nop			;c402	00 	. 
	nop			;c403	00 	. 
	nop			;c404	00 	. 
	nop			;c405	00 	. 
	nop			;c406	00 	. 
	nop			;c407	00 	. 
	nop			;c408	00 	. 
	nop			;c409	00 	. 
	nop			;c40a	00 	. 
	nop			;c40b	00 	. 
	nop			;c40c	00 	. 
	nop			;c40d	00 	. 
	nop			;c40e	00 	. 
	nop			;c40f	00 	. 
	nop			;c410	00 	. 
	nop			;c411	00 	. 
	nop			;c412	00 	. 
	nop			;c413	00 	. 
	nop			;c414	00 	. 
	nop			;c415	00 	. 
	nop			;c416	00 	. 
	nop			;c417	00 	. 
	nop			;c418	00 	. 
	nop			;c419	00 	. 
	nop			;c41a	00 	. 
	nop			;c41b	00 	. 
	nop			;c41c	00 	. 
	nop			;c41d	00 	. 
	nop			;c41e	00 	. 
	nop			;c41f	00 	. 
	nop			;c420	00 	. 
	nop			;c421	00 	. 
	nop			;c422	00 	. 
	nop			;c423	00 	. 
	nop			;c424	00 	. 
	nop			;c425	00 	. 
	nop			;c426	00 	. 
	nop			;c427	00 	. 
	nop			;c428	00 	. 
	nop			;c429	00 	. 
	nop			;c42a	00 	. 
	nop			;c42b	00 	. 
	nop			;c42c	00 	. 
	nop			;c42d	00 	. 
	nop			;c42e	00 	. 
	nop			;c42f	00 	. 
	nop			;c430	00 	. 
	nop			;c431	00 	. 
	nop			;c432	00 	. 
	nop			;c433	00 	. 
	nop			;c434	00 	. 
	nop			;c435	00 	. 
	nop			;c436	00 	. 
	nop			;c437	00 	. 
	nop			;c438	00 	. 
	nop			;c439	00 	. 
	nop			;c43a	00 	. 
	nop			;c43b	00 	. 
	nop			;c43c	00 	. 
	nop			;c43d	00 	. 
	nop			;c43e	00 	. 
	nop			;c43f	00 	. 

Main program at 0 (0000h)

; SamForth for the SAM Coupé
; Copyright (C) 1991 John A. Avis
;
; This file is part of the
; "SamForth disassembled" project (2012-2013)
; (<http://programandala.net/en.program.samforth>),
; by Marcos Cruz (programandala.net).
;
; This file was created on 2013-02-01T19:52:53 CET.
;
; First, the binaries were searched for data with:
; SamForth2z80dasm, a Gforth program.
; Second, they were disassembled with:
; z80dasm 1.1.3
; command line: z80dasm --address --origin=0 --labels --source --block-def=samforth-a.bin_blocks.txt --sym-input=samforth-a.bin_symbols.z80s --output=samforth-a.raw.z80s samforth-a.bin
; And third, the assembly was postprocessed with:
; z80dasm2tidySamForth, a Vim program.

  org 0x0000
rst_10_rom_routine:	equ 0x0010 ; Print char in A register to current stream
jsetstrm_rom_routine:	equ 0x0112 ; Set the stream specified by the A register
jdrawto_rom_routine:	equ 0x013f ; Draw a line from the current position C pixel horizontally and B pixels vertically
jput_rom_routine:	equ 0x0133 ; Place a block of data on the screen at given coordinates
jgrab_rom_routine:	equ 0x0136 ; Store a block of screen data from given coordinates to a buffer
jplot_rom_routine:	equ 0x0139 ; Plot pixel at x coordinate in C and y coordinate in B
jfill_rom_routine:	equ 0x0145 ; Fills an area at coordinates C,B with the pattern at DE
jblitz_rom_routine:	equ 0x0148 ; Execute a string of graphics commands BC long at DE
jroll_rom_routine:	equ 0x014b ; Move part of the screen (A=wrap/roll, B=pixels, C=direction, D=length, E=width, L=x, H=y
jclsbl_rom_routine:	equ 0x014e ; Clear entire screen if A=0, else clear upper screen
jclslower_rom_routine:	equ 0x0151 ; Clear lower screen and select channel K
jpalet_rom_routine:	equ 0x0154 ; Put colours BC for palette colour E; A=y
jgdump_rom_routine:	equ 0x0160 ; Do a graphic screen dump
jreadkey_rom_routine:	equ 0x0169 ; Read keyboard; NZ/CY if pressed, A=key
jnchar_rom_routine:	equ 0x0184 ; Try to match the char at line D, column E; CY=found?, A=char
lmpr:	equ 0xfa ; Low Memory Page Register
hmpr:	equ 0xfb ; High Memory Page Register

  di
  ld iy,flags_fvar
  jp init

	org 0x0008
rst08:
  jp jp_rom_rst10

	org 0x0010
rst10:
  jp push_hl

	org 0x0018
rst18:
  jp pop_hl

	org 0x0020
rst20:
  jp push_hl_de

	org 0x0028
rst28:
  jp pop_hl_de

	org 0x0030
rst30:
jp_error_a:
  jp error_a

	org 0x0038
rst38:
  push af
  push bc
  push de
  push hl
  ld hl,(frames2_fvar)
  inc hl
  ld (frames2_fvar),hl
  ld a,h
  or l
  jr nz,l004eh
  ld hl,(frames1_fvar)
  inc hl
  ld (frames1_fvar),hl
l004eh:
  call sub_0df0h
  pop hl
  pop de
  pop bc
  pop af
  ei
  ret
  ld iy,flags_fvar
  ld (bastack_fvar),sp
  ld sp,(tempstk_fvar) ; xxx -- warning: this variable is used as temporary storage
  jp l006ah ; xxx -- this looks unfinished or debugging code

	org 0x0066
nmi_routine:
  ld hl,(nmi_fvar)
  jp (hl)
l006ah:
  call page_pageno_in_and_set_iy_to_flags
  jr l0073h
  nop
  jp page_pageno_in_and_set_iy_to_flags
l0073h:
  ld a,(samerr_fvar)
  cp 0x00
  jr nz,l0094h
  ld a,(svblk_fvar)
  cp 0x02
  jr nz,l009bh
  ld de,(slen_fvar)
  ld hl,(se_fvar)
  add hl,de
  ld (se_fvar),hl
  ld (elist_fvar),hl
  xor a
  ld (svblk_fvar),a
  ret
l0094h:
  ld sp,(errsp_fvar)
  jp main_loop
l009bh:
  cp 0x0d
  ret nz
  ld hl,(chere_fvar)
  dec hl
  ld b,(hl)
  dec hl
  ld c,(hl)
  dec hl
  ld d,(hl)
  dec hl
  ld e,(hl)
  ld (latest_fvar),bc
  ld (here_fvar),de
  call save_dictionary_pointers
  jp l0094h
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
jp_main_loop:
  jp main_loop
jp_page_rampage_in:
  jp page_rampage_in
jp_u_dot_code_field:
  jp u_dot_code_field
sub_00c9h:
  jp l103dh
jp_page_pageno_in_and_set_iy_to_flags:
  jp page_pageno_in_and_set_iy_to_flags
jp_interpret_code_field:
  jp interpret_code_field
jp_keyboard_input:
  jp keyboard_input
jp_wait_for_keypress_and_return_it_in_a:
  jp wait_for_keypress_and_return_it_in_a
jp_de_hl_slash_mod:
  jp de_hl_slash_mod
jp_rom_rst10:
  jp rom_rst10
jp_change_drive_to_tos:
  jp change_drive_to_tos
jp_call_jplot:
  jp call_jplot
jp_call_jdrawto:
  jp call_jdrawto
jp_beep:
  jp beep
jp_do_sound:
  jp do_sound
jp_cls:
  jp cls
jp_fetch_from_page_0:
  jp fetch_from_page_0
jp_mode:
  jp mode
jp_colour:
  jp colour
jp_load:
  jp load
jp_save:
  jp save
jp_at:
  jp at
jp_link:
  jp link
jp_link_l:
  jp link_l
jp_sam:
  jp sam
jp_clear_lower_screen_and_set_palette_l_to_e:
  jp clear_lower_screen_and_set_palette_l_to_e
jp_paper:
  jp paper
jp_pen:
  jp pen
jp_dir:
  jp dir
jp_call_jpalette:
  jp call_jpalette
jp_border:
  jp border
jp_flash:
  jp flash
jp_bright:
  jp bright
jp_store_into_page_0:
  jp store_into_page_0
jp_c_fetch_from_page_0:
  jp c_fetch_from_page_0
jp_c_store_into_page_0:
  jp c_store_into_page_0
jp_sound_off:
  jp sound_off
jp_rols:
  jp rols
jp_csize:
  jp csize
jp_udgdef:
  jp udgdef
jp_screen:
  jp screen
jp_blitz:
  jp blitz
jp_tab:
  jp tab
jp_overp:
  jp overp
jp_inverse:
  jp inverse
jp_bload:
  jp bload
jp_bsave:
  jp bsave
jp_dload:
  jp dload
jp_dsave:
  jp dsave
jp_editor_command_p:
  jp editor_command_p
jp_clear:
  jp clear
jp_editor_command_l:
  jp editor_command_l
jp_editor_command_f:
  jp editor_command_f
jp_editor_command_to:
  jp editor_command_to
jp_editor_command_n:
  jp editor_command_n
jp_where:
  jp where
jp_edit:
  jp edit
jp_list:
  jp list
jp_newl:
  jp newl
sub_0171h:
  jp l0be1h
sub_0174h:
  jp l0c09h
jp_editor_command_h:
  jp editor_command_h
sub_017ah:
  jp l0c5ch
sub_017dh:
  jp l0c66h
jp_editor_command_from:
  jp editor_command_from
sub_0183h:
  jp l0a0ah
jp_grab:
  jp grab
jp_put:
  jp put
jp_fill:
  jp fill
  nop
flags_fvar:
; Various flags to control the system.
  defb 0x02
lastk_fvar:
; ASCII code of last key pressed.
  defb 0x00
bord_fvar:
; Current border colour.
  defb 0x09
frames1_fvar:
; Counts television picture frames into a double number. Not used by SamForth-B.
  defw 0x0000
frames2_fvar:
; Counts television picture frames into a double number. Not used by SamForth-B.
  defw 0x0000
ycord_fvar:
; Last Y position plotted or drawn.
  defb 0x00
xcord_fvar:
; Last X position plotted or drawn.
  defw 0x0000
rstack_fvar:
; Address of return stack (Z80 stack).
  defw return_stack_end
stp_fvar:
; Stack pointer to Forth stack.
  defw data_stack_end
stack_fvar:
; Start of Forth stack.
  defw data_stack_end
stkend_fvar:
; End of Forth stack.
  defw data_stack_start
samerr_fvar:
; Holds SAM error number. Not used by SamForth-B, but used by the error trapping code of its BASIC loader.
  defb 0x00
nmi_fvar:
; Address to jump to when NMI button pressed. Not used by SamForth-B.
  defw 0x0000
clate_fvar:
; Address of last Forth word in dictionary at cold start.
  defw expand_name
chere_fvar:
; Next vacant address in dictionary at cold start.
  defw cold_here
latest_fvar:
; Address of last Forth word in dictionary.
  defw expand_name
here_fvar:
; Next vacant address in dictionary.
  defw cold_here
base_fvar:
; Current number base.
  defw 0x000a
fence_fvar:
; Address below which FORGET will not operate. It is by hold in the variable FENCE.
  defw cold_here
tib_fvar:
; Start address of the Terminal Input Buffer.
  defw tib_start
pad_fvar:
; Start address of the temporary data holding area.
  defw pad_start
st_fvar:
; Start address of source, usually 32768. The page holding the source file is paged in at C & D.
  defw 0x8000
tempstk_fvar: ; xxx -- warning: this variable is used as temporary storage
; Used as temporary stack store.
  defw 0x0000
rampage_fvar:
; Page number where source file will be held. Defaults to page 7.
  defb 0x07
errsp_fvar:
; Address at which return stack is set upon an error.
  defw return_stack_end
corestore_fvar: ; xxx -- not used: chere_fvar does its function
; Next vacant address in dictionary at cold start.
  defw 0x0000
state_fvar:
; Flag showing compile or immediate mode.
  defb 0x00
length_fvar:
; Used to test for the length of a word being looked for in the dictionary.
  defb 0x00
leng_fvar:
; Used to test for the length of a word being looked for in the dictionary.
  defb 0x00
ip_fvar:
; Address of interpreter pointer within source being compiled.
  defw 0x0000
dubflag_fvar:
; Flag indicating double number.
  defb 0x00
bastack_fvar:
; Holds stack pointer from SAM BASIC.
  defw 0x0000
edits_fvar:
; Start address of source to be edited.
  defw 0x0000
numbit_fvar:
; Temporary store used during number output.
  defw 0x0000
part1_fvar:
; Temporary addresses used during number input.
  defw 0x0000
part2_fvar:
; Temporary addresses used during number input.
  defw 0x0000
endf_fvar:
; Temporary store used during number output.
  defw 0x0000
nega_fvar:
; Flag for negative number during number output.
  defw 0x0000
temp1_fvar:
; Temporary store for HERE during compiling.
  defw 0x0000
temp2_fvar:
; Temporary store for LATEST during compiling.
  defw 0x0000
il1_fvar:
; Length of input line before cursor.
  defb 0x00
il2_fvar:
; Length of input line after cursor.
  defb 0x00
etib_fvar:
; End address of Terminal Input Buffer.
  defw tib_end
iflag_fvar:
; Flag indicating that characters may be inserted into the input line and existing input is not over written.
  defb 0x01
ldflg_fvar:
; Flag showing that source is being compiled.
  defb 0x00
errhld_fvar:
; Address of interpreter pointer position when an error occurred during source compilation.
  defw 0x0000
svblk_fvar:
; Flag used during LOAD, SAVE and DIR commands.
  defw 0x0000
slen_fvar:
; Length of source to be saved.
  defw 0x0000
se_fvar:
; End address of source.
  defw 0x8000
sadd_fvar:
; Address from where source will be LOADed or SAVEd.
  defw 0x0000
hlds_fvar:
; Temporary store during number formatting.
  defw 0x0000
pairs_fvar:
; Flags to indicate whether pairs such as DO-LOOP match up during compilation.
  defw 0x0000
pageno_fvar:
; Holds number of page paged in at 32768 in sections C & D.
  defw 0x0005
cur_fvar:
; Address of cursor in input buffer.
  defw 0x0000
smode_fvar:
; Indicates SAM screen mode 1, 2, 3 or 4.
  defw 0x0000
notused0_fvar:
  defw 0x0000
notused1_fvar:
  defw 0x0000
notused2_fvar:
  defw 0x0000
len2_fvar:
; Used to increase or decrease length of source during editing.
  defw 0x0000
len1_fvar:
; Used to increase or decrease length of source during editing.
  defw 0x0000
lists_fvar:
; Start address of source list on screen, or of source to be SAVEd. Changed with T, N, FROM.
  defw 0x8000
elist_fvar:
; End address of source list on screen or source to be SAVEd. Changed with N or ES.
  defw 0x8000
blong_fvar:
; Used during source editing.
  defw 0x0000
endline_fvar:
; Used during source editing.
  defw 0x0000

tib_start:
	defs 128
tib_end:

pad_start:
	defs 128
pad_end:

data_stack_start:
	defs 256
data_stack_end:

return_stack_start:
	defs 256
return_stack_end:
	rst 0x38
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
cls:
  bit 7,(iy+0x00)
  jp nz,jp_page_pageno_in_and_set_iy_to_flags
  ld a,0x01
  ld iy,jclsbl_rom_routine
  jp call_rom_address_in_iy
rom_rst10:
  ld iy,rst_10_rom_routine
  jp call_rom_address_in_iy
mode:
  call cls
	rst 0x18
  ld a,l
  ld (smode_fvar),a
  dec a
  ld iy,jgdump_rom_routine
  jp call_rom_address_in_iy
link:
	rst 0x18
link_l:
  ld a,l
  cp 0x03
  jr nz,link_a_not_to_channel_p
  set 7,(iy+0x00)
  jr link_a
link_a_not_to_channel_p:
  res 7,(iy+0x00)
link_a:
  ld iy,jsetstrm_rom_routine
  jp call_rom_address_in_iy
at:
  ld a,0x16
  rst 8
	rst 0x28
  push hl
  ld a,e
  rst 8
  pop hl
  ld a,l
  rst 8
  ret
border:
	rst 0x18
  ld a,l
  ld (bord_fvar),a
  out (0xfe),a
  ret
beep:
	rst 0x18
  push hl
	rst 0x18
  push hl
	rst 0x18
  push hl
  ld a,0x1c
  ld l,0x01
  call sound_out_a_l
  ld a,0x14
  ld l,0x3f
  call sound_out_a_l
  ld a,0x00
  ld l,0xff
  call sound_out_a_l
  ld a,0x08
  pop hl
  call sound_out_a_l
  pop hl
  ld a,l
  sla a
  sla a
  sla a
  sla a
  add a,l
  ld l,a
  ld a,0x10
  call sound_out_a_l
  pop hl
l065ah:
  dec hl
  ld de,0x2710
l065eh:
  dec de
  ld a,d
  or e
  jr nz,l065eh
  ld a,h
  or l
  jr nz,l065ah
sound_off:
  ld a,0x1c
  ld l,0x00
  call sound_out_a_l
  ret
sound_out_a_l:
  ld bc,0x01ff
  out (c),a
  ld bc,0x00ff
  out (c),l
  ret
do_sound:
	rst 0x18
  push hl
	rst 0x18
  ld a,l
  pop hl
  jp sound_out_a_l
sam:
  ld a,0x00
  ld (svblk_fvar),a
  ld (smode_fvar),a
return_to_basic:
  ld (tempstk_fvar),sp
  ld sp,(bastack_fvar)
  ld a,0x01
  out (hmpr),a
  jp 0xc364
sub_0699h:
  ld hl,(elist_fvar)
  ld de,(lists_fvar)
  sbc hl,de
  ld (slen_fvar),hl
  ld hl,(lists_fvar)
  ld (sadd_fvar),hl
sub_06abh:
  ld hl,(ip_fvar)
l06aeh:
  inc hl
  ld a,0x0d
  cp (hl)
  jp z,error_0x0c_xxx_unknown
  ld a,0x20
  cp (hl)
  jr nz,l06bch
  jr l06aeh
l06bch:
  ld b,0x0e
  ld de,(pad_fvar)
  ld a,0x20
l06c4h:
  ld (de),a
  inc de
  djnz l06c4h
  ld de,(pad_fvar)
l06cch:
  ld a,(hl)
  ld (de),a
  cp 0x20
  jr z,l06dah
  cp 0x0d
  jr z,l06dfh
  inc hl
  inc de
  jr l06cch
l06dah:
  dec hl
  ld (ip_fvar),hl
  ret
l06dfh:
  ld a,0x20
  ld (de),a
  jr l06dah
error_0x0c_xxx_unknown:
  ld a,0x0c
	rst 0x30
save:
  call sub_0699h
  ld a,0x01
  ld (svblk_fvar),a
  jp return_to_basic
l06f2h:
  ld hl,(se_fvar)
  ld (sadd_fvar),hl
  call sub_06abh
  ld a,0x02
  ld (svblk_fvar),a
  jp return_to_basic

xxx_unknown_zone_00_start:
  defb 0xe7
  defb 0x06

dir:
  ld a,0x03
  ld (svblk_fvar),a
  jp return_to_basic
call_rom_address_in_iy:
  ex af,af'
  ld a,0x01
  out (hmpr),a
  jp 0xc378
call_jplot:
  call get_stack_coords_and_copy_to_bc
  ld iy,jplot_rom_routine
  jp call_rom_address_in_iy
call_jdrawto:
  call get_stack_coords_and_copy_to_bc
  ld iy,jdrawto_rom_routine
  jp call_rom_address_in_iy
get_stack_coords_and_copy_to_bc:
	rst 0x28
  ld b,l
  ld a,b
  ld (ycord_fvar),a
  ld (xcord_fvar),de
  ld c,e
  ret
paper:
  ld a,0x11
  jr print_a_and_tos
pen:
  ld a,0x10
  jr print_a_and_tos
inverse:
  ld a,0x14
  jr print_a_and_tos
flash:
  ld a,0x12
print_a_and_tos:
  rst 8
	rst 0x18
  ld a,l
  rst 8
  ret
bright:
  ld a,0x13
  jr print_a_and_tos
clear_lower_screen_and_set_palette_l_to_e:
  ld iy,jclslower_rom_routine
  jp call_rom_address_in_iy
  ld a,0xff
	rst 0x28
  ld b,e
  ld c,e
  ld e,l
call_jpalette:
  ld iy,jpalet_rom_routine
  jp call_rom_address_in_iy
change_drive_to_tos:
  ld a,0x00
  out (hmpr),a
	rst 0x18
  ld a,l
  ld (0x9a07),a
  jp jp_page_pageno_in_and_set_iy_to_flags
store_into_page_0:
  ld a,0x00
  out (hmpr),a
	rst 0x28
  ld bc,0x4000
  add hl,bc
  ld (hl),e
  inc hl
  ld (hl),d
  jp jp_page_pageno_in_and_set_iy_to_flags
fetch_from_page_0:
  ld a,0x00
  out (hmpr),a
	rst 0x18
  ld bc,0x4000
  add hl,bc
  ld e,(hl)
  inc hl
  ld d,(hl)
  ex de,hl
	rst 0x10
  jp jp_page_pageno_in_and_set_iy_to_flags
c_store_into_page_0:
  ld a,0x00
  out (hmpr),a
	rst 0x28
  ld bc,0x4000
  add hl,bc
  ld (hl),e
  jp jp_page_pageno_in_and_set_iy_to_flags
c_fetch_from_page_0:
  ld a,0x00
  out (hmpr),a
	rst 0x18
  ld bc,0x4000
  add hl,bc
  ld a,(hl)
  ld l,a
  ld h,0x00
	rst 0x10
  jp jp_page_pageno_in_and_set_iy_to_flags
colour:
	rst 0x18
  push hl
	rst 0x18
  ex de,hl
  pop hl
  ld a,0x00
  out (hmpr),a
  ld a,(0x9a40)
  cp 0x01
  jr z,l07c0h
  cp 0x00
  jr z,l07c0h
  jr l07cdh
l07c0h:
  ld a,e
  rlca
  rlca
  rlca
  add a,l
  ld (0x9a45),a
  ld (0x9c48),a
  jr jp_jp_page_pageno_in_and_set_iy_to_flags
l07cdh:
  push hl
  push de
  push af
  ld a,e
  rlca
  rlca
  rlca
  rlca
  add a,e
  ld (0x9a30),a
  ld e,a
  ld a,l
  rlca
  rlca
  rlca
  rlca
  add a,l
  ld (0x9a31),a
  ld l,a
  pop af
  cp 0x02
  jr z,l07f5h
  ld a,l
  ld (0x9a49),a
  ld a,e
  ld (0x9a48),a
  pop de
  pop hl
  jr jp_jp_page_pageno_in_and_set_iy_to_flags
l07f5h:
  pop de
  pop hl
  ld a,e
  rlca
  rlca
  add a,e
  rlca
  rlca
  add a,e
  rlca
  rlca
  add a,e
  ld (0x9a48),a
  ld a,l
  rlca
  rlca
  add a,l
  rlca
  rlca
  add a,l
  rlca
  rlca
  add a,l
  ld (0x9a49),a
jp_jp_page_pageno_in_and_set_iy_to_flags:
  jp jp_page_pageno_in_and_set_iy_to_flags
  ret
rols:
	rst 0x18
  ld c,e
	rst 0x18
  ld d,c
  push de
	rst 0x18
  ld c,e
	rst 0x18
  ld d,e
  ld e,c
  push de
	rst 0x18
  ld c,e
	rst 0x18
  ld b,e
	rst 0x18
  ld a,e
  pop de
  pop hl
  ld iy,0x014b ; xxx fixed -- 'ld ix' in the original
  jp call_rom_address_in_iy
csize:
	rst 0x28
  ld d,l
  ld a,0x00
  out (hmpr),a
  ld hl,0x9a36
  ld (hl),d
  inc hl
  ld (hl),e
  ld l,d
  ld h,0x00
  ld de,jp_main_loop
  call jp_de_hl_slash_mod
	rst 0x18
  ld e,l
  ld hl,0x9a3f
  dec e
  ld (hl),e
  ld hl,0x9a3e
  dec e
  ld (hl),e
  dec e
  ld hl,0x9a3b
  ld (hl),e
	rst 0x18
  ld a,l
  ld hl,0x9a5d
  ld (hl),a
  ld a,0x05
  out (hmpr),a
  ret
  pop de
udgdef:
	rst 0x18
  ld a,0x00
  cp h
  jr nz,l086ch
  ld a,0xa8
  cp l
  jr nc,l0875h
l086ch:
  ld de,0x00a8
  sbc hl,de
  ld a,0x01
  jr l0877h
l0875h:
  ld a,0x00
l0877h:
  ld (tempstk_fvar),a
  push hl
  ld de,rst08
  ld hl,(pad_fvar)
  add hl,de
  ld b,0x08
l0884h:
  push hl
	rst 0x18
  ex de,hl
  pop hl
  ld (hl),e
  dec hl
  djnz l0884h
  pop hl
  add hl,hl
  add hl,hl
  add hl,hl
  ld a,0x00
  out (hmpr),a
  ld a,(tempstk_fvar)
  cp 0x00
  jr z,l08a1h
  ld de,(0x9c7d)
  jr l08a5h
l08a1h:
  ld de,(0x9c36)
l08a5h:
  add hl,de
  ld de,0x4000
  add hl,de
  ex de,hl
  ld hl,(pad_fvar)
  inc hl
  ld bc,rst08
  ldir
  jp jp_page_pageno_in_and_set_iy_to_flags
screen:
	rst 0x28
  ld d,e
  ld e,l
  ld iy,jnchar_rom_routine
  call call_rom_address_in_iy
  ld l,b
  ld h,0x00
	rst 0x10
  ret
blitz:
	rst 0x28
  ld b,h
  ld c,l
  ld iy,jblitz_rom_routine
  ld a,0x01
  out (hmpr),a
  ld h,d
  ld l,e
  push bc
  ld de,0xc000
  push de
  ldir
  pop de
  pop bc
  jp call_rom_address_in_iy
tab:
  ld a,0x17
  rst 8
	rst 0x18
  ld a,l
  rst 8
  ld a,0x00
  rst 8
  ret
overp:
  ld a,0x15
  jp print_a_and_tos
bload:
	rst 0x18
  ld (sadd_fvar),hl
  call sub_06abh
  ld a,0x0b
  ld (svblk_fvar),a
  jp return_to_basic
bsave:
	rst 0x28
  ld (slen_fvar),hl
  ld (sadd_fvar),de
  call sub_06abh
  ld a,0x0c
  ld (svblk_fvar),a
  jp return_to_basic
dload:
  ld hl,(chere_fvar)
  ld de,0x0004
  sbc hl,de
  ld (sadd_fvar),hl
  call sub_06abh
  ld a,0x0d
  ld (svblk_fvar),a
  jp return_to_basic
dsave:
  ld hl,(chere_fvar)
  ld bc,(here_fvar)
  ld de,(latest_fvar)
  dec hl
  ld (hl),d
  dec hl
  ld (hl),e
  dec hl
  ld (hl),b
  dec hl
  ld (hl),c
  ld (sadd_fvar),hl
  ex de,hl
  ld h,b
  ld l,c
  sbc hl,de
  ld (slen_fvar),hl
  call sub_06abh
  ld a,0x0e
  ld (svblk_fvar),a
  jp return_to_basic
editor_command_p:
  call jp_page_rampage_in
  ld hl,(ip_fvar)
  ld de,(se_fvar)
l0959h:
  inc hl
  ld a,(hl)
  ld (de),a
  inc de
  ld a,0x0d
  cp (hl)
  jr nz,l0959h
  ld (se_fvar),de
  ld (elist_fvar),de
  dec hl
  ld (ip_fvar),hl
  jp jp_page_pageno_in_and_set_iy_to_flags
clear:
  ld hl,(lists_fvar)
  ld (se_fvar),hl
  ld (elist_fvar),hl
  ret
editor_command_l:
  call cls
  ld hl,(elist_fvar)
  ld de,(st_fvar)
  ld a,d
  cp h
  jr nz,l098eh
  ld a,e
  cp l
  jr nz,l098eh
  ret
l098eh:
  call jp_page_rampage_in
l0991h:
  ld hl,(lists_fvar)
  ld (elist_fvar),hl
  ld b,0x01
l0999h:
  ld l,b
  inc b
  ld a,b
  cp 0x11
  jr z,l09cfh
  push bc
  ld h,0x00
	rst 0x10
  call jp_u_dot_code_field
  ld a,0x20
  rst 8
  call jp_page_rampage_in
  ld hl,(elist_fvar)
l09b0h:
  ld a,(hl)
  inc hl
  ld (elist_fvar),hl
  push af
  rst 8
  call jp_page_rampage_in
  pop af
  cp 0x0d
  jr nz,l09b0h
  pop bc
  push hl
  ld de,(se_fvar)
  and a
  sbc hl,de
  pop hl
  jr z,l09cfh
  jr nc,l09cfh
  jr l0999h
l09cfh:
  ld hl,(elist_fvar)
  dec hl
  ld (elist_fvar),hl
  jp jp_page_pageno_in_and_set_iy_to_flags
editor_command_from:
  ld hl,(lists_fvar)
  ld de,(st_fvar)
  ld a,e
  cp l
  jr nz,l09e9h
  ld a,h
  cp d
  jp z,l0b0ch
l09e9h:
  call jp_page_rampage_in
  dec hl
l09edh:
  dec hl
  ld a,e
  cp l
  jr nz,l09f7h
  ld a,h
  cp d
  jp z,l0a04h
l09f7h:
  ld a,0x0d
  cp (hl)
  jr nz,l09edh
  inc hl
  ld (lists_fvar),hl
  call jp_page_pageno_in_and_set_iy_to_flags
  ret
l0a04h:
  ld (lists_fvar),hl
  jp l0b0ch
l0a0ah:
  ld hl,(lists_fvar)
  call jp_page_rampage_in
l0a10h:
  inc hl
  ld a,0x0d
  cp (hl)
  jr nz,l0a10h
  ld de,(se_fvar)
  ld a,e
  cp l
  jr nz,l0a23h
  ld a,d
  cp h
  jp z,l0b0ch
l0a23h:
  inc hl
  ld (lists_fvar),hl
  call jp_page_pageno_in_and_set_iy_to_flags
  ret
editor_command_f:
  call sub_0c8eh
  ld hl,(sadd_fvar)
  ld (lists_fvar),hl
  ret
editor_command_to:
  call sub_0c8eh
  call jp_page_rampage_in
  ld hl,(sadd_fvar)
l0a3eh:
  dec hl
  ld a,0x0d
  cp (hl)
  jr nz,l0a3eh
  inc hl
  ld (elist_fvar),hl
  call jp_page_pageno_in_and_set_iy_to_flags
  ret
editor_command_n:
  ld hl,(elist_fvar)
  inc hl
  push hl
  ld de,(se_fvar)
  sbc hl,de
  pop hl
  ret nc
  ld (lists_fvar),hl
  jp editor_command_l
load:
  ld hl,(ip_fvar)
l0a62h:
  inc hl
  ld a,(hl)
  cp 0x0d
  jr z,l0a6fh
  cp 0x20
  jr z,l0a62h
  jp l06f2h
l0a6fh:
  ld hl,(lists_fvar)
  ld (sadd_fvar),hl
l0a75h:
  call jp_page_rampage_in
  ld de,(tib_fvar)
l0a7ch:
  ld a,(hl)
  ld (de),a
  inc hl
  inc de
  cp 0x0d
  jr nz,l0a7ch
  ld (endline_fvar),hl
  call jp_page_pageno_in_and_set_iy_to_flags
  call jp_interpret_code_field
  ld hl,(endline_fvar)
  ld (sadd_fvar),hl
  ld de,(elist_fvar)
  ld a,d
  cp h
  jr nz,l0a75h
  ld a,e
  cp l
  jr nz,l0a75h
  ld a,(ldflg_fvar)
  cp 0x80
  call z,sub_0aaeh ; xxx -- why?
  ld sp,(errsp_fvar)
  jp jp_main_loop
sub_0aaeh: ; xxx -- why?
  ret
where:
  ld hl,(errhld_fvar)
  dec hl
  ld de,(tib_fvar)
  sbc hl,de
  ex de,hl
  ld hl,(sadd_fvar)
  ld (lists_fvar),hl
  add hl,de
  call jp_page_rampage_in
  ld (hl),0x83
  jp l0991h
edit:
  call sub_0cffh
l0acch:
  call jp_page_rampage_in
  ld hl,(edits_fvar)
  ld de,(se_fvar)
  sbc hl,de
  jp z,l0b0ch
  ld hl,(edits_fvar)
  call sub_0bc1h
  ld hl,(tib_fvar)
  call jp_keyboard_input
  ld a,(il1_fvar)
  ld c,a
  ld a,(il2_fvar)
  add a,c
  inc a
  ld (len2_fvar),a
  ld c,a
  ld a,(len1_fvar)
  cp c
  jr z,l0afeh
  jr nc,l0b03h
  jr l0b09h
l0afeh:
  call sub_0b51h
  jr l0b0ch
l0b03h:
  call sub_0b73h
  jp l0b0ch
l0b09h:
  call sub_0b2dh
l0b0ch:
  call jp_page_pageno_in_and_set_iy_to_flags
  ld hl,0x0002
  call link_l
  call editor_command_l
  ld sp,(errsp_fvar)
  jp jp_main_loop
sub_0b1fh:
  ld hl,(se_fvar)
  ld bc,(endline_fvar)
  and a
  sbc hl,bc
  ld (blong_fvar),hl
  ret
sub_0b2dh:
  call sub_0b1fh
  call jp_page_rampage_in
  ld a,(len1_fvar)
  ld c,a
  ld a,(len2_fvar)
  sub c
  ld b,0x00
  ld c,a
  ld hl,(se_fvar)
  push hl
  and a
  add hl,bc
  ld (se_fvar),hl
  ld d,h
  ld e,l
  pop hl
  ld bc,(blong_fvar)
  inc bc
  lddr
sub_0b51h:
  ld hl,(edits_fvar)
  ld de,(edits_fvar)
  call jp_page_rampage_in
  ld a,(len2_fvar)
  cp 0x00
  jp z,l0acch
  ld c,a
  ld b,0x00
  add hl,bc
  ld (endline_fvar),hl
  ld hl,(tib_fvar)
  ldir
  ld hl,(endline_fvar)
  ret
sub_0b73h:
  call sub_0b1fh
  call jp_page_rampage_in
  ld a,(len2_fvar)
  ld c,a
  ld a,(len1_fvar)
  sub c
  ld c,a
  ld b,0x00
  ld hl,(se_fvar)
  and a
  sbc hl,bc
  ld (se_fvar),hl
  ld hl,(endline_fvar)
  push hl
  and a
  sbc hl,bc
  ld d,h
  ld e,l
  pop hl
  ld bc,(blong_fvar)
  ld a,b
  or c
  jr z,sub_0b51h
  ldir
  jr sub_0b51h
sub_0ba3h:
  call jp_page_rampage_in
  ld hl,(edits_fvar)
l0ba9h:
  ld a,(hl)
  cp 0x0d
  jr z,l0bb1h
  inc hl
  jr l0ba9h
l0bb1h:
  inc hl
  ld (endline_fvar),hl
  ld bc,(edits_fvar)
  and a
  sbc hl,bc
  ld a,l
  ld (len1_fvar),a
  ret
sub_0bc1h:
  call sub_0ba3h
  ld c,a
  ld b,0x00
  dec a
  ld (il2_fvar),a
  ld a,0x00
  ld hl,(edits_fvar)
  ld de,(tib_fvar)
  ld (cur_fvar),de
  ld (il1_fvar),a
  ldir
  call sub_00c9h
  ret
l0be1h:
  call sub_0cffh
  ld hl,(se_fvar)
  call jp_page_rampage_in
  ld bc,(endline_fvar)
  sbc hl,bc
  ld b,h
  ld c,l
  inc bc
  ld hl,(se_fvar)
  ld de,(se_fvar)
  inc de
  ld (se_fvar),de
  lddr
  ld hl,(endline_fvar)
  ld (hl),0x0d
  jp l0c52h
l0c09h:
  call sub_0cffh
  call jp_page_rampage_in
  ld hl,(edits_fvar)
l0c12h:
  ld a,(hl)
  cp 0x0d
  jr z,l0c1ah
  inc hl
  jr l0c12h
l0c1ah:
  inc hl
  ld (endline_fvar),hl
  ld bc,(edits_fvar)
  and a
  sbc hl,bc
  ld a,l
  ld (len1_fvar),a
  ld hl,(se_fvar)
  ld de,(endline_fvar)
  sbc hl,de
  ld b,h
  ld c,l
  ld a,(len1_fvar)
  ld e,a
  ld d,0x00
  ld hl,(se_fvar)
  sbc hl,de
  ld (se_fvar),hl
  ld hl,(endline_fvar)
  push hl
  sbc hl,de
  ld (endline_fvar),hl
  ex de,hl
  pop hl
  ldir
  ld hl,(edits_fvar)
l0c52h:
  call jp_page_pageno_in_and_set_iy_to_flags
  ld hl,0x0002
  call link_l
  ret
l0c5ch:
	rst 0x18
	rst 0x10
	rst 0x10
  call l0c09h
  call l0be1h
  ret
l0c66h:
	rst 0x18
	rst 0x10
	rst 0x10
  call l0c5ch
  call sub_0cffh
  ld hl,(tib_fvar)
  push hl
  ld hl,(pad_fvar)
  inc hl
  ld (tib_fvar),hl
  ld hl,(pad_fvar)
  ld a,(hl)
  ld (len2_fvar),a
  ld a,0x01
  ld (len1_fvar),a
  call sub_0b2dh
  pop hl
  ld (tib_fvar),hl
  ret
sub_0c8eh:
  ld de,(ip_fvar)
  call jp_page_rampage_in
l0c95h:
  inc de
  ld a,(de)
  cp 0x20
  jr z,l0c95h
  cp 0x3a
  jr z,l0c95h
  cp 0x0d
  jr z,jp_page_pageno_in_and_set_iy_to_flags_and_error_0x0a_not_found
  ld hl,(lists_fvar)
  dec hl
l0ca7h:
  push hl
  push de
  dec de
l0caah:
  inc de
  inc hl
  ld a,(de)
  ld c,(hl)
  cp c
  jr nz,l0ce3h
  cp 0x0d
  jr z,l0cbbh
  cp 0x20
  jr z,l0cbbh
  jr l0caah
l0cbbh:
  pop bc
  pop hl
  ld (sadd_fvar),hl
  dec de
  ld (ip_fvar),de
  jp jp_page_pageno_in_and_set_iy_to_flags
l0cc8h:
  pop de
  pop bc
l0ccah:
  push hl
  ld bc,(se_fvar)
  and a
  sbc hl,bc
  jr nc,jp_page_pageno_in_and_set_iy_to_flags_and_error_0x0a_not_found
  jr z,jp_page_pageno_in_and_set_iy_to_flags_and_error_0x0a_not_found
  pop hl
  ld a,(hl)
  cp 0x0d
  jr z,l0ca7h
  cp 0x20
  jr z,l0ca7h
  inc hl
  jr l0ccah
l0ce3h:
  cp 0x0d
  jr nz,l0ceeh
  ld a,c
  cp 0x20
  jr z,l0cbbh
  jr l0cc8h
l0ceeh:
  cp 0x20
  jr nz,l0cc8h
  ld a,c
  cp 0x0d
  jr z,l0cbbh
  jr l0cc8h
jp_page_pageno_in_and_set_iy_to_flags_and_error_0x0a_not_found:
  call jp_page_pageno_in_and_set_iy_to_flags
  ld a,0x0a
	rst 0x30
sub_0cffh:
	rst 0x18
  ld a,0x0f
  cp l
  jr c,error_0x0b_editor_error
  ld a,0x00
  cp l
  jr z,error_0x0b_editor_error
  ld b,l
  ld hl,(lists_fvar)
  ld a,b
  ld (notused1_fvar),a
  ld a,0x01
  cp b
  jr z,l0d33h
  call jp_page_rampage_in
  dec b
  dec hl
l0d1ch:
  inc hl
  push hl
  ld de,(se_fvar)
  sbc hl,de
  pop hl
  jp nc,error_0x0b_editor_error
  ld a,0x0d
  cp (hl)
  jr nz,l0d1ch
  djnz l0d1ch
  ld (endline_fvar),hl
  inc hl
l0d33h:
  ld (edits_fvar),hl
  jp jp_page_pageno_in_and_set_iy_to_flags
error_0x0b_editor_error:
  ld a,0x0b
	rst 0x30
newl:
  ld a,(rampage_fvar)
  out (hmpr),a
  ld hl,(se_fvar)
  ld b,0x10
l0d46h:
  ld (hl),0x0d
  inc hl
  djnz l0d46h
  ld (se_fvar),hl
  ld (elist_fvar),hl
  jp editor_command_l
list:
  ld hl,(elist_fvar)
  ld de,(st_fvar)
  ld a,d
  cp h
  jr nz,l0d64h
  ld a,e
  cp l
  jr nz,l0d64h
  ret
l0d64h:
  ld a,(rampage_fvar)
  out (hmpr),a
  ld hl,(lists_fvar)
l0d6ch:
  ld a,(hl)
  rst 8
  ld a,(rampage_fvar)
  out (hmpr),a
  inc hl
  ld bc,(elist_fvar)
  push hl
  and a
  sbc hl,bc
  pop hl
  jr nc,l0da1h
  jr z,l0da1h
  ld a,(hl)
  cp 0x3a
  jr nz,l0d8bh
  ld (lists_fvar),hl
  jr l0d6ch
l0d8bh:
  cp 0x3b
  jr nz,l0d6ch
  rst 8
  ld a,(rampage_fvar)
  out (hmpr),a
  inc hl
  bit 7,(iy+0x00)
  call z,jp_wait_for_keypress_and_return_it_in_a
  cp 0x20
  jr nz,l0d6ch
l0da1h:
  jp jp_page_pageno_in_and_set_iy_to_flags
editor_command_h:
  call sub_0cffh
  call sub_0ba3h
  ld hl,(edits_fvar)
  ld a,(len1_fvar)
  ld c,a
  ld b,0x00
  ld de,(pad_fvar)
  inc de
  ldir
  ld hl,(pad_fvar)
  ld (hl),a
  jp jp_page_pageno_in_and_set_iy_to_flags
grab:
	rst 0x28
  ld d,l
  push de
	rst 0x28
  ld c,l
  ld b,e
  pop de
  ld iy,jgrab_rom_routine
  jp call_rom_address_in_iy
put:
	rst 0x28
  ld a,l
  push de
	rst 0x28
  ld b,l
  ld c,e
  pop hl
  ld iy,jput_rom_routine
  jp call_rom_address_in_iy
fill:
	rst 0x28
  ld b,l
  ld c,e
	rst 0x18
  ex de,hl
  ld a,0x00
  ld iy,jfill_rom_routine
  jp call_rom_address_in_iy
  nop
  nop
  nop
  nop
  nop
sub_0df0h:
  ld bc,0xfef9
  in a,(c)
  cp 0xdf
  ret nz
  ld bc,0xfefe
  in a,(c)
  cp 0x5e
  ret nz
  ld a,0x08
  jp error_a
pop_hl:
  ld (rstack_fvar),sp
  ld sp,(stp_fvar)
  ld hl,(stack_fvar)
  sbc hl,sp
  jp z,error_0x01_stack_empty
  pop hl
  ld (stp_fvar),sp
  ld sp,(rstack_fvar)
  ret
push_hl:
  push hl
  ld (rstack_fvar),sp
  ld sp,(stp_fvar)
  push hl
  ld hl,(stkend_fvar)
  sbc hl,sp
  jp nc,error_0x02_stack_full
  ld (stp_fvar),sp
  ld sp,(rstack_fvar)
  pop hl
  ret
pop_hl_de:
  ld (rstack_fvar),sp
  ld sp,(stp_fvar)
  ld hl,(stack_fvar)
  sbc hl,sp
  jp z,error_0x01_stack_empty
  ld hl,(stack_fvar)
  dec hl
  dec hl
  sbc hl,sp
  jp z,error_0x01_stack_empty
  pop hl
  pop de
  ld (stp_fvar),sp
  ld sp,(rstack_fvar)
  ret
push_hl_de:
  push hl
  ld (rstack_fvar),sp
  ld sp,(stp_fvar)
  push de
  push hl
  ld hl,(stkend_fvar)
  sbc hl,sp
  jp nc,error_0x02_stack_full
  ld (stp_fvar),sp
  ld sp,(rstack_fvar)
  pop hl
  ret
  res 5,(iy+0x00)
  bit 5,(iy+0x00)
wait_for_keypress_and_return_it_in_a:
  call get_keypress_with_what_xxx
  ld a,(lastk_fvar)
  cp 0x00
  jr z,wait_for_keypress_and_return_it_in_a
  bit 1,(iy+0x00)
  ret z
  cp 0x61
  ret c
  cp 0x7b
  ret nc
  res 5,a
  ret
restore_the_input_pointer:
  ld hl,(tib_fvar)
  ld (cur_fvar),hl
  ld a,0x00
  ld (il1_fvar),a
  ld (il2_fvar),a
keyboard_input:
  push hl
  call l103dh
  call wait_for_keypress_and_return_it_in_a
  pop hl
  cp 0x08
  jp z,keyboard_input_cursor_left
  cp 0x09
  jp z,keyboard_input_cursor_right
  cp 0x0c
  jp z,keyboard_input_backspace
  cp 0x0e
  jp z,keyboard_input_delete
  cp 0xc3
  jp z,l0fd2h
  cp 0xc2
  jp z,restore_the_input_pointer
  cp 0x07
  jp z,keyboard_input_edit
  cp 0x06
  jr z,toggle_caps_lock
  cp 0x0b
  jp z,keyboard_input_up
  cp 0x0a
  jp z,keyboard_input_down
  cp 0xc0
  jp z,toggle_insert_mode
  cp 0x0d
  jr z,keyboard_input_cr
  push af
  ld a,(iflag_fvar)
  cp 0x01
  call z,sub_1010h
  pop af
  ld (hl),a
  inc hl
  ld (cur_fvar),hl
  ld a,(il1_fvar)
  inc a
  ld (il1_fvar),a
  ld a,(iflag_fvar)
  cp 0x01
  jr z,keyboard_input
  ld a,(il2_fvar)
  dec a
  cp 0xff
  jr z,keyboard_input
  ld (il2_fvar),a
  jp keyboard_input
keyboard_input_edit:
  ld (hl),0x20
  inc hl
  ld (hl),0x45
  inc hl
  ld (hl),0x44
  inc hl
  ld (hl),0x49
  inc hl
  ld (hl),0x54
  inc hl
  ld (hl),0x20
  ld a,(il1_fvar)
  add a,0x06
  ld (il1_fvar),a
  call keyboard_input_cr
  call interpret_code_field
  ret
toggle_caps_lock:
  ld a,(flags_fvar)
  xor 0x02
  ld (flags_fvar),a
  jp keyboard_input
keyboard_input_cr:
  ld hl,(tib_fvar)
  ld a,(il1_fvar)
  ld c,a
  ld a,(il2_fvar)
  add a,c
  ld c,a
  ld b,0x00
  add hl,bc
  ld (hl),0x0d
  ld (etib_fvar),hl
  call sub_1069h
print_cr: ; xxx -- duplicated code; already in the CR word
  ld a,0x0d
  rst 8
  ret
keyboard_input_backspace:
  ld a,(il1_fvar)
  dec a
  cp 0xff
  jp z,keyboard_input
  ld (il1_fvar),a
  ld hl,(cur_fvar)
  ld de,(cur_fvar)
  dec de
  ld (cur_fvar),de
  ld a,(il2_fvar)
l0f79h:
  cp 0x00
  jr z,l0f82h
  ld c,a
  ld b,0x00
  ldir
l0f82h:
  ld hl,(cur_fvar)
  jp keyboard_input
keyboard_input_delete:
  ld a,(il2_fvar)
  dec a
  cp 0xff
  jp z,keyboard_input
  ld (il2_fvar),a
  ld hl,(cur_fvar)
  inc hl
  ld de,(cur_fvar)
  jr l0f79h
keyboard_input_cursor_left:
  ld a,(il1_fvar)
  dec a
  cp 0xff
  jp z,keyboard_input
  ld (il1_fvar),a
  ld a,(il2_fvar)
  inc a
  ld (il2_fvar),a
  dec hl
  ld (cur_fvar),hl
  jp keyboard_input
keyboard_input_cursor_right:
  ld a,(il2_fvar)
  dec a
  cp 0xff
  jp z,keyboard_input
  ld (il2_fvar),a
  ld a,(il1_fvar)
  inc a
  ld (il1_fvar),a
  inc hl
  ld (cur_fvar),hl
  jp keyboard_input
l0fd2h:
  ld a,0x00
  ld (il2_fvar),a
  jp keyboard_input
keyboard_input_up:
  ld a,(il1_fvar)
  ld c,a
  ld a,(il2_fvar)
  add a,c
  ld (il2_fvar),a
  ld a,0x00
  ld (il1_fvar),a
  ld hl,(tib_fvar)
  ld (cur_fvar),hl
  jp keyboard_input
keyboard_input_down:
  ld a,(il1_fvar)
  ld c,a
  ld a,(il2_fvar)
  add a,c
  ld (il1_fvar),a
  ld c,a
  ld a,0x00
  ld (il2_fvar),a
  ld b,0x00
  ld hl,(tib_fvar)
  add hl,bc
  ld (cur_fvar),hl
  jp keyboard_input
sub_1010h:
  ld hl,(tib_fvar)
  ld a,(il1_fvar)
  ld c,a
  ld a,(il2_fvar)
  add a,c
  ld c,a
  ld b,0x00
  add hl,bc
  ld (etib_fvar),hl
  ld a,(il2_fvar)
  inc a
  ld c,a
  ld de,(etib_fvar)
  inc de
  lddr
  ld hl,(cur_fvar)
  ret
toggle_insert_mode:
  ld a,(iflag_fvar)
  xor 0x01
  ld (iflag_fvar),a
  jp keyboard_input
l103dh:
  ld hl,0x0001
  call jp_link_l
  call jp_clear_lower_screen_and_set_palette_l_to_e
  ld hl,(tib_fvar)
  ld a,(il1_fvar)
  cp 0x00
  jr z,l1056h
  ld c,a
  ld b,0x00
  call type_bc_chars_at_hl
l1056h:
  ld a,0x5f
  rst 8
  ld hl,(cur_fvar)
  ld a,(il2_fvar)
  cp 0x00
  ret z
  ld c,a
  ld b,0x00
  call type_bc_chars_at_hl
  ret
sub_1069h:
  ld hl,0x0002
  call jp_link_l
  ld hl,(tib_fvar)
  ld a,(il1_fvar)
  ld c,a
  ld a,(il2_fvar)
  add a,c
  ld c,a
  ld a,0x00
  cp c
  ret z
  ld b,0x00
  call type_bc_chars_at_hl
  ret
type_bc_chars_at_hl:
  ld a,(hl)
  inc hl
  push hl
  push bc
  rst 8
  pop bc
  pop hl
  dec bc
  ld a,b
  or c
  jr nz,type_bc_chars_at_hl
  ret
main_loop:
  call restore_the_input_pointer
  call interpret_code_field
  jr main_loop
error_0x01_stack_empty:
  ld a,0x01
  jr error_a
error_0x02_stack_full:
  ld a,0x02
error_a:
  ld hl,error_messages
error_message_not_found_yet:
  bit 7,(hl)
  inc hl
  jr z,error_message_not_found_yet
  dec a
  jr nz,error_message_not_found_yet
next_error_message_char:
  ld a,(hl)
  bit 7,a
  inc hl
  jr nz,warm_restart
  rst 8
  jr next_error_message_char
warm_restart:
  ld hl,(stack_fvar)
  ld (stp_fvar),hl
  ld hl,(ip_fvar)
  ld (errhld_fvar),hl
  ld sp,(errsp_fvar)
  ld hl,tib_start
  ld (tib_fvar),hl
  ld hl,tib_end
  ld (pad_fvar),hl
  call restore_dictionary_pointers_and_set_interpretation_mode
  call print_cr
  call page_pageno_in_and_set_iy_to_flags
  ld a,0x00
  ld (dubflag_fvar),a
  jp main_loop

error_messages:
  defb 0x80
	defm "Stack empty" ; Error number 0x01
  defb 0x8d
	defm "Stack full" ; Error number 0x02
  defb 0x8d
	defm "Undefined word" ; Error number 0x03
  defb 0x8d
	defm "Colon definitions only" ; Error number 0x04
  defb 0x8d
	defm "Division by zero" ; Error number 0x05
  defb 0x8d
	defm "Return stack full" ; Error number 0x06
  defb 0x8d
	defm "Inside fence" ; Error number 0x07
  defb 0x8d
	defm "Break" ; Error number 0x08
  defb 0x8d
	defm "Incomplete form" ; Error number 0x09
  defb 0x8d
	defm "Not found" ; Error number 0x0a
  defb 0x8d
	defm "Editor error" ; Error number 0x0b
  defb 0x8d

init:
  ld (bastack_fvar),sp
  ld (0xc34c),sp
  ld sp,(errsp_fvar)
  ld a,0x0d
  rst 8
  call page_pageno_in_and_set_iy_to_flags
  call save_dictionary_pointers
  ld a,0x00
  ld (state_fvar),a
  im 1
  ei
  ld hl,0x0002
  call jp_link_l
  call print_cr
  set 1,(iy+0x00)
  jp main_loop
save_dictionary_pointers:
  ld hl,(here_fvar)
  ld (temp1_fvar),hl
  ld hl,(latest_fvar)
  ld (temp2_fvar),hl
  ret
restore_dictionary_pointers_and_set_interpretation_mode:
  ld hl,(temp1_fvar)
  ld (here_fvar),hl
  ld hl,(temp2_fvar)
  ld (latest_fvar),hl
  ld a,0x00
  ld (state_fvar),a
  ret

lit_link_field:
  defw 0xffff
lit_name_field:
  defb 0x03
lit_name:
	defm "LIT"
lit_code_field:
  pop hl
  ld e,(hl)
  inc hl
  ld d,(hl)
  inc hl
  push hl
  ex de,hl
	rst 0x10
  ret

execute_link_field:
  defw lit_name
execute_name_field:
  defb 0x07
execute_name:
	defm "EXECUTE"
execute_code_field:
	rst 0x18
  jp (hl)

branch_link_field:
  defw execute_name
branch_name_field:
  defb 0x06
branch_name:
	defm "BRANCH"
branch_code_field:
  pop hl
  ld c,(hl)
  inc hl
  ld b,(hl)
  push bc
  ret

zero_branch_link_field:
  defw branch_name
zero_branch_name_field:
  defb 0x07
zero_branch_name:
	defm "0BRANCH"
zero_branch_code_field:
	rst 0x18
  ld a,0x01
  cp l
  jr nz,branch_code_field
  pop hl
  inc hl
  inc hl
  jp (hl)

swap_link_field:
  defw zero_branch_name
swap_name_field:
  defb 0x04
swap_name:
	defm "SWAP"
swap_code_field:
	rst 0x28
  ex de,hl
	rst 0x20
  ret

dup_link_field:
  defw swap_name
dup_name_field:
  defb 0x03
dup_name:
	defm "DUP"
dup_code_field:
	rst 0x18
	rst 0x10
	rst 0x10
  ret

drop_link_field:
  defw dup_name
drop_name_field:
  defb 0x04
drop_name:
	defm "DROP"
drop_code_field:
	rst 0x18
  ret

interpret_link_field:
  defw drop_name
interpret_name_field:
  defb 0x09
interpret_name:
	defm "INTERPRET"
interpret_code_field:
  ld hl,(tib_fvar)
  dec hl
skip_space:
  inc hl
  ld a,0x20
  cp (hl)
  jr z,skip_space
  ld a,0x0d
  cp (hl)
  jr nz,first_char_to_interpret_found
  ret
first_char_to_interpret_found:
  ld (ip_fvar),hl
  call paren_find_code_field
	rst 0x18
  ld a,h
  or l
  jr nz,l1298h
  ld hl,(ip_fvar)
	rst 0x10
  call number_code_field
  ld hl,(numbit_fvar)
  ld (ip_fvar),hl
	rst 0x18
  ld a,h
  or l
  jr z,l1263h
  ld a,0x01
  ld (dubflag_fvar),a
	rst 0x10
l1263h:
  ld a,(state_fvar)
  cp 0x00
  jr z,l1293h
  ld a,(dubflag_fvar)
  cp 0x01
  jr nz,l1274h
	rst 0x28
  ex de,hl
	rst 0x20
l1274h:
	rst 0x18
  ld b,h
  ld c,l
  ld hl,lit_code_field
	rst 0x10
  call compile_call_tos
  ld (hl),c
  inc hl
  ld (hl),b
  inc hl
  ld (here_fvar),hl
  ld a,(dubflag_fvar)
  cp 0x01
  jr nz,l1293h
  ld a,0x00
  ld (dubflag_fvar),a
  jr l1274h
l1293h:
  ld hl,(ip_fvar)
  jr skip_space
l1298h:
  ld a,(leng_fvar)
  bit 6,a
  jr nz,l12b5h
  ld a,(state_fvar)
  bit 7,a
  jr nz,l12bfh
  ld a,(leng_fvar)
  bit 7,a
  jr z,l12b5h
  ld a,(state_fvar)
  bit 7,a
  jp z,error_0x04_colon_definitions_only_xxx_1
l12b5h:
	rst 0x10
  call execute_code_field
  ld hl,(ip_fvar)
  jp skip_space
l12bfh:
  ld a,(leng_fvar)
  bit 7,a
  jr nz,l12b5h
	rst 0x10
  call compile_call_tos
  ld hl,(ip_fvar)
  jp skip_space
compile_call_tos:
	rst 0x18
  ex de,hl
compile_call_de:
  ld hl,(here_fvar)
  ld (hl),0xcd
  inc hl
  ld (hl),e
  inc hl
  ld (hl),d
  inc hl
  ld (here_fvar),hl
  ret
error_0x04_colon_definitions_only_xxx_1:
  ld a,0x04
	rst 0x30

paren_find_link_field:
  defw interpret_name
paren_find_name_field:
  defb 0x06
paren_find_name:
	defm "(FIND)"
paren_find_code_field:
  ld de,(ip_fvar)
  ld b,0x00
l12f2h:
  ld a,(de)
  cp 0x20
  jr z,l12ffh
  cp 0x0d
  jr z,l12ffh
  inc b
  inc de
  jr l12f2h
l12ffh:
  ld a,b
  ld (length_fvar),a
  ld hl,(latest_fvar)
  jr l131ch
l1308h:
  pop hl
l1309h:
  dec hl
  ld b,(hl)
  dec hl
  ld c,(hl)
  ld h,b
  ld l,c
  ld a,0xff
  cp l
  jr nz,l131ch
  cp h
  jr nz,l131ch
  ld hl,0x0000
	rst 0x10
  ret
l131ch:
  dec hl
  ld a,(length_fvar)
  ld c,a
  ld a,(hl)
  res 7,a
  res 6,a
  cp c
  jr nz,l1309h
  ld a,(hl)
  ld (leng_fvar),a
  push hl
  ld de,(ip_fvar)
  ld b,(hl)
  res 7,b
  res 6,b
l1337h:
  inc hl
  ld c,(hl)
  ld a,(de)
  cp c
  jr nz,l1308h
  inc de
  djnz l1337h
  inc hl
  dec de
  ld (ip_fvar),de
	rst 0x10
  pop hl
  ret

u_mult_link_field:
  defw paren_find_name
u_mult_name_field:
  defb 0x02
u_mult_name:
	defm "U*"
u_mult_code_field:
	rst 0x28
  ld b,h
  ld a,l
  call sub_1365h
  push hl
  ld h,a
  ld a,b
  ld b,h
  call sub_1365h
  pop de
  ld c,d
  add hl,bc
  adc a,0x00
  ld d,l
  ld l,h
  ld h,a
	rst 0x20
  ret
sub_1365h:
  ld hl,0x0000
  ld c,0x08
l136ah:
  add hl,hl
  rla
  jr nc,l1371h
  add hl,de
  adc a,0x00
l1371h:
  dec c
  jr nz,l136ah
  ret

plus_link_field:
  defw u_mult_name
plus_name_field:
  defb 0x01
plus_name:
	defm "+"
plus_code_field:
	rst 0x28
  and a
  add hl,de
	rst 0x10
  ret

d_plus_link_field:
  defw plus_name
d_plus_name_field:
  defb 0x02
d_plus_name:
	defm "D+"
d_plus_code_field:
	rst 0x18
  push hl
  pop bc
	rst 0x18
  push hl
  call swap_code_field
	rst 0x18
  pop de
  add hl,de
  ex de,hl
  push af
	rst 0x18
  pop af
  adc hl,bc
	rst 0x20
  ret

minus_link_field:
  defw d_plus_name
minus_name_field:
  defb 0x01
minus_name:
	defm "-"
minus_code_field:
	rst 0x28
  ex de,hl
  sbc hl,de
	rst 0x10
  ret

do_minus_link_field:
  defw minus_name
do_minus_name_field:
  defb 0x05
do_minus_name:
	defm "MINUS"
do_minus_code_field:
	rst 0x18
  ex de,hl
  ld hl,0x0000
  sbc hl,de
	rst 0x10
  ret

d_do_minus_link_field:
  defw do_minus_name
d_do_minus_name_field:
  defb 0x06
d_do_minus_name:
	defm "DMINUS"
d_do_minus_code_field:
	rst 0x28
  sub a
  sub e
  ld e,a
  ld a,0x00
  sbc a,d
  ld d,a
  ld a,0x00
  sbc a,l
  ld l,a
  ld a,0x00
  sbc a,h
  ld h,a
	rst 0x20
  ret

number_link_field:
  defw d_do_minus_name
number_name_field:
  defb 0x06
number_name:
	defm "NUMBER"
number_code_field:
	rst 0x18
  ld a,0x2d
  cp (hl)
  jr nz,l1410h
  inc hl
  ld a,0x01
  ld (nega_fvar),a
  jr l1410h
l13e3h:
  ld hl,(part1_fvar)
  ld de,(part2_fvar)
	rst 0x20
  ld a,(nega_fvar)
  cp 0x01
  jr nz,l140ah
  ld a,h
  or l
  jr nz,l13fbh
  ld a,0x80
  ld (nega_fvar),a
l13fbh:
  call d_do_minus_code_field
  ld a,(nega_fvar)
  cp 0x80
  jr nz,l140ah
	rst 0x18
  ld hl,0x0000
	rst 0x10
l140ah:
  ld a,0x00
  ld (nega_fvar),a
  ret
l1410h:
  ld a,0x00
  ld (endf_fvar),a
  ex de,hl
  ld hl,0x0000
  ld (part1_fvar),hl
  ld (part2_fvar),hl
l141fh:
  ld a,(de)
  cp 0x30
  jp c,error_0x03_undefined_word_xxx_1
  ld c,a
  ld a,(base_fvar)
  ld b,0x0a
  cp b
  jr nc,l1434h
  add a,0x30
  cp c
  jp c,error_0x03_undefined_word_xxx_1
l1434h:
  ld a,c
  cp 0x3a
  jr nc,l1486h
  sub 0x30
l143bh:
  ld h,0x00
  ld l,a
	rst 0x10
  inc de
  ld a,(de)
  cp 0x20
  jr z,l147fh
  cp 0x0d
  jr z,l147fh
l1449h:
  dec de
  ld (numbit_fvar),de
  ld hl,(part1_fvar)
	rst 0x10
  ld hl,(base_fvar)
	rst 0x10
  call u_mult_code_field
	rst 0x18
  ld hl,(base_fvar)
	rst 0x10
  ld hl,(part2_fvar)
	rst 0x10
  call u_mult_code_field
  call d_plus_code_field
	rst 0x18
  ld (part1_fvar),hl
	rst 0x18
  ld (part2_fvar),hl
  ld a,(endf_fvar)
  cp 0x01
  jp z,l13e3h
  ld de,(numbit_fvar)
  inc de
  jr l141fh
l147fh:
  ld a,0x01
  ld (endf_fvar),a
  jr l1449h
l1486h:
  ld c,a
  ld a,(base_fvar)
  add a,0x37
  cp c
  jp c,error_0x03_undefined_word_xxx_1
  ld a,c
  sub 0x37
  jr l143bh
error_0x03_undefined_word_xxx_1:
  ld a,0x03
	rst 0x30

emit_link_field:
  defw number_name
emit_name_field:
  defb 0x04
emit_name:
	defm "EMIT"
emit_code_field:
	rst 0x18
  ld a,l
  rst 8
  ret

u_dot_link_field:
  defw emit_name
u_dot_name_field:
  defb 0x02
u_dot_name:
	defm "U."
u_dot_code_field:
  ld hl,(stp_fvar)
  push hl
l14ach:
  ld hl,(base_fvar)
	rst 0x10
  call slash_mod_code_field
  call swap_code_field
	rst 0x18
  ld a,0x09
  cp l
  jr c,l14cch
  ld a,0x30
l14beh:
  add a,l
  ld l,a
	rst 0x10
  call swap_code_field
	rst 0x18
  ld a,h
  or l
  jr z,l14d0h
	rst 0x10
  jr l14ach
l14cch:
  ld a,0x37
  jr l14beh
l14d0h:
  pop hl
  ld de,(stp_fvar)
  sbc hl,de
  srl l
  ld b,l
  inc b
l14dbh:
	rst 0x18
  ld a,l
  push bc
  rst 8
  pop bc
  djnz l14dbh
  ld a,0x20
  rst 8
  ret

slash_mod_link_field:
  defw u_dot_name
slash_mod_name_field:
  defb 0x04
slash_mod_name:
	defm "/MOD"
slash_mod_code_field:
	rst 0x28
de_hl_slash_mod:
  ex de,hl
  ld a,d
  or e
  jp z,error_0x05_division_by_zero
  and a
  ld b,d
  ld c,e
  ld de,0xffff
l14fah:
  inc de
  sbc hl,bc
  jr nc,l14fah
  add hl,bc
  ex de,hl
	rst 0x20
  ret
error_0x05_division_by_zero:
  ld a,0x05
	rst 0x30
  jp jp_clear_lower_screen_and_set_palette_l_to_e
  jp l1955h

cls_link_field:
  defw slash_mod_name
cls_name_field:
  defb 0x03
cls_name:
	defm "CLS"
cls_code_field:
  jp jp_cls

create_link_field:
  defw cls_name
create_name_field:
  defb 0x06
create_name:
	defm "CREATE"
create_code_field:
  call create_header_with_name_from_the_input_stream
  call save_dictionary_pointers
  ret
create_header_with_name_from_the_input_stream:
  ld de,(ip_fvar)
  ld hl,(here_fvar)
l152ch:
  inc de
  ld a,(de)
  cp 0x20
  jr z,l152ch
  ld bc,(latest_fvar)
  ld (hl),c
  inc hl
  ld (hl),b
  push de
  ld b,0x00
l153ch:
  ld a,(de)
  cp 0x20
  jr z,l1549h
  cp 0x0d
  jr z,l1549h
  inc b
  inc de
  jr l153ch
l1549h:
  ld a,b
  inc hl
  ld (hl),a
  pop de
  inc hl
  ld (latest_fvar),hl
l1551h:
  ld a,(de)
  ld (hl),a
  inc de
  inc hl
  djnz l1551h
  ld (here_fvar),hl
  dec de
  ld (ip_fvar),de
  ret

colon_link_field:
  defw create_name
colon_name_field:
  defb 0x41
colon_name:
	defm ":"
colon_code_field:
  ld a,(state_fvar)
  bit 7,a
  jr nz,error_0x04_colon_definitions_only_xxx_2
  set 7,a
  ld (state_fvar),a
  call create_header_with_name_from_the_input_stream
  ld hl,0x0001
	rst 0x10
  ret
error_0x04_colon_definitions_only_xxx_2:
  ld a,0x04
	rst 0x30

semicolon_link_field:
  defw colon_name
semicolon_name_field:
  defb 0x41
semicolon_name:
	defm ";"
semicolon_code_field:
	rst 0x18
  ld a,0x01
  cp l
  jr nz,error_0x0a_not_found
  ld hl,(here_fvar)
  ld (hl),0xc9
  inc hl
  ld (here_fvar),hl
  ld a,0x00
  ld (state_fvar),a
  call save_dictionary_pointers
  ret
error_0x0a_not_found:
  ld a,0x0a
	rst 0x30

cr_link_field:
  defw semicolon_name
cr_name_field:
  defb 0x02
cr_name:
	defm "CR"
cr_code_field:
  ld a,0x0d
  rst 8
  ret

mode_link_field:
  defw cr_name
mode_name_field:
  defb 0x04
mode_name:
	defm "MODE"
mode_code_field:
  jp jp_mode

vlist_link_field:
  defw mode_name
vlist_name_field:
  defb 0x05
vlist_name:
	defm "VLIST"
vlist_code_field:
  ld hl,(latest_fvar)
l15b8h:
  dec hl
  push hl
  ld c,(hl)
  res 7,c
  res 6,c
  ld b,0x00
  inc hl
  call type_bc_chars_at_hl
  ld a,0x20
  rst 8
  pop hl
  dec hl
  ld b,(hl)
  dec hl
  ld c,(hl)
  ld h,b
  ld l,c
  ld a,0xff
  cp b
  jr nz,l15b8h
  cp c
  jr nz,l15b8h
  ld a,0x0d
  rst 8
  ret

base_link_field:
  defw vlist_name
base_name_field:
  defb 0x04
base_name:
	defm "BASE"
base_code_field:
	rst 0x18
  ld a,l
base_a:
  ld hl,base_fvar
  ld (hl),a
  ret

decimal_link_field:
  defw base_name
decimal_name_field:
  defb 0x07
decimal_name:
	defm "DECIMAL"
decimal_code_field:
  ld a,0x0a
  jp base_a

hex_link_field:
  defw decimal_name
hex_name_field:
  defb 0x03
hex_name:
	defm "HEX"
hex_code_field:
  ld a,0x10
  jp base_a

c_comma_link_field:
  defw hex_name
c_comma_name_field:
  defb 0x02
c_comma_name:
	defm "C,"
c_comma_code_field:
	rst 0x18
  ld a,l
  ld hl,(here_fvar)
  ld (hl),a
  inc hl
  ld (here_fvar),hl
  call save_dictionary_pointers
  ret

comma_link_field:
  defw c_comma_name
comma_name_field:
  defb 0x01
comma_name:
	defm ","
comma_code_field:
	rst 0x18
  ld de,(here_fvar)
  ex de,hl
  ld (hl),e
  inc hl
  ld (hl),d
  inc hl
  ld (here_fvar),hl
  call save_dictionary_pointers
  ret

allot_link_field:
  defw comma_name
allot_name_field:
  defb 0x05
allot_name:
	defm "ALLOT"
allot_code_field:
	rst 0x18
  ld de,(here_fvar)
  add hl,de
  ld (here_fvar),hl
  call save_dictionary_pointers
  ret

store_link_field:
  defw allot_name
store_name_field:
  defb 0x01
store_name:
	defm "!"
store_code_field:
	rst 0x28
  ld (hl),e
  inc hl
  ld (hl),d
  ret

c_store_link_field:
  defw store_name
c_store_name_field:
  defb 0x02
c_store_name:
	defm "C!"
c_store_code_field:
	rst 0x28
  ld (hl),e
  ret

fetch_link_field:
  defw c_store_name
fetch_name_field:
  defb 0x01
fetch_name:
	defm "@"
fetch_code_field:
	rst 0x18
  ld e,(hl)
  inc hl
  ld d,(hl)
  ex de,hl
	rst 0x10
  ret

c_fetch_link_field:
  defw fetch_name
c_fetch_name_field:
  defb 0x02
c_fetch_name:
	defm "C@"
c_fetch_code_field:
	rst 0x18
  ld l,(hl)
  ld h,0x00
	rst 0x10
  ret

here_link_field:
  defw c_fetch_name
here_name_field:
  defb 0x04
here_name:
	defm "HERE"
here_code_field:
  ld hl,(here_fvar)
	rst 0x10
  ret

latest_link_field:
  defw here_name
latest_name_field:
  defb 0x06
latest_name:
	defm "LATEST"
latest_code_field:
  ld hl,(latest_fvar)
	rst 0x10
  ret

semicolon_code_link_field:
  defw latest_name
semicolon_code_name_field:
  defb 0x45
semicolon_code_name:
	defm ";CODE"
semicolon_code_code_field:
	rst 0x18
  ld a,0x01
  cp l
  jr z,l1695h
  ld (pairs_fvar),a
	rst 0x10
  jr l169ah
l1695h:
  ld a,0x00
  ld (pairs_fvar),a
l169ah:
  ld a,0x00
  ld (state_fvar),a
  call save_dictionary_pointers
  ret

code_colon_link_field:
  defw semicolon_code_name
code_colon_name_field:
  defb 0x45
code_colon_name:
	defm "CODE:"
code_colon_code_field:
  ld a,0x80
  ld (state_fvar),a
  ld a,(pairs_fvar)
  cp 0x00
  ret nz
  ld hl,0x0001
	rst 0x10
  ret

in_link_field:
  defw code_colon_name
in_name_field:
  defb 0x02
in_name:
	defm "IN"
in_code_field:
	rst 0x18
  ld b,h
  ld c,l
  in a,(c)
  ld l,a
  ld h,0x00
	rst 0x10
  ret

out_link_field:
  defw in_name
out_name_field:
  defb 0x03
out_name:
	defm "OUT"
out_code_field:
	rst 0x28
  ld b,h
  ld c,l
  out (c),e
	ret

page_link_field:
  defw out_name
page_name_field:
  defb 0x04
page_name:
	defm "PAGE"
page_code_field:
	rst 0x18
  ld a,l
  ld (pageno_fvar),a
  out (hmpr),a
  ret

do_link_field:
  defw page_name
do_name_field:
  defb 0x82
do_name:
	defm "DO"
do_code_field:
  ld de,l16f6h
  call compile_call_de
	rst 0x10
  ld hl,0x0002
	rst 0x10
  ret
l16f6h:
  pop bc
	rst 0x28
  push hl
  push de
  push bc
  ret
sub_16fch:
	rst 0x18
  cp l
  jr nz,error_0x09_incomplete_form
  ret
error_0x09_incomplete_form:
  ld a,0x09
	rst 0x30
l1704h:
  pop hl
  pop de
  pop bc
  push hl
  push bc
  ld a,0x80
  xor d
  ld d,a
	rst 0x18
  ld b,h
  ld c,l
  pop hl
  add hl,bc
  rl b
  push af
  ld b,h
  ld c,l
  ld a,0x80
  xor h
  ld h,a
  pop af
  jr c,l1725h
  and a
  sbc hl,de
  jr c,l172ch
  jr l1738h
l1725h:
  and a
  sbc hl,de
  jr c,l1738h
  jr z,l1738h
l172ch:
  pop hl
  push bc
  ld a,0x80
  xor d
  ld d,a
  push de
  ld c,(hl)
  inc hl
  ld b,(hl)
  push bc
  ret
l1738h:
  pop hl
  inc hl
  inc hl
  jp (hl)
l173ch:
  jp l213fh

plus_loop_link_field:
  defw do_name
plus_loop_name_field:
  defb 0x85
plus_loop_name:
	defm "+LOOP"
plus_loop_code_field:
  ld a,0x02
  call sub_16fch
  ld de,l1704h
  call compile_call_de
  call sub_1756h
  ret
sub_1756h:
	rst 0x18
  ld b,h
  ld c,l
  ld hl,(here_fvar)
  ld (hl),c
  inc hl
  ld (hl),b
  inc hl
  ld (here_fvar),hl
  ret

loop_link_field:
  defw plus_loop_name
loop_name_field:
  defb 0x84
loop_name:
	defm "LOOP"
loop_code_field:
  ld a,0x02
  call sub_16fch
  ld de,l173ch
  call compile_call_de
  call sub_1756h
  ret

i_link_field:
  defw loop_name
i_name_field:
  defb 0x01
i_name:
	defm "I"
i_code_field:
  pop bc
  pop de
  pop hl
  push hl
  push de
  push bc
	rst 0x10
  ret

link_link_field:
  defw i_name
link_name_field:
  defb 0x04
link_name:
	defm "LINK"
link_code_field:
  jp jp_link
  jp jp_link_l

at_link_field:
  defw link_name
at_name_field:
  defb 0x02
at_name:
	defm "AT"
at_code_field:
  jp jp_at

border_link_field:
  defw at_name
border_name_field:
  defb 0x06
border_name:
	defm "BORDER"
border_code_field:
  jp jp_border

beep_link_field:
  defw border_name
beep_name_field:
  defb 0x04
beep_name:
	defm "BEEP"
beep_code_field:
  jp jp_beep

dot_quote_link_field:
  defw beep_name
dot_quote_name_field:
  defb 0x82
dot_quote_name:
	defb 0x2e,0x22 ; '."' string -- notation compatible with Pasmo and pyz80
dot_quote_code_field:
  ld de,l17dah
  call compile_call_de
  ld de,(ip_fvar)
  inc de
l17c1h:
  inc de
  ld a,(de)
  cp 0x22
  jr z,l17cfh
  cp 0x0d
  jr z,l17cfh
  ld (hl),a
  inc hl
  jr l17c1h
l17cfh:
  ld (hl),0xff
  inc hl
  ld (here_fvar),hl
  ld (ip_fvar),de
  ret
l17dah:
  pop hl
l17dbh:
  ld a,(hl)
  cp 0xff
  jr z,l17e4h
  rst 8
  inc hl
  jr l17dbh
l17e4h:
  inc hl
  jp (hl)

sc_store_link_field:
  defw dot_quote_name
sc_store_name_field:
  defb 0x03
sc_store_name:
	defm "SC!"
sc_store_code_field:
  in a,(0xfc)
  and 0x1f
  out (hmpr),a
	rst 0x28
  ld bc,0x8000
  add hl,bc
  ld (hl),e
  jp page_pageno_in_and_set_iy_to_flags

sc_fetch_link_field:
  defw sc_store_name
sc_fetch_name_field:
  defb 0x03
sc_fetch_name:
	defm "SC@"
sc_fetch_code_field:
  in a,(0xfc)
  and 0x1f
  out (hmpr),a
	rst 0x18
  ld bc,0x8000
  add hl,bc
  ld l,(hl)
  ld h,0x00
	rst 0x10
  jp page_pageno_in_and_set_iy_to_flags

p_link_field:
  defw sc_fetch_name
p_name_field:
  defb 0x01
p_name:
	defm "P"
p_code_field:
  jp jp_editor_command_p

clear_link_field:
  defw p_name
clear_name_field:
  defb 0x05
clear_name:
	defm "CLEAR"
clear_code_field:
  jp jp_clear

l_link_field:
  defw clear_name
l_name_field:
  defb 0x01
l_name:
	defm "L"
l_code_field:
  jp jp_editor_command_l

b_link_field:
  defw l_name
b_name_field:
  defb 0x01
b_name:
	defm "B"
b_code_field:
  ld b,0x0f
l1832h:
  call jp_editor_command_from
  djnz l1832h
  jp l_name ; xxx fixme -- wrong jump

r_link_field:
  defw b_name
r_name_field:
  defb 0x01
r_name:
	defm "R"
r_code_field:
  call sub_017dh
  jp jp_editor_command_l

c_link_field:
  defw r_name
c_name_field:
  defb 0x01
c_name:
	defm "C"
c_code_field:
  call swap_code_field
  call jp_editor_command_h
  call sub_017dh
  jp jp_editor_command_l

e_link_field:
  defw c_name
e_name_field:
  defb 0x01
e_name:
	defm "E"
e_code_field:
  call sub_017ah
  jp jp_editor_command_l

up_link_field:
  defw e_name
up_name_field:
  defb 0x02
up_name:
	defm "UP"
up_code_field:
	rst 0x18
  ld b,l
l1865h:
  call sub_0183h
  djnz l1865h
  jp l_name ; xxx fixme -- wrong jump

dn_link_field:
  defw up_name
dn_name_field:
  defb 0x02
dn_name:
	defm "DN"
dn_code_field:
	rst 0x18
  ld b,l
l1874h:
  call jp_editor_command_from
  djnz l1874h
  jp l_name ; xxx fixme -- wrong jump

newl_link_field:
  defw dn_name
newl_name_field:
  defb 0x04
newl_name:
	defm "NEWL"
newl_code_field:
  jp jp_newl

list_link_field:
  defw newl_name
list_name_field:
  defb 0x04
list_name:
	defm "LIST"
list_code_field:
  jp jp_list

t_link_field:
  defw list_name
t_name_field:
  defb 0x01
t_name:
	defm "T"
t_code_field:
  ld hl,(st_fvar)
  ld (lists_fvar),hl
  ret

es_link_field:
  defw t_name
es_name_field:
  defb 0x02
es_name:
	defm "ES"
es_code_field:
  ld hl,(se_fvar)
  ld (elist_fvar),hl
  ret

from_link_field:
  defw es_name
from_name_field:
  defb 0x04
from_name:
	defm "FROM"
from_code_field:
  call jp_editor_command_f
  jp jp_editor_command_from

f_link_field:
  defw from_name
f_name_field:
  defb 0x01
f_name:
	defm "F"
f_code_field:
  jp jp_editor_command_f

to_link_field:
  defw f_name
to_name_field:
  defb 0x02
to_name:
	defm "TO"
to_code_field:
  jp jp_editor_command_to

edit_link_field:
  defw to_name
edit_name_field:
  defb 0x04
edit_name:
	defm "EDIT"
edit_code_field:
  jp jp_edit

n_link_field:
  defw edit_name
n_name_field:
  defb 0x01
n_name:
	defm "N"
n_code_field:
  jp jp_editor_command_n

del_link_field:
  defw n_name
del_name_field:
  defb 0x03
del_name:
	defm "DEL"
del_code_field:
	rst 0x18
  ld b,l
l18dch:
  push bc
  call dup_code_field
  call sub_0174h
  pop bc
  djnz l18dch
  call drop_code_field
  jp l_name ; xxx fixme -- wrong jump

d_link_field:
  defw del_name
d_name_field:
  defb 0x01
d_name:
	defm "D"
d_code_field:
  call sub_0174h
  jp jp_editor_command_l

ins_link_field:
  defw d_name
ins_name_field:
  defb 0x03
ins_name:
	defm "INS"
ins_code_field:
	rst 0x18
  ld b,l
l18feh:
  push bc
  call dup_code_field
  call sub_0171h
  pop bc
  djnz l18feh
  call drop_code_field
  jp l_name ; xxx fixme -- wrong jump

s_link_field:
  defw ins_name
s_name_field:
  defb 0x01
s_name:
	defm "S"
s_code_field:
  call sub_0171h
  jp jp_editor_command_l

h_link_field:
  defw s_name
h_name_field:
  defb 0x01
h_name:
	defm "H"
h_code_field:
  jp jp_editor_command_h

load_link_field:
  defw h_name
load_name_field:
  defb 0x04
load_name:
	defm "LOAD"
load_code_field:
  jp jp_load

where_link_field:
  defw load_name
where_name_field:
  defb 0x05
where_name:
	defm "WHERE"
where_code_field:
  jp jp_where

star_link_field:
  defw where_name
star_name_field:
  defb 0x01
star_name:
	defm "*"
star_code_field:
  call u_mult_code_field
	rst 0x18
  ret

type_link_field:
  defw star_name
type_name_field:
  defb 0x04
type_name:
	defm "TYPE"
type_code_field:
	rst 0x28
  ex de,hl
  ld b,d
  ld c,e
  call type_bc_chars_at_hl
  ret

sam_link_field:
  defw type_name
sam_name_field:
  defb 0x03
sam_name:
	defm "SAM"
sam_code_field:
  jp jp_sam
l1955h:
  push af
  ld a,0x01
  out (hmpr),a
  pop af
  jp 0xc378
get_keypress_with_what_xxx:
  ld a,0x01
  out (hmpr),a
  jp 0xc3b4

save_link_field:
  defw sam_name
save_name_field:
  defb 0x04
save_name:
	defm "SAVE"
save_code_field:
  jp jp_save

dir_link_field:
  defw save_name
dir_name_field:
  defb 0x03
dir_name:
	defm "DIR"
dir_code_field:
  jp jp_dir

equals_link_field:
  defw dir_name
equals_name_field:
  defb 0x01
equals_name:
	defm "="
equals_code_field:
	rst 0x28
  ld a,l
  cp e
  jr nz,push_false
  ld a,h
  cp d
  jr nz,push_false
push_true:
  ld hl,0x0001
l1988h:
	rst 0x10
  ret
push_false:
  ld hl,0x0000
  jr l1988h

slash_link_field:
  defw equals_name
slash_name_field:
  defb 0x01
slash_name:
	defm "/"
slash_code_field:
  call slash_mod_code_field
  call swap_code_field
	rst 0x18
  ret

mod_link_field:
  defw slash_name
mod_name_field:
  defb 0x03
mod_name:
	defm "MOD"
mod_code_field:
  call slash_mod_code_field
	rst 0x18
  ret

begin_link_field:
  defw mod_name
begin_name_field:
  defb 0x85
begin_name:
	defm "BEGIN"
begin_code_field:
  ld hl,(here_fvar)
	rst 0x10
  ld hl,0x0003
	rst 0x10
  ret

until_link_field:
  defw begin_name
until_name_field:
  defb 0x85
until_name:
	defm "UNTIL"
until_code_field:
  ld a,0x03
  call sub_16fch
  ld de,zero_branch_code_field
  call compile_call_de
  call sub_1756h
  ret

less_than_link_field:
  defw until_name
less_than_name_field:
  defb 0x01
less_than_name:
	defm "<"
less_than_code_field:
	rst 0x28
  ex de,hl
  ld a,d
  xor h
  bit 7,a
  jr nz,l19dch
  sbc hl,de
l19dch:
  bit 7,h
  jp z,push_false
  jp push_true

greater_than_link_field:
  defw less_than_name
greater_than_name_field:
  defb 0x01
greater_than_name:
	defm ">"
greater_than_code_field:
  call swap_code_field
  call less_than_code_field
  ret

to_r_link_field:
  defw greater_than_name
to_r_name_field:
  defb 0x02
to_r_name:
	defm "R>"
to_r_code_field:
  pop bc
  pop hl
  push bc
	rst 0x10
  ret

r_from_link_field:
  defw to_r_name
r_from_name_field:
  defb 0x02
r_from_name:
	defm ">R"
r_from_code_field:
	rst 0x18
  pop bc
  push hl
  push bc
  ret

key_link_field:
  defw r_from_name
key_name_field:
  defb 0x03
key_name:
	defm "KEY"
key_code_field:
  call wait_for_keypress_and_return_it_in_a
  ld l,a
  ld h,0x00
	rst 0x10
  ret

over_link_field:
  defw key_name
over_name_field:
  defb 0x04
over_name:
	defm "OVER"
over_code_field:
	rst 0x28
	rst 0x20
  ex de,hl
	rst 0x10
  ret

rot_link_field:
  defw over_name
rot_name_field:
  defb 0x03
rot_name:
	defm "ROT"
rot_code_field:
	rst 0x28
  ld b,h
  ld c,l
	rst 0x18
  push hl
  ld h,b
  ld l,c
	rst 0x20
  pop hl
	rst 0x10
  ret

two_dup_link_field:
  defw rot_name
two_dup_name_field:
  defb 0x04
two_dup_name:
	defm "2DUP"
two_dup_code_field:
	rst 0x28
	rst 0x20
	rst 0x20
  ret

pad_link_field:
  defw two_dup_name
pad_name_field:
  defb 0x03
pad_name:
	defm "PAD"
pad_code_field:
  ld hl,(pad_fvar)
	rst 0x10
  ret

query_link_field:
  defw pad_name
query_name_field:
  defb 0x05
query_name:
	defm "QUERY"
query_code_field:
  ld hl,(tib_fvar)
  push hl
  ld hl,(pad_fvar)
  inc hl
  ld (tib_fvar),hl
  call restore_the_input_pointer
  pop hl
  ld (tib_fvar),hl
  ret

retype_link_field:
  defw query_name
retype_name_field:
  defb 0x06
retype_name:
	defm "RETYPE"
retype_code_field:
  ld hl,(tib_fvar)
  push hl
  ld hl,(pad_fvar)
  inc hl
  ld (tib_fvar),hl
  call keyboard_input
  pop hl
  ld (tib_fvar),hl
  ret

word_link_field:
  defw retype_name
word_name_field:
  defb 0x04
word_name:
	defm "WORD"
word_code_field:
	rst 0x18
  ld a,l
  ld hl,(pad_fvar)
  ld d,0xff
l1a89h:
  inc hl
  inc d
  cp (hl)
  jr nz,l1a89h
  ld hl,(pad_fvar)
  ld (hl),d
	rst 0x10
  ret

if_link_field:
  defw word_name
if_name_field:
  defb 0x82
if_name:
	defm "IF"
if_code_field:
  ld de,zero_branch_code_field
  call compile_call_de
	rst 0x10
  inc hl
  inc hl
  ld (here_fvar),hl
  ld hl,0x0004
	rst 0x10
  ret

else_link_field:
  defw if_name
else_name_field:
  defb 0x84
else_name:
	defm "ELSE"
else_code_field:
  ld a,0x04
  call sub_16fch
  ld de,branch_code_field
  call compile_call_de
  push hl
  inc hl
  inc hl
  ld (here_fvar),hl
	rst 0x18
  ld bc,(here_fvar)
  ld (hl),c
  inc hl
  ld (hl),b
  pop hl
	rst 0x10
  ld hl,0x0004
	rst 0x10
  ret

endif_link_field:
  defw else_name
endif_name_field:
  defb 0x85
endif_name:
	defm "ENDIF"
endif_code_field:
  ld a,0x04
  call sub_16fch
	rst 0x18
  ld bc,(here_fvar)
  ld (hl),c
  inc hl
  ld (hl),b
  ret

then_link_field:
  defw endif_name
then_name_field:
  defb 0x84
then_name:
	defm "THEN"
then_code_field:
  jp endif_code_field

builds_link_field:
  defw then_name
builds_name_field:
  defb 0x87
builds_name:
	defm "<BUILDS"
builds_code_field:
  ld de,create_header_with_name_from_the_input_stream
  call compile_call_de
  ld (hl),0x11
  inc hl
	rst 0x10
  inc hl
  inc hl
  ld (here_fvar),hl
  ld de,compile_call_de
  call compile_call_de
  ld (hl),0x36
  inc hl
  ld (hl),0xc9
  inc hl
  ld (hl),0x23
  inc hl
  ld (hl),0x22
  inc hl
  ld bc,here_fvar
  ld (hl),c
  inc hl
  ld (hl),b
  inc hl
  ld (here_fvar),hl
  ld hl,rst08+1
	rst 0x10
  ret

does_link_field:
  defw builds_name
does_name_field:
  defb 0x85
does_name:
	defm "DOES>"
does_code_field:
  ld a,0x09
  call sub_16fch
  ld hl,(here_fvar)
  ld (hl),0xc9
  inc hl
  ld (here_fvar),hl
  ld d,h
  ld e,l
	rst 0x18
  ld (hl),e
  inc hl
  ld (hl),d
  ld hl,(here_fvar)
  ld (hl),0xe1
  inc hl
  ld (hl),0xe5
  inc hl
  ld (hl),0x23
  inc hl
  ld (hl),0xd7
  inc hl
  ld (here_fvar),hl
  ret

while_link_field:
  defw does_name
while_name_field:
  defb 0x85
while_name:
	defm "WHILE"
while_code_field:
  ld a,0x03
  call sub_16fch
  ld de,zero_branch_code_field
  call compile_call_de
	rst 0x10
  inc hl
  inc hl
  ld (here_fvar),hl
  ld hl,0x0003
	rst 0x10
  ret

repeat_link_field:
  defw while_name
repeat_name_field:
  defb 0x86
repeat_name:
	defm "REPEAT"
repeat_code_field:
  ld a,0x03
  call sub_16fch
  ld de,branch_code_field
  call compile_call_de
  push hl
  inc hl
  inc hl
  ld (here_fvar),hl
  ld b,h
  ld c,l
	rst 0x18
  ld (hl),c
  inc hl
  ld (hl),b
	rst 0x18
  ld b,h
  ld c,l
  pop hl
  ld (hl),c
  inc hl
  ld (hl),b
  ret

variable_link_field:
  defw repeat_name
variable_name_field:
  defb 0x08
variable_name:
	defm "VARIABLE"
variable_code_field:
  call create_header_with_name_from_the_input_stream
  ld de,l1bc7h
  call compile_call_de
  ld hl,(here_fvar)
  ld (hl),0xc9
  inc hl
  ld (hl),0x00
  inc hl
  ld (hl),0x00
  inc hl
  ld (here_fvar),hl
  call save_dictionary_pointers
  ret
l1bc7h:
  pop hl
  push hl
  inc hl
	rst 0x10
  ret

constant_link_field:
  defw variable_name
constant_name_field:
  defb 0x08
constant_name:
	defm "CONSTANT"
constant_code_field:
  call create_header_with_name_from_the_input_stream
  ld de,l1bf3h
  call compile_call_de
	rst 0x18
  ex de,hl
  ld hl,(here_fvar)
  ld (hl),0xc9
  inc hl
  ld (hl),e
  inc hl
  ld (hl),d
  inc hl
  ld (here_fvar),hl
  call save_dictionary_pointers
  ret
l1bf3h:
  pop hl
  push hl
  inc hl
  ld e,(hl)
  inc hl
  ld d,(hl)
  ex de,hl
	rst 0x10
  ret

dot_link_field:
  defw constant_name
dot_name_field:
  defb 0x01
dot_name:
	defm "."
dot_code_field:
	rst 0x18
  bit 7,h
  jr z,l1c0eh
  ex de,hl
  ld hl,0x0000
  sbc hl,de
  ld a,0x2d
  rst 8
l1c0eh:
	rst 0x10
  jp u_dot_code_field

cmove_link_field:
  defw dot_name
cmove_name_field:
  defb 0x05
cmove_name:
	defm "CMOVE"
cmove_code_field:
	rst 0x18
  ld a,h
  or l
  jr z,l1c26h
  ld b,h
  ld c,l
	rst 0x28
  ex de,hl
  ldir
  ret
l1c26h:
	rst 0x28
  ret

and_link_field:
  defw cmove_name
and_name_field:
  defb 0x03
and_name:
	defm "AND"
and_code_field:
	rst 0x28
  ld a,e
  and l
  ld l,a
  ld a,d
  and h
  ld h,a
	rst 0x10
  ret

or_link_field:
  defw and_name
or_name_field:
  defb 0x02
or_name:
	defm "OR"
or_code_field:
	rst 0x28
  ld a,e
  or l
  ld l,a
  ld a,d
  or h
  ld h,a
	rst 0x10
  ret

xor_link_field:
  defw or_name
xor_name_field:
  defb 0x03
xor_name:
	defm "XOR"
xor_code_field:
	rst 0x28
  ld a,e
  xor l
  ld l,a
  ld a,d
  xor h
  ld h,a
	rst 0x10
  ret

not_link_field:
  defw xor_name
not_name_field:
  defb 0x03
not_name:
	defm "NOT"
not_code_field:
	rst 0x18
  ld a,0x00
  cp l
  inc hl
  jr z,l1c63h
  ld l,0x00
l1c63h:
  ld h,0x00
	rst 0x10
  ret

find_link_field:
  defw not_name
find_name_field:
  defb 0x04
find_name:
	defm "FIND"
find_code_field:
  ld de,(ip_fvar)
l1c72h:
  inc de
  ld a,(de)
  cp 0x20
  jr z,l1c72h
  cp 0x0d
  jr z,l1c72h
  ld (ip_fvar),de
  call paren_find_code_field
  ret

cold_link_field:
  defw find_name
cold_name_field:
  defb 0x44
cold_name:
	defm "COLD"
cold_code_field:
  ld hl,(clate_fvar)
  ld (latest_fvar),hl
  ld hl,(chere_fvar)
  ld (here_fvar),hl
  ld (fence_fvar),hl
  call save_dictionary_pointers
  ld hl,(stack_fvar)
  ld (stp_fvar),hl
  ld a,0x00
  ld (state_fvar),a
  ld (ldflg_fvar),a
  ret

fence_link_field:
  defw cold_name
fence_name_field:
  defb 0x05
fence_name:
	defm "FENCE"
fence_code_field:
  ld hl,fence_fvar
	rst 0x10
  ret

u_slash_mod_link_field:
  defw fence_name
u_slash_mod_name_field:
  defb 0x05
u_slash_mod_name:
	defm "U/MOD"
u_slash_mod_code_field:
	rst 0x18
  ld b,h
  ld c,l
	rst 0x28
  ld a,l
  sub c
  ld a,h
  sbc a,b
  jr c,l1cd3h
  ld hl,0xffff
  ld de,0xffff
  jr l1cf3h
l1cd3h:
  ld a,0x10
l1cd5h:
  add hl,hl
  rla
  ex de,hl
  add hl,hl
  jr nc,l1cddh
  inc de
  and a
l1cddh:
  ex de,hl
  rra
  push af
  jr nc,l1ce7h
  and l
  sbc hl,bc
  jr l1ceeh
l1ce7h:
  and a
  sbc hl,bc
  jr nc,l1ceeh
  add hl,bc
  dec de
l1ceeh:
  inc de
  pop af
  dec a
  jr nz,l1cd5h
l1cf3h:
  ex de,hl
	rst 0x20
  ret

less_number_sign_link_field:
  defw u_slash_mod_name
less_number_sign_name_field:
  defb 0x02
less_number_sign_name:
	defm "<#"
less_number_sign_code_field:
  call pad_code_field
	rst 0x18
  ld (hlds_fvar),hl
  ret

number_sign_greater_link_field:
  defw less_number_sign_name
number_sign_greater_name_field:
  defb 0x02
number_sign_greater_name:
	defm "#>"
number_sign_greater_code_field:
	rst 0x28
  ld hl,(hlds_fvar)
	rst 0x10
  call pad_code_field
  call over_code_field
  call minus_code_field
  ret

number_sign_link_field:
  defw number_sign_greater_name
number_sign_name_field:
  defb 0x01
number_sign_name:
	defm "#"
number_sign_code_field:
  ld hl,(base_fvar)
	rst 0x10
  call sub_1e9ah
  call rot_code_field
  ld hl,rst08+1
	rst 0x10
  call over_code_field
  call less_than_code_field
  call zero_branch_code_field
  defw branch_1d3b
  ld hl,0x0007
	rst 0x10
  call plus_code_field
branch_1d3b:
  ld hl,jp_error_a
	rst 0x10
  call plus_code_field
  call hold_code_field
  ret

number_sign_s_link_field:
  defw number_sign_name
number_sign_s_name_field:
  defb 0x02
number_sign_s_name:
	defm "#S"
number_sign_s_code_field:
branch_1d4b:
  call number_sign_code_field
  call over_code_field
  call over_code_field
  call or_code_field
  call zero_equals_code_field
  call zero_branch_code_field
  defw branch_1d4b
  ret

d_dot_link_field:
  defw number_sign_s_name
d_dot_name_field:
  defb 0x02
d_dot_name:
	defm "D."
d_dot_code_field:
  call less_number_sign_code_field
  call number_sign_s_code_field
  call number_sign_greater_code_field
  call type_code_field
  ld a,0x20
  rst 8
  ret

hold_link_field:
  defw d_dot_name
hold_name_field:
  defb 0x04
hold_name:
	defm "HOLD"
hold_code_field:
  ld hl,(hlds_fvar)
  dec hl
  ld (hlds_fvar),hl
	rst 0x18
  ld a,l
  ld hl,(hlds_fvar)
  ld (hl),a
  ret

sign_link_field:
  defw hold_name
sign_name_field:
  defb 0x04
sign_name:
	defm "SIGN"
sign_code_field:
  call rot_code_field
  call zero_less_code_field
  call zero_branch_code_field
  defw branch_1da3
  ld hl,0x002d
	rst 0x10
  call hold_code_field
branch_1da3:
  ret
  call dup_code_field
  call zero_less_code_field
  call zero_branch_code_field
  defw branch_1db2
  call d_do_minus_code_field
branch_1db2:
  ret

zero_equals_link_field:
  defw sign_name
zero_equals_name_field:
  defb 0x02
zero_equals_name:
	defm "0="
zero_equals_code_field:
	rst 0x18
  ld a,l
  or h
  ld hl,0x0000
  jr nz,l1dc1h
  inc hl
l1dc1h:
	rst 0x10
  ret

zero_less_link_field:
  defw zero_equals_name
zero_less_name_field:
  defb 0x02
zero_less_name:
	defm "0<"
zero_less_code_field:
	rst 0x18
  bit 7,h
  ld hl,0x0000
  jr z,l1dd1h
  inc hl
l1dd1h:
	rst 0x10
  ret

inkey_link_field:
  defw zero_less_name
inkey_name_field:
  defb 0x05
inkey_name:
	defm "INKEY"
inkey_code_field:
  ld iy,jreadkey_rom_routine
  call l1955h
  ld h,0x00
  ld l,b
	rst 0x10
  ret

forget_link_field:
  defw inkey_name
forget_name_field:
  defb 0x06
forget_name:
	defm "FORGET"
forget_code_field:
  call find_code_field
  ex de,hl
	rst 0x18
  ld a,h
  or l
  jr z,error_0x03_undefined_word_xxx_2
  ld hl,(fence_fvar)
  sbc hl,de
  jr nc,error_0x08_break
  ex de,hl
  dec hl
  ld b,(hl)
  dec hl
  ld c,(hl)
  ld (latest_fvar),bc
  ld (here_fvar),hl
  call save_dictionary_pointers
  ret
error_0x03_undefined_word_xxx_2:
  ld a,0x03
	rst 0x30
error_0x08_break:
  ld a,0x08
	rst 0x30

error_link_field:
  defw forget_name
error_name_field:
  defb 0x05
error_name:
	defm "ERROR"
error_code_field:
	rst 0x18
  ld a,l
	rst 0x30

paren_link_field:
  defw error_name
paren_name_field:
  defb 0x01
paren_name:
	defm "("
paren_code_field:
  ld hl,(ip_fvar)
l1e28h:
  inc hl
  ld a,0x29
  cp (hl)
  jr nz,l1e28h
  ld (ip_fvar),hl
  ret

pick_link_field:
  defw paren_name
pick_name_field:
  defb 0x04
pick_name:
	defm "PICK"
pick_code_field:
	rst 0x18
  ld a,h
  or l
  ret z
  ld e,l
  dec e
  rl e
  ld hl,(stp_fvar)
  ld d,0x00
  add hl,de
  ld c,(hl)
  inc hl
  ld b,(hl)
  ld h,b
  ld l,c
	rst 0x10
  ret

roll_link_field:
  defw pick_name
roll_name_field:
  defb 0x04
roll_name:
	defm "ROLL"
roll_code_field:
	rst 0x18
  ld a,h
  or l
  ret z
  ld b,l
  ld c,l
l1e5bh:
	rst 0x18
  push hl
  djnz l1e5bh
  pop de
  ld b,c
  dec b
l1e62h:
  pop hl
	rst 0x10
  djnz l1e62h
  ld h,d
  ld l,e
	rst 0x10
  ret

ascii_link_field:
  defw roll_name
ascii_name_field:
  defb 0x45
ascii_name:
	defm "ASCII"
ascii_code_field:
  ld hl,(ip_fvar)
l1e75h:
  inc hl
  ld a,0x20
  cp (hl)
  jr z,l1e75h
  ld a,(hl)
  ld (ip_fvar),hl
  ld l,a
  ld h,0x00
	rst 0x10
  ld a,(state_fvar)
  bit 7,a
  ret z
	rst 0x18
  ld b,h
  ld c,l
  ld de,lit_code_field
  call compile_call_de
  ld (hl),c
  inc hl
  ld (hl),b
  inc hl
  ld (here_fvar),hl
  ret
sub_1e9ah:
  call r_from_code_field
  ld hl,0x0000
	rst 0x10
  call to_r_code_field
  call dup_code_field
  call r_from_code_field
  call u_slash_mod_code_field
  call to_r_code_field
  call swap_code_field
  call r_from_code_field
  call u_slash_mod_code_field
  call to_r_code_field
  ret

paper_link_field:
  defw ascii_name
paper_name_field:
  defb 0x05
paper_name:
	defm "PAPER"
paper_code_field:
  jp jp_paper

pen_link_field:
  defw paper_name
pen_name_field:
  defb 0x03
pen_name:
	defm "PEN"
pen_code_field:
  jp jp_pen

bright_link_field:
  defw pen_name
bright_name_field:
  defb 0x06
bright_name:
	defm "BRIGHT"
bright_code_field:
  jp jp_bright

flash_link_field:
  defw bright_name
flash_name_field:
  defb 0x05
flash_name:
	defm "FLASH"
flash_code_field:
  jp jp_flash

colour_link_field:
  defw flash_name
colour_name_field:
  defb 0x06
colour_name:
	defm "COLOUR"
colour_code_field:
  jp jp_colour

plot_link_field:
  defw colour_name
plot_name_field:
  defb 0x04
plot_name:
	defm "PLOT"
plot_code_field:
  jp jp_call_jplot

draw_link_field:
  defw plot_name
draw_name_field:
  defb 0x04
draw_name:
	defm "DRAW"
draw_code_field:
  jp jp_call_jdrawto

drawby_link_field:
  defw draw_name
drawby_name_field:
  defb 0x06
drawby_name:
	defm "DRAWBY"
drawby_code_field:
	rst 0x28
  ex de,hl
  ld bc,(xcord_fvar)
  add hl,bc
  ld a,(ycord_fvar)
  add a,e
  ld e,a
  ex de,hl
	rst 0x20
  jp jp_call_jdrawto

question_scroll_link_field:
  defw drawby_name
question_scroll_name_field:
  defb 0x07
question_scroll_name:
	defm "?SCROLL"
question_scroll_code_field:
	rst 0x18
  ld a,0x00
  out (hmpr),a
  ld a,0x01
  xor l
  ld (0x9abb),a
  jp page_pageno_in_and_set_iy_to_flags

palette_link_field:
  defw question_scroll_name
palette_name_field:
  defb 0x07
palette_name:
	defm "PALETTE"
palette_code_field:
	rst 0x28
  ld a,l
  push de
	rst 0x28
  ld c,l
  ld b,e
  pop de
  jp jp_call_jpalette

drive_link_field:
  defw palette_name
drive_name_field:
  defb 0x05
drive_name:
	defm "DRIVE"
drive_code_field:
  jp jp_change_drive_to_tos

sv_fetch_link_field:
  defw drive_name
sv_fetch_name_field:
  defb 0x03
sv_fetch_name:
	defm "SV@"
sv_fetch_code_field:
  jp jp_fetch_from_page_0

sv_store_link_field:
  defw sv_fetch_name
sv_store_name_field:
  defb 0x03
sv_store_name:
	defm "SV!"
sv_store_code_field:
  jp jp_store_into_page_0

sv_c_fetch_link_field:
  defw sv_store_name
sv_c_fetch_name_field:
  defb 0x04
sv_c_fetch_name:
	defm "SVC@"
sv_c_fetch_code_field:
  jp jp_c_fetch_from_page_0

sv_c_store_link_field:
  defw sv_c_fetch_name
sv_c_store_name_field:
  defb 0x04
sv_c_store_name:
	defm "SVC!"
sv_c_store_code_field:
  jp jp_c_store_into_page_0

sound_link_field:
  defw sv_c_store_name
sound_name_field:
  defb 0x05
sound_name:
	defm "SOUND"
sound_code_field:
  jp jp_do_sound

soff_link_field:
  defw sound_name
soff_name_field:
  defb 0x04
soff_name:
	defm "SOFF"
soff_code_field:
  jp jp_sound_off

rols_link_field:
  defw soff_name
rols_name_field:
  defb 0x04
rols_name:
	defm "ROLS"
rols_code_field:
  jp jp_rols

csize_link_field:
  defw rols_name
csize_name_field:
  defb 0x05
csize_name:
	defm "CSIZE"
csize_code_field:
  jp jp_csize

udgdef_link_field:
  defw csize_name
udgdef_name_field:
  defb 0x06
udgdef_name:
	defm "UDGDEF"
udgdef_code_field:
  jp jp_udgdef

screen_link_field:
  defw udgdef_name
screen_name_field:
  defb 0x06
screen_name:
	defm "SCREEN"
screen_code_field:
  jp jp_screen

blitz_link_field:
  defw screen_name
blitz_name_field:
  defb 0x05
blitz_name:
	defm "BLITZ"
blitz_code_field:
  jp jp_blitz

blitz_dollar_link_field:
  defw blitz_name
blitz_dollar_name_field:
  defb 0x06
blitz_dollar_name:
	defm "BLITZ$"
blitz_dollar_code_field:
  call create_header_with_name_from_the_input_stream
  ld de,0x2011
  call compile_call_de
  ld (hl),0xc9
  inc hl
  ld (here_fvar),hl
  call dup_code_field
  call c_comma_code_field
  ld hl,(here_fvar)
  dec hl
	rst 0x10
  call swap_code_field
  call allot_code_field
  ld hl,(here_fvar)
  dec hl
	rst 0x10
  call l16f6h
  call i_code_field
  call c_store_code_field
  call lit_code_field
	rst 0x38
	rst 0x38
  call l1704h
  defb 0xfd,0x1f,0xcd ;illegal sequence
  xor c
  ld de,0xe1c9
  push hl
  inc hl
	rst 0x10
	rst 0x10
  call c_fetch_code_field
  call swap_code_field
	rst 0x18
  inc hl
	rst 0x10
  call swap_code_field
  jp jp_blitz

put_link_field:
  defw blitz_dollar_name
put_name_field:
  defb 0x03
put_name:
	defm "PUT"
put_code_field:
  jp jp_put

put_dollar_link_field:
  defw put_name
put_dollar_name_field:
  defb 0x04
put_dollar_name:
	defm "PUT$"
put_dollar_code_field:
	rst 0x18
  push hl
  ld a,(hl)
  inc hl
  ld c,(hl)
  ld h,0x00
  ld l,a
	rst 0x10
  ld l,c
	rst 0x10
  call star_code_field
	rst 0x18
  ld b,h
  ld c,l
  ld de,0xe001
  pop hl
  ld a,0x1e
  out (hmpr),a
  ldir
  ld a,(pageno_fvar)
  out (hmpr),a
  ld hl,0xe001
	rst 0x10
  call swap_code_field
  jp jp_put

fill_link_field:
  defw put_dollar_name
fill_name_field:
  defb 0x04
fill_name:
	defm "FILL"
fill_code_field:
  jp jp_fill

grab_link_field:
  defw fill_name
grab_name_field:
  defb 0x04
grab_name:
	defm "GRAB"
grab_code_field:
  jp jp_grab

grab_dollar_link_field:
  defw grab_name
grab_dollar_name_field:
  defb 0x05
grab_dollar_name:
	defm "GRAB$"
grab_dollar_code_field:
  call jp_grab
  call create_header_with_name_from_the_input_stream
  ld de,l20bdh
  call compile_call_de
  ld (hl),0xc9
  inc hl
  ld (here_fvar),hl
  ld a,0x1e
  out (hmpr),a
  ld hl,0xe001
  ld a,(hl)
  inc hl
  ld c,(hl)
  ld h,0x00
  ld l,c
	rst 0x10
  ld l,a
	rst 0x10
  call star_code_field
	rst 0x18
  inc hl
  inc hl
  ex de,hl
  ld hl,(here_fvar)
  push hl
  add hl,de
  ld (here_fvar),hl
  ld b,d
  ld c,e
  pop de
  ld hl,0xe001
  ldir
  ld a,(pageno_fvar)
  out (hmpr),a
  call save_dictionary_pointers
  ret
l20bdh:
  pop hl
  push hl
  inc hl
	rst 0x10
  ret

tab_link_field:
  defw grab_dollar_name
tab_name_field:
  defb 0x03
tab_name:
	defm "TAB"
tab_code_field:
  jp jp_tab

overp_link_field:
  defw tab_name
overp_name_field:
  defb 0x05
overp_name:
	defm "OVERP"
overp_code_field:
  jp jp_overp

inverse_link_field:
  defw overp_name
inverse_name_field:
  defb 0x07
inverse_name:
	defm "INVERSE"
inverse_code_field:
  jp jp_inverse

bload_link_field:
  defw inverse_name
bload_name_field:
  defb 0x05
bload_name:
	defm "BLOAD"
bload_code_field:
  jp jp_bload

bsave_link_field:
  defw bload_name
bsave_name_field:
  defb 0x05
bsave_name:
	defm "BSAVE"
bsave_code_field:
  jp jp_bsave

dload_link_field:
  defw bsave_name
dload_name_field:
  defb 0x05
dload_name:
	defm "DLOAD"
dload_code_field:
  jp jp_dload

dsave_link_field:
  defw dload_name
dsave_name_field:
  defb 0x05
dsave_name:
	defm "DSAVE"
dsave_code_field:
  jp jp_dsave
page_rampage_in:
  ld a,(rampage_fvar)
  out (hmpr),a
  ret

expand_link_field:
  defw dsave_name
expand_name_field:
  defb 0x06
expand_name:
	defm "EXPAND"
expand_code_field:
  ld hl,(latest_fvar)
  ld (clate_fvar),hl
  ld hl,(here_fvar)
  inc hl
  inc hl
  inc hl
  inc hl
  ld (chere_fvar),hl
  ld (fence_fvar),hl
  call save_dictionary_pointers
  ret
page_pageno_in_and_set_iy_to_flags:
  ld a,(pageno_fvar)
  out (hmpr),a
  ld iy,flags_fvar
  ret
l213fh:
  pop de
  pop hl
  pop bc
  inc bc
  push hl
  and a
  sbc hl,bc
  jr z,l2152h
  pop hl
  push bc
  push hl
  ex de,hl
  ld c,(hl)
  inc hl
  ld b,(hl)
  push bc
  ret
l2152h:
  pop bc
  ex de,hl
  inc hl
  inc hl
  jp (hl)
  nop
  nop
  nop
  nop
cold_here:
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
  nop
0x2710:


Downloads

Tools and other related project files can be downloaded from the download section of SamForth.

Related pages

SamForth disassembled
Disassembling of SamForth.
SamForth-B
SamForth-B disassembled.
Development history of SamForth disassembled
Development history of the SamForth disassembling project
SamForth documentation
Edited documentation of SamForth, a Forth system for the SAM Coupé computer.