c68a05020d461798317e4741e5f078c4044e3206
[ScratchNES.git] / src / meta.tosh
1 define mapper read (addr)
2 if addr < 8192 then
3 set M to item (addr mod 2048 + 1) of RAM
4 else
5 if addr > 32767 then
6 set M to (join "0x" (item ((addr - 32768) mod 16384 + 1) of PRG-ROM))
7 end
8 end
9
10 define mapper write (addr) (value)
11 if addr < 8192 then
12 replace item addr mod 2048 + 1 of RAM with value
13 else
14 if addr > 8191 and addr < 8200 then
15 ask join join (value) " to PPU " (addr) and wait
16 else
17 if addr > 32768 then
18 say "Writing to ROM isn't very nice, you know..."
19 end
20 end
21 end
22
23 define PLP
24
25 define interrupt
26
27 define compute SR
28
29 when flag clicked
30 set A to 0
31 set X to 0
32 set Y to 0
33 set S to "0xFD"
34 set PC to 32768
35 show variable A
36 show variable X
37 show variable Y
38 show variable PC
39 show variable M
40 show variable flagC
41 show variable flagV
42 show variable flagN
43 show variable flagZ
44 show variable flagI
45 show variable flagB
46 show variable flagD
47 show variable S
48 delete all of RAM
49 repeat 2048
50 add "0" to RAM
51 end
52
53 when p key pressed
54 mapper read (PC)
55 interpret instruction (M)
56
57 define interpret instruction (opcode)
58
This page took 0.05805 seconds and 3 git commands to generate.