Blame view

disasm.c 392 Bytes
1
#include "disasm.h"
2
3
void disassemble_program(uint32_t length)
4
5
6
7
8
9
10
11
12
13
{
    uint16_t arg1;
    uint16_t arg2;
    uint16_t arg3;
    for(;;)
    {
        if(pc == length - 1)
        {
            break;
        }
14
        fprintf(stderr,"%02X: ",pc);
15
16
17
        uint16_t opcode = fetch();
        decode_instruction(opcode,&arg1,&arg2,&arg3);
        print_instruction(opcode,arg1,arg2,arg3);
18
19
    }
}