added vcs .h files; can repeat Run to Line

This commit is contained in:
Steven Hugg 2018-08-16 22:45:59 -04:00
parent d8a98989f5
commit 9d3e658a7b
10 changed files with 212 additions and 74 deletions

View File

@ -49,6 +49,7 @@ TODO:
- go to error in include files
- BOM in upload/download?
- stack view for Z80 platforms using memory map
- online tools for music etc
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?

View File

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>8bitworkshop</title>
<link rel="stylesheet" href="css/ui.css">
</head>
<body>
<h3>8bitworkshop Local Storage Editor</h3>
<p>
<select id="storageitems" size="20">
</select>
</p><p>
<button id="deleteitem">Delete Selected Item</button>
</p>
<script src="jquery/jquery-2.2.3.min.js"></script>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<script src="bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="bootstrap/css/bootstrap-tour.min.css">
<script src="bootstrap/js/bootstrap-tour.min.js"></script>
<script src="codemirror/lib/codemirror.js"></script>
<script src="src/util.js"></script>
<script src="src/ui.js"></script>
<!-- <script src="src/audio/votrax.js"></script> -->
<script>
var storagelist = $("#storageitems");
var items = getBiggestItems(localStorage);
for (var i=items.length-1; i>=0; i--) {
var item = items[i];
var option = new Option(item[1] + " (" + item[0] + " bytes )", item[1]);
storagelist.append(option);
}
$("#deleteitem").click(function(e) {
var key = storagelist.find(":selected").val();
console.log(key);
if (key) {
if (confirm("Delete " + key + " from local storage (make sure you have any edits backed up!)")) {
localStorage.removeItem(key);
window.location = location;
}
} else {
alert("Please select an item first");
}
});
</script>
</body>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-54497476-9', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
</html>

View File

@ -159,10 +159,11 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<div id="mem_info" class="mem_info" style="display:none">
</div>
</div>
<!--
<div class="twitbtn">
<a target="_new" href="https://twitter.com/8bitworkshop" class="twitter-follow-button" data-show-count="false">Follow @8bitworkshop</a>
<a target="_new" href="https://twitter.com/8bitworkshop" class="twitter-follow-button" data-show-count="false">Follow @8bitworkshop</a>-->
<!--<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>-->
</div>
<!--</div>-->
<div id="pixeditback" class="pixeditback" style="display:none">
<iframe id="pixeditframe" src="pixels.html">
</iframe>

176
presets/nes/scrollrt.asm Normal file
View File

@ -0,0 +1,176 @@

include "nesdefs.asm"
;;;;; VARIABLES
seg.u ZEROPAGE
org $0
seg.u RAM
org $300
LineXLo ds 224
LineXHi ds 224
;;;;; NES CARTRIDGE HEADER
NES_HEADER 0,2,1,0 ; mapper 0, 2 PRGs, 1 CHR, horiz. mirror
;;;;; START OF 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)
jsr SetPalette ; set palette colors
jsr FillVRAM ; set PPU video RAM
lda #0
sta PPU_ADDR
sta PPU_ADDR ; PPU addr = $0000
sta PPU_SCROLL
sta PPU_SCROLL ; scroll = $0000
lda #CTRL_NMI
sta PPU_CTRL ; enable NMI
lda #MASK_BG
sta PPU_MASK ; enable rendering
.endless
jmp .endless ; endless loop
; fill video RAM
FillVRAM: subroutine
txa
ldy #$20
sty PPU_ADDR
sta PPU_ADDR
ldy #$10
.loop:
sta PPU_DATA
adc #7
inx
bne .loop
dey
bne .loop
rts
; 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
NMIHandler: subroutine
SAVE_REGS
ldy #0
.loop
tya
sec
adc LineXLo,y
sta LineXLo,y
lda LineXHi,y
adc #0
sta LineXHi,y
sta PPU_SCROLL ; horiz byte
lda #0
sta PPU_SCROLL ; vert byte
ldx #15
.delay
dex
bne .delay
iny
cpy #224
bne .loop
RESTORE_REGS
rti
;;;;; CONSTANT DATA
align $100
Palette:
hex 1f ;background
hex 09092c00 ;bg0
hex 09091900 ;bg1
hex 09091500 ;bg2
hex 09092500 ;bg3
;;;;; CPU VECTORS
NES_VECTORS
;;;;; TILE SETS
org $10000
; background (tile) pattern table
REPEAT 10
;;{w:8,h:8,bpp:1,count:48,brev:1,np:2,pofs:8,remap:[0,1,2,4,5,6,7,8,9,10,11,12]};;
hex 00000000000000000000000000000000
hex 7e42424646467e007e42424646467e00
hex 08080818181818000808081818181800
hex 3e22023e30303e003e22023e30303e00
hex 3c24041e06263e003c24041e06263e00
hex 4444447e0c0c0c004444447e0c0c0c00
hex 3c20203e06263e003c20203e06263e00
hex 3e22203e26263e003e22203e26263e00
hex 3e020206060606003e02020606060600
hex 3c24247e46467e003c24247e46467e00
hex 3e22223e060606003e22223e06060600
hex 3c24247e626262003c24247e62626200
hex 7c44447e62627e007c44447e62627e00
hex 7e42406060627e007e42406060627e00
hex 7e42426262627e007e42426262627e00
hex 7c40407c60607c007c40407c60607c00
hex 3c20203c303030003c20203c30303000
hex 7e42406e62627e007e42406e62627e00
hex 4242427e626262004242427e62626200
hex 10101018181818001010101818181800
hex 0404040606467e000404040606467e00
hex 4444447e626262004444447e62626200
hex 2020203030303e002020203030303e00
hex fe9292d2d2d2d200fe9292d2d2d2d200
hex 7e424262626262007e42426262626200
hex 7e46464242427e007e46464242427e00
hex 7e42427e606060007e42427e60606000
hex 7e424242424e7e007e424242424e7e00
hex 7c44447e626262007c44447e62626200
hex 7e42407e06467e007e42407e06467e00
hex 7e101018181818007e10101818181800
hex 4242426262627e004242426262627e00
hex 646464642c2c3c00646464642c2c3c00
hex 4949494969697f004949494969697f00
hex 4242423c626262004242423c62626200
hex 4242427e181818004242427e18181800
hex 7e42027e60627e007e42027e60427e00
hex 10101818180018001010181818001800
hex 187e407e067e1800187e407e067e1800
hex 00180018180000000018001818000000
hex 00003c3c0000000000003c3c00000000
hex 00000018180000000000001818000000
hex 18180810000000001818081000000000
hex 00000018180810000000001818081000
hex 7c7c7c7c7c7c7c007c7c7c7c7c7c7c00
hex 0000000000007c000000000000007c00
hex 00000000000000000000000000000000
hex 00000000000000000000000000000000
;;
REPEND
REPEAT 32
hex 00000000000000000000000000000000
REPEND

