~rabbits/spacetime

11b8d0ff68df352e7ca05e6866b4b0258e68b452 — Devine Lu Linvega 4 years ago 9c28a93
Minor changes
2 files changed, 25 insertions(+), 23 deletions(-)

M README
M src/cart.asm
M README => README +2 -1
@@ 15,4 15,5 @@ M = fast metro
m = slow metro
# = jump random position

https://monome.org/docs/norns/study-3/
\ No newline at end of file
More info
	https://llllllll.co/t/spacetime-6502-port/35807
\ No newline at end of file

M src/cart.asm => src/cart.asm +23 -22
@@ 50,9 50,9 @@ position                .dsb 1
cursor                  .dsb 1 
note                    .dsb 1 
octave                  .dsb 1 
down@input              .dsb 1 
last@input              .dsb 1 
next@input              .dsb 1 
btndown                 .dsb 1 
btnlast                 .dsb 1 
btnqueue                .dsb 1 
rate                    .dsb 1 
timer                   .dsb 1 
seed                    .dsb 1 


@@ 67,7 67,7 @@ RESET:
	LDX #$40
	STX $4017                    ; disable APU frame IRQ
	LDX #$FF
	TXS                          ; Set up stack
	TXS                          ; set up stack
	INX                          ; now X = 0
	STX PPUCTRL                  ; disable NMI
	STX PPUMASK                  ; disable rendering


@@ 163,7 163,7 @@ EnableSprites:
;; main phase

MAIN:
	LDA next@input
	LDA btnqueue
	; style1
	CMP BUTTON_LEFT
	BEQ MoveLeft


@@ 182,7 182,7 @@ MAIN:
	BEQ MoveUp
	CMP BUTTON_B
	BEQ MoveDown
	JMP MAIN                     ; jump back to Forever, infinite loop
	JMP MAIN                     ; infinite loop

;; General functions



@@ 200,7 200,7 @@ MoveRight:
	INC cursor
	LDA cursor
	CMP #$10
	BCC @done                    ; when greater skip
	BCC @done                    ; when greaterthan skip
	LDA #$00                     ; wrap around
	STA cursor
@done:


@@ 221,7 221,7 @@ MoveUp:
	LDX cursor
	INC $10,x
	LDA $10,x
	CMP #$08                     ; when greater skip
	CMP #$08                     ; when greaterthan skip
	BCC @done                    ; wrap around
	LDA #$00
	STA $10,x


@@ 230,7 230,7 @@ MoveUp:

MoveEnd:
	LDA #$00
	STA next@input
	STA btnqueue
	STA RedrawTimeline
	JMP MAIN



@@ 455,7 455,7 @@ DoOperationEnd: ; return from operations
DoSound:
	; calculate note position, store in x
	LDX octave                   ; get oct in x
	LDA Offset,x                 ; get note offset from oct in y
	LDA Octaves,x                ; get octave offset in y
	CLC 
	ADC note
	TAY 


@@ 471,8 471,9 @@ DoSound:
	SBC note
	STA APUCH1LEN
	; ch2
	STX APUCH2VOL
	LDA position
	LDA seed
	STA APUCH2VOL
	LDA cursor
	STA APUCH2SWP
	STX APUCH2FRQ
	LDA #%01101011


@@ 486,28 487,28 @@ NMI: ;
ReadJoy:
	LDA #$01
	STA JOY1                     ; start reading
	STA down@input
	STA btndown
	LSR a
	STA JOY1
@loop:
	LDA JOY1
	LSR a
	ROL down@input
	ROL btndown
	BCC @loop

SaveJoy:
	LDA down@input
	CMP last@input
	LDA btndown
	CMP btnlast
	BEQ @done
	STA last@input
	STA btnlast
	CMP #$00
	BEQ @done
	STA next@input
	STA btnqueue
@done:
	LDA #$00
	STA SPRADDR                  ; set the low byte (00) of the RAM address
	STA SPRADDR
	LDA #$02
	STA $4014                    ; set the high byte (02) of the RAM address, start the transfer
	STA $4014

RunTimer:
	INC seed


@@ 533,7 534,7 @@ Cleanup:
	JSR RedrawTimeline
	JSR RedrawInterface
	LDA PPUSTATUS
	LDA #$c0                     ; Shift background to center
	LDA #$c0                     ; shift background to center
	STA PPUSCROLL
	LDA #$00
	STA PPUSCROLL


@@ 554,7 555,7 @@ Notes: ;
	.db $1f,$1d,$1b,$1a,$18,$17,$15,$14,$13,$12,$11,$10 ; oct 2
	.db $d2,$c9,$b3

Offset:
Octaves:
	.db $24,$18,$0c,$00

;; Vectors