mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-11-29 03:51:35 +00:00
Deal with the inputs/outputs of buffers, in a weak way.
This commit is contained in:
parent
d84566a880
commit
6afbf581f7
@ -6,6 +6,7 @@ History of SixtyPical
|
||||
|
||||
* Explicit word literals prefixed with `word` token.
|
||||
* Can `copy` literals into user-defined destinations.
|
||||
* Fixed bug where loop variable wasn't being checked at end of `repeat` loop.
|
||||
* `buffer` and `pointer` types.
|
||||
* `copy ^` syntax to load the addr of a buffer into a pointer.
|
||||
* `copy []+y` syntax to read and write values to and from memory through a pointer.
|
||||
|
@ -41,9 +41,10 @@ Documentation
|
||||
TODO
|
||||
----
|
||||
|
||||
Insist the buffer being read or written to through pointer, appears in approporiate set.
|
||||
### Add to pointer.
|
||||
|
||||
Add to pointer.
|
||||
And then write a little demo "game" where you can move a block around the screen with
|
||||
the joystick.
|
||||
|
||||
### `word table` and `vector table` types
|
||||
|
||||
@ -58,6 +59,9 @@ are trashed inside the block.
|
||||
|
||||
### And at some point...
|
||||
|
||||
* `copy x, [ptr] + y`
|
||||
* Maybe even `copy [ptra] + y, [ptrb] + y`, which can be compiled to indirect LDA then indirect STA!
|
||||
* Check that the buffer being read or written to through pointer, appears in approporiate inputs or outputs set.
|
||||
* initialized `byte table` memory locations
|
||||
* always analyze before executing or compiling, unless told not to
|
||||
* `trash` instruction.
|
||||
|
@ -1176,9 +1176,20 @@ Can't `copy` from a `word` to a `byte`.
|
||||
|
||||
Buffers and pointers.
|
||||
|
||||
Note that `^buf` is not considered "reading" buf, so does not require it in `inputs`.
|
||||
TODO: If reading from it through a pointer, it *should* require it in `inputs`.
|
||||
TODO: If writing to it through a pointer, it *should* require it in `outputs`.
|
||||
Note that `^buf` is a constant value, so it by itself does not require `buf` to be
|
||||
listed in any input/output sets.
|
||||
|
||||
However, if the code reads from it through a pointer, it *should* be in `inputs`.
|
||||
|
||||
Likewise, if the code writes to it through a pointer, it *should* be in `outputs`.
|
||||
|
||||
Of course, unless you write to *all* the bytes in a buffer, some of those bytes
|
||||
might not be meaningful. So how meaningful is this check?
|
||||
|
||||
This is an open problem.
|
||||
|
||||
For now, convention says: if it is being read, list it in `inputs`, and if it is
|
||||
being modified, list it in both `inputs` and `outputs`.
|
||||
|
||||
Write literal through a pointer.
|
||||
|
||||
@ -1186,7 +1197,8 @@ Write literal through a pointer.
|
||||
| pointer ptr
|
||||
|
|
||||
| routine main
|
||||
| outputs y //, buf
|
||||
| inputs buf
|
||||
| outputs y, buf
|
||||
| trashes a, z, n, ptr
|
||||
| {
|
||||
| ld y, 0
|
||||
@ -1201,7 +1213,8 @@ It does use `y`.
|
||||
| pointer ptr
|
||||
|
|
||||
| routine main
|
||||
| // outputs buf
|
||||
| inputs buf
|
||||
| outputs buf
|
||||
| trashes a, z, n, ptr
|
||||
| {
|
||||
| copy ^buf, ptr
|
||||
@ -1216,8 +1229,8 @@ Write stored value through a pointer.
|
||||
| byte foo
|
||||
|
|
||||
| routine main
|
||||
| inputs foo
|
||||
| outputs y //, buf
|
||||
| inputs foo, buf
|
||||
| outputs y, buf
|
||||
| trashes a, z, n, ptr
|
||||
| {
|
||||
| ld y, 0
|
||||
@ -1233,7 +1246,7 @@ Read through a pointer.
|
||||
| byte foo
|
||||
|
|
||||
| routine main
|
||||
| // inputs buf
|
||||
| inputs buf
|
||||
| outputs foo
|
||||
| trashes a, y, z, n, ptr
|
||||
| {
|
||||
|
@ -342,7 +342,9 @@ goto.
|
||||
| }
|
||||
= 00c0a0c84c06c060a2c860
|
||||
|
||||
Buffers and pointers.
|
||||
### Buffers and Pointers
|
||||
|
||||
Load address into pointer.
|
||||
|
||||
| buffer[2048] buf
|
||||
| pointer ptr @ 254
|
||||
@ -357,12 +359,13 @@ Buffers and pointers.
|
||||
| }
|
||||
= 00c0a000a90b85fea9c085ff60
|
||||
|
||||
Writing literal through a pointer.
|
||||
Write literal through a pointer.
|
||||
|
||||
| buffer[2048] buf
|
||||
| pointer ptr @ 254
|
||||
|
|
||||
| routine main
|
||||
| inputs buf
|
||||
| outputs buf, y
|
||||
| trashes a, z, n, ptr
|
||||
| {
|
||||
@ -379,8 +382,8 @@ Write stored value through a pointer.
|
||||
| byte foo
|
||||
|
|
||||
| routine main
|
||||
| inputs foo
|
||||
| outputs y //, buf
|
||||
| inputs foo, buf
|
||||
| outputs y, buf
|
||||
| trashes a, z, n, ptr
|
||||
| {
|
||||
| ld y, 0
|
||||
@ -389,14 +392,14 @@ Write stored value through a pointer.
|
||||
| }
|
||||
= 00c0a000a91085fea9c085ffad12c091fe60
|
||||
|
||||
Reading through a pointer.
|
||||
Read through a pointer.
|
||||
|
||||
| buffer[2048] buf
|
||||
| pointer ptr @ 254
|
||||
| byte foo
|
||||
|
|
||||
| routine main
|
||||
| // inputs buf
|
||||
| inputs buf
|
||||
| outputs y, foo
|
||||
| trashes a, z, n, ptr
|
||||
| {
|
||||
|
Loading…
Reference in New Issue
Block a user