-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#295 extended memory access with FC@ and FC!
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
\ STM8eForth : FC! TG9541-200726 | ||
\ ------------------------------------------------------------------------------ | ||
|
||
\ store char c to far address ah:al | ||
: FC! ( c al ah -- ) [ | ||
\ Note: creates/executes LDF A,ah:al + RET code on the Data Stack | ||
$A6BD , \ LD A,#0xBD ; Opcode LDF ExtAddr,A | ||
$F7 C, \ LD (X),A ; MSB of ah (instead of "0") | ||
$A681 , \ LD A,#0x81 ; Opcode RET | ||
$E704 , \ LD (4,X),A ; MSB of C (instead of "0") | ||
$E605 , \ LD A,(5,X) ; load C | ||
$FD C, \ CALL (X) ; execute LDF | ||
$1C C, $0006 , \ ADDW X,#6 ; DROP all | ||
] ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
\ STM8eForth : FC@ TG9541-200726 | ||
\ ------------------------------------------------------------------------------ | ||
|
||
\ read char c at far address ah:al | ||
: FC@ ( al ah -- c ) | ||
\ Note: creates/executes LDF ah:al,A + RET code on the Data Stack | ||
$8100 ROT ROT [ \ get a RET ready | ||
$A6BC , \ LD A,#0xBC ; Opcode LDF A,ExtAddr | ||
$F7 C, \ LD (X),A ; MSB of ah (instead of "0") | ||
$FD C, \ CALL (X) ; execute LDF | ||
$6F04 , \ CLR (4,X) ; bring c onto stack | ||
$E705 , \ LD (5,X),A | ||
] 2DROP \ remove LDF ah:al | ||
; |