ack/mach/mantra/int/mloop1

365 lines
14 KiB
Plaintext
Raw Normal View History

1984-07-23 11:49:00 +00:00
!-------------------------------------------------------------------------------
! Main loop of the interpreter starts here
!----------------------------------------------------------------------------
loop: move.l #0,d0
move.b (a3)+,d0 !opcode in d0
add.w d0,d0 !opcode to index in table
add.w d0,d0
#if prof
move.l profile,a0
lea timeinf,a5
move.l 0(a5,d0),d1 !get operation time
add.l d1,(a0)
#endif
#if opfreq
lea counttab,a5
add.l #1,0(a5,d0)
#endif
jmp dispat(pc,d0) !jump to branch to the operation
!---------------------------------------------------------------------------
! the BRANCH LIST follows
!--------------------------------------------------------------------------
dispat:
bra loc_0 ; bra loc_1 ; bra loc_2 ; bra loc_3
bra loc_4 ; bra loc_5 ; bra loc_6 ; bra loc_7
bra loc_8 ; bra loc_9 ; bra loc_10 ; bra loc_11
bra loc_12 ; bra loc_13 ; bra loc_14 ; bra loc_15
bra loc_16 ; bra loc_17 ; bra loc_18 ; bra loc_19
bra loc_20 ; bra loc_21 ; bra loc_22 ; bra loc_23
bra loc_24 ; bra loc_25 ; bra loc_26 ; bra loc_27
bra loc_28 ; bra loc_29 ; bra loc_30 ; bra loc_31
bra loc_32 ; bra loc_33 ; bra aar_1W ; bra adf_s0
bra adi_1W ; bra adi_2W ; bra adp_l ; bra adp_1
bra adp_2 ; bra adp_s0 ; bra adp_s_1 ; bra ads_1W
bra and_1W ; bra asp_1W ; bra asp_2W ; bra asp_3W
bra asp_4W ; bra asp_5W ; bra asp_w0 ; bra beq_l
bra beq_s0 ; bra bge_s0 ; bra bgt_s0 ; bra ble_s0
bra blm_s0 ; bra blt_s0 ; bra bne_s0 ; bra bra_l
bra bra_s_1 ; bra bra_s_2 ; bra bra_s0 ; bra bra_s1
bra cal_1 ; bra cal_2 ; bra cal_3 ; bra cal_4
bra cal_5 ; bra cal_6 ; bra cal_7 ; bra cal_8
bra cal_9 ; bra cal_10 ; bra cal_11 ; bra cal_12
bra cal_13 ; bra cal_14 ; bra cal_15 ; bra cal_16
bra cal_17 ; bra cal_18 ; bra cal_19 ; bra cal_20
bra cal_21 ; bra cal_22 ; bra cal_23 ; bra cal_24
bra cal_25 ; bra cal_26 ; bra cal_27 ; bra cal_28
bra cal_s0 ; bra cff_z ; bra cif_z ; bra cii_z
bra cmf_s0 ; bra cmi_1W ; bra cmi_2W ; bra cmp_z
bra cms_s0 ; bra csa_1W ; bra csb_1W ; bra dec_z
bra dee_w0 ; bra del_w_1 ; bra dup_1W ; bra dvf_s0
bra dvi_1W ; bra fil_l ; bra inc_z ; bra ine_lw
bra ine_w0 ; bra inl__1W ; bra inl__2W ; bra inl__3W
bra inl_w_1 ; bra inn_s0 ; bra ior_1W ; bra ior_s0
bra lae_l ; bra lae_w0 ; bra lae_w1 ; bra lae_w2
bra lae_w3 ; bra lae_w4 ; bra lae_w5 ; bra lae_w6
bra lal_p ; bra lal_n ; bra lal_0 ; bra lal__1
bra lal_w0 ; bra lal_w_1 ; bra lal_w_2 ; bra lar_1W
bra ldc_0 ; bra lde_lw ; bra lde_w0 ; bra ldl_0
bra ldl_w_1 ; bra lfr_1W ; bra lfr_2W ; bra lfr_s0
bra lil_w_1 ; bra lil_w0 ; bra lil_0 ; bra lil_1W
bra lin_l ; bra lin_s0 ; bra lni_z ; bra loc_l
bra loc__1 ; bra loc_s0 ; bra loc_s_1 ; bra loe_lw
bra loe_w0 ; bra loe_w1 ; bra loe_w2 ; bra loe_w3
bra loe_w4 ; bra lof_l ; bra lof_1W ; bra lof_2W
bra lof_3W ; bra lof_4W ; bra lof_s0 ; bra loi_l
bra loi_1 ; bra loi_1W ; bra loi_2W ; bra loi_3W
bra loi_4W ; bra loi_s0 ; bra lol_pw ; bra lol_nw
bra lol_0 ; bra lol_1W ; bra lol_2W ; bra lol_3W
bra lol__1W ; bra lol__2W ; bra lol__3W ; bra lol__4W
bra lol__5W ; bra lol__6W ; bra lol__7W ; bra lol__8W
bra lol_w0 ; bra lol_w_1 ; bra lxa_1 ; bra lxl_1
bra lxl_2 ; bra mlf_s0 ; bra mli_1W ; bra mli_2W
bra rck_1W ; bra ret_0 ; bra ret_1W ; bra ret_s0
bra rmi_1W ; bra sar_1W ; bra sbf_s0 ; bra sbi_1W
bra sbi_2W ; bra sdl_w_1 ; bra set_s0 ; bra sil_w_1
bra sil_w0 ; bra sli_1W ; bra ste_lw ; bra ste_w0
bra ste_w1 ; bra ste_w2 ; bra stf_l ; bra stf_1W
bra stf_2W ; bra stf_s0 ; bra sti_1 ; bra sti_1W
bra sti_2W ; bra sti_3W ; bra sti_4W ; bra sti_s0
bra stl_pw ; bra stl_nw ; bra stl_0 ; bra stl_1W
bra stl__1W ; bra stl__2W ; bra stl__3W ; bra stl__4W
bra stl__5W ; bra stl_w_1 ; bra teq_z ; bra tgt_z
bra tlt_z ; bra tne_z ; bra zeq_l ; bra zeq_s0
bra zeq_s1 ; bra zer_s0 ; bra zge_s0 ; bra zgt_s0
bra zle_s0 ; bra zlt_s0 ; bra zne_s0 ; bra zne_s_1
bra zre_lw ; bra zre_w0 ; bra zrl__1W ; bra zrl__2W
bra zrl_w_1 ; bra zrl_nw
.errnz .-dispat-1016
!-----------------------------------------------------------------------------
! Two byte opcodes come here for decoding of second byte
!----------------------------------------------------------------------------
escape1:
move.l #0,d0
bra 1f
bra escape2
1: move.b (a3)+,d0 !second byte ,extended opcode
add.w d0,d0 !make index of address
add.w d0,d0
cmp.w #640,d0 !check for range
bhi e_illins !jump to ill instruction procedure
#if prof
lea timeinf1,a5
move.l 0(a5,d0),d1
add.l d1,(a0)
#endif
#if opfreq
lea counttab+1024,a5
add.l #1,0(a5,d0)
#endif
jmp dispae1(pc,d0) !jump to the operation
!------------------------------------------------------------------------------
! now dispatch table for escaped opcodes
!------------------------------------------------------------------------------
dispae1: !dispatch escaped opcodes 1
bra aar_l ; bra aar_z ; bra adf_l ; bra adf_z
bra adi_l ; bra adi_z ; bra ads_l ; bra ads_z
bra adu_l ; bra adu_z ; bra and_l ; bra and_z
bra asp_lw ; bra ass_l ; bra ass_z ; bra bge_l
bra bgt_l ; bra ble_l ; bra blm_l ; bra bls_l
bra bls_z ; bra blt_l ; bra bne_l ; bra cai_z
bra cal_l ; bra cfi_z ; bra cfu_z ; bra ciu_z
bra cmf_l ; bra cmf_z ; bra cmi_l ; bra cmi_z
bra cms_l ; bra cms_z ; bra cmu_l ; bra cmu_z
bra com_l ; bra com_z ; bra csa_l ; bra csa_z
bra csb_l ; bra csb_z ; bra cuf_z ; bra cui_z
bra cuu_z ; bra dee_lw ; bra del_pw ; bra del_nw
bra dup_l ; bra dus_l ; bra dus_z ; bra dvf_l
bra dvf_z ; bra dvi_l ; bra dvi_z ; bra dvu_l
bra dvu_z ; bra fef_l ; bra fef_z ; bra fif_l
bra fif_z ; bra inl_pw ; bra inl_nw ; bra inn_l
bra inn_z ; bra ior_l ; bra ior_z ; bra lar_l
bra lar_z ; bra ldc_l ; bra ldf_l ; bra ldl_pw
bra ldl_nw ; bra lfr_l ; bra lil_pw ; bra lil_nw
bra lim_z ; bra los_l ; bra los_z ; bra lor_s0
bra lpi_l ; bra lxa_l ; bra lxl_l ; bra mlf_l
bra mlf_z ; bra mli_l ; bra mli_z ; bra mlu_l
bra mlu_z ; bra mon_z ; bra ngf_l ; bra ngf_z
bra ngi_l ; bra ngi_z ; bra nop_z ; bra rck_l
bra rck_z ; bra ret_l ; bra rmi_l ; bra rmi_z
bra rmu_l ; bra rmu_z ; bra rol_l ; bra rol_z
bra ror_l ; bra ror_z ; bra rtt_z ; bra sar_l
bra sar_z ; bra sbf_l ; bra sbf_z ; bra sbi_l
bra sbi_z ; bra sbs_l ; bra sbs_z ; bra sbu_l
bra sbu_z ; bra sde_l ; bra sdf_l ; bra sdl_pw
bra sdl_nw ; bra set_l ; bra set_z ; bra sig_z
bra sil_pw ; bra sil_nw ; bra sim_z ; bra sli_l
bra sli_z ; bra slu_l ; bra slu_z ; bra sri_l
bra sri_z ; bra sru_l ; bra sru_z ; bra sti_l
bra sts_l ; bra sts_z ; bra str_s0 ; bra tge_z
bra tle_z ; bra trp_z ; bra xor_l ; bra xor_z
bra zer_l ; bra zer_z ; bra zge_l ; bra zgt_l
bra zle_l ; bra zlt_l ; bra zne_l ; bra zrf_l
bra zrf_z ; bra zrl_pw ; bra dch_z ; bra exg_s0
bra exg_l ; bra exg_z ; bra lpb_z ; bra gto_l
.errnz .-dispae1-640
!----------------------------------------------------------------------------
escape2:
move.l #0,d0
move.b (a3)+,d0 !opcode
sub.l #4,sp
move.b (a3)+,(sp)
move.b (a3)+,1(sp)
move.b (a3)+,2(sp)
move.b (a3)+,3(sp)
add.w d0,d0
add.w d0,d0
cmp.w #220,d0
bhi e_illins
#if prof
lea timeinf2,a5
move.l 0(a5,d0),d1
add.l d1,(a0)
#endif
#if opfreq
lea counttab+1664,a5
add.l #1,0(a5,d0)
#endif
jmp dispae2(pc,d0)
!---------------------------------------------------------------------------
! BRANCH TABLE FOR SECOND ESCAPED OPCODES
!---------------------------------------------------------------------------
dispae2:
bra ldc_q ; bra lae_q ; bra lal_qp ; bra lal_qn
bra lde_qw ; bra ldf_q ; bra ldl_qpw ; bra ldl_qnw
bra lil_qpw ; bra lil_qnw ; bra loc_q ; bra loe_qw
bra lof_q ; bra lol_qpw ; bra lol_qnw ; bra lpi_q
bra adp_q ; bra asp_qw ; bra beq_q ; bra bge_q
bra bgt_q ; bra ble_q ; bra blm_q ; bra blt_q
bra bne_q ; bra bra_q ; bra cal_q ; bra dee_qw
bra del_qpw ; bra del_qnw ; bra fil_q ; bra gto_q
bra ine_qw ; bra inl_qpw ; bra inl_qnw ; bra lin_q
bra sde_q ; bra sdf_q ; bra sdl_qpw ; bra sdl_qnw
bra sil_qpw ; bra sil_qnw ; bra ste_qw ; bra stf_q
bra stl_qpw ; bra stl_qnw ; bra zeq_q ; bra zge_q
bra zgt_q ; bra zle_q ; bra zlt_q ; bra zne_q
bra zre_qw ; bra zrl_qpw ; bra zrl_qnw
.errnz .-dispae2-220
!------------------------------------------------------------------------------
! timeinf tables, first the unescaped opcodes
! these tables are parallel to the tables dispat , dispae1 and dispae2
! Each entry contains a reasonable estimate of
! the number of processor state cycles needed to
! execute that instruction. The exact amount cannot be
! supplied, since this can depend rather heavily on the
! size of the object in set, array case instructions etc.
! The table timeinf also contains, added to each entry,
! the number of processor state cycles needed to find the instruction.
! This number is currently 22.Also the number of processor state
! cycles to return from the instruction is included.
! The number is computed for
! the case that all check and runinf options are off.
!------------------------------------------------------------------------------
#if prof
.data
timeinf:
.long 33 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 35 ; .long 35
.long 35 ; .long 35 ; .long 127 ; .long 00
.long 36 ; .long 42 ; .long 56 ; .long 40
.long 40 ; .long 42 ; .long 42 ; .long 42
.long 36 ; .long 39 ; .long 39 ; .long 39
.long 39 ; .long 39 ; .long 41 ; .long 67
.long 48 ; .long 48 ; .long 48 ; .long 48
.long 97 ; .long 48 ; .long 48 ; .long 55
.long 45 ; .long 45 ; .long 36 ; .long 43
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 211 ; .long 211 ; .long 211 ; .long 211
.long 213 ; .long 00 ; .long 00 ; .long 66
.long 00 ; .long 50 ; .long 54 ; .long 54
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
timeinf1:
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
timeinf2:
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00 ; .long 00
.long 00 ; .long 00 ; .long 00
#endif
.text