View File

@ -8,11 +8,11 @@
;;;;; NES CARTRIDGE HEADER
NES_HEADER 0,2,1,0 ; mapper 0, 2 PRGs, 1 CHR, vertical
NES_HEADER 0,2,1,NES_MIRR_HORIZ ; mapper 0, 2 PRGs, 1 CHR
;;;;; START OF CODE
Start:
Start: subroutine
NES_INIT ; set up stack pointer, turn off PPU
jsr WaitSync ; wait for VSYNC
jsr ClearRAM ; clear RAM
@ -37,7 +37,9 @@ Start:
;;;;; INTERRUPT HANDLERS
NMIHandler:
NMIHandler: subroutine
SAVE_REGS
RESTORE_REGS
rti
;;;;; CPU VECTORS

24
presets/vcs/xmacro.h Normal file
View File

@ -0,0 +1,24 @@
;-------------------------------------------------------
; Usage: TIMER_SETUP lines
; where lines is the number of scanlines to skip (> 2).
; The timer will be set so that it expires before this number
; of scanlines. A WSYNC will be done first.
MAC TIMER_SETUP
.lines SET {1}
lda #(((.lines-1)*76-14)/64)
sta WSYNC
sta TIM64T
ENDM
;-------------------------------------------------------
; Use with TIMER_SETUP to wait for timer to complete.
; You may want to do a WSYNC afterwards, since the timer
; is not accurate to the beginning/end of a scanline.
MAC TIMER_WAIT
.waittimer
lda INTIM
bne .waittimer
ENDM

View File

@ -99,7 +99,7 @@ abstract class BaseDebugPlatform {
clearDebug() {
this.debugSavedState = null;
this.debugBreakState = null;
this.debugTargetClock = 0;
this.debugTargetClock = -1;
this.debugClock = 0;
this.onBreakpointHit = null;
this.debugCondition = null;
@ -144,7 +144,7 @@ abstract class BaseFrameBasedPlatform extends BaseDebugPlatform {
}
runEval(evalfunc : DebugEvalCondition) {
this.setDebugCondition( () => {
if (this.debugClock++ >= this.debugTargetClock) {
if (this.debugClock++ > this.debugTargetClock) {
var cpuState = this.getCPUState();
cpuState.PC = (cpuState.PC + this.debugPCDelta) & 0xffff;
if (evalfunc(cpuState)) {

View File

@ -439,7 +439,7 @@ export function padBytes(data, len) {
type AddressReadWriteFn = ((a:number) => number) | ((a:number,v:number) => void);
type AddressDecoderEntry = [number, number, number, AddressReadWriteFn];
type AddressDecoderOptions = {gmask:number}
type AddressDecoderOptions = {gmask?:number};
// TODO: better performance, check values
export function AddressDecoder(table : AddressDecoderEntry[], options?:AddressDecoderOptions) {