Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Block instructions (OTIR, LDIR, etc.) and interrupts

Reply to topic
Author Message
  • Joined: 23 Aug 2009
  • Posts: 118
  • Location: Seattle, WA
Reply with quote
Block instructions (OTIR, LDIR, etc.) and interrupts
Post Posted: Mon Aug 12, 2019 10:44 pm
How well do interrupts play with block load instructions, such as OTIR/LDIR, etc.?

The official Z80 docs indicate that interrupts should happen seamlessly between individual loads in a long-running block operation, but I'm curious how that fares in actual practice. For example, do you run the risk of having a block operation fail if a VBLANK occurs in the middle of one?

The official Sega docs say the following:

The VDP chip cannot process data any faster than the following rates:
16 Z80A T-States during VBLANK
29 Z80A T-States during active video.
This means that you should never issue two consecutive OUT or IN instructions to the VDP; they should be separated by at least a NOP instruction.

...but I've never known if those were legit or not.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13276
  • Location: London
Reply with quote
Post Posted: Tue Aug 13, 2019 7:32 am
During VBlank the VDP timing constraints are below the speed the Z80 can access it.

The block instructions work executing the same address once per byte, allowing interrupts after each iteration. The interrupt would disrupt the operation if it did not restore state before returning.
  View user's profile Send private message Visit poster's website
Reply to topic

Back to the top of this page

Back to SMS Power!