// File: /workspace/github_c_makefile_star2_O0/mist64[P]cbmbasic/runtime.c
// Function: kernal_dispatch
int
kernal_dispatch() {
//{ printf("kernal_dispatch $%04X; ", PC); int i; printf("stack (%02X): ", S); for (i=S+1; i<0x100; i++) { printf("%02X ", RAM[0x0100+i]); } printf("\n"); }

	unsigned int new_pc;
	switch(PC) {
		case 0x0073:	CHRGET();	break;
		case 0x0079:	CHRGOT();	break;
		case 0xFF90:	SETMSG();	break;
		case 0xFF99:	MEMTOP();	break;
		case 0xFF9C:	MEMBOT();	break;
		case 0xFFB7:	READST();	break;
		case 0xFFBA:	SETLFS();	break;
		case 0xFFBD:	SETNAM();	break;
		case 0xFFC0:	OPEN();		break;
		case 0xFFC3:	CLOSE();	break;
		case 0xFFC6:	CHKIN();	break;
		case 0xFFC9:	CHKOUT();	break;
		case 0xFFCC:	CLRCHN();	break;
		case 0xFFCF:	CHRIN();	break;
		case 0xFFD2:	CHROUT();	break;
		case 0xFFD5:	LOAD();		break;
		case 0xFFD8:	SAVE();		break;
		case 0xFFDB:	SETTIM();	break;
		case 0xFFDE:	RDTIM();	break;
		case 0xFFE1:	STOP();		break;
		case 0xFFE4:	GETIN();	break;
		case 0xFFE7:	CLALL();	break;
		case 0xFFF0:	PLOT();		break;
		case 0xFFF3:	IOBASE();	break;

		case 0:		plugin_off(); S+=2; break;
		case 1:		plugin_on(); S+=2; break;

		case MAGIC_ERROR:	new_pc = plugin_error(); PUSH_WORD(new_pc? new_pc-1:orig_error-1); break;
		case MAGIC_MAIN:	new_pc = plugin_main(); PUSH_WORD(new_pc? new_pc-1:orig_main-1); break;
		case MAGIC_CRNCH:	new_pc = plugin_crnch(); PUSH_WORD(new_pc? new_pc-1:orig_crnch-1); break;
		case MAGIC_QPLOP:	new_pc = plugin_qplop(); PUSH_WORD(new_pc? new_pc-1:orig_qplop-1); break;
		case MAGIC_GONE:	new_pc = plugin_gone(); PUSH_WORD(new_pc? new_pc-1:orig_gone-1); break;
		case MAGIC_EVAL:	new_pc = plugin_eval(); PUSH_WORD(new_pc? new_pc-1:orig_eval-1); break;
		
		case MAGIC_CONTINUATION: /*printf("--CONTINUATION--\n");*/ return 0;

		default: printf("unknown PC=$%04X S=$%02X\n", PC, S); exit(1);
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0x1ec71(%rip), %rax     # 0x5aab0
movzwl (%rax), %eax
movl %eax, -0xc(%rbp)
testl %eax, %eax
je 0x3c13c
jmp 0x3be4f
movl -0xc(%rbp), %eax
subl $0x1, %eax
je 0x3c15e
jmp 0x3be5d
movl -0xc(%rbp), %eax
subl $0x73, %eax
je 0x3c04c
jmp 0x3be6b
movl -0xc(%rbp), %eax
subl $0x79, %eax
je 0x3c056
jmp 0x3be79
movl -0xc(%rbp), %eax
subl $0xff00, %eax           # imm = 0xFF00
je 0x3c180
jmp 0x3be89
movl -0xc(%rbp), %eax
subl $0xff01, %eax           # imm = 0xFF01
je 0x3c23c
jmp 0x3be99
movl -0xc(%rbp), %eax
subl $0xff02, %eax           # imm = 0xFF02
je 0x3c2f8
jmp 0x3bea9
movl -0xc(%rbp), %eax
subl $0xff03, %eax           # imm = 0xFF03
je 0x3c3b4
jmp 0x3beb9
movl -0xc(%rbp), %eax
subl $0xff04, %eax           # imm = 0xFF04
je 0x3c470
jmp 0x3bec9
movl -0xc(%rbp), %eax
subl $0xff05, %eax           # imm = 0xFF05
je 0x3c52c
jmp 0x3bed9
movl -0xc(%rbp), %eax
subl $0xff90, %eax           # imm = 0xFF90
je 0x3c060
jmp 0x3bee9
movl -0xc(%rbp), %eax
subl $0xff99, %eax           # imm = 0xFF99
je 0x3c06a
jmp 0x3bef9
movl -0xc(%rbp), %eax
subl $0xff9c, %eax           # imm = 0xFF9C
je 0x3c074
jmp 0x3bf09
movl -0xc(%rbp), %eax
subl $0xffb7, %eax           # imm = 0xFFB7
je 0x3c07e
jmp 0x3bf19
movl -0xc(%rbp), %eax
subl $0xffba, %eax           # imm = 0xFFBA
je 0x3c088
jmp 0x3bf29
movl -0xc(%rbp), %eax
subl $0xffbd, %eax           # imm = 0xFFBD
je 0x3c092
jmp 0x3bf39
movl -0xc(%rbp), %eax
subl $0xffc0, %eax           # imm = 0xFFC0
je 0x3c09c
jmp 0x3bf49
movl -0xc(%rbp), %eax
subl $0xffc3, %eax           # imm = 0xFFC3
je 0x3c0a6
jmp 0x3bf59
movl -0xc(%rbp), %eax
subl $0xffc6, %eax           # imm = 0xFFC6
je 0x3c0b0
jmp 0x3bf69
movl -0xc(%rbp), %eax
subl $0xffc9, %eax           # imm = 0xFFC9
je 0x3c0ba
jmp 0x3bf79
movl -0xc(%rbp), %eax
subl $0xffcc, %eax           # imm = 0xFFCC
je 0x3c0c4
jmp 0x3bf89
movl -0xc(%rbp), %eax
subl $0xffcf, %eax           # imm = 0xFFCF
je 0x3c0ce
jmp 0x3bf99
movl -0xc(%rbp), %eax
subl $0xffd2, %eax           # imm = 0xFFD2
je 0x3c0d8
jmp 0x3bfa9
movl -0xc(%rbp), %eax
subl $0xffd5, %eax           # imm = 0xFFD5
je 0x3c0e2
jmp 0x3bfb9
movl -0xc(%rbp), %eax
subl $0xffd8, %eax           # imm = 0xFFD8
je 0x3c0ec
jmp 0x3bfc9
movl -0xc(%rbp), %eax
subl $0xffdb, %eax           # imm = 0xFFDB
je 0x3c0f6
jmp 0x3bfd9
movl -0xc(%rbp), %eax
subl $0xffde, %eax           # imm = 0xFFDE
je 0x3c100
jmp 0x3bfe9
movl -0xc(%rbp), %eax
subl $0xffe1, %eax           # imm = 0xFFE1
je 0x3c10a
jmp 0x3bff9
movl -0xc(%rbp), %eax
subl $0xffe4, %eax           # imm = 0xFFE4
je 0x3c114
jmp 0x3c009
movl -0xc(%rbp), %eax
subl $0xffe7, %eax           # imm = 0xFFE7
je 0x3c11e
jmp 0x3c019
movl -0xc(%rbp), %eax
subl $0xfff0, %eax           # imm = 0xFFF0
je 0x3c128
jmp 0x3c029
movl -0xc(%rbp), %eax
subl $0xfff3, %eax           # imm = 0xFFF3
je 0x3c132
jmp 0x3c039
movl -0xc(%rbp), %eax
subl $0xffff, %eax           # imm = 0xFFFF
je 0x3c5e5
jmp 0x3c5ee
callq 0x3b7f0
jmp 0x3c61a
callq 0x3bbd0
jmp 0x3c61a
callq 0x3c630
jmp 0x3c61a
callq 0x3c660
jmp 0x3c61a
callq 0x3c680
jmp 0x3c61a
callq 0x3c6a0
jmp 0x3c61a
callq 0x3c6c0
jmp 0x3c61a
callq 0x3c700
jmp 0x3c61a
callq 0x3c740
jmp 0x3c61a
callq 0x3c8b0
jmp 0x3c61a
callq 0x3c920
jmp 0x3c61a
callq 0x3c980
jmp 0x3c61a
callq 0x3c9e0
jmp 0x3c61a
callq 0x3ca00
jmp 0x3c61a
callq 0x3cc60
jmp 0x3c61a
callq 0x3cff0
jmp 0x3c61a
callq 0x3d980
jmp 0x3c61a
callq 0x3db20
jmp 0x3c61a
callq 0x3dbf0
jmp 0x3c61a
callq 0x3dca0
jmp 0x3c61a
callq 0x3dcb0
jmp 0x3c61a
callq 0x3de10
jmp 0x3c61a
callq 0x3de80
jmp 0x3c61a
callq 0x3df00
jmp 0x3c61a
callq 0x3df90
leaq 0x5fd8(%rip), %rax      # 0x42120
movzbl (%rax), %eax
addl $0x2, %eax
movb %al, %cl
leaq 0x5fc9(%rip), %rax      # 0x42120
movb %cl, (%rax)
jmp 0x3c61a
callq 0x3bd80
leaq 0x5fb6(%rip), %rax      # 0x42120
movzbl (%rax), %eax
addl $0x2, %eax
movb %al, %cl
leaq 0x5fa7(%rip), %rax      # 0x42120
movb %cl, (%rax)
jmp 0x3c61a
callq 0x3e100
movzwl %ax, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x3c19c
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x3c1a9
movzwl 0x1ea01(%rip), %eax     # 0x5aba4
subl $0x1, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
shrl $0x8, %eax
movb %al, %dl
leaq 0x5f68(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5f58(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe8d3(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
cmpl $0x0, -0x8(%rbp)
je 0x3c1f1
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3c1fe
movzwl 0x1e9ac(%rip), %eax     # 0x5aba4
subl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
leaq 0x5f11(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5f01(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe87c(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
jmp 0x3c61a
callq 0x3e110
movzwl %ax, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x3c258
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x3c265
movzwl 0x1e947(%rip), %eax     # 0x5aba6
subl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
shrl $0x8, %eax
movb %al, %dl
leaq 0x5eac(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5e9c(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe817(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
cmpl $0x0, -0x8(%rbp)
je 0x3c2ad
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x3c2ba
movzwl 0x1e8f2(%rip), %eax     # 0x5aba6
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
leaq 0x5e55(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5e45(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe7c0(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
jmp 0x3c61a
callq 0x3e120
movzwl %ax, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x3c314
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x3c321
movzwl 0x1e88d(%rip), %eax     # 0x5aba8
subl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
shrl $0x8, %eax
movb %al, %dl
leaq 0x5df0(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5de0(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe75b(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
cmpl $0x0, -0x8(%rbp)
je 0x3c369
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3c376
movzwl 0x1e838(%rip), %eax     # 0x5aba8
subl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
leaq 0x5d99(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5d89(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe704(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
jmp 0x3c61a
callq 0x3e130
movzwl %ax, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x3c3d0
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x3c3dd
movzwl 0x1e7d3(%rip), %eax     # 0x5abaa
subl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
shrl $0x8, %eax
movb %al, %dl
leaq 0x5d34(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5d24(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe69f(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
cmpl $0x0, -0x8(%rbp)
je 0x3c425
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x3c432
movzwl 0x1e77e(%rip), %eax     # 0x5abaa
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
leaq 0x5cdd(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5ccd(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe648(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
jmp 0x3c61a
callq 0x3e140
movzwl %ax, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x3c48c
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x3c499
movzwl 0x1e719(%rip), %eax     # 0x5abac
subl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
shrl $0x8, %eax
movb %al, %dl
leaq 0x5c78(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5c68(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe5e3(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
cmpl $0x0, -0x8(%rbp)
je 0x3c4e1
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3c4ee
movzwl 0x1e6c4(%rip), %eax     # 0x5abac
subl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
leaq 0x5c21(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5c11(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe58c(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
jmp 0x3c61a
callq 0x3e470
movzwl %ax, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x3c548
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x3c555
movzwl 0x1e65f(%rip), %eax     # 0x5abae
subl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
shrl $0x8, %eax
movb %al, %dl
leaq 0x5bbc(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5bac(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe527(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
cmpl $0x0, -0x8(%rbp)
je 0x3c59d
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3c5aa
movzwl 0x1e60a(%rip), %eax     # 0x5abae
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
leaq 0x5b65(%rip), %rax      # 0x42120
movb (%rax), %al
movb %al, %sil
addb $-0x1, %sil
leaq 0x5b55(%rip), %rcx      # 0x42120
movb %sil, (%rcx)
movzbl %al, %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rcx
leaq 0xe4d0(%rip), %rax      # 0x4aab0
movb %dl, (%rax,%rcx)
jmp 0x3c61a
movl $0x0, -0x4(%rbp)
jmp 0x3c621
leaq 0x1e4bb(%rip), %rax     # 0x5aab0
movzwl (%rax), %esi
leaq 0x5b21(%rip), %rax      # 0x42120
movzbl (%rax), %edx
leaq 0x34dc(%rip), %rdi      # 0x3fae5
movb $0x0, %al
callq 0x10b0
movl $0x1, %edi
callq 0x11f0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)