[stella] Seawolf: Day Eleven

Subject: [stella] Seawolf: Day Eleven
From: Manuel Rotschkar <cybergoth@xxxxxxxx>
Date: Thu, 15 Jan 2004 20:06:05 +0100
Hi there!

So, I'm finalizing the display stuff. The mine kernel is 
now flawless and I also finished the state display at 
the bottom.

For Glenn, here is the subroutine I'm using for it:

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

STATEOFFSET = 43

Statekernel

; Position State display...
    LDA #STATEOFFSET+8
    LDX #$01
    JSR PosElement
    DEX
    LDA #STATEOFFSET
    JSR PosElement
    STA WSYNC
    STA HMOVE

; State Loop:

NextStateLine
    STA WSYNC
    LDA (spritePointer1),Y         ;
    STA GRP0
    LDA (spritePointer2),Y         ;
    STA GRP1            ;

    SLEEP 11

    LAX (spritePointer6),Y         ; 
    LDA (spritePointer3),Y         ;
    STA GRP0            ;
    LDA (spritePointer4),Y         ;
    STA GRP1            ; 
    LDA (spritePointer5),Y         ; 
    STA GRP0            ; 
    STX GRP1            ; 

    ; SLEEP 9 ; Another 9 cyles here!

    DEY
    BPL NextStateLine   ; Draw next line
    STA WSYNC
    LDA #$00
    STA GRP0
    STA GRP1
    RTS

PosElement
       SEC
       STA WSYNC                ;
.waitzone
       SBC #$0F                 ;
       BCS .waitzone            ; RESP loop
       EOR #$07                 ;
       ASL                      ;
       ASL                      ;
       ASL                      ;
       ASL                      ;
       STA HMP0,X
       STA RESP0,X           ; Position it!
       RTS                      ; done, that's all!

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

To call it, just load the number of lines-1 into Y and 
set the spritePointers 1-6

The subroutine has 2 possible entries, *if* the display 
is already positioned, you can enter it straight at:

NextStateLine


So in todays binary, I'm calling it twice like in:


==================================================
    SET_POINTER spritePointer1, FUEL1
    SET_POINTER spritePointer2, FUEL2
    SET_POINTER spritePointer3, TORP1
    SET_POINTER spritePointer4, TORP2
    SET_POINTER spritePointer5, TUBE1
    SET_POINTER spritePointer6, TUBE2

    LDY #$04
    JSR Statekernel		; Key

    LDA #<four
    STA spritePointer1
    LDA #<five
    STA spritePointer2
    LDA #<two
    STA spritePointer3
    LDA #<three
    STA spritePointer4
    LDA #<zero
    STA spritePointer5
    LDA #<one
    STA spritePointer6
    
    LDY #$09
    JSR NextStateLine		; And value
==================================================

Greetings,
	Manuel

Attachment: seawolf.bin
Description: application/macbinary

Current Thread