Re: [stella] Rubik Cube 3d

Subject: Re: [stella] Rubik Cube 3d
From: Christopher Tumber <christophertumber@xxxxxxxxxx>
Date: Mon, 23 Dec 2002 14:27:25 -0500
>Humm yes.. but then there should be enough time to load into ram a new chunk
>of code to draw the next line. I don't think there is!..

You don't need a new chunk of code, you re-use the same chunk over and over and just change the colour values.

 From one scanline:

      lda #$76
      STA COLUPF
      lda #$36
      STA COLUPF

becomes:

      lda #$1c
      STA COLUPF
      lda #$b6
      STA COLUPF 

You just need to quickly LDA/STA the colour values between scanlines.

Check the attached file, the cubes are the same width. So the only trickery then is the diagonals which are too short to be playfield graphics so they're Players/Missile/Balls...

You only need to be changing the colour values in the RAM routine at the start of every new square so all the other scanliness will be handling positioning of the Player/Missile/Ball graphics to handle the diagonals - You should only need two of those per scanline and you can probably move them with the HMOVE after each scanline 'cuz they're shifting over the same couple of scanlines each time.

Chris..


Attachment: cubes.bin
Description: Binary data

;BEWARE! NO STACK!!
	processor 6502
	include vcs.h

	org $F000








Start

;	SEI  ; Disable interrupts, if there are any.
;	CLD  ; Clear BCD math bit.

;	LDX  #$FF
;	TXS  ; Set stack to beginning.

;	LDA #0
;B1    STA 0,X
;	DEX
;	BNE B1




      lda #255
      sta PF0
      sta PF1
      sta PF2
      lda #1
      sta CTRLPF
      lda #00
      STA COLUBK
      lda #0
      STA COLUPF  
      sta GRP0
      sta GRP1
      sta HMCLR

      lda #14
      sta COLUP1
      sta COLUP0



      lda #0
      sta $81
;      lda table
;      sta $82
;      lda table+1
;      sta $83

      lda #20
      sta $84

DrawLogo

	LDX  #0
	LDA  #2

	STA  VSYNC ;Begin vertical sync.
	STA  WSYNC ; First line of VSYNC
	STA  WSYNC ; Second line of VSYNC.

	LDA  #41
	STA  TIM64T
	LDA #0
	STA CXCLR
	STA  WSYNC ; Third line of VSYNC.
	STA  VSYNC ; (0)

DrawScreen
	LDA INTIM
	BNE DrawScreen ; Whew!
	STA WSYNC
	STA VBLANK  ;End the VBLANK period with a zero.


      ldy #20
next:

      sta WSYNC
      nop
      nop
      nop
      nop
      nop
      nop
      nop
      nop
      nop
      nop
      nop
      lda #$76
      STA COLUPF
      lda #$36
      STA COLUPF
      lda #$1c
      STA COLUPF
      lda #$b6
      STA COLUPF 
      lda #$12

      STA COLUPF
      lda #$76+4
      STA COLUPF
      lda #$36+4
      STA COLUPF
      lda #$1c+4
      STA COLUPF
      lda #$00
      STA COLUPF
      dey
      bpl next


      sta WSYNC

      ldy #100
nextblankline:
      sta WSYNC
      dey
      bne nextblankline     




	STA VBLANK ; Make TIA output invisible,
      lda #35
      sta TIM64T
OverscanWait:
      lda     INTIM
      bne     OverscanWait

      

   JMP  DrawLogo      ;Continue forever.



	org $FFFC
	.word Start
	.word Start


Attachment: cubes.gif
Description: GIF image

Current Thread