Slowly I am figuring out how EDCW moves the pointer.
Meantime I find some curious details about how it has been programmed.
-It is plagued of auto modifiable code, for example:
wasn ld a,0
or a
jr nz,nonc
ld a,252
call seize
ld a,255
ld (wasn+1),a
-Almost the entire extension is loaded on Z80 Page 0 at 100h address every time it is executed:
push bc
ld hl,maincde+1
ld bc,extname-256; end of the code
ld de,100h
ldir
pop bc
jp 100h
To do it, there is a compiler command that forces the assembly of that chunk to be executed from 100h:
maincde ret
phase 100h; assembles this chunk on 100h address
And, at the end of the code:
extname equ $
dephase
PEND equ $
END
I think that the Rom version of the EDCW uses the same method, as the author claims the two versions are compatible. It would have cost the rewriting of all the program to remove all that auto-modifiable code.
-An unknown "External keyboard" hardware is used by the program. Probably also created by Meszaros, uses Z80 ports 60h and 61h, not present on
LGB list.
-Inside the code, some 16 bit input-output port instructions are used. I though they where forbidden due to the paging method of the Enterprise:
int ld bc,0b5h; b=0
ld e,7; row 7
out (c),e; Keyboard/Joystick row select
in d,(c); Keyboard line status
bit 2,d; right
jr nz,wo
Here, "out (c),e" is used to save some instructions when scanning the keyboard.
But here it is used to scan for connected hardware in a way that I still don't understand:
he? push bc
in a,(c); I think it searches for hardware in the ports
inc a
jr z,pw
ld (hl),c
inc hl
inc d
pw pop bc
inc c
djnz he?
ret