1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-11 18:49:16 +00:00
rk65c02/examples/min3.c
2018-04-10 10:12:27 +02:00

34 lines
488 B
C

#include <stdio.h>
#include <stdint.h>
#include "rk65c02.h"
#include "bus.h"
#include "log.h"
#include "instruction.h"
static const uint16_t load_addr = 0xC000;
int main(void)
{
uint8_t a, b, c;
uint8_t min;
rk65c02emu_t e;
e = rk65c02_load_rom("min3.rom", load_addr, NULL);
e.regs.SP = 0xFF;
e.regs.PC = load_addr;
a = 5; b = 9; c = 4;
stack_push(&e, a);
stack_push(&e, b);
stack_push(&e, c);
rk65c02_start(&e);
min = stack_pop(&e);
printf("Min is: %d\n", min);
}