Line counting; PC at 0xC000 for CPU testing
[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 49152
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 set line to 0
49 show variable line
50 delete all of RAM
51 repeat 2048
52 add "0" to RAM
53 end
54
55 when p key pressed
56 mapper read (PC)
57 interpret instruction (M)
58 change line by 1
59
60 define interpret instruction (opcode)
This page took 0.061325 seconds and 4 git commands to generate.