/* Orion recompiler Template for Apple I basic (4K) See... http://www.pagetable.com/?p=32 [www.pagetable.com] http://www.brouhaha.com/~eric/retrocomputing/apple/apple1/basic/ [www.brouhaha.com] http://home.comcast.net/~mjmahon/AP1BASIC.txt [home.comcast.net] http://gloonk.com/programming/images/wozbasicvars.txt [gloonk.com] Orion did most of the disassembly pretty well with no seeding; the labels below are imported from eric@brouhaha's manual disassembly in order to improve readability; they're not strictly needed for recompiling to C. */ cpu 6502; /* I don't think the data labels are used unless you ask for a re-assemblable version */ datalabel 0x0000 = RESET, 0x0024 = ch, 0x0025 = cv, 0x004a = lomem, 0x004c = himem, 0x004e = rnd, 0x0050 = noun_stk_l, 0x0058 = syn_stk_h, 0x0078 = noun_stk_h_str, 0x0080 = syn_stk_l, 0x00a0 = noun_stk_h_int, 0x00a8 = txtndxstk, 0x00c8 = text_index, 0x00c9 = leadbl, 0x00ca = pp, 0x00cc = pv, 0x00ce = acc, 0x00d0 = srch, 0x00d1 = tokndxstk, 0x00d2 = srch2, 0x00d4 = if_flag, 0x00d5 = cr_flag, 0x00d6 = current_verb, 0x00d7 = precedence, 0x00d8 = x_save, 0x00d9 = run_flag, 0x00da = aux, 0x00dc = pline, 0x00e0 = pverb, 0x00e2 = p1, 0x00e4 = p2, 0x00e6 = p3, 0x00f1 = token_index, 0x00f2 = pcon, 0x00f4 = auto_inc, 0x00f6 = auto_ln, 0x00f8 = auto_flag, 0x00f9 = char, 0x00fa = leadzr, 0x00fb = for_nest_count, 0x00fc = gosub_nest_count, 0x00fd = synstkdx, 0x00fe = synpag, 0x0100 = gstk_pverbl, 0x0108 = gstk_pverbh, 0x0110 = gstk_plinel, 0x0118 = gstk_plineh, 0x0120 = fstk_varl, 0x0128 = fstk_varh, 0x0200 = buffer, 0xd010 = keytst, /* could use on-the-fly code replacement in the c emitter */ 0xd011 = keyval, /* to read data from stdin here. */ /* Is 0xd0f2 the output register?. It is bit-tested, then written to: e3d5: 2cf2d0 bit 0d0f2h e3d8: 30fb bmi 0e3d5h e3da: 8df2d0 sta 0d0f2h */ 0xd0f2 = console; /* verb_adr_l and verb_adr_h are the low and high bytes of code addresses (a jump table) and therefore every address in this table (except ffff) needs to have a label. Neil has some trick for specifying that kind of table here, but I've forgotten what it is... */ codelabel 0xe750 = abs_fn, 0xe785 = add, 0xe7e2 = auto_cmd, 0xe7f8 = auto_com, 0xe817 = begin_line, 0xeea6 = bogus_eea6, 0xeec2 = bogus_eec2, 0xeea0 = call_stmt, 0xe5b7 = clr, 0xe2b0 = cold, 0xe819 = colon, 0xe109 = comma_substr, 0xe3c9 = cout, 0xe3cd = crout, 0xe568 = dectabh, 0xe563 = dectabl, 0xe387 = del_cmd, 0xe36f = del_comma, 0xef1e = dim_num, 0xe130 = dim_str, 0xef10 = divide, 0xe6ec = do_verb, 0xe8d3 = end_stmt, 0xe733 = eq_op, 0xeb00 = error_msg_tbl, 0xe679 = execute_stmt, 0xe6a0 = execute_token, 0xe60c = execute_var, 0xe6c3 = execute_verb, 0xe682 = fetch_prog_byte, 0xe56d = find_line, 0xe575 = find_line1, 0xe576 = find_line2, 0xe93a = for_stmt, 0xe715 = get16bit, 0xee34 = getbyte, 0xe6ff = get_next_prog_byte, 0xe106 = go_errmess_1, 0xe4a6 = go_errmess_2, 0xe712 = go_errmess_3, 0xe8a2 = go_errmess_4, 0xee65 = go_errmess_5, 0xe83c = gosub_stmt, 0xe85b = goto_stmt, 0xee63 = gr_255_err, 0xe828 = if_stmt, 0xebcb = input_num_comma, 0xebaa = input_num_stmt, 0xefbc = input_prompt, 0xe171 = input_str, 0xe823 = left_paren, 0xee22 = len_fn, 0xe04b = list_all, 0xe05d = list_cmd, 0xe035 = list_comman, 0xe077 = list_int, 0xe06d = list_line, 0xe0a3 = list_token, 0xee54 = man_cmd, 0xefd3 = mem_init_4k, 0xe27a = mod_op, 0xe222 = mult_op, 0xe76f = negate, 0xe74a = neq_op, 0xe5ad = new_cmd, 0xe02a = nextbyte, 0xe8d8 = next_stmt, 0xe736 = not_op, 0xef24 = num_array_subs, 0xe0fb = paren_substr, 0xe000 = Pe000, 0xeef6 = peek_fn, 0xee3e = plot_comma, 0xef00 = poke_stmt, 0xe51b = prdec, 0xe7c1 = print_com_num, 0xe81d = print_cr, 0xe3e0 = print_err_msg, 0xeed3 = print_err_msg, 0xe7c4 = print_num, 0xe820 = print_semi, 0xee03 = print_str, 0xee00 = print_str_comma, 0xe70a = push_a_noun_stk, 0xe681 = push_old_verb, 0xe708 = push_ya_noun_stk, 0xe41c = put_token, 0xee68 = range_err, 0xe003 = rdkey, 0xe29e = read_line, 0xe8a5 = return_stmt, 0xe827 = right_paren, 0xef4e = rnd_fn, 0xe86b = run_loop, 0xe836 = run_warm, 0xe759 = sgn_fn, 0xe121 = str_arr_dest, 0xe1d7 = string_eq, 0xe104 = string_err, 0xefb6 = string_input, 0xe18c = string_lit, 0xe21c = string_neq, 0xe782 = subtract, 0xec20 = syntabl_index, 0xe7a4 = tab_fn, 0xe7b1 = tabout, 0xe950 = to_clause, 0xe3de = too_long_err, 0xe7a3 = unary_pos, 0xe801 = var_assign, 0xea88 = verb_adr_h, 0xea10 = verb_adr_l, 0xe998 = verb_prec_tbl, 0xee57 = vtab_stmt, 0xe2b3 = warm; entry 0xe000, 0xe00c, 0xe018, 0xe035, 0xe04b, 0xe109, 0xe121, 0xe12c, 0xe1d7, 0xe222, 0xe8d6, 0xee3e, 0xee4c, 0xee52, 0xeee4, 0xeef6, 0xef00, 0xefec, 0xeff2, 0xe16c, 0xe733, 0xe7a4, 0xe7b1, 0xe7c1, 0xe7e2, 0xe7f8, 0xe817, 0xe828, 0xe8a5, 0xe93a, 0xe950, 0xe97e, 0xeea0, 0xeea6, 0xeec9, 0xeed1, 0xef10, 0xef1e, 0xef24, 0xef4e, 0xe05d, 0xec01, 0xec40, 0xee00, 0xef4e, 0xefb3, apple1basic; moduleprefix apple1basic; coderegion 0xe000-0xefff; ramregion 0x0000-0x1000; // Work RAM loadimage 0xe000, "3rdparty/roms/apple1/apple1basic.bin"; inlinedata 0xec1e-0xec1f; inlinedata 0xec20-0xec3f; inlinedata 0xec53-0xedff; inlinedata 0xe27f-0xe27f;