forth: Forth-ify "PC!"
This commit is contained in:
parent
04a6784de4
commit
7beac94b5a
Binary file not shown.
@ -21,11 +21,6 @@
|
|||||||
;
|
;
|
||||||
; PutC: Write character specified in A onto the device.
|
; PutC: Write character specified in A onto the device.
|
||||||
;
|
;
|
||||||
; *** ASCII ***
|
|
||||||
.equ BS 0x08
|
|
||||||
.equ CR 0x0d
|
|
||||||
.equ LF 0x0a
|
|
||||||
.equ DEL 0x7f
|
|
||||||
; *** Const ***
|
; *** Const ***
|
||||||
; Base of the Return Stack
|
; Base of the Return Stack
|
||||||
.equ RS_ADDR 0xf000
|
.equ RS_ADDR 0xf000
|
||||||
@ -738,23 +733,10 @@ PRINT:
|
|||||||
inc hl
|
inc hl
|
||||||
jr .loop
|
jr .loop
|
||||||
|
|
||||||
; ( c port -- )
|
|
||||||
.db "PC!"
|
|
||||||
.fill 4
|
|
||||||
.dw $-PRINT
|
|
||||||
.db 0
|
|
||||||
PSTORE:
|
|
||||||
.dw nativeWord
|
|
||||||
pop bc
|
|
||||||
pop hl
|
|
||||||
call chkPS
|
|
||||||
out (c), l
|
|
||||||
jp next
|
|
||||||
|
|
||||||
; ( port -- c )
|
; ( port -- c )
|
||||||
.db "PC@"
|
.db "PC@"
|
||||||
.fill 4
|
.fill 4
|
||||||
.dw $-PSTORE
|
.dw $-PRINT
|
||||||
.db 0
|
.db 0
|
||||||
PFETCH:
|
PFETCH:
|
||||||
.dw nativeWord
|
.dw nativeWord
|
||||||
|
@ -107,12 +107,25 @@
|
|||||||
C@ ( b r op )
|
C@ ( b r op )
|
||||||
ROT ( r op b )
|
ROT ( r op b )
|
||||||
8 * ( r op b<<3 )
|
8 * ( r op b<<3 )
|
||||||
OR OR Z,
|
OR OR A,
|
||||||
;
|
;
|
||||||
0xc0 OP2br SETbr,
|
0xc0 OP2br SETbr,
|
||||||
0x80 OP2br RESbr,
|
0x80 OP2br RESbr,
|
||||||
0x40 OP2br BITbr,
|
0x40 OP2br BITbr,
|
||||||
|
|
||||||
|
( cell contains both bytes. MSB is spit as-is, LSB is ORed with r )
|
||||||
|
( r -- )
|
||||||
|
: OP2r
|
||||||
|
CREATE ,
|
||||||
|
DOES>
|
||||||
|
@ 256 /MOD ( r lsb msb )
|
||||||
|
A, ( r lsb )
|
||||||
|
SWAP 8 * ( lsb r<<3 )
|
||||||
|
OR A,
|
||||||
|
;
|
||||||
|
0xed41 OP2r OUT(C)r,
|
||||||
|
0xeb40 OP2r INr(C),
|
||||||
|
|
||||||
( dd nn -- )
|
( dd nn -- )
|
||||||
: OP3ddnn
|
: OP3ddnn
|
||||||
CREATE C,
|
CREATE C,
|
||||||
|
@ -83,3 +83,10 @@ CODE AND
|
|||||||
H A LDrr,
|
H A LDrr,
|
||||||
HL PUSHqq,
|
HL PUSHqq,
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
|
CODE PC!
|
||||||
|
BC POPqq,
|
||||||
|
HL POPqq,
|
||||||
|
chkPS,
|
||||||
|
L OUT(C)r,
|
||||||
|
;CODE
|
||||||
|
Loading…
Reference in New Issue
Block a user