Skip to content

Instantly share code, notes, and snippets.

View Dooshco's full-sized avatar

8bit Coding Dooshco

View GitHub Profile
P1Up: lda GAMEPORT1
and #1
bne P1Dn
jsr Player1Up
P1Dn: lda GAMEPORT1
and #2
bne P2Up
jsr Player1Down
//===========================================
WaitForFireButton:
//
// Input: None
// Modifies: A
//===========================================
!: lda GAMEPORT1
and GAMEPORT2
and #$10
bne !-
@Dooshco
Dooshco / gist:308056f6751dd905762ec5b710570fcc
Last active August 10, 2019 20:37
PlayerUp/PlayerDown
//===========================================
Player1Up:
//
// Input: None
// Modifies: A,X,Y
//===========================================
ldx P1Y
ldy #P1X
jsr RacketOff
ldx P1Y
//===========================================
InitGraphics:
//
// Input: none
// Modifies: A,X,Y
//===========================================
jsr CLS
lda #1 // White Text
jsr SetColor
lda #0
@Dooshco
Dooshco / gist:99620ed31ce62f439b675e4cf4e66f10
Created August 10, 2019 22:52
KickAssembler Screen Lookup
// Lookup table to screen locations for fast calculations
ScreenLo:
.for (var i=SCREEN;i<SCREEN+1000;i+=40) {
.byte <i
}
ScreenHi:
.for (var i=SCREEN;i<SCREEN+1000;i+=40) {
.byte >i
}
//===========================================
InitSound:
//
// Input: None
// Modifies: A
//===========================================
// Voice 1 - High pitch for ball bounce off the wall
lda #$00
sta $d400
lda #$30
Sound1On: pha
lda #%00010001 // Sawtooth, gate open
sta $d404 // Voice 1
lda #Sound1Duration
sta Sound1Counter
pla
rts
Sound1Off: pha
lda #%00010000 // Sawtooth, gate close
//===========================================
CheckSound:
//
// Input: None
// Modifies: A
//===========================================
// Check sound 1
lda Sound1Counter
beq s2
dec Sound1Counter
// Hardware locations
.label SCREEN = $0400 // Start of Default Screen
.label COLOR = $D800 // Color Memory Location
.label RASTER = $D012 // VIC Raster counter
// CIA addresses
.label GAMEPORT1 = $dc01
.label GAMEPORT2 = $dc00
// Custom constants
FrameCount: .byte 0
BallX: .byte 20
SpeedX: .byte 0
BallY: .byte 12
SpeedY: .byte 0
Background: .byte 117
P1Y: .byte 0
P2Y: .byte 0
P1Score: .byte 0