10 SYS(32768)
20 PRINT PEEK(2)
30 GOTO 10
-A passive pin adapter is required in order to hook up an nes controller to the userport. *=$1000
;Set sprite pointer0 to $2000 ($80*$40)
lda #$80
sta $07f8
;Enable sprites
lda #$01
sta $d015
;Expand X,Y
sta $d01d
sta $d017
;Set X position of sprite0 (128)
lda #$80
sta $d000
sta $d001
loop
inc $d001
ldx #$00
delay1
ldy #$05
delay2
dey
bne delay2
dex
bne delay1
lda $d001
lsr a
lsr a
lsr a
lsr a
sta $d027
jmp loop
rts
*=$2000
; Metroid
BYTE $01,$FF,$80
BYTE $07,$FF,$E0
BYTE $0E,$63,$F0
BYTE $19,$99,$F8
BYTE $33,$3D,$FC
BYTE $37,$3D,$FC
BYTE $66,$3C,$FE
BYTE $68,$18,$3E
BYTE $79,$42,$9E
BYTE $CB,$A5,$DF
BYTE $F3,$C3,$DF
BYTE $F9,$E7,$BF
BYTE $8C,$C3,$31
BYTE $87,$18,$E1
BYTE $59,$C3,$9A
BYTE $3C,$FF,$3C
BYTE $3A,$3C,$5C
BYTE $34,$DB,$2C
BYTE $10,$81,$08
BYTE $08,$C3,$10
BYTE $00,$42,$00
joy2 = 56320
vic = $d000
spr0_x = $00
spr0_y = $01
screen0H = $04
screen1H = $08
ptr0 = $FC
ptr1 = $FE
defm incw
inc /1
bne @no_carry
inc /1 + $01
@no_carry
endm
*=$1000
start
loop
ldx #0
stx ptr0 ;ptr0L
stx ptr1 ;ptr1L
ldx #screen0H
stx ptr0+$01 ;ptr0H
ldx #screen1H
stx ptr1+$01 ;ptr1H
ldx #$08
jsr copy_loop1
lda #$25
sta vic + $18
ldx #0
stx ptr0 ;ptr0L
stx ptr1 ;ptr1L
ldx #screen0H
stx ptr0+$01 ;ptr0H
ldx #screen1H
stx ptr1+$01 ;ptr1H
ldx #$08
jsr copy_loop0
lda #$15
sta vic + $18
jmp loop
;;;;;;;;;;;;;;;;
copy_loop1
;Start of program.
ldy #0
lda (ptr0),y ;Copy from screen0
incw ptr0
ldy #1
sta (ptr1),y ;Save to screen1.
incw ptr1
cpx ptr0 + $01 ; Stop if end of screen is reached.
bne copy_loop1
rts
copy_loop0
;Start of program.
ldy #0
lda (ptr1),y ;Copy from screen0
incw ptr1
ldy #1
sta (ptr0),y ;Save to screen1.
incw ptr0
cpx ptr0 + $01 ; Stop if end of screen is reached.
bne copy_loop0
rts
I will optimize this eventually. I want to add smooth scrolling.
*=2
lda #01
sta $00
loop0:
lda $01
and #2
beq loop0:
loop1:
lda $01
and #2
bne loop1:
lda $01
and #1
eor #1
sta $01
jmp loop0:
.end
Cool ! :D Also, you both need to grow some hair. :PWell, not everyone necessarily wants 12 inch long hairs like us, though :P
Yet another member owns a commodore 64 now. I found a whole stack of commodore stuff in a thriftshop including 3 disk drives, 2 cartridges, a datasette and ofc. a commodore 64. aeTIos came over to my place today and came to pick it up. Expect more software to be released soon!
Left: me, right: aeTIos.
And I'm not that good at 6502 assembly yet. The most complex thing I made so far is a sprite which you can move using the joystick.would it be possible in BASIC, though, even if the game lacks scrolling and the character moves block by block like in the original 2004 game?
setup=*
sei
lda #<intcode
sta 788
lda #>intcode
sta 789
cli
rts
intcode=*
inc $d020
jmp $ea31
Hex:78 A9 0D 8D 14 03 A9 10
8D 15 03 58 60 EE 20 D0
4C 31 EA
A9 01 85 FB A9 06 8D 03
DD A9 02 8D 01 DD A2 08
A9 00 8D 01 DD 06 02 AD
01 DD A0 04 8C 01 DD 25
FB 05 02 85 02 A0 00 8C
01 DD CA D0 E8 60
// Draw blocks on screen
// Author: Koen van Vliet
// Date: 12 Jul 2014
//
// Notes:
// * Use kickassembler to assemble
//=================================================
// B A S I C S Y S ()
//=================================================
.pc =$0801 "Basic Upstart Program"
:BasicUpstart(main)
//=================================================
// M A I N
//=================================================
.pc = $0820
main:
jsr $E544 // Kernal routine: Clear screen
sei // Disable interrupts
// Black block
:fillBlock($0400,4,16,10,6,35)
:fillBlock($D800,4,16,10,6,0)
// Green block
:fillBlock($0400,11,1,18,23,224)
:fillBlock($D800,11,1,18,23,13)
// White block
:fillBlock($0400,16,6,20,6,0)
:fillBlock($D800,16,6,20,6,1)
cli // Enable interrupts
rts // Return to Basic
//=================================================
// M A C R O 'S
//=================================================
// Routine: fillBlock
// Fills a rectangular block in memory with one value
.macro fillBlock(base,col,row,w,h,val){
.const addr = base + 40 * row + col - 1
lda #<addr // Set up parameters
sta mod_b_addr + 1
lda #>addr
sta mod_b_addr + 2
lda #w
sta mod_b_w + 1
lda #h
sta mod_b_h + 1
lda #val
sta mod_b_v + 1
jsr fill_block // Draw a block on screen
}
//=================================================
// R O U T I N E S
//=================================================
// Routine: fill block
// Fills a rectangular block in memory with one value
//
// Input: Modify parameters by modifying operands.
// Preferably use the macro for this
// Output: -
// Notes:
// * Intended for filling blocks in screen/color ram.
// Assumes 40 bytes per row.
// * Does not clip outside of screen area.
fill_block:
mod_b_h:
ldy #$08 // Operand is modified by program.
loop_row: // Default value given to make this
mod_b_w:
ldx #$08 // Operand is modified by program.
loop_col:
mod_b_v:
lda #224 // Fill block with single value.
mod_b_addr: // Operand is modified by program.
sta $FFFF,x // Write character to screen. Operand is
dex // modified by program.
bne loop_col
clc
lda #40
adc mod_b_addr + 1 // Modify operand low byte
sta mod_b_addr + 1
lda #0
adc mod_b_addr + 2 // Modify operand high byte
sta mod_b_addr + 2
dey
bne loop_row
rts