mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-05-28 08:41:30 +00:00
updated nes presets
This commit is contained in:
parent
78d83e0a20
commit
b2264d75cf
|
@ -80,10 +80,10 @@ NMIHandler:
|
|||
|
||||
Palette:
|
||||
hex 1f ;screen color
|
||||
hex 09092c00 ;background 0
|
||||
hex 09091900 ;background 1
|
||||
hex 09091500 ;background 2
|
||||
hex 09092500 ;background 3
|
||||
hex 01112100 ;background 0
|
||||
hex 02122200 ;background 1
|
||||
hex 02112100 ;background 2
|
||||
hex 01122200 ;background 3
|
||||
|
||||
;;;;; CPU VECTORS
|
||||
|
||||
|
|
|
@ -40,10 +40,9 @@ Start:
|
|||
; fill video RAM
|
||||
FillVRAM: subroutine
|
||||
PPU_SETADDR $2000
|
||||
ldy #$10 ; set $10 pages ($1000 bytes)
|
||||
ldy #$8 ; set $8 pages ($800 bytes)
|
||||
.loop:
|
||||
tya ; Y -> A
|
||||
ora #$40 ; A = A OR $40
|
||||
lda PageData,y ; A -> PageData[Y]
|
||||
sta PPU_DATA ; A -> PPU data port
|
||||
inx ; X = X + 1
|
||||
bne .loop ; repeat until 256 bytes
|
||||
|
@ -51,6 +50,11 @@ FillVRAM: subroutine
|
|||
bne .loop ; repeat until Y is 0
|
||||
rts ; return to caller
|
||||
|
||||
PageData:
|
||||
hex 00
|
||||
hex 42424242 ; 'B'
|
||||
hex 41414141 ; 'A'
|
||||
|
||||
; set palette colors
|
||||
SetPalette: subroutine
|
||||
PPU_SETADDR $3f00
|
||||
|
@ -97,10 +101,10 @@ NMIHandler:
|
|||
|
||||
Palette:
|
||||
hex 1f ;screen color
|
||||
hex 09092c00 ;background 0
|
||||
hex 09091900 ;background 1
|
||||
hex 09091500 ;background 2
|
||||
hex 09092500 ;background 3
|
||||
hex 01112100 ;background 0
|
||||
hex 02122200 ;background 1
|
||||
hex 02112100 ;background 2
|
||||
hex 01122200 ;background 3
|
||||
|
||||
;;;;; CPU VECTORS
|
||||
|
||||
|
|
|
@ -132,14 +132,14 @@ NMIHandler:
|
|||
|
||||
Palette:
|
||||
hex 1f ;screen color
|
||||
hex 09092c00 ;background 0
|
||||
hex 09091900 ;background 1
|
||||
hex 09091500 ;background 2
|
||||
hex 09092500 ;background 3
|
||||
hex 14243400 ;sprite 0
|
||||
hex 15253500 ;sprite 1
|
||||
hex 16263600 ;sprite 2
|
||||
hex 17273700 ;sprite 3
|
||||
hex 01112100 ;background 0
|
||||
hex 02122200 ;background 1
|
||||
hex 02112100 ;background 2
|
||||
hex 01122200 ;background 3
|
||||
hex 19293900 ;sprite 0
|
||||
hex 1a2a3a00 ;sprite 1
|
||||
hex 1b2b3b00 ;sprite 2
|
||||
hex 1c2c3c00 ;sprite 3
|
||||
|
||||
;;;;; CPU VECTORS
|
||||
|
||||
|
|
|
@ -102,14 +102,14 @@ ScrollDirTab:
|
|||
align $100
|
||||
Palette:
|
||||
hex 1f ;background
|
||||
hex 09090000 ;bg0
|
||||
hex 09090c00 ;bg1
|
||||
hex 09091c00 ;bg2
|
||||
hex 09092c00 ;bg3
|
||||
hex 14243400 ;sp0
|
||||
hex 15253500 ;sp1
|
||||
hex 16263600 ;sp2
|
||||
hex 17273700 ;sp3
|
||||
hex 01112100 ;background 0
|
||||
hex 02122200 ;background 1
|
||||
hex 02112100 ;background 2
|
||||
hex 01122200 ;background 3
|
||||
hex 19293900 ;sprite 0
|
||||
hex 1a2a3a00 ;sprite 1
|
||||
hex 1b2b3b00 ;sprite 2
|
||||
hex 1c2c3c00 ;sprite 3
|
||||
|
||||
;;;;; CPU VECTORS
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@ void put_str(unsigned int adr, const char *str) {
|
|||
// main function, run after console reset
|
||||
void main(void) {
|
||||
// set palette colors
|
||||
pal_col(1,0x04);
|
||||
pal_col(0,0x02);
|
||||
pal_col(1,0x14);
|
||||
pal_col(2,0x20);
|
||||
pal_col(3,0x30);
|
||||
|
||||
// write text to name table
|
||||
put_str(NTADR_A(2,2),"HELLO, WORLD!");
|
||||
put_str(NTADR_A(2,4),"THIS CODE PRINTS SOME TEXT");
|
||||
put_str(NTADR_A(2,5),"USING ASCII-ENCODED CHARACTER");
|
||||
put_str(NTADR_A(2,6),"SET WITH CAPITAL LETTERS ONLY");
|
||||
put_str(NTADR_A(2,4),"Hello, World!");
|
||||
put_str(NTADR_A(2,6),"\x14 \x15 \x16 \x17 \x18 \x19");
|
||||
|
||||
// enable PPU rendering (turn on screen)
|
||||
ppu_on_all();
|
||||
|
|
|
@ -42,7 +42,8 @@ void new_building() {
|
|||
}
|
||||
|
||||
void update_nametable() {
|
||||
word addr;
|
||||
register word addr;
|
||||
// a buffer drawn to the nametable vertically
|
||||
char buf[PLAYROWS];
|
||||
// divide x_scroll by 8
|
||||
// to get nametable X position
|
||||
|
@ -51,7 +52,6 @@ void update_nametable() {
|
|||
addr = NTADR_A(x, 4);
|
||||
else
|
||||
addr = NTADR_B(x&31, 4);
|
||||
// create vertical slice
|
||||
// clear empty space
|
||||
memset(buf, 0, PLAYROWS-bldg_height);
|
||||
// draw a random star
|
||||
|
@ -91,9 +91,10 @@ void scroll_demo() {
|
|||
update_nametable();
|
||||
}
|
||||
// manually force vram update
|
||||
// flush and clear VRAM buffer after NMI
|
||||
ppu_wait_nmi();
|
||||
flush_vram_update(updbuf);
|
||||
vrambuf_end();
|
||||
vrambuf_clear();
|
||||
// reset ppu address
|
||||
vram_adr(0x0);
|
||||
// set scroll register
|
||||
|
|
Loading…
Reference in New Issue
Block a user