Занялся изучением железа, инфы нашлось немного, наскреб кое-что
Всего есть 8 спрайтов, Каждый из них может быть задан монохромным или multicolor. На данные отводится 63 байта. Получается 3*8=24 ширина, 21-высота. В режиме multicolor доступно 4 цвета - прозрачный и заданные регистрами. Короче, после чтения доков вышел пример
!to "ballm.prg",cbm ; #name of output, type of assembly
!cpu 6502 ; type of cpu
* = $0801 ; set assembler context, where to operate.
!word nxt_line ; Calculate pointer to next BASIC line
!word 2012 ; BASIC Line# (change this to any # you want)
!byte $9e ; BASIC token for SYS
!byte $32,$30,$36,$31
!byte 0;hex 00 ; End of BASIC line
nxt_line !byte 0,0 ; hex 00 00 ; The next BASIC line would start here
ml_start
;http://unusedino.de/ec64/technical/project64/mapping_c64.html
;http://www.oxyron.de/html/registers_vic2.html
;memory location
lda #$80
sta $07f8;7F8-7ff,3*21=63
sta $07F9
lda #$80
sta $d000;sprite 0 X pos
lda #$88
sta $d002;sprite 1 X pos
lda #$60
sta $d001;sprite 0 Y pos
sta $d003;sprite 1 Y pos
;setup
;53269 $D015 SPENA
;Sprite Enable Register
;Bit 0: Enable Sprite 0 (1=sprite is on, 0=sprite is off)
;Bit 1: Enable Sprite 1 (1=sprite is on, 0=sprite is off)
;Bit 2: Enable Sprite 2 (1=sprite is on, 0=sprite is off)
;Bit 3: Enable Sprite 3 (1=sprite is on, 0=sprite is off)
;Bit 4: Enable Sprite 4 (1=sprite is on, 0=sprite is off)
;Bit 5: Enable Sprite 5 (1=sprite is on, 0=sprite is off)
;Bit 6: Enable Sprite 6 (1=sprite is on, 0=sprite is off)
;Bit 7: Enable Sprite 7 (1=sprite is on, 0=sprite is off)
lda #$FF;SPRITE_BITMASK:=%00000001
sta $D015
;53276 $D01C SPMC
;Sprite Multicolor Registers
;Bit 0: Select multicolor mode for Sprite 0 (1=multicolor, 0=hi-res)
;Bit 1: Select multicolor mode for Sprite 1 (1=multicolor, 0=hi-res)
;Bit 2: Select multicolor mode for Sprite 2 (1=multicolor, 0=hi-res)
;Bit 3: Select multicolor mode for Sprite 3 (1=multicolor, 0=hi-res)
;Bit 4: Select multicolor mode for Sprite 4 (1=multicolor, 0=hi-res)
;Bit 5: Select multicolor mode for Sprite 5 (1=multicolor, 0=hi-res)
;Bit 6: Select multicolor mode for Sprite 6 (1=multicolor, 0=hi-res)
;Bit 7: Select multicolor mode for Sprite 7 (1=multicolor, 0=hi-res)
sta $D01C;SPRITE_MULTICOLOR:=1
;53285 $D025 SPMC0
;Sprite Multicolor Register 0
;This register sets the color that is displayed by the 01 bit-pair in
;multicolor sprite graphics. The default color value is 4 (purple).
lda #0
sta $D025;SPRITE_MULTICOLOR_REG1:=blue;
;53286 $D026 SPMC1
;Sprite Multicolor Register 1
;This register sets the color that is displayed by the 11 bit-pair in
;multicolor sprite graphics. The default color value is 0 (black).
lda #1
sta $D026;SPRITE_MULTICOLOR_REG2:=white;
;sprite colors
lda #1 ;white
sta $D027
sta $D028
;copy
ldx #0
cp lda spr1,x
sta $2000,x
inx
cpx #65
bne cp
loop: jmp loop
spr1
!bin "sprites.raw"
!cpu 6502 ; type of cpu
* = $0801 ; set assembler context, where to operate.
!word nxt_line ; Calculate pointer to next BASIC line
!word 2012 ; BASIC Line# (change this to any # you want)
!byte $9e ; BASIC token for SYS
!byte $32,$30,$36,$31
!byte 0;hex 00 ; End of BASIC line
nxt_line !byte 0,0 ; hex 00 00 ; The next BASIC line would start here
ml_start
;http://unusedino.de/ec64/technical/project64/mapping_c64.html
;http://www.oxyron.de/html/registers_vic2.html
;memory location
lda #$80
sta $07f8;7F8-7ff,3*21=63
sta $07F9
lda #$80
sta $d000;sprite 0 X pos
lda #$88
sta $d002;sprite 1 X pos
lda #$60
sta $d001;sprite 0 Y pos
sta $d003;sprite 1 Y pos
;setup
;53269 $D015 SPENA
;Sprite Enable Register
;Bit 0: Enable Sprite 0 (1=sprite is on, 0=sprite is off)
;Bit 1: Enable Sprite 1 (1=sprite is on, 0=sprite is off)
;Bit 2: Enable Sprite 2 (1=sprite is on, 0=sprite is off)
;Bit 3: Enable Sprite 3 (1=sprite is on, 0=sprite is off)
;Bit 4: Enable Sprite 4 (1=sprite is on, 0=sprite is off)
;Bit 5: Enable Sprite 5 (1=sprite is on, 0=sprite is off)
;Bit 6: Enable Sprite 6 (1=sprite is on, 0=sprite is off)
;Bit 7: Enable Sprite 7 (1=sprite is on, 0=sprite is off)
lda #$FF;SPRITE_BITMASK:=%00000001
sta $D015
;53276 $D01C SPMC
;Sprite Multicolor Registers
;Bit 0: Select multicolor mode for Sprite 0 (1=multicolor, 0=hi-res)
;Bit 1: Select multicolor mode for Sprite 1 (1=multicolor, 0=hi-res)
;Bit 2: Select multicolor mode for Sprite 2 (1=multicolor, 0=hi-res)
;Bit 3: Select multicolor mode for Sprite 3 (1=multicolor, 0=hi-res)
;Bit 4: Select multicolor mode for Sprite 4 (1=multicolor, 0=hi-res)
;Bit 5: Select multicolor mode for Sprite 5 (1=multicolor, 0=hi-res)
;Bit 6: Select multicolor mode for Sprite 6 (1=multicolor, 0=hi-res)
;Bit 7: Select multicolor mode for Sprite 7 (1=multicolor, 0=hi-res)
sta $D01C;SPRITE_MULTICOLOR:=1
;53285 $D025 SPMC0
;Sprite Multicolor Register 0
;This register sets the color that is displayed by the 01 bit-pair in
;multicolor sprite graphics. The default color value is 4 (purple).
lda #0
sta $D025;SPRITE_MULTICOLOR_REG1:=blue;
;53286 $D026 SPMC1
;Sprite Multicolor Register 1
;This register sets the color that is displayed by the 11 bit-pair in
;multicolor sprite graphics. The default color value is 0 (black).
lda #1
sta $D026;SPRITE_MULTICOLOR_REG2:=white;
;sprite colors
lda #1 ;white
sta $D027
sta $D028
;copy
ldx #0
cp lda spr1,x
sta $2000,x
inx
cpx #65
bne cp
loop: jmp loop
spr1
!bin "sprites.raw"
Когда шарики появились на экране, я начал работать над эффектом, где задействованы 8 спрайтов. Вышел косяк - шарики перемешались косо. Стал читать, нашел еще одно описание:
$D010 (R/W) M?X8 M7X8 M6X8 M5X8 M4X8 M3X8 M2X8 M1X8 M0X8
$D017 (R/W) M?YE M7YE M6YE M5YE M4YE M3YE M2YE M1YE M0YE
Это биты признаков старших байтов для спрайта. Если в $D010 записано 1, то координата спрайта 0 определяется как 256+ значение $D000.
Все равно не работает, стал разбираться дальше.
Добавил к координатам 30 и шарики задвигались!
После добавления музона из Goat Tracker получился 1K, который я не стал публиковать
Комментарии
Отправить комментарий