Page 1 of 1

Counting TStates

Posted: Tue Jul 28, 2020 6:46 pm
by marste
For the people that develop their own flicker-free routine (e.g. for ZX80, but also custom ones for ZX81) or anyway programs that need very accurate fine grain timing, there is always the need to calculate the cpu cycles of the program pieces, and usually this activity is done by hand (as I did also myself for the flicker free version of the 1K real chess prototype for ZX80)...

I discovered this interesting zmac assembler that has a feature among many others that can help in doing this. Here is the link for the people interested: http://48k.ca/beamhack3.html

(another interesting one is for example the automatic transformation of jr and djnz when target exceed the allowed range)

Re: Counting TStates

Posted: Tue Jul 28, 2020 8:02 pm
by kmurta
Recently I started using sjasmplus with the Visual Studio Code + Z80 Assembly Meter extension and I'm really enjoying it, just select the code with the mouse and you have the count of bytes and T-states displayed in the status bar. Very practical!

https://code.visualstudio.com/

https://github.com/z00m128/sjasmplus

https://github.com/theNestruo/z80-asm-meter-vscode

Re: Counting TStates

Posted: Fri Jul 31, 2020 9:43 pm
by marste
kmurta wrote: Tue Jul 28, 2020 8:02 pm Recently I started using sjasmplus with the Visual Studio Code + Z80 Assembly Meter extension and I'm really enjoying it, just select the code with the mouse and you have the count of bytes and T-states displayed in the status bar. Very practical!
It is still manual calculation (and when you start seriously to count TStates you'll know the single instruction ones by heart ;)).

Anyway, how do you find sjasmplus? Are you able to do debugging using the source files instead of disasm? (I tryed to let Dezog digest fasmg listings but still didn't succeed)

Re: Counting TStates

Posted: Sun Aug 02, 2020 6:49 pm
by kmurta
marste wrote: Fri Jul 31, 2020 9:43 pm It is still manual calculation (and when you start seriously to count TStates you'll know the single instruction ones by heart ;)).
Indeed, semi manual, you still have to calculate the total cycles in loops and conditional jumps, but it helps a lot to visualize the count of cycles and bytes of the instruction before of compile the code:
2020-08-02.png
marste wrote: Fri Jul 31, 2020 9:43 pm Anyway, how do you find sjasmplus? Are you able to do debugging using the source files instead of disasm? (I tryed to let Dezog digest fasmg listings but still didn't succeed)
Yes, there is the DeZog extension for VS Code (https://github.com/maziac/DeZog), but I haven't tested it yet. For now, I'm debugging the code using only the tools of the Eighty One emulator.

Regardless of your preferred assembler, VS Code is a versatile development environment that offers several facilities in code editing (including a built-in terminal) and you can use it with several assemblers, sjasm, sjasmplus, pasmo, rasm, tasm , zmac, etc. It's been very pleasant to use it!