Actually Metal Warrior 1-3 never used zone splitted or fixed IRQ's, but an inaccurate bucket sorting method, where Y was simply divided by 8, and that's what the tutorial was referring to if I remember right.
- ldy SortOrder,X ;Copy Y pos, X posL, Color and Tile Number to sorted buffers lda SpritePosY.w,Y sta SpriteSortedPosY.w,X lda SpritePosXL.w,Y ;So that they are accedded faster during IRQ sta SpriteSortedPosXL.w,X lda SpriteFlags.w,Y ;And can be written again during the frame by the main programm and #$0f sta SpriteSortedFlags.w,X lda SpriteTileNmr.w,Y sta SpriteSortedTileNmr.w,X dex bpl - inx stx SpriteReadyFlag ;Clear the pending flag OldSprites ldy #$00 - lda InterruptLine.w,Y ;Load the first valid interrupt (nonzero) bne + iny cpy #SpriteAmount bne - ;If no valid interrupt lda #$ff ;...we set $ff for VBlank interrupt + sta $d012 ;Initislise the first interrupt cmp #$ff beq + tya + sta SpriteRasterIndex ;The next IRQ is a sprite IRQ if line is not $ff, else it's the VBlank IRQ stx $d015 ;No sprite visible before the first interrupt cli ;Enable the interrupts rts
IRQ inc $d019 ;Acknownledge the raster IRQ pha txa pha tya pha ;Check if the IRQ is caused by the sprite multiplexing ldx SpriteRasterIndex bpl SpriteIRQ ;Or by the end of the frame (raster position $ff) MainIRQ jsr SpriteMultiplexer jsr InitSprites jsr SetSprites ; jsr MoveStars jsr MoveCenter lda FrameCtr eor #$01 sta FrameCtr pla tay pla tax pla NMI rti SpriteIRQ ldy SpriteHWAssign.w,X lda SpriteSortedFlags.w,X sta $d027,Y ;Color lda SpriteSortedTileNmr.w,X sta $7f8,Y ;Tile number tya asl A tay inc $d020 lda SpriteSortedPosY.w,X sta $d001,Y lda SpritePosXL.w,X sta $d000,Y lda D017Buffer.w,X sta $d017 lda D01dBuffer.w,X sta $d01d lda D01bBuffer.w,X ;Copy all flags sta $d01b lda D01cBuffer.w,X sta $d01c lda D015Buffer.w,X sta $d015 lda D010Buffer.w,X sta $d010 dec $d020 - inx cpx #SpriteAmount ;Last sprite ? bcs _lastInt lda InterruptLine.w,X beq - ;If raster line is 0, we should ignore it stx SpriteRasterIndex ;Copy valid index and rasterline sta $d012 cmp #$ff beq _lastInt ;If value is $ff, then it's the last interrupt of the frame sec sbc #$02 ;If a new interrupt should occur in less than 2 scanlines cmp $d012 ;Do it straight away bcs + jmp SpriteIRQ -- lda #$ff cmp $d012 bne _lastInt - jmp MainIRQ _lastInt bit $d011 bmi - ;If we somehow missed the main IRQ make sure we jump to it right away lda #$fd cmp $d012 ;If rasterline is $fe or $ff go to main IRQ after a small delay (I don't want to miss it) bcc -- lda #$ff sta $d012 sta SpriteRasterIndex + pla tay pla tax pla rti