
**********************************************************************
files: Jelly-Vision.TXT
       http://www.users.globalnet.co.uk/~jg27paw4/pourri/jelly-vision.zip
       http://www.users.globalnet.co.uk/~jg27paw4/pourri/jelly-vision.gif
**********************************************************************


** Jelly-Vision!
   =============



Here's an interrupt driven full screen wobbling routine which has no practical use whatsoever apart from making you feel a bit queasy after a while. As a safety feature it will temporarily de-wobble if the last key pressed was the ENTER key.

[code]
;    start: POKE 23681,254: RANDOMIZE USR 33001
;    stop : RANDOMIZE USR 32994

            org  $80E2       ;32994
DEACTIVATE: LD   A,$3F
            LD   I,A
            IM   1
            RET
                             ;33001
ACTIVATE:   LD   A,$80
            LD   I,A
            IM   2
            RET

            org  $80ff       ;33023
            defw WOBBLE

WOBBLE:     di               ;33025

            push af;[color=blue]
            ld   a,(23672)
            bit  2,a
            jr   z,NOWOBBLE;[/color]
            ld   a,(23560)
            cp   13
            jr   z,NOWOBBLE;[color=green]
            bit  0,(iy+2)    ;TV_FLAG printing in lower screen?
            jr   nz,TESTSCROLL
            bit  1,(iy+1)    ;FLAGS   printer in use?
            jr   z,NOWOBBLE
TESTSCROLL: push hl
            ld   hl,0005
            add  hl,sp
            ld   a,(hl)
            cp   $0e
            jr   z,INSCROLL
            push bc
            push de;[/color]

            ld   a,(23681)
            cpl
            ld   (23681),a
            xor  1
            ld   bc,6144-256
            jr   nz,MOVEUP
MOVEDOWN:   ld   hl,16384+256
            ld   de,16384
            ldir
            jr   MOVEDONE
MOVEUP:     ld   de,16384+6143
            ld   hl,16384+6143-256
            lddr;[color=green]

MOVEDONE:   pop  de
            pop  bc
INSCROLL:   pop  hl
NOWOBBLE:   pop  af;[/color]
            ei
            rst  $38
            ret
[/code]

   =============

I've added some small refinements (marked in green above) to temporarily suspend wobbling when the screen is busy. I'll have a think about how to speed up the intra-wobbling intervals as well.

   =============

The three lines marked in blue provide some background performance enhancement while keeping a smooth wobble effect.

   =============

I don't think that BASin handles IM2 very well. Jelly-Vision relies on the data bus holding $FF when there are no peripherals attached, so doesn't bother with a vector table. I thought that maybe BASin's emulation wasn't doing that, so I tried it with a full 257 byte table but it still didn't work. Even the following routine (copied from David Webb's "Advanced ..." book), which just sets IM2 to run the normal keyboard interrupt routine, doesn't work in BASin.

[code]
ACTIVATE:   ld   hl,$fe00
            ld   bc,$00fd
ACT1:       ld   (hl),c
            inc  hl
            djnz ACT1
            ld   (hl),c
            LD   A,$FE
            LD   I,A
            IM   2
            RET

            org  $fdfd
            jp   $0038         ;MASK_INT
[/code]

   =============

I don't think that BASin loads Z80 snapshots very well either. I've tried several non-Jelly Z80s, and they all get corrupted when loaded into BASin. I tried saving a Z80 from Spin while Jelly was running, which loads & runs OK in other emulators; but with BASin, although it said it was running, it just displayed in a frozen state as at the point saved.

   =============

The program will load & run in BASin, but once the IM2 routine is activated BASin gets stuck in RUN mode; it won't Pause or Stop to return to the editor - and there's no visual effect in the Display window. It works OK in the three other emulators which I tried.


**********************************************************************