forth: Forth-ify "SCPY"

This commit is contained in:
Virgil Dupras 2020-03-30 17:59:30 -04:00
parent 5b01f797fc
commit 36e200adbb
5 changed files with 24 additions and 18 deletions

Binary file not shown.

View File

@ -710,24 +710,10 @@ DOES:
jp EXIT+2
.fill 82
.db "SCPY"
.dw $-DOES
.db 4
SCPY:
.dw nativeWord
pop hl
ld de, (HERE)
call strcpy
ld (HERE), de
jp next
.fill 460
.fill 566
.db "_bend"
.dw $-SCPY
.dw $-DOES
.db 5
; Offset: 0647
.out $

View File

@ -148,7 +148,7 @@
: (entry)
_c HERE _c @ ( h )
_c WORD ( h s )
SCPY ( h )
_c SCPY ( h )
( Adjust HERE -1 because SCPY copies the null )
_c HERE _c @ 1 _c - ( h h' )
_c DUP _c HERE _c ! ( h h' )

View File

@ -39,6 +39,8 @@
: OP1 CREATE C, DOES> C@ A, ;
0xeb OP1 EXDEHL,
0x76 OP1 HALT,
0x12 OP1 LD(DE)A,
0x1a OP1 LDA(DE),
0xc9 OP1 RET,
0x17 OP1 RLA,
0x07 OP1 RLCA,

View File

@ -379,6 +379,7 @@ CODE (parsed)
CODE (find)
HL POPqq,
chkPS,
( 3 == find )
3 CALLnn,
10 JRZe, ( found )
@ -392,3 +393,20 @@ CODE (find)
DE 1 LDddnn,
DE PUSHqq,
;CODE
CODE SCPY
HL POPqq,
chkPS,
DE HERE LDdd(nn),
B 0 LDrn,
( loop )
A (HL) LDrr,
LD(DE)A,
HL INCss,
DE INCss,
B INCr,
A ORr,
-6 JRNZe, ( loop )
DE A LD(dd)r
HERE DE LD(nn)dd,
;CODE