MegaProcessor

Check-in [9b1ea624ff]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:yet another small tool.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9b1ea624ff469cefa994cbb7d94004122bb7386c
User & Date: jos 2015-07-17 21:03:12
Context
2015-07-29
16:01
More and more opcodes are now evaluated correctly. check-in: 2dacb66e8e user: jos tags: trunk
2015-07-17
21:03
yet another small tool. check-in: 9b1ea624ff user: jos tags: trunk
12:10
Replaced a couple of print-statements to skeleton return statements. Eventually, each function must return 1, 2, or 3 bytes corresponding to the assembly-language instruction. check-in: 4b1a7e15eb user: jos tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tools/gen_cpu.lua.



























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env lua
--
-- One-off tool.
-- Output the skeleton for a 256-element byte-indexable table
-- with a function definition for each element.
--

function printf( fmt, ... )
    io.write( string.format(fmt,...) );
end

local template = [[
function ()  -- 0x%02x
   print('instr: 0x%02x');
end%s
-------
]]

print("CPU_instr = { [0]= ");

local separator = ',';

for i=0x00, 0xff do
    if( i == 0xff ) then separator = ""; end--if
    printf( template, i, i, separator );
end--for

print( "}; -- Note: VIM syntax highlighting has a problem with this brace so far apart from its match." );