If shadow registers of VIC disable...

Started by MIRKOSOFT, May 06, 2010, 01:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MIRKOSOFT

...it stops KERNAL/Editor VIC-II IRQ.
Disabling with $D8 = $FF and bit 1 of $0A04 will be set on 0
If I'm programming in BASIC commands GRAPHIC, sprite collision, SOUND and PLAY will be disabled, yes?


I don't understand correctly what seems that lightpen collision will be disabled...
Is something more what will be disabled too?


Thanks for every help.


Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

Hydrophilic

Unfortunately, the C128 PRG (and other books I've read) do not give a good description of how graphm ($d8) and init_status ($a04) work together to (dis)able ROM features.  So I will try...

First, graphm ($d8), ONLY affects the Editor ROM's interrupt (IRQ) code dealing with VIC video display.  Using BASIC GRAPHIC command changes this value (and others).  Normal values are:
$00 = text
$20 = hi-res bitmap
$60 = split-screen hi-res bitmap
$a0 = multi-color bitmap
$e0 = split-screen multi-color bitmap

Two important things to note:
$80 should logically produce multi-color text, but does not!
$ff will disable VIC changes by Editor IRQ

WARNING: Using GRAPHIC command will ALWAYS change graphm value!  This means if you set graphm to $ff and then use GRAPHIC command, then graphm will NOT be $ff anymore and the Editor IRQ routine will be used again!

So if you want to disable Editor IRQ by graphm = $ff then you must ensure GRAPHIC is never called.

Second, init_status ($a04) has 3 bits that do different things.  For this discussion, we only care about bit 0.  Bit 0 ONLY control's BASIC's interrupt (IRQ) routines, and only if using original (or compatible) KERNAL interrupt routine.

Here is a very simplified overview of KENRAL interrupt routine:

       
  • Call Editor ROM IRQ (Editor ROM will check graphm/$d8)
  • If "normal" IRQ, update Jiffy clock
  • If "normal" IRQ, turn cassette motor on/off
  • If "normal" IRQ and $a04/bit0 is set, call BASIC ROM IRQ
(a "normal" IRQ occurs at bottom of VIC screen, split-screen IRQ or non-VIC IRQ are the exceptions)

Anyway, if BASIC ROM interrupt routine ($4006 -> $a84d) is called then the following things happen:

       
  • Update sprite positions (MOVSPR)
  • Test for COLLISION/BUMP interrupts (sprite-sprite and sprite-forground)
  • Test for PEN interrupt
  • Update PLAY voices
  • Update SOUND voices

To summarize:

       
  • graphm ($d8) = $ff will disable Editor ROM changes to VIC (text/bitmap/mutli-color mode changes) but GRAPHIC will change graphm so never use GRAPHIC if you set graphm = $ff
  • init_status ($a04) bit 0 = 0 will disable BASIC ROM IRQ updates used by BUMP, COLLISION, MOVSPR, PEN, PLAY, and SOUND
Hopefully that answers your question.  Here are some extra thoughts I had. 

When you first turn on C128, BASIC will *normally* setup tables for interrupt (IRQ) processing and set $a04 bit 0.  *normally* means this won't happen if you hold C= key for C64 mode or maybe you have a special cartridge (changes C128 BASIC or forces C64 mode).

If you reset C128 and hold STOP key, you arrive in MONITOR.  In this case the KERNAL has cleared bit 0 of $a04, so BASIC interrupt routine will not work.

Also, BASIC IRQ routine will check a flag, irq_wrap_flag ($12fd), and if the value is not zero then it will exit immediately.  So you can clear bit 0 of $a04 or put non-zero value in $12fd to disable BASIC IRQ.  Clearing bit 0 of $a04 is faster because KERNAL will not call BASIC IRQ at all.

There is another KERNAL flag, hold_off ($a3a), that controls I/O operations.  If this value is set to $ff, then I/O operations (cassette/disk) will not change VIC settings.  Normally the KERNAL will turn off all sprites, set CPU to 1MHz, and (if cassette I/O) blank the VIC screen.  The previous settings will be restored after I/O.  I recommend to NOT change this value to $ff.

I hope I've covered everything...
I'm kupo for kupo nuts!

wte

Wow, thanks a lot for this comprehensive explanations.

Regards WTE