Thank you for answers.
I have two news questions please, about cc65.
How I create an assembly project ? What is the minimum code ? And for compilation ?
Can I have an example of code (to draw just a sprite for example) and the .bat to compile ? please...
And second question, with a C project, how can create a "lib" in assembly and compile it. What is the .bat file ?
Again, if you accept can I have a little example of lib code and .bat for compile it and use it after in a project please ?
Edit: another little question about my code, I wrote a little asm with NESASM to move a meta sprite. But on the left (and only left), the player what cut before the end of the window (see screen). Can you help me please ? Thank you.
The code :
Code:
.inesprg 1 ; 1x 16KB PRG code
.ineschr 1 ; 1x 8KB CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring
;;;;;;;;;;;;;;;
.bank 0
.org $C000
RESET:
SEI
CLD
LDX #$40
STX $4017
LDX #$FF
TXS
INX
STX $2000
STX $2001
STX $4010
vblankwait1:
BIT $2002
BPL vblankwait1
clrmem:
LDA #$00
STA $0000, x
STA $0100, x
STA $0200, x
STA $0400, x
STA $0500, x
STA $0600, x
STA $0700, x
LDA #$FE
STA $0300, x
INX
BNE clrmem
vblankwait2:
BIT $2002
BPL vblankwait2
LoadPalettes:
LDA $2002
LDA #$3F
STA $2006
LDA #$00
STA $2006
LDX #$00
LoadPalettesLoop:
LDA palette, x
STA $2007
INX
CPX #$20
BNE LoadPalettesLoop
LoadSprites:
LDX #$00
LoadSpritesLoop:
LDA sprites, x
STA $0200, x
INX
CPX #$10
BNE LoadSpritesLoop
LDA #%10000000
STA $2000
LDA #%00010000
STA $2001
Forever:
JMP Forever
NMI:
LDA #$00
STA $2003
LDA #$02
STA $4014
LatchController:
LDA #$01
STA $4016
LDA #$00
STA $4016
LDA $4016
LDA $4016
LDA $4016
LDA $4016
ReadUP:
LDA $4016
AND #%00000001
BEQ ReadUPDone
LDX #$00
UPLoop:
LDA $0200, x
SEC
SBC #$01
STA $0200, x
INX
INX
INX
INX
CPX #$10
BNE UPLoop
ReadUPDone:
ReadDOWN:
LDA $4016
AND #%00000001
BEQ ReadDOWNDone
LDX #$00
DOWNLoop:
LDA $0200, x
CLC
ADC #$01
STA $0200, x
INX
INX
INX
INX
CPX #$10
BNE DOWNLoop
ReadDOWNDone:
ReadLEFT:
LDA $4016
AND #%00000001
BEQ ReadLEFTDone
;
LDX #$00
LEFTLoop:
LDA $0203, x
SEC
SBC #$01
STA $0203, x
INX
INX
INX
INX
CPX #$10
BNE LEFTLoop
ReadLEFTDone:
ReadRIGHT:
LDA $4016
AND #%00000001
BEQ ReadRIGHTDone
LDX #$00
RIGHTLoop:
LDA $0203, x
CLC
ADC #$01
STA $0203, x
INX
INX
INX
INX
CPX #$10
BNE RIGHTLoop
ReadRIGHTDone:
RTI
;;;;;;;;;;;;;;
.bank 1
.org $E000
palette:
.db $0F,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$0F
.db $0F,$1C,$15,$14,$31,$02,$38,$3C,$0F,$1C,$15,$14,$31,$02,$38,$3C
sprites:
;vert tile attr horiz
.db $80, $32, $00, $80 ;sprite 0
.db $80, $33, $00, $88 ;sprite 1
.db $88, $34, $00, $80 ;sprite 2
.db $88, $35, $00, $88 ;sprite 3
.org $FFFA
.dw NMI
.dw RESET
.dw 0
;;;;;;;;;;;;;;
.bank 2
.org $0000
.incbin "mario.chr"
the screen: