mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-24 12:31:25 +00:00
make sure all presets start with a blank line, looks nicer (tools/checkpresets.py); updated nes
This commit is contained in:
parent
690b3ac013
commit
4a82d341bc
@ -48,6 +48,7 @@ TODO:
|
||||
- how to revert included files?
|
||||
- go to error in include files
|
||||
- BOM in upload/download?
|
||||
- find version of neslib.h compatible with cc65
|
||||
|
||||
FYI: Image links for the books on http://8bitworkshop.com/ are broken
|
||||
On the website the additional grey spacing next to the program line numbers is not dynamically resized when the web browser window size is changed. Intentional?
|
||||
|
@ -22,6 +22,7 @@
|
||||
"test": "npm run test-node",
|
||||
"test-one": "mocha --recursive --timeout 60000",
|
||||
"test-node": "mocha --recursive --timeout 60000 test/cli",
|
||||
"test-worker": "mocha --recursive --timeout 60000 test/cli/testworker.js",
|
||||
"test-profile": "mocha --recursive --timeout 60000 --prof test/cli"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
; Conway II
|
||||
; Lee W. Fastenau
|
||||
; thelbane@gmail.com
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <conio.h>
|
||||
#include <apple2.h>
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
seg program
|
||||
org $803
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
/*****************************************************************************\
|
||||
** mandelbrot sample program for cc65. **
|
||||
** **
|
||||
|
@ -139,7 +139,7 @@ byte ai_try_dir(Player* p, dir_t dir, byte shift) {
|
||||
dir &= 3;
|
||||
x = p->x + (DIR_X[dir] << shift);
|
||||
y = p->y + (DIR_Y[dir] << shift);
|
||||
if (x < COLS && y < ROWS && getchar(x, y) == ' ') {
|
||||
if (x < COLS && y < ROWS && (getchar(x, y) & 0x7f) == ' ') {
|
||||
p->dir = dir;
|
||||
return 1;
|
||||
} else {
|
||||
@ -197,7 +197,7 @@ void declare_winner(byte winner) {
|
||||
cputsxy(12,10,"WINNER:");
|
||||
cputsxy(12,13,"PLAYER ");
|
||||
cputcxy(12+7, 13, '1'+winner);
|
||||
delay(75);
|
||||
delay(200);
|
||||
gameover = 1;
|
||||
}
|
||||
|
||||
|
@ -1,55 +1,41 @@
|
||||
|
||||
/*
|
||||
** Calculate all primes up to a specific number.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <conio.h>
|
||||
|
||||
|
||||
/* Workaround missing clock stuff */
|
||||
#ifdef __APPLE2__
|
||||
# define clock() 0
|
||||
# define CLOCKS_PER_SEC 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#define COUNT 4096 /* Up to what number? */
|
||||
#define SQRT_COUNT 64 /* Sqrt of COUNT */
|
||||
|
||||
static unsigned char Sieve[COUNT];
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#pragma static-locals(1);
|
||||
|
||||
|
||||
|
||||
static char ReadUpperKey (void)
|
||||
/* Read a key from console, convert to upper case and return */
|
||||
{
|
||||
return toupper (cgetc ());
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main (void)
|
||||
{
|
||||
/* Clock variable */
|
||||
@ -118,4 +104,3 @@ int main (void)
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
; From: http://www.deater.net/weave/vmwprod/tb1/tb_6502.html
|
||||
|
||||
.segment "INIT"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cc65.h>
|
||||
@ -6,8 +7,6 @@
|
||||
#include <modload.h>
|
||||
#include <tgi.h>
|
||||
|
||||
|
||||
|
||||
#ifndef DYN_DRV
|
||||
# define DYN_DRV 0
|
||||
#endif
|
||||
@ -15,26 +14,19 @@
|
||||
#define COLOR_BACK TGI_COLOR_BLACK
|
||||
#define COLOR_FORE TGI_COLOR_WHITE
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Driver stuff */
|
||||
static unsigned MaxX;
|
||||
static unsigned MaxY;
|
||||
static unsigned AspectRatio;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
static void CheckError (const char* S)
|
||||
{
|
||||
unsigned char Error = tgi_geterror ();
|
||||
@ -47,8 +39,6 @@ static void CheckError (const char* S)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if DYN_DRV
|
||||
static void DoWarning (void)
|
||||
/* Warn the user that the dynamic TGI driver is needed for this program */
|
||||
@ -63,8 +53,6 @@ static void DoWarning (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void DoCircles (void)
|
||||
{
|
||||
static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_ORANGE };
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
; Atari 5200 "Hello World" sample code
|
||||
; Written by Daniel Boris (dboris@comcast.net)
|
||||
;
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
; Atari 5200 "Hello World" sample code
|
||||
; Written by Daniel Boris (dboris@comcast.net)
|
||||
;
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#ifndef _CV_COMMON_H
|
||||
#define _CV_COMMON_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
const uint16_t notes[] = { 12846, 12334, 11086, 10062, 10062, 9806, 10062, 10574, 11086, 10062, 11086, 12430, 11042, 12334, 12878, 14158, 14158, 12878, 13390, 13646, 10574, 9806, 10574, 12430, 12846, 12334, 11086, 10062, 10062, 9806, 10062, 10574, 11086, 10062, 11086, 12430, 11054, 12334, 12878, 14158, 14158, 12878, 13390, 13646, 10574, 10062, 10062, 10126, 11054, 12334, 12878, 14158, 13902, 14158, 14670, 14158, 13646, 12878, 13390, 13646, 3918, 12878, 14158, 13902, 12878, 12366, 12878, 12366, 12878, 11086, 10062, 9870, 12334, 11054, 11086, 10062, 10062, 9806, 10062, 10574, 11086, 10062, 11086, 12430, 11054, 12334, 12878, 14158, 14158, 12878, 13390, 13646, 10574, 10062, 10062, 10126, 0xffff };
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cv.h>
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include "neslib.h"
|
||||
|
||||
//#define DEBUG
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
//this example shows how to set up a palette and use 8x8 HW sprites
|
||||
//also shows how fast (or slow) C code is
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
//this example shows how to set up a palette and use 8x8 HW sprites
|
||||
//also shows how fast (or slow) C code is
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "neslib.h"
|
||||
|
||||
#include "neslib.h"
|
||||
|
||||
//#define DEBUG
|
||||
#define HAS_DEBUGGER
|
||||
|
@ -1,103 +1,46 @@
|
||||
|
||||
;;;;; CONSTANTS
|
||||
include "nesdefs.asm"
|
||||
|
||||
PPU_CTRL equ $2000
|
||||
PPU_MASK equ $2001
|
||||
PPU_STATUS equ $2002
|
||||
PPU_SCROLL equ $2005
|
||||
PPU_ADDR equ $2006
|
||||
PPU_DATA equ $2007
|
||||
DMC_FREQ equ $4010
|
||||
;;;;; VARIABLES
|
||||
|
||||
;;;;; CARTRIDGE FILE HEADER
|
||||
seg.u RAM
|
||||
org $0
|
||||
|
||||
processor 6502
|
||||
seg Header
|
||||
org $7FF0
|
||||
;;;;; NES CARTRIDGE HEADER
|
||||
|
||||
NES_MAPPER equ 0 ;mapper number
|
||||
NES_PRG_BANKS equ 2 ;number of 16K PRG banks, change to 2 for NROM256
|
||||
NES_CHR_BANKS equ 1 ;number of 8K CHR banks (0 = RAM)
|
||||
NES_MIRRORING equ 1 ;0 horizontal, 1 vertical, 8 four screen
|
||||
NES_HEADER 0,2,1,0 ; mapper 0, 2 PRGs, 1 CHR, vertical
|
||||
|
||||
.byte $4e,$45,$53,$1a ; header
|
||||
.byte NES_PRG_BANKS
|
||||
.byte NES_CHR_BANKS
|
||||
.byte NES_MIRRORING|(NES_MAPPER<<4)
|
||||
.byte NES_MAPPER&$f0
|
||||
.byte 0,0,0,0,0,0,0,0 ; reserved, set to zero
|
||||
;;;;; START OF CODE
|
||||
|
||||
;;;;; CODE
|
||||
Start:
|
||||
NES_INIT ; set up stack pointer, turn off PPU
|
||||
jsr WaitSync ; wait for VSYNC
|
||||
jsr ClearRAM ; clear RAM
|
||||
jsr WaitSync ; wait for VSYNC (and PPU warmup)
|
||||
|
||||
seg Code
|
||||
org $8000
|
||||
start:
|
||||
_exit:
|
||||
sei ;disable IRQs
|
||||
cld ;decimal mode not supported
|
||||
ldx #$ff
|
||||
txs ;set up stack pointer
|
||||
inx ;increment X to 0
|
||||
stx PPU_MASK ;disable rendering
|
||||
stx DMC_FREQ ;disable DMC interrupts
|
||||
stx PPU_CTRL ;disable NMI interrupts
|
||||
jsr WaitSyncSafe ;wait for VSYNC
|
||||
; clear RAM -- not a subroutine because we clear the stack too
|
||||
lda #0
|
||||
tax
|
||||
.clearRAM
|
||||
sta $0,x
|
||||
sta $100,x
|
||||
; skip $200-$2FF, used for OAM display list
|
||||
sta $300,x
|
||||
sta $400,x
|
||||
sta $500,x
|
||||
sta $600,x
|
||||
sta $700,x
|
||||
inx
|
||||
bne .clearRAM
|
||||
; wait for PPU warmup
|
||||
jsr WaitSync
|
||||
; set palette background
|
||||
ldy #$0
|
||||
lda #$3f
|
||||
sta PPU_ADDR
|
||||
sty PPU_ADDR
|
||||
lda #$1c
|
||||
sta PPU_DATA
|
||||
; enable PPU rendering
|
||||
lda #0
|
||||
sta PPU_ADDR
|
||||
sta PPU_ADDR ;PPU addr = 0
|
||||
sta PPU_SCROLL
|
||||
sta PPU_SCROLL ;scroll = 0
|
||||
lda #$90
|
||||
sta PPU_CTRL ;enable NMI
|
||||
lda #$1e
|
||||
sta PPU_MASK ;enable rendering
|
||||
lda #$3f ; $3F -> A register
|
||||
ldy #$00 ; $00 -> Y register
|
||||
sta PPU_ADDR ; write high byte first
|
||||
sty PPU_ADDR ; $3F00 -> PPU address
|
||||
lda #$1c ; $1C = light blue color
|
||||
sta PPU_DATA ; $1C -> PPU data
|
||||
lda #CTRL_NMI
|
||||
sta PPU_CTRL ; enable NMI
|
||||
lda #MASK_COLOR
|
||||
sta PPU_MASK ; enable rendering
|
||||
.endless
|
||||
jmp .endless ;endless loop
|
||||
jmp .endless ; endless loop
|
||||
|
||||
;;;;; SUBROUTINES
|
||||
;;;;; COMMON SUBROUTINES
|
||||
|
||||
; wait for VSYNC to start
|
||||
WaitSyncSafe: subroutine
|
||||
bit PPU_STATUS
|
||||
WaitSync:
|
||||
bit PPU_STATUS
|
||||
bpl WaitSync
|
||||
rts
|
||||
include "nesppu.asm"
|
||||
|
||||
;;;;; INTERRUPT HANDLERS
|
||||
|
||||
nmi:
|
||||
irq:
|
||||
NMIHandler:
|
||||
rti
|
||||
|
||||
;;;;; CPU VECTORS
|
||||
|
||||
org $fffa
|
||||
.word nmi ;$fffa vblank nmi
|
||||
.word start ;$fffc reset
|
||||
.word irq ;$fffe irq / brk
|
||||
NES_VECTORS
|
||||
|
||||
|
@ -1,121 +1,37 @@
|
||||
|
||||
;;;;; CONSTANTS
|
||||
include "nesdefs.asm"
|
||||
|
||||
PPU_CTRL equ $2000
|
||||
PPU_MASK equ $2001
|
||||
PPU_STATUS equ $2002
|
||||
OAM_ADDR equ $2003
|
||||
OAM_DATA equ $2004
|
||||
PPU_SCROLL equ $2005
|
||||
PPU_ADDR equ $2006
|
||||
PPU_DATA equ $2007
|
||||
PPU_OAM_DMA equ $4014
|
||||
DMC_FREQ equ $4010
|
||||
;;;;; VARIABLES
|
||||
|
||||
;;;;; ZERO-PAGE VARIABLES
|
||||
|
||||
seg.u ZPVars
|
||||
seg.u RAM
|
||||
org $0
|
||||
|
||||
ScrollPos byte ; used during NMI
|
||||
Rand byte
|
||||
|
||||
;;;;; CARTRIDGE FILE HEADER
|
||||
;;;;; NES CARTRIDGE HEADER
|
||||
|
||||
NES_MAP_HORIZ equ 0
|
||||
NES_MAP_VERT equ 1
|
||||
NES_MAP_QUAD equ 8
|
||||
NES_HEADER 0,2,1,0 ; mapper 0, 2 PRGs, 1 CHR, vertical
|
||||
|
||||
MAC NES_HEADER
|
||||
processor 6502
|
||||
seg Header
|
||||
org $7FF0
|
||||
.NES_MAPPER SET {1} ;mapper number
|
||||
.NES_PRG_BANKS SET {2} ;number of 16K PRG banks, change to 2 for NROM256
|
||||
.NES_CHR_BANKS SET {3} ;number of 8K CHR banks (0 = RAM)
|
||||
.NES_MIRRORING SET {4} ;0 horizontal, 1 vertical, 8 four screen
|
||||
byte $4e,$45,$53,$1a ; header
|
||||
byte .NES_PRG_BANKS
|
||||
byte .NES_CHR_BANKS
|
||||
byte .NES_MIRRORING|(.NES_MAPPER<<4)
|
||||
byte .NES_MAPPER&$f0
|
||||
byte 0,0,0,0,0,0,0,0 ; reserved, set to zero
|
||||
seg Code
|
||||
org $8000
|
||||
ENDM
|
||||
|
||||
MAC NES_INIT
|
||||
sei ;disable IRQs
|
||||
cld ;decimal mode not supported
|
||||
ldx #$ff
|
||||
txs ;set up stack pointer
|
||||
inx ;increment X to 0
|
||||
stx PPU_MASK ;disable rendering
|
||||
stx DMC_FREQ ;disable DMC interrupts
|
||||
stx PPU_CTRL ;disable NMI interrupts
|
||||
bit PPU_STATUS ;clear VBL flag
|
||||
ENDM
|
||||
;;;;; START OF CODE
|
||||
|
||||
NES_HEADER 0,2,1,1 ; mapper 0, 2 PRGs, 1 CHR, vertical
|
||||
|
||||
start:
|
||||
_exit:
|
||||
NES_INIT ; set up stack pointer, turn off PPU
|
||||
jsr WaitSync
|
||||
jsr WaitSync
|
||||
jsr ClearRAM
|
||||
jsr WaitSync ;wait for VSYNC
|
||||
jsr SetPalette ;set colors
|
||||
jsr FillVRAM ;set PPU RAM
|
||||
jsr WaitSync ;wait for VSYNC (and PPU warmup)
|
||||
Start:
|
||||
NES_INIT ; set up stack pointer, turn off PPU
|
||||
jsr WaitSync ; wait for VSYNC
|
||||
jsr ClearRAM ; clear RAM
|
||||
jsr SetPalette ; set palette colors
|
||||
jsr FillVRAM ; set PPU video RAM
|
||||
jsr WaitSync ; wait for VSYNC (and PPU warmup)
|
||||
lda #0
|
||||
sta PPU_ADDR
|
||||
sta PPU_ADDR ;PPU addr = 0
|
||||
sta PPU_ADDR ; PPU addr = $0000
|
||||
sta PPU_SCROLL
|
||||
sta PPU_SCROLL ;scroll = 0
|
||||
sta PPU_SCROLL ; scroll = $0000
|
||||
lda #$90
|
||||
sta PPU_CTRL ;enable NMI
|
||||
sta PPU_CTRL ; enable NMI
|
||||
lda #$1e
|
||||
sta PPU_MASK ;enable rendering
|
||||
sta PPU_MASK ; enable rendering
|
||||
.endless
|
||||
jmp .endless ;endless loop
|
||||
|
||||
;;;;; SUBROUTINES
|
||||
|
||||
ClearRAM: subroutine
|
||||
lda #0
|
||||
tax
|
||||
.clearRAM
|
||||
sta $0,x
|
||||
cpx #$fe ; don't clear last 2 bytes of stack
|
||||
bcs .skipStack
|
||||
sta $100,x
|
||||
.skipStack
|
||||
; skip $200-$2FF, used for OAM display list
|
||||
sta $300,x
|
||||
sta $400,x
|
||||
sta $500,x
|
||||
sta $600,x
|
||||
sta $700,x
|
||||
inx
|
||||
bne .clearRAM
|
||||
rts
|
||||
|
||||
; set palette colors
|
||||
|
||||
SetPalette: subroutine
|
||||
ldy #$0
|
||||
lda #$3f
|
||||
sta PPU_ADDR
|
||||
sty PPU_ADDR
|
||||
ldx #4
|
||||
.loop:
|
||||
lda Palette,y
|
||||
sta PPU_DATA
|
||||
iny
|
||||
dex
|
||||
bne .loop
|
||||
rts
|
||||
jmp .endless ; endless loop
|
||||
|
||||
; fill video RAM
|
||||
FillVRAM: subroutine
|
||||
@ -133,41 +49,59 @@ FillVRAM: subroutine
|
||||
bne .loop
|
||||
rts
|
||||
|
||||
; wait for VSYNC to start
|
||||
WaitSync:
|
||||
bit PPU_STATUS
|
||||
bpl WaitSync
|
||||
; set palette colors
|
||||
SetPalette: subroutine
|
||||
ldy #$00
|
||||
lda #$3f
|
||||
sta PPU_ADDR
|
||||
sty PPU_ADDR
|
||||
ldx #32
|
||||
.loop:
|
||||
lda Palette,y
|
||||
sta PPU_DATA
|
||||
iny
|
||||
dex
|
||||
bne .loop
|
||||
rts
|
||||
|
||||
|
||||
;;;;; COMMON SUBROUTINES
|
||||
|
||||
include "nesppu.asm"
|
||||
|
||||
;;;;; INTERRUPT HANDLERS
|
||||
|
||||
nmi:
|
||||
irq:
|
||||
NMIHandler:
|
||||
; save registers
|
||||
pha ; save A
|
||||
; update scroll position
|
||||
; update scroll position (must be done after VRAM updates)
|
||||
inc ScrollPos
|
||||
lda ScrollPos
|
||||
sta PPU_SCROLL
|
||||
lda #0
|
||||
sta PPU_SCROLL
|
||||
; TODO: write high bits to PPUCTRL
|
||||
lda ScrollPos
|
||||
and #0
|
||||
ora #$90 ; enable NMI
|
||||
sta PPU_CTRL
|
||||
; reload registers
|
||||
pla ; reload A
|
||||
rti
|
||||
|
||||
;;;;; CONSTANT DATA
|
||||
|
||||
align $100
|
||||
Palette:
|
||||
hex 1f001020 ; black, gray, lt gray, white
|
||||
TextString:
|
||||
byte "HELLO WORLD!"
|
||||
byte 0
|
||||
hex 1f ;background
|
||||
hex 09091900 ;bg0
|
||||
hex 09091900 ;bg1
|
||||
hex 09091900 ;bg2
|
||||
hex 09091900 ;bg3
|
||||
|
||||
;;;;; CPU VECTORS
|
||||
|
||||
org $fffa
|
||||
.word nmi ;$fffa vblank nmi
|
||||
.word start ;$fffc reset
|
||||
.word irq ;$fffe irq / brk
|
||||
NES_VECTORS
|
||||
|
||||
;;;;; TILE SETS
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
include "nesdefs.asm"
|
||||
|
||||
;;;;; ZERO-PAGE VARIABLES
|
||||
;;;;; VARIABLES
|
||||
|
||||
seg.u Zeropage
|
||||
seg.u RAM
|
||||
org $0
|
||||
|
||||
ScrollPos byte ; used during NMI
|
||||
@ -12,8 +12,12 @@ Temp1 byte
|
||||
|
||||
SpriteBuf equ $200
|
||||
|
||||
;;;;; NES CARTRIDGE HEADER
|
||||
|
||||
NES_HEADER 0,2,1,0 ; mapper 0, 2 PRGs, 1 CHR, vertical
|
||||
|
||||
;;;;; START OF CODE
|
||||
|
||||
Start:
|
||||
NES_INIT ; set up stack pointer, turn off PPU
|
||||
jsr WaitSync
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
include "nesdefs.asm"
|
||||
|
||||
;;;;; ZERO-PAGE VARIABLES
|
||||
|
@ -28,6 +28,38 @@ OAM_DMA = $4014
|
||||
; OAM local RAM copy goes from $0200-$02FF:
|
||||
OAM_RAM = $0200
|
||||
|
||||
; PPU_CTRL flags
|
||||
CTRL_NMI = %10000000 ; Execute Non-Maskable Interrupt on VBlank
|
||||
CTRL_8x8 = %00000000 ; Use 8x8 Sprites
|
||||
CTRL_8x16 = %00100000 ; Use 8x16 Sprites
|
||||
CTRL_BG_0000 = %00000000 ; Background Pattern Table at $0000 in VRAM
|
||||
CTRL_BG_1000 = %00010000 ; Background Pattern Table at $1000 in VRAM
|
||||
CTRL_SPR_0000 = %00000000 ; Sprite Pattern Table at $0000 in VRAM
|
||||
CTRL_SPR_1000 = %00001000 ; Sprite Pattern Table at $1000 in VRAM
|
||||
CTRL_INC_1 = %00000000 ; Increment PPU Address by 1 (Horizontal rendering)
|
||||
CTRL_INC_32 = %00000100 ; Increment PPU Address by 32 (Vertical rendering)
|
||||
CTRL_NT_2000 = %00000000 ; Name Table Address at $2000
|
||||
CTRL_NT_2400 = %00000001 ; Name Table Address at $2400
|
||||
CTRL_NT_2800 = %00000010 ; Name Table Address at $2800
|
||||
CTRL_NT_2C00 = %00000011 ; Name Table Address at $2C00
|
||||
|
||||
; PPU_MASK flags
|
||||
MASK_TINT_RED = %00100000 ; Red Background
|
||||
MASK_TINT_BLUE = %01000000 ; Blue Background
|
||||
MASK_TINT_GREEN = %10000000 ; Green Background
|
||||
MASK_SPR = %00010000 ; Sprites Visible
|
||||
MASK_BG = %00001000 ; Backgrounds Visible
|
||||
MASK_SPR_CLIP = %00000100 ; Sprites clipped on left column
|
||||
MASK_BG_CLIP = %00000010 ; Background clipped on left column
|
||||
MASK_COLOR = %00000000 ; Display in Color
|
||||
MASK_MONO = %00000001 ; Display in Monochrome
|
||||
|
||||
; read flags
|
||||
F_BLANK = %10000000 ; VBlank Active
|
||||
F_SPRITE0 = %01000000 ; VBlank hit Sprite 0
|
||||
F_SCAN8 = %00100000 ; More than 8 sprites on current scanline
|
||||
F_WIGNORE = %00010000 ; VRAM Writes currently ignored.
|
||||
|
||||
|
||||
;;;;; CARTRIDGE FILE HEADER
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
//this example shows how to set up a palette and use 8x8 HW sprites
|
||||
//also shows how fast (or slow) C code is
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
//this example shows how to set up a palette and use 8x8 HW sprites
|
||||
//also shows how fast (or slow) C code is
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
;;;;; SUBROUTINES
|
||||
|
||||
ClearRAM: subroutine
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Playing music on the Atari VCS can be challenging since
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Playing music on the Atari VCS can be challenging since
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
; Assembler should use basic 6502 instructions
|
||||
processor 6502
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
processor 6502
|
||||
include "vcs.h"
|
||||
include "macro.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
|
||||
/*
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
|
||||
module ball_absolute_top(clk, reset, hsync, vsync, rgb);
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "digits10.v"
|
||||
`include "scoreboard.v"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
|
||||
module ball_slip_counter_top(clk, reset, hsync, vsync, rgb);
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
module clock_divider(
|
||||
input clk,
|
||||
input reset,
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef CPU16_H
|
||||
`define CPU16_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef ALU_H
|
||||
`define ALU_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "font_cp437_8x8.v"
|
||||
`include "ram.v"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef DIGITS10_H
|
||||
`define DIGITS10_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
; Architecture file for the FEMTO-8
|
||||
|
||||
; default output format is a memory initialization file
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
{
|
||||
"name":"femto16",
|
||||
"width":16,
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
; Architecture file for the FEMTO-8
|
||||
|
||||
; default output format is a memory initialization file
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
{
|
||||
"name":"femto8",
|
||||
"vars":{
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef FONT_CP437_H
|
||||
`define FONT_CP437_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "sprite_bitmap.v"
|
||||
`include "sprite_renderer.v"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "cpu16.v"
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
module gates(clk, out_not, out_and, out_or, out_xor, in);
|
||||
|
||||
input clk;
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef HVSYNC_GENERATOR_H
|
||||
`define HVSYNC_GENERATOR_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef LFSR_V
|
||||
`define LFSR_V
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
|
||||
module sound_psg(clk, reset, out, reg_sel, reg_data, reg_write);
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
|
||||
module paddles_top(clk, reset, hsync, vsync, hpaddle, vpaddle, rgb);
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "sprite_bitmap.v"
|
||||
`include "sprite_renderer.v"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "sprite_bitmap.v"
|
||||
`include "sprite_renderer.v"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef RAM_H
|
||||
`define RAM_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "digits10.v"
|
||||
`include "ram.v"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "digits10.v"
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef SCOREBOARD_H
|
||||
`define SCOREBOARD_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "cpu8.v"
|
||||
`include "cpu16.v"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
|
||||
module top(clk, reset, hsync, vsync, rgb);
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "lfsr.v"
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef SPRITE_BITMAP_H
|
||||
`define SPRITE_BITMAP_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef SPRITE_RENDERER_H
|
||||
`define SPRITE_RENDERER_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`ifndef SPRITE_ROTATION_H
|
||||
`define SPRITE_ROTATION_H
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "lfsr.v"
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "digits10.v"
|
||||
`include "sprite_rotation.v"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
.arch femto16
|
||||
|
||||
.include "hvsync_generator.v"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
|
||||
module test_hvsync_top(clk, reset, hsync, vsync, rgb);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user