1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 22:48:05 +11:00

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 jp EXIT+2
.fill 82 .fill 566
.db "SCPY"
.dw $-DOES
.db 4
SCPY:
.dw nativeWord
pop hl
ld de, (HERE)
call strcpy
ld (HERE), de
jp next
.fill 460
.db "_bend" .db "_bend"
.dw $-SCPY .dw $-DOES
.db 5 .db 5
; Offset: 0647 ; Offset: 0647
.out $ .out $

View File

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

View File

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

View File

@ -379,6 +379,7 @@ CODE (parsed)
CODE (find) CODE (find)
HL POPqq, HL POPqq,
chkPS,
( 3 == find ) ( 3 == find )
3 CALLnn, 3 CALLnn,
10 JRZe, ( found ) 10 JRZe, ( found )
@ -392,3 +393,20 @@ CODE (find)
DE 1 LDddnn, DE 1 LDddnn,
DE PUSHqq, DE PUSHqq,
;CODE ;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