|
Post by D-Type on Jun 21, 2018 3:57:53 GMT -5
As subject. Can you read it, or is it write only and you have to just wait for the timeout flag?
Reason: I can use VIDE tracki to monitor the cycles my program is using, but I'd also like to monitor it directly on the Vectrex.
(I've also been thinking about multitasking and output buffering using a vector drawing daemon, but that's for another day...)
|
|
|
Post by Malban on Jun 21, 2018 5:36:57 GMT -5
Yes you can. When reading the "low" timer the Interrupt flag is also reseted.
In my game "Release" I check the current "speed" by reading only the hi byte and comparing it to defined threshold values. (Read T2-Hi just befor my own WaitRecal)
If I have enough "time left" I spawn new background stars.
If time is "short" - I despawn stars.
Malban
|
|
|
Post by D-Type on Jun 21, 2018 5:45:40 GMT -5
Aha! Great, thanks for the reference. The 6522 doc I read implied you could for the upper byte, but I couldn't find anything on the web as an example.
I did try coding it a while back, but it crashed my code, clearly I was doing it wrong!
|
|
|
Post by D-Type on Jun 22, 2018 11:22:44 GMT -5
Works! You can just grab what's in $D009 and use it, counter appears to be free-running wrap-around countdown on the Vectrex:
VecForth v0.1 2018-03-18 based on 6809 CamelForth v1.1 2016-03-20 OK-0 HEX OK-0 : .T2 0 80 0 DO D009 C@ DUP ROT > IF CR THEN DUP U. LOOP DROP ; OK-0 .T2 CB AF 93 78 5C 40 24 9 F9 DC C1 A5 89 6D 52 36 1A FF E2 C6 AB 8F 73 58 3C 20 4 F4 D8 BC A0 85 69 4D 32 16 FA DE C2 A6 8B 6F 53 37 1C 0 F0 D4 B8 9C 80 65 49 2D 12 F6 D9 BE A2 86 6B 4F 33 17 FC DF C4 A8 8C 70 55 39 1D 1 F1 D5 B9 9E 82 66 4A 2F 13 F7 DB BF A3 88 6C 50 35 19 FD E1 C5 A9 8E 72 56 3A 1F 3 F3 D7 BB 9F 83 68 4C 30 14 F9 DC C1 A5 89 6D 52 36 1A FF E2 C6 AB 8F 73 58 3C OK-0
4th line down in the code above is the Forth source code to test, here it again is with stack comments:
: .T2 \ -- ; Dump $80 samples of Timer 2 high byte 0 \ -- prev ; 80 0 \ -- prev loop-end loop-start ; DO \ -- prev ; D009 C@ \ -- prev new ; DUP ROT \ -- new new prev ; > \ -- new reset? ; IF CR THEN \ -- new ; DUP U. \ -- new ; LOOP \ -- new ; DROP ; \ -- ;
|
|