Job meter: Difference between revisions
(Created page with "right The Job meter is the name given by some developers to a mean of knowing how much time (or video lines) some of the CPU calculations take to execute. ...") |
mNo edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[File:Jobmeter.png|right]] | [[File:Jobmeter.png|right]] | ||
A job meter is a debugging or optimization tool which can be used to know how much time (or video lines) some of the CPU calculations take to execute. | |||
This can be particularly useful to know if [[VRAM]] updates don't last longer than the vblank period, or to find what routines are causing slowdowns... | |||
Job meters | Job meters can be made by changing a [[palette RAM|palette]] value just before and just after execution of said code. Multiple routines can be timed by using multiple colors. More advanced job meters can also display values on the [[fix layer]] to indicate how buffers (ennemies, ammo, animation loops...) are filled. | ||
Something as simple as this in the vblank subroutine can be used to monitor time usage by looking at the borders of the screen: | Something as simple as this in the vblank subroutine can be used to monitor time usage by looking at the borders of the screen: | ||
Line 17: | Line 17: | ||
*Exit subroutine | *Exit subroutine | ||
< | <syntaxhighlight> | ||
VBlank: | VBlank: | ||
...BIOS calls... | ...BIOS calls... | ||
move.w #RED, | move.w #RED,BACKDROPCOLOR | ||
...VRAM update code... | ...VRAM update code... | ||
move.w #ORANGE, | move.w #ORANGE,BACKDROPCOLOR | ||
...Sprite position update code... | ...Sprite position update code... | ||
move.w #GREEN, | move.w #GREEN,BACKDROPCOLOR | ||
rts | rts | ||
</ | </syntaxhighlight> | ||
As long as there's no red lines | As long as there's no red lines reaching the top of the active display, the code is guaranteed to run fast enough to avoid tearing. | ||
[[Category:Code]] | [[Category:Code]] |
Latest revision as of 00:32, 5 April 2016
A job meter is a debugging or optimization tool which can be used to know how much time (or video lines) some of the CPU calculations take to execute.
This can be particularly useful to know if VRAM updates don't last longer than the vblank period, or to find what routines are causing slowdowns...
Job meters can be made by changing a palette value just before and just after execution of said code. Multiple routines can be timed by using multiple colors. More advanced job meters can also display values on the fix layer to indicate how buffers (ennemies, ammo, animation loops...) are filled.
Something as simple as this in the vblank subroutine can be used to monitor time usage by looking at the borders of the screen:
- Do BIOS calls and anything which has to be done right after vblank
- Set "Bad" color
- Update VRAM
- Set "Okay" color
- Update values in RAM, prepare stuff for the next frame...
- Set "Done" color
- Exit subroutine
VBlank:
...BIOS calls...
move.w #RED,BACKDROPCOLOR
...VRAM update code...
move.w #ORANGE,BACKDROPCOLOR
...Sprite position update code...
move.w #GREEN,BACKDROPCOLOR
rts
As long as there's no red lines reaching the top of the active display, the code is guaranteed to run fast enough to avoid tearing.