1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-02 12:41:30 +00:00

renamed noise() to xorshift32()

This commit is contained in:
Steven Hugg 2019-08-24 20:53:57 -04:00
parent ca0e81c07f
commit 698d0c616c
5 changed files with 9 additions and 5 deletions

View File

@ -85,6 +85,10 @@ function require(modname) {
<script src="gen/recorder.js"></script> <script src="gen/recorder.js"></script>
<script src="gen/embedui.js"></script> <script src="gen/embedui.js"></script>
<script src="gen/devices.js"></script>
<script src="gen/cpu/MOS6502.js"></script>
<script src="gen/cpu/ZilogZ80.js"></script>
<script src="lib/liblzg.js"></script> <script src="lib/liblzg.js"></script>
<script> <script>

View File

@ -102,8 +102,7 @@ export interface Probeable {
connectProbe(probe: ProbeAll) : void; connectProbe(probe: ProbeAll) : void;
} }
// TODO? export function xorshift32(x : number) : number {
export function noise(x : number) : number {
x ^= x << 13; x ^= x << 13;
x ^= x >> 17; x ^= x >> 17;
x ^= x << 5; x ^= x << 5;

View File

@ -1,6 +1,6 @@
import { MOS6502, MOS6502State } from "../cpu/MOS6502"; import { MOS6502, MOS6502State } from "../cpu/MOS6502";
import { BasicScanlineMachine, noise } from "../devices"; import { BasicScanlineMachine, xorshift32 } from "../devices";
import { KeyFlags } from "../emu"; // TODO import { KeyFlags } from "../emu"; // TODO
import { lzgmini } from "../util"; import { lzgmini } from "../util";
@ -113,7 +113,7 @@ export class AppleII extends BasicScanlineMachine {
} }
} }
noise() : number { noise() : number {
return (this.rnd = noise(this.rnd)) & 0xff; return (this.rnd = xorshift32(this.rnd)) & 0xff;
} }
readConst(address:number) : number { readConst(address:number) : number {
if (address < 0xc000) { if (address < 0xc000) {

View File

@ -1,6 +1,6 @@
import { MOS6502, MOS6502State } from "../cpu/MOS6502"; import { MOS6502, MOS6502State } from "../cpu/MOS6502";
import { Bus, RasterFrameBased, SavesState, SavesInputState, AcceptsROM, AcceptsKeyInput, noise, Resettable, SampledAudioSource, SampledAudioSink, HasCPU } from "../devices"; import { Bus, RasterFrameBased, SavesState, SavesInputState, AcceptsROM, AcceptsKeyInput, Resettable, SampledAudioSource, SampledAudioSink, HasCPU } from "../devices";
import { KeyFlags } from "../emu"; // TODO import { KeyFlags } from "../emu"; // TODO
import { hex, lzgmini, stringToByteArray, lpad, rpad, rgb2bgr } from "../util"; import { hex, lzgmini, stringToByteArray, lpad, rpad, rgb2bgr } from "../util";

View File

@ -112,6 +112,7 @@ const _GalaxianPlatform = function(mainElement, options) {
yy = 15-yy; yy = 15-yy;
code &= 0x3f; code &= 0x3f;
var color0 = (oram.mem[base+2] & 7) << 2; var color0 = (oram.mem[base+2] & 7) << 2;
var color0 = 0;
var addr = gfxBase+(code<<5)+(yy<8?yy:yy+8); var addr = gfxBase+(code<<5)+(yy<8?yy:yy+8);
outi = pixofs + sx; //<< 1 outi = pixofs + sx; //<< 1
var data1 = rom[addr]; var data1 = rom[addr];